summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2009-03-12 02:40:44 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2009-03-12 02:40:44 +0000
commit9b2bcfcaeaee438b361e660850f42c9601d14845 (patch)
tree81ff8bbc189f975ce0ef1fe0d3b5e158522ceb9b
parent0d5cb5a68569f61fcb054e51b520dc6b090794a1 (diff)
Like the Not Spam button, only show the Delete button conditionally i.e. when we are in the Trash folder.
-rw-r--r--roundcubemail/program/localization/en_US/labels.inc1
-rw-r--r--roundcubemail/skins/npk/functions.js29
-rw-r--r--roundcubemail/skins/npk/templates/mail.html1
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 @@
<li id="movemessagebutton"><roundcube:button name="movemessagearrow" id="movemessagearrow" title="movemessages" onclick="rcmail_ui.show_movemenu();return false" label="buttonbarmove" image="/images/arrow_down.png" /></li>
<li id="copymessagebutton"><roundcube:button name="copymessagearrow" id="copymessagearrow" title="copymessages" onclick="rcmail_ui.show_copymenu();return false" label="buttonbarcopy" image="/images/arrow_down.png" /></li>
<li id="hamnotspamli" style="display: none"><roundcube:button name="hamnotspambutton" id="hamnotspambutton" type="link" label="buttonbarnotspam" title="notspammessages" onclick="rcmail.command('copyto','INBOX',this);rcmail.command('moveto','HamNotSpam',this)" /></li>
+<li id="deleteli" style="display: none"><roundcube:button name="deletebutton" id="deletebutton" type="link" label="delete" title="deletemessages" onclick="rcmail.command('delete', this)" /></li>
&nbsp;&nbsp;<a href="#" onclick="return rcmail.command('checkmail','',this)">Refresh</a>
</ul>