From b5ca559968e8c8721a0d64b1b76d9b4525224720 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 14 Jan 2014 15:43:06 +0000 Subject: [PATCH] Fix context menu Calendar -> Add appointment --- addressbook/js/app.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index c3aff315d7..b30a38336e 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -86,24 +86,27 @@ app.classes.addressbook = AppJS.extend( */ add_cal: function(_action, _senders) { - if (!_senders[0].id.match(/^[0-9]+$/)) + if (!_senders[0].id.match(/^(?:addressbook::)?[0-9]+$/)) { // send org-view requests to server _action.data.nm_action = "submit"; + nm_action(_action, _senders); } else { - // call nm_action's popup, but already replace id's in url, because they need to be prefix with a "c" - if (_action.data.popup) _action.data.nm_action = "popup"; var ids = ""; for (var i = 0; i < _senders.length; i++) { - ids += "c" + _senders[i].id + ((i < _senders.length - 1) ? "," : ""); + // Remove UID prefix for just contact_id + var id = _senders[i].id.split('::'); + ids += "c" + id[1] + ((i < _senders.length - 1) ? "," : ""); } - // we cant just replace $id, as under jdots this can get called multiple times (with already replaced url)! - _action.data.url = _action.data.url.replace(/(owner|participants)=(0%2C)?[^&]+/,"$1=$2"+ids); + var extra = {}; + extra[_action.data.url.indexOf('owner') > 0 ? 'owner' : 'participants'] = ids; + + // Use framework to add calendar entry + egw.open('','calendar','add',extra); } - nm_action(_action, _senders); }, /**