summaryrefslogtreecommitdiff
path: root/plugins/archive/archive.js
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-03-03 14:23:04 +0000
committerthomascube <thomas@roundcube.net>2012-03-03 14:23:04 +0000
commit884add1419729cb8eb5ed8fb47ea68e5f6ce6682 (patch)
tree183fdf813b3d84475e01d08abbe6d3511b2dd389 /plugins/archive/archive.js
parent10ac35625a04074467f002c283d65db24a0508de (diff)
Tagging plugins for 0.8-betav0.8-beta
Diffstat (limited to 'plugins/archive/archive.js')
-rw-r--r--plugins/archive/archive.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js
new file mode 100644
index 000000000..af2b0d26d
--- /dev/null
+++ b/plugins/archive/archive.js
@@ -0,0 +1,34 @@
+/*
+ * Archive plugin script
+ * @version @package_version@
+ */
+
+function rcmail_archive(prop)
+{
+ if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length))
+ return;
+
+ if (rcmail.env.mailbox != rcmail.env.archive_folder)
+ rcmail.command('moveto', rcmail.env.archive_folder);
+}
+
+// callback for app-onload event
+if (window.rcmail) {
+ rcmail.addEventListener('init', function(evt) {
+
+ // register command (directly enable in message view mode)
+ rcmail.register_command('plugin.archive', rcmail_archive, (rcmail.env.uid && rcmail.env.mailbox != rcmail.env.archive_folder));
+
+ // add event-listener to message list
+ if (rcmail.message_list)
+ rcmail.message_list.addEventListener('select', function(list){
+ rcmail.enable_command('plugin.archive', (list.get_selection().length > 0 && rcmail.env.mailbox != rcmail.env.archive_folder));
+ });
+
+ // set css style for archive folder
+ var li;
+ if (rcmail.env.archive_folder && (li = rcmail.get_folder_li(rcmail.env.archive_folder, '', true)))
+ $(li).addClass('archive');
+ })
+}
+