WIP admin history

This commit is contained in:
Ralf Becker 2019-03-12 17:13:18 +01:00
parent e1476e4167
commit 21962bdfe4
2 changed files with 84 additions and 24 deletions

View File

@ -5,51 +5,63 @@
<template id="admin.cmds.rows" template="" lang="" group="0" version="1.5.001">
<grid width="100%">
<columns>
<column width="30%" minWidth="300"/>
<column/>
<column/>
<column/>
<column width="120"/>
<column width="120"/>
<column width="120"/>
<column width="30%" minWidth="120"/>
<column/>
<column/>
<column/>
<column/>
<column width="20%" minWidth="300"/> <!-- Title -->
<column width="200"/> <!-- Application -->
<column width="200"/> <!-- Account -->
<column width="200"/> <!-- Type -->
<column width="200"/> <!-- Requested -->
<column width="15%" minWidth="120"/> <!-- Comment -->
<column width="120"/> <!-- Scheduled -->
<column width="80"/> <!-- Periodic -->
<column/> <!-- Remote -->
<column width="200"/> <!-- Created/or -->
<column width="15%" minWidth="120"/> <!-- Status/Error -->
<column width="200"/> <!-- Mofified/r -->
</columns>
<rows>
<row class="th">
<nextmatch-header label="Title" id="title"/>
<nextmatch-filterheader type="select-app" empty_label="Application" id="app"/>
<nextmatch-accountfilter empty_label="Account" id="account"/>
<nextmatch-filterheader empty_label="Type" id="type"/>
<nextmatch-accountfilter empty_label="Requested" id="requested"/>
<nextmatch-header label="Comment" id="comment"/>
<nextmatch-sortheader label="Scheduled" id="scheduled"/>
<nextmatch-sortheader label="Scheduled" id="cmd_scheduled"/>
<nextmatch-filterheader empty_label="Periodic" id="periodic"/>
<nextmatch-filterheader options="Remote" id="remote_id"/>
<nextmatch-sortheader label="Created" id="created"/>
<vbox>
<nextmatch-sortheader label="Created" id="cmd_created"/>
<nextmatch-accountfilter empty_label="Creator" id="creator"/>
</vbox>
<nextmatch-filterheader empty_label="Status" id="status"/>
<nextmatch-sortheader label="Modified" id="modified"/>
<vbox>
<nextmatch-sortheader label="Modified" id="cmd_modified"/>
<nextmatch-accountfilter options="Modifier" id="modifier"/>
</vbox>
</row>
<row class="row $row_cont[class]">
<description id="${row}[title]" statustext="$row_cont[data]"/>
<select-app id="${row}[app]" readonly="true"/>
<select-account id="${row}[account]" readonly="true"/>
<select id="${row}[type]" readonly="true"/>
<url-email id="${row}[requested_email]" readonly="true" statustext="$row_cont[comment]"/>
<description id="${row}[comment]"/>
<date-time id="${row}[scheduled]" readonly="true"/>
<description id="${row}[rrule]"/>
<select id="${row}[remote_id]" readonly="true"/>
<vbox>
<date-time id="${row}[created]" readonly="true"/>
<select-account id="${row}[creator]" readonly="true" statustext="$row_cont[creator_email]"/>
</vbox>
<vbox>
<select id="${row}[status]" readonly="true"/>
<description id="${row}[error]" class="redItalic"/>
<description id="${row}[value]"/>
</vbox>
<vbox>
<date-time id="${row}[modified]" readonly="true"/>
<select-account id="${row}[modifier]" readonly="true" statustext="$row_cont[modifier_email]"/>
</vbox>
</row>
</rows>
</grid>

View File

@ -7,7 +7,7 @@
* @subpackage etemplate
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-18 by RalfBecker@outdoor-training.de
* @copyright 2002-19 by RalfBecker@outdoor-training.de
*/
namespace EGroupware\Api\Etemplate\Widget;
@ -762,6 +762,43 @@ class Nextmatch extends Etemplate\Widget
}, array(), 86400); // cache for 1 day
}
/**
* Merges actions together with positions based on group parameter
*
* @param array $actions
* @param array $actions2
* @return array
*/
static function merge_actions_by_group(array $actions, array $actions2)
{
//error_log(__METHOD__.'('.array2string($actions).', '.array2string($actions2).')');
//return array_merge_recursive($actions, $actions2);
foreach($actions2 as $name => $action)
{
// overwrite existing action of given name or append action without group
if (isset($actions[$name]) || !isset($action['group']))
{
$actions[$name] = $action;
}
// find position to insert action
else
{
$n = 0;
foreach($actions as $a)
{
if ($a['group'] > $action['group']) break;
++$n;
}
$actions = array_merge(array_slice($actions, 0, $n),
array($name => $action),
array_slice($actions, $n, count($actions)-$n));
}
}
//error_log(__METHOD__.'() returning '.array2string($actions));
return $actions;
}
/**
* Default maximum length for context submenus, longer menus are put as a "More" submenu
*/
@ -817,6 +854,19 @@ class Nextmatch extends Etemplate\Widget
//echo "<p>".__METHOD__."(\$actions, '$template_name', '$prefix', \$action_links, $max_length) \$actions="; _debug_array($actions);
$first_level = !$action_links; // add all first level actions
if ($first_level)
{
// allow other apps to add actions
foreach(Api\Hooks::process(array(
'location' => 'add_row_actions',
'template_name' => $template_name,
), array('policy'), true) as $app => $data)
{
// todo: place new items based on group
if ($data) $actions = self::merge_actions_by_group((array)$actions, $data);
}
}
//echo "actions="; _debug_array($actions);
$egw_actions = array();
$n = 1;
@ -1053,7 +1103,6 @@ class Nextmatch extends Etemplate\Widget
return $cat_actions;
}
/**
* Validate input
*
@ -1092,7 +1141,6 @@ class Nextmatch extends Etemplate\Widget
$validated += $content[$value[$preserve['action_var']].'_popup'];
}
// Save current column settings as default, clear, or force (admins only)
if($GLOBALS['egw_info']['user']['apps']['admin'] && $app && $value['selectcols'])
{