2 commits - plugins/calendar plugins/kolab_addressbook plugins/tasklist
Thomas Brüderli
bruederli at kolabsys.com
Wed Oct 30 17:00:28 CET 2013
plugins/calendar/calendar.php | 2
plugins/calendar/calendar_base.js | 21 +++++---
plugins/kolab_addressbook/kolab_addressbook.js | 40 +++++++++++++++++
plugins/kolab_addressbook/lib/kolab_addressbook_ui.php | 4 +
plugins/tasklist/tasklist.php | 2
plugins/tasklist/tasklist_base.js | 18 +++++--
6 files changed, 73 insertions(+), 14 deletions(-)
New commits:
commit 6eb9ccf3e8b660880692159bfe4d32e3284b49fe
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed Oct 30 16:59:04 2013 +0100
Add Kolab-specific address book functions to contextmenu (if available)
diff --git a/plugins/kolab_addressbook/kolab_addressbook.js b/plugins/kolab_addressbook/kolab_addressbook.js
index 5824880..2eb5fad 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.js
+++ b/plugins/kolab_addressbook/kolab_addressbook.js
@@ -4,6 +4,46 @@ if (window.rcmail) {
if (rcmail.gui_objects.editform && rcmail.env.action.match(/^plugin\.book/)) {
rcmail.enable_command('book-save', true);
}
+
+ // add contextmenu items
+ if (window.rcm_contextmenu_register_command) {
+ var menu = $('#rcmGroupMenu');
+ rcm_contextmenu_register_command(
+ 'book-edit',
+ function(cmd,el){ rcmail.book_edit() },
+ 'kolab_addressbook.bookedit',
+ null,
+ true,
+ false,
+ false,
+ menu
+ );
+ rcm_contextmenu_register_command(
+ 'book-delete',
+ function(cmd,el){ rcmail.book_delete() },
+ 'kolab_addressbook.bookdelete',
+ null,
+ false,
+ false,
+ false,
+ menu
+ );
+
+ // adjust menu items when shown
+ rcmail.addEventListener('contextmenu_show', function(p){
+ if (p.menu.attr('id') != '#rcmGroupMenu')
+ return;
+
+ var m = String(p.src.attr('id')).match(/rcmli([a-z0-9\-_=]+)/i),
+ source = m && m.length ? rcmail.html_identifier_decode(m[1]) : null,
+ sources = rcmail.env.address_sources,
+ editable = source && sources[source] && sources[source].kolab && sources[source].editable;
+
+ if (p.menu) {
+ p.menu[editable?'enableContextMenuItems':'disableContextMenuItems']('#book-edit,#book-delete');
+ }
+ });
+ }
});
rcmail.addEventListener('listupdate', function() {
rcmail.set_book_actions();
diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
index 5e4e4d5..37a7539 100644
--- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
+++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
@@ -87,7 +87,9 @@ class kolab_addressbook_ui
$this->rc->output->add_label('kolab_addressbook.bookdeleteconfirm',
'kolab_addressbook.bookdeleting', 'kolab_addressbook.bookshowurl',
- 'kolab_addressbook.carddavurldescription');
+ 'kolab_addressbook.carddavurldescription',
+ 'kolab_addressbook.bookedit',
+ 'kolab_addressbook.bookdelete');
}
// book create/edit form
else {
commit fa480dfa2ce0c5bd8743d2818f935acac66edc09
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed Oct 30 16:05:07 2013 +0100
Add mail actions to contextmenu if loaded
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index cfbe94c..573ebdc 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 at kolabsys.com>
*
* Copyright (C) 2010, Lazlo Westerhof <hello at lazlo.me>
- * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
+ * Copyright (C) 2013, Kolab Systems AG <contact at 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 at kolabsys.com>
*
- * Copyright (C) 2012, Kolab Systems AG <contact at kolabsys.com>
+ * Copyright (C) 2013, Kolab Systems AG <contact at 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');
+ }
});
More information about the commits
mailing list