[dev] [gollem-patch] javascript select-all in gollem

Peter Arien Peter.Arien at cc.kuleuven.ac.be
Tue Aug 3 07:02:05 PDT 2004


Patch for gollem:

The same thing Francois Marier did for IMP-Folders.

Here's what he said:

"It changes the checkbox image, in the column header, for a
  real checkbox that performs a select all/none just like the
  one in the Mailbox page of IMP."


-- 
Peter

  K.U.Leuven - LUDIT             -=- Tel: +32 16 322219
  peter.arien at cc.kuleuven.ac.be  -=- http://ludit.kuleuven.be

Bakers trade bread recipes on a knead-to-know basis.
-------------- next part --------------
--- gollem/templates/manager/javascript.inc.orig	2004-08-03 15:37:39.000000000 +0200
+++ gollem/templates/manager/javascript.inc	2004-08-03 15:42:52.000000000 +0200
@@ -230,5 +230,27 @@ function uploadFile()
         document.manager.submit();
     }
 }
+
+function toggleSelection()
+{
+    var total = 0;
+    var checked = 0;
+    for (var i = 0; i < document.manager.elements.length; i++) {
+        if (document.manager.elements[i].name == "items[]") {
+            total++;
+            if (document.manager.elements[i].checked) {
+                checked++;
+            }
+        }
+    }
+
+    var new_value = (total != checked);
+    for (var i = 0; i < document.manager.elements.length; i++) {
+        if (document.manager.elements[i].name == "items[]") {
+            document.manager.elements[i].checked = new_value;
+        }
+    }
+}
+
 // -->
 </script>
-------------- next part --------------
--- gollem/templates/manager/file_headers.inc.orig	2004-08-03 15:31:36.000000000 +0200
+++ gollem/templates/manager/file_headers.inc	2004-08-03 15:31:56.000000000 +0200
@@ -8,7 +8,7 @@
 <tr><td class="item">
 <table width="100%" border="0" cellpadding="0" cellspacing="1">
 <tr class="item">
-  <th nowrap="nowrap" width="3%" align="center">&nbsp;<?php echo Horde::img('checkbox.gif', _("Checkbox")) ?></td>
+  <th nowrap="nowrap" width="3%" align="center"><input type="checkbox" name="checkAll" onclick="toggleSelection()" <?php echo Horde::getAccessKeyAndTitle(_("Check _All/None")) ?>" /></th>
 <?php foreach ($columns as $head): ?>
 <?php if ($head == 'type'): ?>
   <th class="<?php echo ($sortby == GOLLEM_SORT_TYPE) ? 'selected' : 'item' ?>" width="5%" nowrap="nowrap" align="right">


More information about the dev mailing list