From a3b85d7b8560cdc1057fcaffa3acbd247b4b5b7a Mon Sep 17 00:00:00 2001 From: Thomas B. <thomas@roundcube.net> Date: Mon, 07 Oct 2013 13:19:03 -0400 Subject: [PATCH] Merge pull request #133 from cwickert/release-0.9-canned-responses --- plugins/archive/archive.js | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js new file mode 100644 index 0000000..af2b0d2 --- /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'); + }) +} + -- Gitblit v1.9.1