Add ability to reload folder list in dimp.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 7 Oct 2009 05:16:33 +0000 (23:16 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 7 Oct 2009 05:16:33 +0000 (23:16 -0600)
Should never be needed, but if folder list does somehow manage to become
corrupt, this will fix things.

imp/js/DimpBase.js
imp/templates/index/index-dimp.inc
imp/themes/screen-dimp.css
imp/themes/silver/screen-dimp.css
imp/themes/tango-blue/screen-dimp.css

index d325fab..55665c3 100644 (file)
@@ -10,7 +10,7 @@
 var DimpBase = {
     // Vars used and defaulting to null/false:
     //   cfolderaction, folder, folderswitch, offset, pollPE, pp, sfolder,
-    //   showunsub, uid, viewport
+    //   uid, viewport
     // message_list_template set via js/mailbox-dimp.js
     bcache: $H(),
     cacheids: {},
@@ -18,6 +18,7 @@ var DimpBase = {
     pivotrow: -1,
     ppcache: {},
     ppfifo: [],
+    showunsub: 0,
     tcache: {},
 
     // Preview pane cache size is 20 entries. Given that a reasonable guess
@@ -726,6 +727,10 @@ var DimpBase = {
             }.bind(this));
             break;
 
+        case 'ctx_folderopts_reload':
+            this._reloadFolders();
+            break;
+
         case 'ctx_container_expand':
         case 'ctx_container_collapse':
         case 'ctx_folder_expand':
@@ -2261,11 +2266,15 @@ var DimpBase = {
     toggleSubscribed: function()
     {
         this.showunsub = !this.showunsub;
+        $('ctx_folderopts_sub', 'ctx_folderopts_unsub').invoke('toggle');
+        this._reloadFolders();
+    },
+
+    _reloadFolders: function()
+    {
         $('foldersLoading').show();
         $('foldersSidebar').hide();
-        $('ctx_folderopts_sub', 'ctx_folderopts_unsub').invoke('toggle');
 
-        // TODO - Only do for unsub -> sub switch
         [ $('specialfolders').childElements(), $('dropbase').nextSiblings() ].flatten().each(function(elt) {
             this.deleteFolderElt(elt.readAttribute('id'), true);
         }, this);
index 35ab5d2..d4c8e62 100644 (file)
@@ -365,7 +365,8 @@ function _simpleButton($id, $text, $image, $imagedir = null)
  <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>
+ <a id="ctx_folderopts_collapse" class="sep"><span class="contextImg"></span><?php echo _("Collapse All") ?></a>
+ <a id="ctx_folderopts_reload"><span class="contextImg"></span><?php echo _("Rebuild Folder List") ?></a>
 </div>
 <?php endif; ?>
 
index ba0ebfd..235db75 100644 (file)
@@ -981,6 +981,9 @@ span.dimpactionDrafts {
 #ctx_contacts_add span.contextImg {
     background-image: url("graphics/add_contact.png");
 }
+#ctx_folderopts_reload span.contextImg {
+    background-image: url("graphics/reload.png");
+}
 #ctx_flag span.contextImg.flagUser {
     border: 1px black solid;
     height: 15px;
index 4cf06d5..d436514 100644 (file)
@@ -124,6 +124,9 @@ span.dimpactionDrafts {
 #ctx_contacts_add span.contextImg {
     background-image: url("graphics/add_contact.png");
 }
+#ctx_folderopts_reload span.contextImg {
+    background-image: url("graphics/reload.png");
+}
 
 /* Other images */
 #msg_newwin span.iconImg, #msg_newwin_options span.iconImg {
index c3f4ec3..2e068f1 100644 (file)
@@ -14,3 +14,7 @@
 #dimpmain_portal {
     background-color: #c9daed;
 }
+
+#ctx_folderopts_reload span.contextImg {
+    background-image: url("graphics/reload.png");
+}