* Addressbook: show calendar of contact(s) via context menu

This commit is contained in:
Ralf Becker 2012-01-05 04:10:54 +00:00
parent a34e9b8431
commit f71782a8e0
2 changed files with 30 additions and 9 deletions

View File

@ -551,11 +551,23 @@ class addressbook_ui extends addressbook_bo
{
$actions['calendar'] = array(
'icon' => 'calendar/navbar',
'caption' => 'Calendar',
'group' => $group,
'children' => array(
'calendar_view' => array(
'caption' => 'Show',
'icon' => 'view',
'url' => 'menuaction=calendar.calendar_uiviews.index&owner=c$id',
'onExecute' => 'javaScript:add_cal', // call server for org-view only
),
'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'),
'group' => $group,
'onExecute' => 'javaScript:add_cal', // call server for org-view only
),
),
);
}
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
@ -566,6 +578,8 @@ class addressbook_ui extends addressbook_bo
'url' => 'menuaction=filemanager.filemanager_ui.index&path=/apps/addressbook/$id',
'allowOnMultiple' => false,
'group' => $group,
// disable for for org-views, as it needs contact-ids
'enabled' => !isset($this->org_views[(string) $org_view]),
);
}
@ -885,7 +899,7 @@ class addressbook_ui extends addressbook_bo
$msg = ''; // no message, as we send none in javascript too and users sees opening popup
return false;
case 'calendar': // add appointment for org-views, other views are handled directly in javascript
case 'calendar_add': // add appointment for org-views, other views are handled directly in javascript
list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
egw_framework::set_onload(
"egw_openWindowCentered2('".egw::link('/index.php',array(
@ -894,6 +908,13 @@ class addressbook_ui extends addressbook_bo
))."','_blank',$width,$height);");
$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
list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
egw::redirect_link('/index.php',array(
'menuaction' => 'calendar.calendar_uiviews.index',
'owner' => 'c'.implode(',c',$checked),
));
}
foreach($checked as $id)
{

View File

@ -10,7 +10,7 @@
/**
* Add appointment for selected contacts, call default nm_action after some checks
* Add appointment or show calendar for selected contacts, call default nm_action after some checks
*
* @param _action
* @param _senders
@ -25,13 +25,13 @@ function add_cal(_action, _senders)
else
{
// call nm_action's popup, but already replace id's in url, because they need to be prefix with a "c"
_action.data.nm_action = "popup";
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) ? "," : "");
}
_action.data.url = _action.data.url.replace(/participants=.*$/,"participants="+ids);
_action.data.url = _action.data.url.replace(/=c%24id/,"="+ids);
}
nm_action(_action, _senders);
}