From 56582a8cf97bcf7e3a34583c30e50cf109ea15aa Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 14 Apr 2009 21:20:54 -0600 Subject: [PATCH] Remove the need for the DimpCore.buttons variable --- imp/js/src/DimpBase.js | 22 +++++++++------------- imp/js/src/DimpCore.js | 13 ------------- imp/lib/DIMP.php | 8 +++----- imp/templates/index/index-dimp.inc | 14 +++++++------- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index 795ace025..c34d9bb01 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -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); }); }, diff --git a/imp/js/src/DimpCore.js b/imp/js/src/DimpCore.js index 198f0ebd4..0244495c7 100644 --- a/imp/js/src/DimpCore.js +++ b/imp/js/src/DimpCore.js @@ -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', diff --git a/imp/lib/DIMP.php b/imp/lib/DIMP.php index 894926b76..0fdac7520 100644 --- a/imp/lib/DIMP.php +++ b/imp/lib/DIMP.php @@ -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']) diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index cea4ae1de..acdfd0db9 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -177,21 +177,24 @@ function _simpleButton($id, $text, $image, $imagedir = null) 'quicksearch_close', 'style' => 'display:none', 'title' => _("Clear Search")), $hordeimg) ?> - + - + - + - + + + + @@ -199,9 +202,6 @@ function _simpleButton($id, $text, $image, $imagedir = null) - - - -- 2.11.0