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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 15 Oct 2004 22:29:31 -0000


albertel		Fri Oct 15 18:29:31 2004 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - Add unselect all buttons to the parm screen
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.175 loncom/interface/lonparmset.pm:1.176
--- loncom/interface/lonparmset.pm:1.175	Fri Sep 10 17:29:54 2004
+++ loncom/interface/lonparmset.pm	Fri Oct 15 18:29:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.175 2004/09/10 21:29:54 albertel Exp $
+# $Id: lonparmset.pm,v 1.176 2004/10/15 22:29:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1002,23 +1002,36 @@
 
         $r->print('<tr><td colspan="3" align="center">'.&mt('Select Parameters to View').'</td></tr>');
 
-        $r->print('<tr><td colspan="2"><table>');
-        $r->print('<tr><td><input type="checkbox" name="pscat" value="all"');
-        $r->print(' checked') unless (@pscat);
-        $r->print('>'.&mt('All Parameters').'</td>');
-
+        $r->print('<tr><td colspan="2"><table><tr>');
         my $cnt=0;
         foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} }
                       keys %allparms ) {
             ++$cnt;
-            $r->print('</tr><tr>') unless ($cnt%2);
+            $r->print('</tr><tr>') if ($cnt%2);
             $r->print('<td><input type="checkbox" name="pscat" ');
             $r->print('value="'.$tempkey.'"');
             if ($pscat[0] eq "all" || grep $_ eq $tempkey, @pscat) {
                 $r->print(' checked');
             }
-            $r->print('>'.$allparms{$tempkey}.'</td>');
+	    $r->print('>'.$allparms{$tempkey}.'</td>');
+	}
+	$r->print('
+</tr><tr><td>
+<script type="text/javascript">
+    function checkall(value, checkName) {
+	for (i=0; i<document.forms.parmform.elements.length; i++) {
+            ele = document.forms.parmform.elements[i];
+            if (ele.name == checkName) {
+                document.forms.parmform.elements[i].checked=value;
+            }
         }
+    }
+</script>
+<input type="button" onclick="checkall(true, \'pscat\')" value="Select All" />
+</td><td>
+<input type="button" onclick="checkall(false, \'pscat\')" value="Unselect All" />
+</td>
+');
         $r->print('</tr></table>');
 
 #        $r->print('<tr><td>Select Parts</td><td>');