diff options
author | thomascube <thomas@roundcube.net> | 2010-11-27 14:09:03 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2010-11-27 14:09:03 +0000 |
commit | 5fec6de4216883e625d7e166f862985d00c99d4a (patch) | |
tree | a5a1aec807bcbd2e7f03bd2a0155867339b47d04 /plugins/archive/archive.js | |
parent | 26ea6f9ceb79a78b8b804897d863654bac46d01a (diff) |
Copy plugins to release branch
Diffstat (limited to 'plugins/archive/archive.js')
-rw-r--r-- | plugins/archive/archive.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js new file mode 100644 index 000000000..ce5d0f5e2 --- /dev/null +++ b/plugins/archive/archive.js @@ -0,0 +1,36 @@ +/* + * Archive plugin script + * @version @package_version@ + */ + +function rcmail_archive(prop) +{ + if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length)) + return; + + var uids = rcmail.env.uid ? rcmail.env.uid : rcmail.message_list.get_selection().join(','), + lock = rcmail.set_busy(true, 'loading'); + + rcmail.http_post('plugin.archive', '_uid='+uids+'&_mbox='+urlencode(rcmail.env.mailbox), lock); +} + +// 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 + ')'); + }) +} + |