* Infolog: Add a context menu action to view a list of linked timesheets

This commit is contained in:
nathangray 2016-11-22 11:41:51 -07:00
parent 3fed6fd20d
commit ed6069aa4d
6 changed files with 64 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
'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'])

View File

@ -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
*

View File

@ -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',

View File

@ -567,8 +567,16 @@ class timesheet_ui extends timesheet_bo
// handle linked filter (show only entries linked to a certain other entry)
if ($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'];