version 1.17, 2014/03/16 22:27:06
|
version 1.19, 2014/07/31 15:45:27
|
Line 489 sub instcode_selectors_data {
|
Line 489 sub instcode_selectors_data {
|
if ($officialjs) { |
if ($officialjs) { |
$jscript .= ' |
$jscript .= ' |
|
|
function toggleOfficial() {'; |
function toggleOfficial() { |
|
var choice; |
|
for (var i=0; i<document.'.$formname.'.official.length; i++) { |
|
if (document.'.$formname.'.official[i].checked) { |
|
choice = document.'.$formname.'.official[i].value; |
|
} |
|
} |
|
if (choice == "off") { |
|
if (document.getElementById("instcodes")) { |
|
document.getElementById("instcodes").style.display = "none"; |
|
}'; |
for (my $i=0; $i<@{$codetitles}-1; $i++) { |
for (my $i=0; $i<@{$codetitles}-1; $i++) { |
$jscript .= ' |
$jscript .= ' |
document.'.$formname.'.'.$codetitles->[$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) { |
function setOfficial(caller) { |
Line 564 sub build_instcode_selectors {
|
Line 579 sub build_instcode_selectors {
|
my $output; |
my $output; |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
if ($numtitles > 0) { |
if ($numtitles > 0) { |
$output .= '<table><tr>'; |
my $style; |
|
if ($env{'form.official'} eq 'off') { |
|
$style = ' style="display: none"'; |
|
} |
|
$output .= '<div id="instcodes"'.$style.'><table><tr>'; |
for (my $k=0; $k<$lasttitle-1; $k++) { |
for (my $k=0; $k<$lasttitle-1; $k++) { |
my (@items,@unsorted); |
my (@items,@unsorted); |
if (ref($cat_items->{$codetitles->[$k]}) eq 'ARRAY') { |
if (ref($cat_items->{$codetitles->[$k]}) eq 'ARRAY') { |
Line 600 sub build_instcode_selectors {
|
Line 619 sub build_instcode_selectors {
|
'<input type="text" name="'.$standardnames[$numtitles-1]. |
'<input type="text" name="'.$standardnames[$numtitles-1]. |
'" /><br />'."\n"; |
'" /><br />'."\n"; |
} |
} |
$output .= '<br />'; |
$output .= '</div>'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 614 sub instcode_selectors {
|
Line 633 sub instcode_selectors {
|
if ($numtitles > 0) { |
if ($numtitles > 0) { |
my $official = ' checked="checked" '; |
my $official = ' checked="checked" '; |
my $unofficial = ''; |
my $unofficial = ''; |
if ($env{'form.official'} eq 'off') { |
if (($formname eq 'filterpicker') && ($env{'form.official'} eq 'off')) { |
$unofficial = $official; |
$unofficial = $official; |
$official = ''; |
$official = ''; |
} |
} |
$output .= '<span class="LC_nobreak">'.&mt('Official course:').' <label>'. |
$output .= '<span class="LC_nobreak">'.&mt('Official course:').' <label>'. |
'<input type="radio" name="official" value="on"'.$official.' />'. |
'<input type="radio" name="official" value="on"'.$official. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
' onclick="toggleOfficial();" />'.&mt('Yes').'</label>'. |
|
(' 'x3).'<label>'. |
'<input type="radio" name="official" value="off"'.$unofficial. |
'<input type="radio" name="official" value="off"'.$unofficial. |
' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'. |
' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'. |
&build_instcode_selectors($numtitles,$lasttitle,\%cat_items,$codetitles, |
&build_instcode_selectors($numtitles,$lasttitle,\%cat_items,$codetitles, |
Line 719 sub javascript_select_filler {
|
Line 739 sub javascript_select_filler {
|
my $nocrs = &mt('No courses'); |
my $nocrs = &mt('No courses'); |
my $output = <<END; |
my $output = <<END; |
|
|
function courseSet(caller) { |
function courseSet(caller, onload) { |
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 = ''; |
var valsem = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value |
var valsem = ''; |
var valdept = document.$formname.Department.options[document.$formname.Department.selectedIndex].value |
var valdept = ''; |
var valclass = document.$formname.Number.options[document.$formname.Number.selectedIndex].value |
var valclass = ''; |
|
if (onload) { |
|
valyr = "$env{'form.Year'}"; |
|
valsem = "$env{'form.Semester'}"; |
|
valdept = "$env{'form.Department'}"; |
|
valclass = "$env{'form.Number'}"; |
|
} else { |
|
valyr = document.$formname.Year.options[document.$formname.Year.selectedIndex].value; |
|
valsem = document.$formname.Semester.options[document.$formname.Semester.selectedIndex].value; |
|
valdept = document.$formname.Department.options[document.$formname.Department.selectedIndex].value; |
|
valclass = document.$formname.Number.options[document.$formname.Number.selectedIndex].value; |
|
} |
var idyears = new Array("$allidlist"); |
var idyears = new Array("$allidlist"); |
var idyr = -1; |
var idyr = -1; |
var idsem = -1; |
var idsem = -1; |
Line 733 function courseSet(caller) {
|
Line 764 function courseSet(caller) {
|
|
|
$scripttext |
$scripttext |
|
|
selYear = document.$formname.Year.selectedIndex-1; |
if (onload) { |
selSemester = document.$formname.Semester.selectedIndex-1; |
if (document.$formname.Year.options.length > 0) { |
selDepartment = document.$formname.Department.selectedIndex-1; |
for (var i = 0; i< document.$formname.Year.options.length; i++) { |
|
if (document.$formname.Year.options[i].value == "$env{'form.Year'}") { |
|
document.$formname.Year.selectedIndex = i; |
|
break; |
|
} |
|
} |
|
} |
|
if (document.$formname.Department.options.length > 0) { |
|
for (var i = 0; i< document.$formname.Department.options.length; i++) { |
|
if (document.$formname.Department.options[i].value == "$env{'form.Department'}") { |
|
document.$formname.Department.selectedIndex = i; |
|
break; |
|
} |
|
} |
|
} |
|
if (document.$formname.Semester.options.length > 0) { |
|
for (var i = 0; i< document.$formname.Semester.options.length; i++) { |
|
if (document.$formname.Semester.options[i].value == "$env{'form.Semester'}") { |
|
document.$formname.Semester.selectedIndex = i; |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
|
|
var selYear = document.$formname.Year.selectedIndex-1; |
|
var selSemester = document.$formname.Semester.selectedIndex-1; |
|
var selDepartment = document.$formname.Department.selectedIndex-1; |
if (selYear == -1) { |
if (selYear == -1) { |
if (selSemester == -1) { |
if (selSemester == -1) { |
if (selDepartment > -1) { |
if (selDepartment > -1) { |
Line 850 function courseSet(caller) {
|
Line 908 function courseSet(caller) {
|
} |
} |
document.$formname.Number.selectedIndex = 0 |
document.$formname.Number.selectedIndex = 0 |
} |
} |
$officialjs |
if (onload) { |
|
if (document.$formname.Number.options.length > 0) { |
|
for (var i = 0; i< document.$formname.Number.options.length; i++) { |
|
if (document.$formname.Number.options[i].value == "$env{'form.Number'}") { |
|
document.$formname.Number.selectedIndex = i; |
|
break; |
|
} |
|
} |
|
} |
|
} else { |
|
$officialjs |
|
} |
} |
} |
END |
END |
return $output; |
return $output; |