version 1.6, 2009/05/01 01:30:08
|
version 1.8, 2009/07/29 22:32:44
|
Line 445 END
|
Line 445 END
|
} |
} |
|
|
sub instcode_selectors_data { |
sub instcode_selectors_data { |
my ($codedom,$formname,$cat_items,$codetitles,$cat_titles,$cat_order) = @_; |
my ($codedom,$formname,$cat_items,$codetitles,$cat_titles,$cat_order,$officialjs) = @_; |
my ($jscript,%coursecodes,%codes,%idlist,%idnums,%idlist_titles, |
my ($jscript,%coursecodes,%codes,%idlist,%idnums,%idlist_titles, |
%by_year,%by_sem,%by_dept); |
%by_year,%by_sem,%by_dept); |
my ($numtitles,$lasttitle); |
my ($numtitles,$lasttitle); |
Line 478 sub instcode_selectors_data {
|
Line 478 sub instcode_selectors_data {
|
$level = &recurse_options($codetitles->[$k],$idlist{$codetitles->[$k]},$level,$cat,$cat_items,\@data,\%by_year,\%by_sem,\%by_dept); |
$level = &recurse_options($codetitles->[$k],$idlist{$codetitles->[$k]},$level,$cat,$cat_items,\@data,\%by_year,\%by_sem,\%by_dept); |
} |
} |
$scripttext .= &build_javascript(\%by_year,\%by_sem,\%by_dept,$cat_order,$codetitles); |
$scripttext .= &build_javascript(\%by_year,\%by_sem,\%by_dept,$cat_order,$codetitles); |
$jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist); |
if ($officialjs) { |
|
$jscript .= ' |
|
|
|
function toggleOfficial() {'; |
|
for (my $i=0; $i<@{$codetitles}-1; $i++) { |
|
$jscript .= ' |
|
document.'.$formname.'.'.$codetitles->[$i].'.selectedIndex = 0;'; |
|
} |
|
$jscript .= ' |
|
} |
|
|
|
function setOfficial(caller) { |
|
if (typeof(caller) != "undefined") { |
|
if (caller.options[caller.selectedIndex].value != 0) { |
|
if (document.'.$formname.'.official.length > 0) { |
|
for (var j=0; j<document.'.$formname.'.official.length; j++) { |
|
if (document.'.$formname.'.official[j].value == "on") { |
|
document.'.$formname.'.official[j].checked = true; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
'; |
|
|
|
$officialjs = 'setOfficial(caller);'; |
|
} |
|
$jscript .= &javascript_select_filler($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs); |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$jscript .= ' |
$jscript .= ' |
function setElements() { |
function setElements() { |
Line 532 sub build_instcode_selectors {
|
Line 562 sub build_instcode_selectors {
|
@longitems = @items; |
@longitems = @items; |
} |
} |
$output .= '<td align="center">'.$codetitles->[$k].'<br />'."\n". |
$output .= '<td align="center">'.$codetitles->[$k].'<br />'."\n". |
'<select name="'.$codetitles->[$k].'" onChange="courseSet()"'. |
'<select name="'.$codetitles->[$k].'" onChange="courseSet(this)"'. |
'>'."\n".'<option value="0" />All'."\n"; |
'>'."\n".'<option value="0" />All'."\n"; |
for (my $i=0; $i<@items; $i++) { |
for (my $i=0; $i<@items; $i++) { |
if ($longitems[$i] eq '') { |
if ($longitems[$i] eq '') { |
Line 640 sub build_javascript {
|
Line 670 sub build_javascript {
|
} |
} |
|
|
sub javascript_select_filler { |
sub javascript_select_filler { |
my ($formname,$scripttext,$codetitles,$longtitles_str,$allidlist) = @_; |
my ($formname,$scripttext,$codetitles,$longtitles_str,$allidlist,$officialjs) = @_; |
my $output = <<END; |
my $output = <<END; |
|
|
function courseSet() { |
function courseSet(caller) { |
var longtitles = new Array ("$longtitles_str"); |
var longtitles = new Array ("$longtitles_str"); |
var valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value |
var valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value |
var valsem = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value |
var valsem = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value |
Line 774 function courseSet() {
|
Line 804 function courseSet() {
|
} |
} |
document.$formname.Number.selectedIndex = 0 |
document.$formname.Number.selectedIndex = 0 |
} |
} |
|
$officialjs |
} |
} |
END |
END |
return $output; |
return $output; |