--- loncom/interface/courseclassifier.pm 2013/07/15 14:32:45 1.15 +++ loncom/interface/courseclassifier.pm 2014/03/16 22:27:06 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utilities for classifying courses based on institutional code # -# $Id: courseclassifier.pm,v 1.15 2013/07/15 14:32:45 bisitz Exp $ +# $Id: courseclassifier.pm,v 1.17 2014/03/16 22:27:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,7 +37,8 @@ use LONCAPA; sub retrieve_instcodes { my ($coursecodes,$codedom) = @_; my $totcodes; - my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.', undef,undef,'Course'); + my %courses = &Apache::lonnet::courseiddump($codedom,'.',1,'.','.','.', + undef,undef,'Course'); foreach my $course (keys(%courses)) { if (ref($courses{$course}) eq 'HASH') { if ($courses{$course}{'inst_code'} ne '') { @@ -604,6 +605,32 @@ sub build_instcode_selectors { return $output; } +sub instcode_selectors { + my ($codedom,$formname,$officialjs,$codetitles) = @_; + my ($output,%cat_titles,%cat_order,%cat_items); + my ($jscript,$totcodes,$numtitles,$lasttitle) = + &instcode_selectors_data($codedom,$formname,\%cat_items,$codetitles, + \%cat_titles,\%cat_order,$officialjs); + if ($numtitles > 0) { + my $official = ' checked="checked" '; + my $unofficial = ''; + if ($env{'form.official'} eq 'off') { + $unofficial = $official; + $official = ''; + } + $output .= ''.&mt('Official course:').' '.(' 'x3).'
'. + &build_instcode_selectors($numtitles,$lasttitle,\%cat_items,$codetitles, + \%cat_titles,\%cat_order)."\n". + ''."\n". + ''."\n"; + } + return ($output,$jscript,$numtitles); +} + sub recurse_options { my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_; if (ref($currlist) eq 'HASH') { @@ -802,7 +829,7 @@ function courseSet(caller) { } } if (iddept != -1) { - document.$formname.Number.options[0] = new Option('$all','0',false,false); + document.$formname.Number.options[0] = new Option('$all','0',false,false); for (var i=0; i