Add Expand/Collapse All menu items to all collapsible folders
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 13 Aug 2009 17:47:02 +0000 (11:47 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 15 Aug 2009 18:13:47 +0000 (12:13 -0600)
imp/js/DimpBase.js
imp/templates/index/index-dimp.inc
imp/themes/screen-dimp.css
imp/themes/silver/screen-dimp.css

index 35a5c39..2bb4bbd 100644 (file)
@@ -639,7 +639,7 @@ var DimpBase = {
 
     contextOnClick: function(parentfunc, elt, baseelt, menu)
     {
-        var flag, id = elt.readAttribute('id');
+        var flag, id = elt.readAttribute('id'), tmp;
 
         switch (id) {
         case 'ctx_folder_create':
@@ -700,6 +700,16 @@ var DimpBase = {
             }.bind(this));
             break;
 
+        case 'ctx_container_expand':
+        case 'ctx_container_collapse':
+        case 'ctx_folder_expand':
+        case 'ctx_folder_collapse':
+            tmp = baseelt.up('LI');
+            [ tmp, $(this.getSubFolderId(tmp.readAttribute('id'))).select('LI.folder') ].flatten().each(function(f) {
+                this._toggleSubFolder(f, (id == 'ctx_container_expand' || id == 'ctx_folder_expand') ? 'exp' : 'col', true);
+            }.bind(this));
+            break;
+
         case 'ctx_message_spam':
         case 'ctx_message_ham':
             this.reportSpam(id == 'ctx_message_spam');
@@ -811,6 +821,10 @@ var DimpBase = {
             tmp = baseelt.hasAttribute('u');
             [ $('ctx_folder_poll') ].invoke(tmp ? 'hide' : 'show');
             [ $('ctx_folder_nopoll') ].invoke(tmp ? 'show' : 'hide');
+
+            tmp = $(this.getSubFolderId(baseelt.readAttribute('id')));
+            $('ctx_folder_collapse', 'ctx_folder_expand').invoke(tmp ? 'show' : 'hide');
+            [ $('ctx_folder_expand').previous() ].invoke(tmp ? 'addClassName' : 'removeClassName', 'sep');
             break;
 
         case 'ctx_reply':
index 4c4664a..62e9fcf 100644 (file)
@@ -345,22 +345,28 @@ function _simpleButton($id, $text, $image, $imagedir = null)
  <a id="ctx_folder_sub"><span class="contextImg"></span><?php echo _("Subscribe") ?></a>
  <a id="ctx_folder_unsub"><span class="contextImg"></span><?php echo _("Unsubscribe") ?></a>
 <?php endif; ?>
+ <a id="ctx_folder_expand" style="display:none"><span class="contextImg"></span><?php echo _("Expand All") ?></a>
+ <a id="ctx_folder_collapse" style="display:none"><span class="contextImg"></span><?php echo _("Collapse All") ?></a>
 </div>
 
 <div class="context" id="ctx_container" style="display:none">
  <a id="ctx_container_create"><span class="contextImg"></span><?php echo _("Create subfolder") ?></a>
- <a id="ctx_container_rename"><span class="contextImg"></span><?php echo _("Rename Folder") ?></a>
+ <a id="ctx_container_rename" class="sep"><span class="contextImg"></span><?php echo _("Rename Folder") ?></a>
+ <a id="ctx_container_expand"><span class="contextImg"></span><?php echo _("Expand All") ?></a>
+ <a id="ctx_container_collapse"><span class="contextImg"></span><?php echo _("Collapse All") ?></a>
 </div>
 
+<?php if ($conf['user']['allow_folders']): ?>
 <div class="context" id="ctx_folderopts" style="display:none">
  <a id="ctx_folderopts_new"><span class="contextImg"></span><?php echo _("New Folder") ?></a>
-<?php if ($conf['user']['allow_folders'] && $use_sub): ?>
+<?php if ($use_sub): ?>
  <a id="ctx_folderopts_sub" style="display:none"><span class="contextImg"></span><?php echo _("Hide Unsubscribed") ?></a>
  <a id="ctx_folderopts_unsub"><span class="contextImg"></span><?php echo _("Show Unsubscribed") ?></a>
 <?php endif; ?>
  <a id="ctx_folderopts_expand"><span class="contextImg"></span><?php echo _("Expand All") ?></a>
  <a id="ctx_folderopts_collapse"><span class="contextImg"></span><?php echo _("Collapse All") ?></a>
 </div>
+<?php endif; ?>
 
 <div class="context" id="ctx_message" style="display:none">
  <a id="ctx_message_reply"><span class="contextImg"></span><?php echo _("Reply") ?></a>
index e6eb861..f671494 100644 (file)
@@ -343,10 +343,10 @@ div.vpRow.flagDeleted {
 #ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg {
     background-image: url("graphics/folders/folder.png");
 }
-#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg {
+#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg, #ctx_container_collapse span.contextImg, #ctx_folder_collapse span.contextImg {
     background-image: url("graphics/folders/minus.png");
 }
-#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg {
+#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg, #ctx_container_expand span.contextImg, #ctx_folder_expand span.contextImg {
     background-image: url("graphics/folders/plus.png");
 }
 #normalfolders {
index 1275ccb..e5b6468 100644 (file)
@@ -1,10 +1,10 @@
 #ctx_folder_sub span.contextImg, #ctx_folder_unsub span.contextImg, #ctx_folderopts_sub span.contextImg, #ctx_folderopts_unsub span.contextImg {
     background-image: url("graphics/folders/folder.png");
 }
-#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg {
+#sidebarPanel span.col, #ctx_folderopts_collapse span.contextImg, #ctx_container_collapse span.contextImg, #ctx_folder_collapse span.contextImg {
     background-image: url("graphics/folders/minus.png");
 }
-#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg {
+#sidebarPanel span.exp, #ctx_folderopts_expand span.contextImg, #ctx_container_expand span.contextImg, #ctx_folder_expand span.contextImg {
     background-image: url("graphics/folders/plus.png");
 }