--- loncom/interface/courseclassifier.pm 2014/03/17 02:33:32 1.18 +++ loncom/interface/courseclassifier.pm 2014/07/31 15:45:27 1.19 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utilities for classifying courses based on institutional code # -# $Id: courseclassifier.pm,v 1.18 2014/03/17 02:33:32 raeburn Exp $ +# $Id: courseclassifier.pm,v 1.19 2014/07/31 15:45:27 musolffc Exp $ # # Copyright Michigan State University Board of Trustees # @@ -739,12 +739,23 @@ sub javascript_select_filler { my $nocrs = &mt('No courses'); my $output = < 0) { + 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 (selSemester == -1) { if (selDepartment > -1) { @@ -870,7 +908,18 @@ function courseSet(caller) { } 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 return $output;