Patch from Philippe Mingo to fix the javascript 'Select All' (actually turns
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 30 Jul 2001 13:59:38 +0000 (13:59 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 30 Jul 2001 13:59:38 +0000 (13:59 +0000)
it into a 'Toggle All' button)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1469 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php

index 1298b6b..35c81f1 100644 (file)
    function ShowSelectAllLink($startMessage, $sort)
    {
        global $checkall, $PHP_SELF, $what, $where, $mailbox;
-       
-       // If you can figure out some working javascript,
-       // feel free to put it in here!
-       // Allegedly this stuff works for someone somewhere
-       // Don't forget to uncomment the </noscript> at the end!
-       
-       // This code is from Kevin Cawthorne <kevin at intuitive.net>
-       // It was adapted by Tyler to use a document.write for drawing the
-       // input checkbox and to use the <noscript> and old style selection
-       // for non-javascript browsers.
-
-       // echo "<script language=\"JavaScript\">\n";
-       // echo "<!--\n";
-       // echo "function CheckAll() {\n";
-       // echo "   for (var i = 0; i < document.List.elements.length; i++) {\n";
-       // echo "      var e = document.List.elements[i];\n";
-       // echo "      if (e.name != 'allbox')\n";
-       // echo "         e.checked = document.List.allbox.checked;\n";
-       // echo "   }\n";
-       // echo "}\n";
-       // echo "document.write(\"<input name=\\\"allbox\\\" " .
-       //    "type=\\\"checkbox\\\" value=\\\"Check All\\\" " .
-       //    "onClick=\\\"CheckAll();\\\"> <B>" . _("Select All") .
-       //    "</B>\n");
-       // echo "//-->\n";
-       // echo "</script><noscript>\n";
+
+       // This code is from Philippe Mingo <mingo@rotedic.com>
+    
+       ?>
+<script language="JavaScript">
+<!--
+function CheckAll() {
+  for (var i = 0; i < document.messageList.elements.length; i++) {
+    if( document.messageList.elements[i].name.substr( 0, 3 ) == 'msg') {
+      document.messageList.elements[i].checked =
+        !(document.messageList.elements[i].checked);
+    }
+  }
+}
+window.document.write('<a href="#" onClick="CheckAll();"><?php echo
+ _("Toggle All") ?></A>');
+//-->
+</script><noscript>
+<?PHP
 
        echo "<a href=\"$PHP_SELF?mailbox=" . urlencode($mailbox) .
           "&startMessage=$startMessage&sort=$sort&checkall=";
        else
            echo _("Select All");
           
-       // If a javascript selection solution can be created eventually,
-       // do not forget to uncomment this line too!
-       // echo "</A>\n</noscript>\n";
+       echo "</A>\n</noscript>\n";
    }
 
    function processSubject($subject)