* 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

@ -477,7 +477,7 @@ class addressbook_ui extends addressbook_bo
'children' => $add_lists, 'children' => $add_lists,
'prefix' => 'to_list_', 'prefix' => 'to_list_',
'icon' => 'foldertree_nolines_plus', 'icon' => 'foldertree_nolines_plus',
'enabled' => ($add_lists?true:false), // if there are editable lists, allow to add a contact to one of them, 'enabled' => ($add_lists?true:false), // if there are editable lists, allow to add a contact to one of them,
//'disableClass' => 'rowNoEdit', // wether you are allowed to edit the contact or not, as you alter a list, not the contact //'disableClass' => 'rowNoEdit', // wether you are allowed to edit the contact or not, as you alter a list, not the contact
), ),
'remove_from_list' => array( 'remove_from_list' => array(
@ -551,11 +551,23 @@ class addressbook_ui extends addressbook_bo
{ {
$actions['calendar'] = array( $actions['calendar'] = array(
'icon' => 'calendar/navbar', 'icon' => 'calendar/navbar',
'caption' => 'Add appointment', 'caption' => 'Calendar',
'url' => 'menuaction=calendar.calendar_uiforms.edit&participants=c$id',
'popup' => egw_link::get_registry('calendar', 'add_popup'),
'group' => $group, 'group' => $group,
'onExecute' => 'javaScript:add_cal', // call server for org-view only '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'),
'onExecute' => 'javaScript:add_cal', // call server for org-view only
),
),
); );
} }
if ($GLOBALS['egw_info']['user']['apps']['filemanager']) 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', 'url' => 'menuaction=filemanager.filemanager_ui.index&path=/apps/addressbook/$id',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
'group' => $group, '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 $msg = ''; // no message, as we send none in javascript too and users sees opening popup
return false; 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')); list($width,$height) = explode('x',egw_link::get_registry('calendar', 'add_popup'));
egw_framework::set_onload( egw_framework::set_onload(
"egw_openWindowCentered2('".egw::link('/index.php',array( "egw_openWindowCentered2('".egw::link('/index.php',array(
@ -894,6 +908,13 @@ class addressbook_ui extends addressbook_bo
))."','_blank',$width,$height);"); ))."','_blank',$width,$height);");
$msg = ''; // no message, as we send none in javascript too and users sees opening popup $msg = ''; // no message, as we send none in javascript too and users sees opening popup
return false; 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) 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 _action
* @param _senders * @param _senders
@ -25,13 +25,13 @@ function add_cal(_action, _senders)
else else
{ {
// call nm_action's popup, but already replace id's in url, because they need to be prefix with a "c" // 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 = ""; var ids = "";
for (var i = 0; i < _senders.length; i++) for (var i = 0; i < _senders.length; i++)
{ {
ids += "c" + _senders[i].id + ((i < _senders.length - 1) ? "," : ""); 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); nm_action(_action, _senders);
} }