version 1.10, 2010/07/09 14:40:20
|
version 1.12, 2011/02/25 02:07:46
|
Line 40 sub retrieve_instcodes {
|
Line 40 sub retrieve_instcodes {
|
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)) { |
foreach my $course (keys(%courses)) { |
if (ref($courses{$course}) eq 'HASH') { |
if (ref($courses{$course}) eq 'HASH') { |
$$coursecodes{$course} = $courses{$course}{'inst_code'}; |
if ($courses{$course}{'inst_code'} ne '') { |
$totcodes ++; |
$$coursecodes{$course} = $courses{$course}{'inst_code'}; |
|
$totcodes ++; |
|
} |
} |
} |
} |
} |
return $totcodes; |
return $totcodes; |
Line 53 sub sort_cats {
|
Line 55 sub sort_cats {
|
if (defined($$cat_order{$$codetitles[$num]})) { |
if (defined($$cat_order{$$codetitles[$num]})) { |
foreach my $item (@{$$cat_order{$$codetitles[$num]}}) { |
foreach my $item (@{$$cat_order{$$codetitles[$num]}}) { |
if (grep/^\Q$item\E$/,@unsorted) { |
if (grep/^\Q$item\E$/,@unsorted) { |
push @{$sorted}, $item; |
push(@{$sorted},$item); |
} |
} |
} |
} |
} else { |
} else { |
Line 515 function setOfficial(caller) {
|
Line 517 function setOfficial(caller) {
|
} |
} |
$jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs); |
$jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs); |
if ($env{'form.state'} eq 'listing') { |
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 .= ' |
$jscript .= ' |
function setElements() { |
function setElements() { |
'; |
'; |
for (my $i=0; $i<@{$codetitles}-1; $i++) { |
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 .= ' |
$jscript .= ' |
for (var j=0; j<document.'.$formname.'.'.$codetitles->[$i].'.length; j++) { |
for (var j=0; j<document.'.$formname.'.'.$item.'.length; j++) { |
if (document.'.$formname.'.'.$codetitles->[$i].'[j].value == "'.$env{'form.'.$codetitles->[$i]}.'") { |
if (document.'.$formname.'.'.$item.'[j].value == "'.$env{'form.'.$item}.'") { |
document.'.$formname.'.'.$codetitles->[$i].'.selectedIndex = j; |
document.'.$formname.'.'.$item.'.selectedIndex = j; |
} |
} |
} |
} |
'; |
'; |
} |
} |
} |
} |
$jscript .= ' courseSet()'."\n"; |
$jscript .= ' courseSet()'."\n"; |
if ($env{'form.'.$codetitles->[-1]} != -1) { |
my $lastcodetitle = $local_to_standard{$codetitles->[-1]}; |
|
if ($env{'form.'.$lastcodetitle} != -1) { |
$jscript .= ' |
$jscript .= ' |
for (var j=0; j<document.'.$formname.'.'.$codetitles->[-1].'.length; j++) { |
for (var j=0; j<document.'.$formname.'.'.$lastcodetitle.'.length; j++) { |
if (document.'.$formname.'.'.$codetitles->[-1].'[j].value == "'.$env{'form.'.$codetitles->[-1]}.'") { |
if (document.'.$formname.'.'.$lastcodetitle.'[j].value == "'.$env{'form.'.$lastcodetitle}.'") { |
document.'.$formname.'.'.$codetitles->[-1].'.selectedIndex = j; |
document.'.$formname.'.'.$lastcodetitle.'.selectedIndex = j; |
} |
} |
} |
} |
'; |
'; |
Line 839 sub instcode_search_str {
|
Line 850 sub instcode_search_str {
|
my $item = $local_to_standard{$loctitle}; |
my $item = $local_to_standard{$loctitle}; |
if ($item ne '') { |
if ($item ne '') { |
if ($env{'form.'.$item} eq '0' ) { |
if ($env{'form.'.$item} eq '0' ) { |
$instcode .= $codedefaults{$item}; |
$instcode .= $codedefaults{$loctitle}; |
} else { |
} else { |
$instcode .= $env{'form.'.$item}; |
$instcode .= $env{'form.'.$item}; |
} |
} |