diff options
author | thomascube <thomas@roundcube.net> | 2011-08-16 19:44:01 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-08-16 19:44:01 +0000 |
commit | 5375e84b75eb23e730f9fd44d042a413970bdc7f (patch) | |
tree | 6cb6d62fdd5aa764a64cb7c522d813e8a408e406 /plugins/archive/archive.js | |
parent | af80aae480b28a82a1c248bfdd6abf96b02ae6d8 (diff) |
Copying plugins into 0.6 release branch
Diffstat (limited to 'plugins/archive/archive.js')
-rw-r--r-- | 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 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 + ')'); + }) +} + |