[LON-CAPA-cvs] cvs: loncom /interface lonpickcourse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 18:43:13 -0000
albertel Fri Oct 14 14:43:13 2005 EDT
Modified files:
/loncom/interface lonpickcourse.pm
Log:
- if only one course met the critia things didn't work on Firefox
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.32 loncom/interface/lonpickcourse.pm:1.33
--- loncom/interface/lonpickcourse.pm:1.32 Fri Oct 14 14:23:32 2005
+++ loncom/interface/lonpickcourse.pm Fri Oct 14 14:43:13 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.32 2005/10/14 18:23:32 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.33 2005/10/14 18:43:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -160,25 +160,42 @@
courseCount = 0;
var courses = '';
if (multflag) {
- for (var j=0; j<document.courselist.course_id.length; j++) {
- if (document.courselist.course_id[j].checked) {
- courses = courses + document.courselist.course_id[j].value + "&&";
- courseCount ++;
- }
- }
+ if (typeof(document.courselist.course_id.length) == 'undefined') {
+ // only 1 course checkbox was created
+ if (document.courselist.course_id.checked) {
+ courses = courses + document.courselist.course_id.value + "&&";
+ courseCount ++;
+ }
+ } else {
+ for (var j=0; j<document.courselist.course_id.length; j++) {
+ if (document.courselist.course_id[j].checked) {
+ courses = courses + document.courselist.course_id[j].value + "&&";
+ courseCount ++;
+ }
+ }
+ }
opener.document.$env{'form.form'}.coursetotal.value = courseCount;
- for (var j=0; j<opener.document.$env{'form.form'}.coursepick.length; j++) {
- if (opener.document.$env{'form.form'}.coursepick[j].value == 'specific') {
- opener.document.$env{'form.form'}.coursepick[j].checked = true;
- }
- else {
- opener.document.$env{'form.form'}.coursepick[j].checked = false;
- }
- }
- if (courseCount > 0) {
- courses = courses.substr(0,courses.length-2);
- opener.document.$env{'form.form'}.courselist.value = courses
- }
+ if (typeof(opener.document.$env{'form.form'}.coursepick.length) ==
+ 'undefined') {
+ if (opener.document.$env{'form.form'}.coursepick.value == 'specific') {
+ opener.document.$env{'form.form'}.coursepick.checked = true;
+ } else {
+ opener.document.$env{'form.form'}.coursepick.checked = false;
+ }
+ } else {
+ for (var j=0; j<opener.document.$env{'form.form'}.coursepick.length; j++) {
+ if (opener.document.$env{'form.form'}.coursepick[j].value == 'specific') {
+ opener.document.$env{'form.form'}.coursepick[j].checked = true;
+ }
+ else {
+ opener.document.$env{'form.form'}.coursepick[j].checked = false;
+ }
+ }
+ }
+ if (courseCount > 0) {
+ courses = courses.substr(0,courses.length-2);
+ opener.document.$env{'form.form'}.courselist.value = courses;
+ }
}
else {
$name_code