From 62a83b3bd5813885d964d9fd1509d52bb9c4f12c Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 12 Jan 2011 15:47:44 +0000 Subject: Copying plugins to release branch --- plugins/archive/archive.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/archive/archive.js (limited to 'plugins/archive/archive.js') diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js new file mode 100644 index 000000000..a83750819 --- /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 && rcmail.env.archive_folder_icon && (li = rcmail.get_folder_li(rcmail.env.archive_folder))) + $(li).css('background-image', 'url(' + rcmail.env.archive_folder_icon + ')'); + }) +} + -- cgit v1.2.3