if we have javascript available, use that to toggle more/less links. This is
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 19 May 2008 18:35:21 +0000 (18:35 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 19 May 2008 18:35:21 +0000 (18:35 +0000)
faster (instantaneous) and saves a full reload of the page on the server. If
no JS keep old behaviour.

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

templates/default/css/default.css
templates/default/js/default.js
templates/default/read_recipient_list.tpl

index caffe3a72b8257808ebbbefbd9cb77eb04f5fb78..1a89b89d62bfe220be2c7e0b31c246361949ecaa 100644 (file)
@@ -1078,3 +1078,10 @@ div.viewText td.spacer {
     padding: 1em;
     font-size: x-large;
 }
     padding: 1em;
     font-size: x-large;
 }
+
+#recpt_tail_to, #recpt_tail_cc {
+    display: none;
+}
+#toggle_to, #toggle_cc {
+    font-size: smaller;
+}
index 4c7b9e890a18d56524f1529c575d6796f1341c6a..2c045a36cee40927268c903d03d28920bf239957 100644 (file)
@@ -289,3 +289,17 @@ function printThis()
     parent.frames['right'].focus();
     parent.frames['right'].print();
 }
     parent.frames['right'].focus();
     parent.frames['right'].print();
 }
+
+/* JS implementation of more/less links in To/CC. Could later be extended
+ * show/hide other interface items */
+function showhide (item, txtmore, txtless) {
+    var oTemp=document.getElementById("recpt_tail_" + item);
+    var oClick=document.getElementById("toggle_" + item);
+    if (oTemp.style.display=="inline") {
+        oTemp.style.display="none";
+        oClick.innerHTML=txtmore;
+    } else {
+        oTemp.style.display="inline";
+        oClick.innerHTML=txtless;
+    }
+}
index 99a1c52468883c65f71c9e19de7cd97bb45da745..a50b7f280339cc313e7aba50d871048e25875c08 100644 (file)
@@ -31,25 +31,33 @@ extract($t);
 
 /** Begin template **/
 $count = 0;
 
 /** Begin template **/
 $count = 0;
+echo "<span class=\"recpt_head\">";
+
 foreach ($recipients as $r) {
     $count++;
 foreach ($recipients as $r) {
     $count++;
-    if ($count > 3 && !$show_more)
-        continue;
+
     echo $r['Full'];
     if ($count != count($recipients)) {
         echo ", \n   ";
     }
     echo $r['Full'];
     if ($count != count($recipients)) {
         echo ", \n   ";
     }
+    if (!$show_more && $count == 3) {
+        echo "</span><span id=\"recpt_tail_" . $which_field . "\">";
+    }
 }
 }
+echo "</span>\n";
+
 
 if (count($recipients) > 3) {
 
 if (count($recipients) > 3) {
-    if ($show_more) {
-        ?>
-&nbsp;<small>(<a href="<?php echo $more_less_toggle_href; ?>"><?php echo _("less"); ?></a>)</small>
-        <?php
+    if ( checkForJavascript() ) {
+        $url = "javascript:void(0)";
+        $onclick = ' onclick="showhide(\'' . $which_field . "','" . _("more") . "','" . _("less") . "')\"";
     } else {
     } else {
-        ?>
-&nbsp;<small>(<a href="<?php echo $more_less_toggle_href; ?>"><?php echo _("more"); ?></a>)</small>
-        <?php
+        $url = $more_less_toggle_href;
+        $onlclick = '';
     }
     }
+
+    echo "&nbsp;(<a href=\"" . $url . "\"" . $onclick . " id=\"toggle_" . $which_field . "\">" .
+        ($show_more ? _("less") : _("more") ) .
+        "</a>)";
 }
 
 }