--- loncom/interface/courseclassifier.pm 2014/03/11 21:42:18 1.16 +++ loncom/interface/courseclassifier.pm 2014/03/17 02:33:32 1.18 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utilities for classifying courses based on institutional code # -# $Id: courseclassifier.pm,v 1.16 2014/03/11 21:42:18 raeburn Exp $ +# $Id: courseclassifier.pm,v 1.18 2014/03/17 02:33:32 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 '') { @@ -488,12 +489,27 @@ sub instcode_selectors_data { if ($officialjs) { $jscript .= ' -function toggleOfficial() {'; +function toggleOfficial() { + var choice; + for (var i=0; i[$i].'.selectedIndex = 0;'; + document.'.$formname.'.'.$codetitles->[$i].'.selectedIndex = 0;'; } - $jscript .= ' + $jscript .= ' + } else { + if (document.getElementById("instcodes")) { + document.getElementById("instcodes").style.display = "block"; + } + } } function setOfficial(caller) { @@ -563,7 +579,11 @@ sub build_instcode_selectors { my $output; my @standardnames = &Apache::loncommon::get_standard_codeitems(); if ($numtitles > 0) { - $output .= ''; + my $style; + if ($env{'form.official'} eq 'off') { + $style = ' style="display: none"'; + } + $output .= '
'; for (my $k=0; $k<$lasttitle-1; $k++) { my (@items,@unsorted); if (ref($cat_items->{$codetitles->[$k]}) eq 'ARRAY') { @@ -599,7 +619,7 @@ sub build_instcode_selectors { '
'."\n"; } - $output .= '
'; + $output .= ''; } return $output; } @@ -613,13 +633,14 @@ sub instcode_selectors { if ($numtitles > 0) { my $official = ' checked="checked" '; my $unofficial = ''; - if ($env{'form.official'} eq 'off') { + if (($formname eq 'filterpicker') && ($env{'form.official'} eq 'off')) { $unofficial = $official; $official = ''; } $output .= ''.&mt('Official course:').' '.(' 'x3).''. + (' 'x3).'
'. &build_instcode_selectors($numtitles,$lasttitle,\%cat_items,$codetitles, @@ -828,7 +849,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