diff --git a/api/lang/egw_de.lang b/api/lang/egw_de.lang index d886c86c5f..a580402b7d 100644 --- a/api/lang/egw_de.lang +++ b/api/lang/egw_de.lang @@ -1378,6 +1378,7 @@ vertical alignment of row common de vertikale Ausrichtung der Zeile vfs upload directory common de Dateimanager Upload Verzeichnis viet nam common de VIETNAM view common de Anzeigen +view linked %1 entries common de Verknüpfte %1 Einträge anzeigen view this etemplate common de dieses eTemplate anzeigen view this linked entry in its application common de Zeige diesen Eintrag in seiner Anwendung an virgin islands, british common de VIRGIN ISLANDS, BRITISH diff --git a/api/lang/egw_en.lang b/api/lang/egw_en.lang index 2e6471ffc9..ab55bc65dc 100644 --- a/api/lang/egw_en.lang +++ b/api/lang/egw_en.lang @@ -1380,6 +1380,7 @@ vertical alignment of row common en Vertical alignment of row vfs upload directory common en VFS upload directory viet nam common en VIET NAM view common en View +view linked %1 entries common en View linked %1 entries view this etemplate common en View eTemplate view this linked entry in its application common en View linked entry in its application virgin islands, british common en VIRGIN ISLANDS, BRITISH diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 60da88ccca..3d7a525879 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1218,10 +1218,24 @@ class infolog_ui $actions['timesheet'] = array( // interactive add for a single event 'icon' => 'timesheet/navbar', 'caption' => 'Timesheet', - 'url' => 'menuaction=timesheet.timesheet_ui.edit&link_app[]=infolog&link_id[]=$id', 'group' => $group, 'allowOnMultiple' => false, - 'popup' => Link::get_registry('timesheet', 'add_popup'), + + 'children' => array( + 'timesheet_list' => array( + 'caption' => lang('View linked %1 entries', lang('timesheet')), + 'icon' => 'infolog/navbar', + 'onExecute' => 'javaScript:app.infolog.timesheet_list', + 'allowOnMultiple' => false, + 'hideOnDisabled' => true, + ), + 'timesheet_add' => array( + 'icon' => 'timesheet/navbar', + 'caption' => 'Add a new Timesheet', + 'url' => 'menuaction=timesheet.timesheet_ui.edit&link_app[]=infolog&link_id[]=$id', + 'popup' => Link::get_registry('timesheet', 'add_popup'), + ) + ) ); } if ($GLOBALS['egw_info']['user']['apps']['tracker']) diff --git a/infolog/js/app.js b/infolog/js/app.js index aa8fc57458..023776e91d 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -634,6 +634,34 @@ app.classes.infolog = AppJS.extend( } }, + /** + * View a list of timesheets for the linked infolog entry + * + * Only one infolog entry at a time is allowed, we just pick the first one + * + * @param {egwAction} _action + * @param {egwActionObject[]} _selected + */ + timesheet_list: function(_action, _selected) + { + var extras = { + link_app: 'infolog', + link_id: false + }; + for(var i = 0; i < _selected.length; i++) + { + // Remove UID prefix for just contact_id + var ids = _selected[i].id.split('::'); + ids.shift(); + ids = ids.join('::'); + + extras.link_id = ids; + break; + } + + egw.open("","timesheet","list", extras, 'timesheet'); + }, + /** * Go to parent entry * diff --git a/timesheet/inc/class.timesheet_hooks.inc.php b/timesheet/inc/class.timesheet_hooks.inc.php index 139c09b42a..18c5920b1b 100644 --- a/timesheet/inc/class.timesheet_hooks.inc.php +++ b/timesheet/inc/class.timesheet_hooks.inc.php @@ -54,8 +54,9 @@ class timesheet_hooks 'view_id' => 'ts_id', 'view_popup' => '630x480', 'edit_popup' => '630x480', - 'index' => array( + 'list' => array( 'menuaction' => 'timesheet.timesheet_ui.index', + 'ajax' => 'true' ), 'add' => array( 'menuaction' => TIMESHEET_APP.'.timesheet_ui.edit', diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index fa35cb693d..207af1de50 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -568,7 +568,15 @@ class timesheet_ui extends timesheet_bo // handle linked filter (show only entries linked to a certain other entry) if ($query['col_filter']['linked']) { - list($app,$id) = explode(':',$query['col_filter']['linked']); + if(!is_array($query['col_filter']['linked'])) + { + list($app,$id) = explode(':',$query['col_filter']['linked']); + } + else + { + $app = $query['col_filter']['linked']['app']; + $id = $query['col_filter']['linked']['id']; + } if (!($links = Link::get_links($app,$id,'timesheet'))) { $rows = array(); // no infologs linked to project --> no rows to return @@ -922,6 +930,13 @@ class timesheet_ui extends timesheet_bo { $content['nm']['search'] = $_GET['search']; } + if($_GET['link_app'] && Link::get_registry($_GET['link_app'], 'query') && $_GET['link_id']) + { + $content['nm']['col_filter']['linked'] = array( + 'app' => $_GET['link_app'], + 'id' => $_GET['link_id'] + ); + } $read_grants = $this->grant_list(Acl::READ); $content['nm']['no_owner_col'] = count($read_grants) == 1; if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'];