Get calendar view working with orgs again

This commit is contained in:
Nathan Gray 2015-03-19 15:30:34 +00:00
parent 8c86b4b41f
commit b7a8e41778
2 changed files with 57 additions and 5 deletions

View File

@ -579,15 +579,16 @@ class addressbook_ui extends addressbook_bo
'calendar_view' => array(
'caption' => 'Show',
'icon' => 'view',
'url' => 'menuaction=calendar.calendar_uilist.listview&filter=all&owner=0,c$id&ajax=true',
'targetapp' => 'calendar', // open in calendar tab
'url' => 'menuaction=calendar.calendar_uiforms.edit&participants=c$id',
'onExecute' => 'javaScript:app.addressbook.view_calendar',
'targetapp' => 'calendar', // open in calendar tab,
'hideOnDisabled' => true,
),
'calendar_add' => array(
'caption' => 'Add appointment',
'icon' => 'new',
'url' => 'menuaction=calendar.calendar_uiforms.edit&participants=c$id',
'popup' => egw_link::get_registry('calendar', 'add_popup'),
'onExecute' => 'javaScript:app.addressbook.add_cal', // call server for org-view only
'onExecute' => 'javaScript:app.addressbook.add_cal',
),
),
);
@ -1076,7 +1077,7 @@ window.egw_LAB.wait(function() {
$msg = ''; // no message, as we send none in javascript too and users sees opening popup
return false;
case 'calendar_view': // show calendar for org-views, other views are handled directly in javascript
case 'calendar_view': // show calendar for org-views, although all views are handled directly in javascript
list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
egw::redirect_link('/index.php',array(
'menuaction' => 'calendar.calendar_uiviews.index',

View File

@ -157,6 +157,57 @@ app.classes.addressbook = AppJS.extend(
}
},
/**
* Open the calender to view the selected contacts
* @param {egwAction} _action
* @param {egwActionObject[]} _senders
*/
view_calendar: function(_action, _senders)
{
var extras = {
filter: 'all',
owner: []
};
var orgs = [];
for(var i = 0; i < _senders.length; i++)
{
// Remove UID prefix for just contact_id
var ids = _senders[i].id.split('::');
ids.shift();
ids = ids.join('::');
// Orgs need to get all the contact IDs first
if (ids.substr(0,9) == 'org_name:')
{
orgs.push(ids);
}
else
{
extras.owner.push('c'+ids);
}
}
if(orgs.length > 0)
{
// Get organisation contacts, then show infolog list
this.egw.json('addressbook.addressbook_ui.ajax_organisation_contacts',
[orgs],
function(contacts) {
for(var i = 0; i < contacts.length; i++)
{
extras.owner.push('c'+contacts[i]);
}
extras.owner = extras.owner.join(',');
this.egw.open('','calendar','list',extras,'calendar');
},this,true,this
).sendRequest();
}
else
{
extras.owner = extras.owner.join(',');
egw.open('', 'calendar', 'list', extras, 'calendar');
}
},
/**
* Add appointment or show calendar for selected contacts, call default nm_action after some checks
*