forked from extern/egroupware
WIP admin history
This commit is contained in:
parent
6ba3dbbd33
commit
8c6fc0f4d5
@ -1295,4 +1295,57 @@ abstract class admin_cmd
|
||||
{
|
||||
return Api\Auth::randomstring($len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return (human readable) labels for keys of changes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_change_labels()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Read change labels from descriptions in template:
|
||||
* - <description value="Expires" for="account_expires"/>
|
||||
* - <description value="Label"/>\n<widget id="id"/>
|
||||
* - <checkbox id="account_status" selected_value="A" label="Account active"/>
|
||||
* @param type $name
|
||||
*/
|
||||
protected function change_labels_from_template($name)
|
||||
{
|
||||
$labels = [];
|
||||
$matches = null;
|
||||
if (($path = Api\Etemplate::relPath($name)) &&
|
||||
($tpl = file_get_contents(Api\Etemplate::rel2path($path))))
|
||||
{
|
||||
if (preg_match_all('/<description.*value="([^"]+)".*\n?.*(for|id)="([^"]+)"/sU', $tpl, $matches, PREG_PATTERN_ORDER))
|
||||
{
|
||||
foreach($matches[1] as $key => $name)
|
||||
{
|
||||
$id = $matches[3][$key];
|
||||
$label= $matches[1][$key];
|
||||
if (!empty($id) && !empty($label))
|
||||
{
|
||||
$labels[$id] = $label;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preg_match_all('/<(checkbox).*(label|id)="([^"]+)".*(label|id)="([^"]+)"/', $tpl, $matches, PREG_PATTERN_ORDER))
|
||||
{
|
||||
foreach($matches[2] as $key => $name)
|
||||
{
|
||||
$id = $name === 'id' ? $matches[3][$key] : $matches[5][$key];
|
||||
$label= $name === 'id' ? $matches[5][$key] : $matches[3][$key];
|
||||
if (!empty($id) && !empty($label))
|
||||
{
|
||||
$labels[$id] = $label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
error_log(__METHOD__."($name) path=$path returning ".json_encode($labels));
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
|
@ -86,4 +86,24 @@ class admin_cmd_config extends admin_cmd
|
||||
return lang('%1 site configuration',
|
||||
lang($this->appname ? $this->appname : $this->app));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return (human readable) labels for keys of changes
|
||||
*
|
||||
* Reading them from admin.account template
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_change_labels()
|
||||
{
|
||||
$labels = [];
|
||||
foreach($this->change_labels_from_template(($this->appname ? $this->appname : $this->app).'.config') as $id => $label)
|
||||
{
|
||||
if (strpos($id, 'newsettings[') === 0)
|
||||
{
|
||||
$labels[substr($id, 12, -1)] = $label;
|
||||
}
|
||||
}
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +224,18 @@ class admin_cmd_edit_user extends admin_cmd_change_pw
|
||||
admin_cmd::display_account($this->account ? $this->account : $this->set['account_lid']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return (human readable) labels for keys of changes
|
||||
*
|
||||
* Reading them from admin.account template
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_change_labels()
|
||||
{
|
||||
return $this->change_labels_from_template('admin.account');
|
||||
}
|
||||
|
||||
/**
|
||||
* parse the expired string and return the expired date as timestamp
|
||||
*
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package admin
|
||||
* @copyright (c) 2007-18 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2007-19 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
|
||||
@ -34,6 +34,12 @@ class admin_cmds
|
||||
{
|
||||
Api\Cache::setSession('admin', 'cmds', $query);
|
||||
|
||||
// show also old api
|
||||
if ($query['col_filter']['app'] === 'api')
|
||||
{
|
||||
$query['col_filter']['app'] = ['api', 'phpgwapi'];
|
||||
}
|
||||
|
||||
return admin_cmd::get_rows($query,$rows,$readonlys);
|
||||
}
|
||||
|
||||
@ -60,9 +66,9 @@ class admin_cmds
|
||||
'sort' => 'DESC',
|
||||
'row_id' => 'id',
|
||||
'default_cols' => 'title,created,creator,status',
|
||||
'actions' => self::cmd_actions(),
|
||||
);
|
||||
}
|
||||
$content['nm']['actions'] = self::cmd_actions();
|
||||
}
|
||||
elseif ($content['nm']['rows']['delete'])
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="admin.cmds.rows" template="" lang="" group="0" version="1.5.001">
|
||||
<grid width="100%">
|
||||
@ -21,8 +20,8 @@
|
||||
<rows>
|
||||
<row class="th">
|
||||
<nextmatch-header label="Title" id="title"/>
|
||||
<nextmatch-customfilter type="select-app" empty_label="Application" id="app"/>
|
||||
<nextmatch-accountfilter empty_label="Account" id="account"/>
|
||||
<nextmatch-customfilter type="select-app" empty_label="All applications" id="app"/>
|
||||
<nextmatch-accountfilter empty_label="All accounts" id="account"/>
|
||||
<nextmatch-filterheader empty_label="Type" id="type"/>
|
||||
<nextmatch-accountfilter empty_label="Requested" id="requested"/>
|
||||
<nextmatch-header label="Comment" id="comment"/>
|
||||
|
Loading…
Reference in New Issue
Block a user