* Calendar - add context menu actions for email & documents to non-list views

This commit is contained in:
nathangray 2018-06-19 14:35:08 -06:00
parent 238988373e
commit c50d8007e2
4 changed files with 74 additions and 4 deletions

View File

@ -1318,6 +1318,14 @@ class calendar_uiforms extends calendar_ui
{
//error_log(__METHOD__.__LINE__.' '.$uid.':'.array2string($status));
if (empty($status)) continue;
if(!is_array($status))
{
calendar_so::split_status($status,$quantity,$role);
$status = array(
'status' => $status,
'uid' => $uid,
);
}
$toadd = '';
if ((isset($status['status']) && $status['status'] == 'R') || (isset($status['uid']) && $status['uid'] == $this->user)) continue;

View File

@ -954,6 +954,29 @@ class calendar_uilist extends calendar_ui
'popup' => Link::get_registry('infolog', 'add_popup'),
);
}
if($GLOBALS['egw_info']['user']['apps']['mail'])
{
//Send to email
$actions['email'] = array(
'caption' => 'Email',
'icon' => 'mail/navbar',
'hideOnDisabled' => true,
'group' => $group,
'allowOnMultiple' => false,
'children' => array(
'mail' => array(
'caption' => 'Mail all participants',
'onExecute' => 'javaScript:app.calendar.action_mail',
),
'sendrequest' => array(
'caption' => 'Meetingrequest to all participants',
'onExecute' => 'javaScript:app.calendar.action_mail',
)
),
);
}
if ($GLOBALS['egw_info']['user']['apps']['timesheet'])
{
$actions['timesheet'] = array( // interactive add for a single event

View File

@ -931,11 +931,16 @@ class calendar_uiviews extends calendar_ui
$actions['infolog_app']['open'] = '{"app": "infolog", "type": "add", "extra": "type=task&action=$app&action_id=$id"}';
$actions['infolog_app']['onExecute'] = 'javaScript:app.calendar.action_open';
}
if ($actions['documents'])
// Get documents working with other views
$set_execute = function(&$action) use (&$set_execute)
{
// TODO: See if we can get this working sensibly
$actions['documents']['enabled'] = false;
}
$action['onExecute'] = 'javaScript:app.calendar.action_merge';
foreach($action['children'] as &$child)
{
$set_execute($child);
}
};
$set_execute($actions['documents']);
$actions['ical']['onExecute'] = 'javaScript:app.calendar.ical';
$actions['delete']['onExecute'] = 'javaScript:app.calendar.delete';

View File

@ -1788,6 +1788,40 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
}
},
/**
* Send a mail or meeting request to event participants
*
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
action_mail: function(_action, _selected)
{
var data = egw.dataGetUIDdata(_selected[0].id) || {data:{}};
var event = data.data;
this.egw.json('calendar.calendar_uiforms.ajax_custom_mail',
[event, false, _action.id==='sendrequest'],
null,null,null,null
).sendRequest();
},
/**
* Insert selected event(s) into a document
*
* Actually, just pass it off to the nextmatch
*
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
action_merge: function(_action, _selected)
{
var ids = {ids:[]};
for(var i = 0; i < _selected.length; i++)
{
ids.ids.push(_selected[i].id);
}
nm_action(egw_getAppActionManager('calendar').getActionById('nm').getActionById(_action.id), _selected, null, ids);
},
/**
* Sidebox merge
*