summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-30 15:05:07 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-31 11:59:09 (GMT)
commitd55977fee33b4e84b1af0991482ced917a61e927 (patch)
treeb39e651c237a44f084cf3c049b15c6daee35024b /plugins
parentfb7de4efda2324617a0784a1d68f36e430f56284 (diff)
downloadroundcubemail-plugins-kolab-d55977fee33b4e84b1af0991482ced917a61e927.tar.gz
Add mail actions to contextmenu if loaded
Diffstat (limited to 'plugins')
-rw-r--r--plugins/calendar/calendar.php2
-rw-r--r--plugins/calendar/calendar_base.js21
-rw-r--r--plugins/tasklist/tasklist.php2
-rw-r--r--plugins/tasklist/tasklist_base.js18
4 files changed, 30 insertions, 13 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index ced9b20..685745d 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -163,6 +163,8 @@ class calendar extends rcube_plugin
'innerclass' => 'icon calendar',
))),
'messagemenu');
+
+ $this->api->output->add_label('calendar.createfrommail');
}
}
diff --git a/plugins/calendar/calendar_base.js b/plugins/calendar/calendar_base.js
index c60c89a..33fe9e4 100644
--- a/plugins/calendar/calendar_base.js
+++ b/plugins/calendar/calendar_base.js
@@ -6,7 +6,7 @@
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
* Copyright (C) 2010, Lazlo Westerhof <hello@lazlo.me>
- * Copyright (C) 2012, Kolab Systems AG <contact@kolabsys.com>
+ * Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -36,10 +36,9 @@ function rcube_calendar(settings)
var me = this;
// create new event from current mail message
- this.create_from_mail = function()
+ this.create_from_mail = function(uid)
{
- var uid;
- if ((uid = rcmail.get_single_uid())) {
+ if (uid || (uid = rcmail.get_single_uid())) {
// load calendar UI (scripts and edit dialog template)
if (!this.ui_loaded) {
$.when(
@@ -53,7 +52,7 @@ function rcube_calendar(settings)
me.ui_loaded = true;
me.ui = new rcube_calendar_ui(me.settings);
- me.create_from_mail(); // start over
+ me.create_from_mail(uid); // start over
});
return;
}
@@ -156,9 +155,6 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
// register create-from-mail command to message_commands array
if (rcmail.env.task == 'mail') {
- // place link above 'view source'
- $('#messagemenu a.calendarlink').parent().insertBefore($('#messagemenu a.sourcelink').parent());
-
rcmail.register_command('calendar-create-from-mail', function() { cal.create_from_mail() });
rcmail.addEventListener('plugin.mail2event_dialog', function(p){ cal.mail2event_dialog(p) });
rcmail.addEventListener('plugin.unlock_saving', function(p){ cal.ui && cal.ui.unlock_saving(); });
@@ -169,6 +165,15 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
}
else
rcmail.enable_command('calendar-create-from-mail', true);
+
+ // add contextmenu item
+ if (window.rcm_contextmenu_register_command) {
+ rcm_contextmenu_register_command(
+ 'calendar-create-from-mail',
+ function(cmd,el){ cal.create_from_mail() },
+ 'calendar.createfrommail',
+ 'moveto');
+ }
}
}
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index 619a652..e77bccc 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -113,6 +113,8 @@ class tasklist extends rcube_plugin
'innerclass' => 'icon taskadd',
))),
'messagemenu');
+
+ $this->api->output->add_label('tasklist.createfrommail');
}
}
diff --git a/plugins/tasklist/tasklist_base.js b/plugins/tasklist/tasklist_base.js
index e3a889c..f804c34 100644
--- a/plugins/tasklist/tasklist_base.js
+++ b/plugins/tasklist/tasklist_base.js
@@ -4,7 +4,7 @@
* @version @package_version@
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
- * Copyright (C) 2012, Kolab Systems AG <contact@kolabsys.com>
+ * Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -37,10 +37,9 @@ function rcube_tasklist(settings)
/**
* Open a new task dialog prefilled with contents from the currently selected mail message
*/
- function create_from_mail()
+ function create_from_mail(uid)
{
- var uid;
- if ((uid = rcmail.get_single_uid())) {
+ if (uid || (uid = rcmail.get_single_uid())) {
// load calendar UI (scripts and edit dialog template)
if (!ui_loaded) {
$.when(
@@ -53,7 +52,7 @@ function rcube_tasklist(settings)
ui_loaded = true;
me.ui = new rcube_tasklist_ui(settings);
- create_from_mail(); // start over
+ create_from_mail(uid); // start over
});
return;
}
@@ -90,5 +89,14 @@ window.rcmail && rcmail.env.task == 'mail' && rcmail.addEventListener('init', fu
rcmail.env.message_commands.push('tasklist-create-from-mail');
else
rcmail.enable_command('tasklist-create-from-mail', true);
+
+ // add contextmenu item
+ if (window.rcm_contextmenu_register_command) {
+ rcm_contextmenu_register_command(
+ 'tasklist-create-from-mail',
+ function(cmd,el){ tasks.create_from_mail() },
+ 'tasklist.createfrommail',
+ 'moveto');
+ }
});