--- loncom/interface/courseclassifier.pm 2010/12/03 04:28:36 1.11 +++ loncom/interface/courseclassifier.pm 2011/02/25 02:07:46 1.12 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utilities for classifying courses based on institutional code # -# $Id: courseclassifier.pm,v 1.11 2010/12/03 04:28:36 raeburn Exp $ +# $Id: courseclassifier.pm,v 1.12 2011/02/25 02:07:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,7 +55,7 @@ sub sort_cats { if (defined($$cat_order{$$codetitles[$num]})) { foreach my $item (@{$$cat_order{$$codetitles[$num]}}) { if (grep/^\Q$item\E$/,@unsorted) { - push @{$sorted}, $item; + push(@{$sorted},$item); } } } else { @@ -517,26 +517,35 @@ function setOfficial(caller) { } $jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs); if ($env{'form.state'} eq 'listing') { + my @standardnames = &Apache::loncommon::get_standard_codeitems(); + my %local_to_standard; + if (ref($codetitles) eq 'ARRAY') { + for (my $i=0; $i<@{$codetitles}; $i++) { + $local_to_standard{$codetitles->[$i]} = $standardnames[$i]; + } + } $jscript .= ' function setElements() { '; for (my $i=0; $i<@{$codetitles}-1; $i++) { - if ($env{'form.'.$codetitles->[$i]} != -1) { + my $item = $local_to_standard{$codetitles->[$i]}; + if ($env{'form.'.$item} != -1) { $jscript .= ' - for (var j=0; j[$i].'.length; j++) { - if (document.'.$formname.'.'.$codetitles->[$i].'[j].value == "'.$env{'form.'.$codetitles->[$i]}.'") { - document.'.$formname.'.'.$codetitles->[$i].'.selectedIndex = j; + for (var j=0; j[-1]} != -1) { + my $lastcodetitle = $local_to_standard{$codetitles->[-1]}; + if ($env{'form.'.$lastcodetitle} != -1) { $jscript .= ' - for (var j=0; j[-1].'.length; j++) { - if (document.'.$formname.'.'.$codetitles->[-1].'[j].value == "'.$env{'form.'.$codetitles->[-1]}.'") { - document.'.$formname.'.'.$codetitles->[-1].'.selectedIndex = j; + for (var j=0; j