[LON-CAPA-cvs] cvs: loncom /interface lonmsgdisplay.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 17 Jan 2007 18:05:58 -0000


raeburn		Wed Jan 17 13:05:58 2007 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  Fix bug 5130.
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.63 loncom/interface/lonmsgdisplay.pm:1.64
--- loncom/interface/lonmsgdisplay.pm:1.63	Thu Jan  4 15:58:26 2007
+++ loncom/interface/lonmsgdisplay.pm	Wed Jan 17 13:05:57 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.63 2007/01/04 20:58:26 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.64 2007/01/17 18:05:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -924,19 +924,11 @@
                       nome => 'No messages have been selected to apply ths action to.',
                       chec => 'Check the checkbox for at least one message.',  
     );
+    my $jscript = &Apache::loncommon::check_uncheck_jscript();
     $r->print(<<ENDDISHEADER);
 <script type="text/javascript">
-    function checkall() {
-	for (i=0; i<document.forms.disall.delmark.length; i++) {
-	    document.forms.disall.delmark[i].checked=true;
-        }
-    }
+    $jscript
 
-    function uncheckall() {
-	for (i=0; i<document.forms.disall.delmark.length; i++) {
-	    document.forms.disall.delmark[i].checked=false;
-        }
-    }
     function checkfoldermove() {
         if (document.disall.checkedaction.options[document.disall.checkedaction.selectedIndex].value == 'markedmove') {
             if (document.disall.movetofolder.options[document.disall.movetofolder.selectedIndex].value == "") {
@@ -956,11 +948,17 @@
             } 
         }
         var checktotal = 0;
-        for (var i=0; i<document.forms.disall.delmark.length; i++) {
-            if (document.forms.disall.delmark[i].checked) {
+        if (document.forms.disall.delmark.length > 0) {
+            for (var i=0; i<document.forms.disall.delmark.length; i++) {
+                if (document.forms.disall.delmark[i].checked) {
+                    checktotal ++;
+                }
+            }
+        } else {
+            if (document.forms.disall.delmark.checked) {
                 checktotal ++;
             }
-        }
+        }   
         if (checktotal == 0) {
             alert("$lt{'nome'}\\n$lt{'chec'}");
             return;
@@ -1097,8 +1095,8 @@
     $r->print('<table border="0" cellspacing="2" cellpadding="2">
  <tr>
   <td>'.
-  '<input type="button" onclick="javascript:checkall()" value="'.&mt('Check All').'" /><br />'."\n".
-  '<input type="button" onclick="javascript:uncheckall()" value="'.&mt('Uncheck All').'" />'."\n".
+  '<input type="button" onclick="javascript:checkAll(document.disall.delmark)" value="'.&mt('Check All').'" /><br />'."\n".
+  '<input type="button" onclick="javascript:uncheckAll(document.disall.delmark)" value="'.&mt('Uncheck All').'" />'."\n".
   '<input type="hidden" name="sortedby" value="'.$env{'form.sortedby'}.'" /></td><td>&nbsp;</td>'."\n".
   '<td align="center"><b>'.&mt('Action').'</b><br />'."\n".
   '  <select name="checkedaction" onchange="javascript:checkfoldermove()">'."\n");