Remove the need for the DimpCore.buttons variable
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 15 Apr 2009 03:20:54 +0000 (21:20 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 15 Apr 2009 03:20:54 +0000 (21:20 -0600)
imp/js/src/DimpBase.js
imp/js/src/DimpCore.js
imp/lib/DIMP.php
imp/templates/index/index-dimp.inc

index 795ace0..c34d9bb 100644 (file)
@@ -499,20 +499,19 @@ var DimpBase = {
 
                 if (this.folderswitch) {
                     this.folderswitch = false;
-                    if (this.folder == DIMP.conf.spam_folder) {
-                        if (!DIMP.conf.spam_spamfolder &&
-                            DimpCore.buttons.indexOf('button_spam') != -1) {
+                    if (this.folder == DIMP.conf.spam_mbox) {
+                        if (!DIMP.conf.spam_spammbox && $('button_spam')) {
                             [ $('button_spam').up(), $('ctx_message_spam') ].invoke('hide');
                         }
-                        if (DimpCore.buttons.indexOf('button_ham') != -1) {
+                        if ($('button_ham')) {
                             [ $('button_ham').up(), $('ctx_message_ham') ].invoke('show');
                         }
                     } else {
-                        if (DimpCore.buttons.indexOf('button_spam') != -1) {
+                        if ($('button_spam')) {
                             [ $('button_spam').up(), $('ctx_message_spam') ].invoke('show');
                         }
-                        if (DimpCore.buttons.indexOf('button_ham') != -1) {
-                            if (DIMP.conf.ham_spamfolder) {
+                        if ($('button_ham')) {
+                            if (DIMP.conf.ham_spammbox) {
                                 [ $('button_ham').up(), $('ctx_message_ham') ].invoke('hide');
                             } else {
                                 [ $('button_ham').up(), $('ctx_message_ham') ].invoke('show');
@@ -1267,12 +1266,9 @@ var DimpBase = {
     toggleButtons: function()
     {
         var disable = (this.selectedCount() == 0);
-        DimpCore.buttons.each(function(b) {
-            var elt = $(b);
-            if (elt) {
-                [ elt.up() ].invoke(disable ? 'addClassName' : 'removeClassName', 'disabled');
-                DimpCore.DMenu.disable(b + '_img', true, disable);
-            }
+        $('dimpmain_folder_top').select('DIV.dimpActions A.noselectDisable').each(function(b) {
+            [ b.up() ].invoke(disable ? 'addClassName' : 'removeClassName', 'disabled');
+            DimpCore.DMenu.disable(b.readAttribute('id') + '_img', true, disable);
         });
     },
 
index 198f0eb..0244495 100644 (file)
@@ -15,11 +15,6 @@ var DimpCore = {
     //   onDoActionComplete
     server_error: 0,
 
-    buttons: [
-        'button_reply', 'button_forward', 'button_spam', 'button_ham',
-        'button_deleted'
-    ],
-
     doActionOpts: {
         onException: function(r, e) { DimpCore.debug('onException', e); },
         onFailure: function(t, o) { DimpCore.debug('onFailure', t); },
@@ -468,14 +463,6 @@ var DimpCore = {
             }
         } catch (e) {}
 
-        /* Remove unneeded buttons. */
-        if (!DIMP.conf.spam_reporting) {
-            this.buttons = this.buttons.without('button_spam');
-        }
-        if (!DIMP.conf.ham_reporting) {
-            this.buttons = this.buttons.without('button_ham');
-        }
-
         /* Add Growler notifications. */
         this.Growler = new Growler({
             location: 'br',
index 894926b..0fdac75 100644 (file)
@@ -194,11 +194,9 @@ class DIMP
 
             'flags' => $flags,
 
-            'spam_folder' => IMP::folderPref($prefs->getValue('spam_folder'), true),
-            'spam_reporting' => intval(!empty($conf['spam']['reporting'])),
-            'spam_spamfolder' => intval(!empty($conf['spam']['spamfolder'])),
-            'ham_reporting' => intval(!empty($conf['notspam']['reporting'])),
-            'ham_spamfolder' => intval(!empty($conf['notspam']['spamfolder'])),
+            'spam_mbox' => IMP::folderPref($prefs->getValue('spam_folder'), true),
+            'spam_spammbox' => intval(!empty($conf['spam']['spamfolder'])),
+            'ham_spammbox' => intval(!empty($conf['notspam']['spamfolder'])),
             'refresh_time' => intval($prefs->getValue('refresh_time')),
 
             'fixed_folders' => empty($conf['server']['fixed_folders'])
index cea4ae1..acdfd0d 100644 (file)
@@ -177,21 +177,24 @@ function _simpleButton($id, $text, $image, $imagedir = null)
       </form>
       <?php echo IMP::img('close.png', '', array('id' => 'quicksearch_close', 'style' => 'display:none', 'title' => _("Clear Search")), $hordeimg) ?>
       <span>
-       <?php _createDA(_("Reply"), 'Reply', 'button_reply', '', $show_text) ?>
+       <?php _createDA(_("Reply"), 'Reply', 'button_reply', 'noselectDisable', $show_text) ?>
       </span>
       <span>
-       <?php _createDA(_("Forward"), 'Forward', 'button_forward', '', $show_text) ?>
+       <?php _createDA(_("Forward"), 'Forward', 'button_forward', 'noselectDisable', $show_text) ?>
       </span>
 <?php if (!empty($conf['spam']['reporting'])): ?>
       <span>
-       <?php _createDA(_("Spam"), 'Spam', 'button_spam', '', $show_text) ?>
+       <?php _createDA(_("Spam"), 'Spam', 'button_spam', 'noselectDisable', $show_text) ?>
       </span>
 <?php endif; ?>
 <?php if (!empty($conf['notspam']['reporting'])): ?>
       <span style="display:none">
-       <?php _createDA(_("Innocent"), 'Ham', 'button_ham', '', $show_text) ?>
+       <?php _createDA(_("Innocent"), 'Ham', 'button_ham', 'noselectDisable', $show_text) ?>
       </span>
 <?php endif; ?>
+      <span>
+       <?php _createDA(_("Delete"), 'Delete', 'button_deleted', 'noselectDisable', $show_text) ?>
+      </span>
       <span id="button_compose">
        <?php _createDA(_("Compose"), 'Compose', '', '', $show_text) ?>
       </span>
@@ -199,9 +202,6 @@ function _simpleButton($id, $text, $image, $imagedir = null)
        <?php _createDA(_("Get Mail"), 'Checkmail', '', '', $show_text) ?>
       </span>
       <span>
-       <?php _createDA(_("Delete"), 'Delete', 'button_deleted', '', $show_text) ?>
-      </span>
-      <span>
        <?php _createDA(_("Other Actions"), 'Other', 'button_other', '', $show_text) ?>
       </span>
      </div>