From 9b2bcfcaeaee438b361e660850f42c9601d14845 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Thu, 12 Mar 2009 02:40:44 +0000 Subject: Like the Not Spam button, only show the Delete button conditionally i.e. when we are in the Trash folder. --- .../program/localization/en_US/labels.inc | 1 + roundcubemail/skins/npk/functions.js | 29 +++++++++++++++++++--- roundcubemail/skins/npk/templates/mail.html | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/roundcubemail/program/localization/en_US/labels.inc b/roundcubemail/program/localization/en_US/labels.inc index ad4fd8b9c..994d05b48 100644 --- a/roundcubemail/program/localization/en_US/labels.inc +++ b/roundcubemail/program/localization/en_US/labels.inc @@ -189,6 +189,7 @@ $labels['archivemessages'] = 'Move to archives folder'; $labels['movemessages'] = 'Move to selected folder'; $labels['copymessages'] = 'Copy to selected folder'; $labels['notspammessages'] = 'Copy to INBOX, then move to HamNotSpam'; +$labels['deletemessages'] = 'Delete message(s)'; // message compose $labels['compose'] = 'Compose a message'; diff --git a/roundcubemail/skins/npk/functions.js b/roundcubemail/skins/npk/functions.js index 8cd643b89..68886f184 100644 --- a/roundcubemail/skins/npk/functions.js +++ b/roundcubemail/skins/npk/functions.js @@ -181,9 +181,9 @@ body_mouseup: function(evt, p) if (this.copymenu && this.copymenu.visible && evtElm.parentNode != rcube_find_object('copymessagebutton') && evtElm != rcube_find_object('copymessagearrow')) this.show_copymenu(false); - // It's a bit questionable to coopt the mouseup event for this - // purpose, but it keeps the code inside the skin and seems to - // work well enough for now. + // It's a bit questionable to coopt the mouseup event for these + // purposes, but here goes, and it keeps the code inside the skin + // and seems to // work well enough for now. if (evt.target) { if (evt.target.childNodes[0].nodeValue=="Spam") @@ -192,6 +192,14 @@ body_mouseup: function(evt, p) toggle_hamnotspambutton('none'); } + if (evt.target) + { + if (evt.target.childNodes[0].nodeValue=="Trash") + toggle_deletebutton('inline'); + else + toggle_deletebutton('none'); + } + }, // hide menus if user presses Escape key @@ -214,6 +222,12 @@ function rcube_init_mail_ui() rcmail_ui = new rcube_mail_ui(); rcube_event.add_listener({ object:rcmail_ui, method:'body_mouseup', event:'mouseup' }); rcube_event.add_listener({ object:rcmail_ui, method:'body_keypress', event:'keypress' }); + // When the interface is coming up, decide whether to show + // certain buttons depending on the mailbox. + if (this.rcmail.env.mailbox=="Spam") + toggle_hamnotspambutton('inline'); + if (this.rcmail.env.mailbox=="Trash") + toggle_deletebutton('inline'); } // Only display the "Not Spam" button if the current @@ -224,3 +238,12 @@ function toggle_hamnotspambutton(disposition) if (hamnotspam_elm) hamnotspam_elm.style.display = disposition; } + +// Only display the "Delete" button if the current +// mailbox is "Trash", otherwise hide it. +function toggle_deletebutton(disposition) +{ + var delete_elm = rcube_find_object('deleteli'); + if (delete_elm) + delete_elm.style.display = disposition; +} diff --git a/roundcubemail/skins/npk/templates/mail.html b/roundcubemail/skins/npk/templates/mail.html index a375f8165..51e582e55 100644 --- a/roundcubemail/skins/npk/templates/mail.html +++ b/roundcubemail/skins/npk/templates/mail.html @@ -102,6 +102,7 @@
  • +   Refresh -- cgit v1.2.3