[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm lonpopulate.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Mon, 13 Sep 2004 16:21:30 -0000
raeburn Mon Sep 13 12:21:30 2004 EDT
Modified files:
/loncom/interface lonpopulate.pm londropadd.pm
Log:
Fix bug #3371. Also in londropadd::show_class_list() prevent line break between checkbox and label.
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.19 loncom/interface/lonpopulate.pm:1.20
--- loncom/interface/lonpopulate.pm:1.19 Mon Aug 23 12:53:06 2004
+++ loncom/interface/lonpopulate.pm Mon Sep 13 12:21:30 2004
@@ -1,5 +1,5 @@
# automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.19 2004/08/23 16:53:06 raeburn Exp $
+# $Id: lonpopulate.pm,v 1.20 2004/09/13 16:21:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -118,39 +118,28 @@
}
}
if (calling == "viewclass") {
- document.forms.studentform.state.value = "process";
var totcheck = 0
+ var numchk = 0
if (numauto > 0) {
- for (var i=0; i<document.studentform.chgauto.length; i++) {
- if (document.studentform.chgauto[i].checked == true) {
- totcheck ++
- }
- }
+ numchk = countChecked(document.studentform.chgauto);
+ totcheck = totcheck + numchk
}
if (nummanual > 0) {
- for (var i=0; i<document.studentform.chgmanual.length; i++) {
- if (document.studentform.chgmanual[i].checked == true) {
- totcheck ++
- }
- }
+ numchk = countChecked(document.studentform.chgmanual);
+ totcheck = totcheck + numchk
}
if (numlock > 0) {
- for (var i=0; i<document.studentform.lockchg.length; i++) {
- if (document.studentform.lockchg[i].checked == true) {
- totcheck ++
- }
- }
+ numchk = countChecked(document.studentform.lockchg);
+ totcheck = totcheck + numchk
}
if (numunlock > 0) {
- for (var i=0; i<document.studentform.unlockchg.length; i++) {
- if (document.studentform.unlockchg[i].checked == true) {
- totcheck ++
- }
- }
+ numchk = countChecked(document.studentform.unlockchg);
+ totcheck = totcheck + numchk
}
if (totcheck > 0) {
- checker = 1
- } else {
+ document.forms.studentform.state.value = "process";
+ }
+ if (totcheck == 0) {
alert("You must check at least one checkbox, before proceeding to the next page")
checker = 0
}
@@ -163,14 +152,41 @@
if ($action eq 'viewclass') {
$scripttag .= qq|
function checkAll(field) {
- for (i = 0; i < field.length; i++)
- field[i].checked = true ;
+ if (field.length > 0) {
+ for (i = 0; i < field.length; i++) {
+ field[i].checked = true ;
+ }
+ } else {
+ field.checked = true
+ }
}
function uncheckAll(field) {
- for (i = 0; i < field.length; i++)
- field[i].checked = false ;
+ if (field.length > 0) {
+ for (i = 0; i < field.length; i++) {
+ field[i].checked = false ;
+ }
+ } else {
+ field.checked = false ;
+ }
}
+
+function countChecked(field) {
+ var count = 0;
+ if (field.length > 0) {
+ for (var i=0; i<field.length; i++) {
+ if (field[i].checked == true) {
+ count ++
+ }
+ }
+ } else {
+ if (field.checked == true) {
+ count ++
+ }
+ }
+ return count
+}
+
|;
}
$scripttag .= qq|
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.117 loncom/interface/londropadd.pm:1.118
--- loncom/interface/londropadd.pm:1.117 Mon Jul 26 17:57:27 2004
+++ loncom/interface/londropadd.pm Mon Sep 13 12:21:30 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.117 2004/07/26 21:57:27 albertel Exp $
+# $Id: londropadd.pm,v 1.118 2004/09/13 16:21:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1377,7 +1377,7 @@
$cellentry = '<b>'.&mt('auto').'</b> <input type="checkbox" name="chgauto" value="'.$username.':'.$domain.'" /> Change';
$autocount ++;
} else {
- $cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</td></tr><tr><td>';
+ $cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><nobr><input type="checkbox" name="chgmanual" value="'.$username.':'.$domain.'" /> Change</nobr></td></tr><tr><td><nobr>';
$manualcount ++;
if ($lockedtype) {
$cellentry .= '<input type="checkbox" name="unlockchg" value="'.$username.':'.$domain.'" /> '.&mt('Unlock');
@@ -1386,7 +1386,7 @@
$cellentry .= '<input type="checkbox" name="lockchg" value="'.$username.':'.$domain.'" /> '.&mt('Lock');
$lockcount ++;
}
- $cellentry .= '</td></tr></table>';
+ $cellentry .= '</nobr></td></tr></table>';
}
$r->print("<td>$cellentry<td>\n ");
} else {