mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-02 04:43:46 +01:00
462719d45e
- all commands get loged and optional documented with requesting person and a comment - all commands can be run immediatly or scheduled for a later execusion - all commands can be run either from a command line (admin-cli), from the web GUI or via a remore administration from a different instance current status: - command queue / history table created (need to be installed) - base class for all comments - one exemplary command to change application rights of users or groups - admin-cli used the above comment and has additional parameters to set the requesting person, scheduled execution time and comment - GUI to watch the queue / history - URL to excute/schedule commands remote More to come now on a daily basis
80 lines
2.0 KiB
PHP
80 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* eGgroupWare admin - UI for the command queue
|
|
*
|
|
* @link http://www.egroupware.org
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
* @package admin
|
|
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
* @version $Id$
|
|
*/
|
|
|
|
require_once(EGW_INCLUDE_ROOT.'/admin/inc/class.admin_cmd.inc.php');
|
|
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php');
|
|
|
|
/**
|
|
* UI for the admin comand queue
|
|
*/
|
|
class admin_cmds
|
|
{
|
|
var $public_functions = array(
|
|
'index' => true,
|
|
);
|
|
|
|
/**
|
|
* calling get_rows of our static so_sql instance
|
|
*
|
|
* @param array $query
|
|
* @param array &$rows
|
|
* @param array $readonlys
|
|
* @return int
|
|
*/
|
|
function get_rows($query,&$rows,$readonlys)
|
|
{
|
|
$total = admin_cmd::get_rows($query,$rows,$readonlys);
|
|
|
|
$readonlys = array();
|
|
|
|
if (!$rows) return array();
|
|
|
|
foreach($rows as &$row)
|
|
{
|
|
try {
|
|
$cmd = admin_cmd::instanciate($row);
|
|
$row['title'] = $cmd->__tostring(); // we call __tostring explicit, as a cast to string requires php5.2+
|
|
}
|
|
catch (Exception $e) {
|
|
$row['title'] = $e->getMessage();
|
|
}
|
|
$readonlys["delete[$row[id]]"] = $row['status'] != admin_cmd::scheduled;
|
|
}
|
|
//_debug_array($rows);
|
|
return $total;
|
|
}
|
|
|
|
function index(array $content=null)
|
|
{
|
|
$tpl = new etemplate('admin.cmds');
|
|
|
|
if (!is_array($content))
|
|
{
|
|
$content['nm'] = $GLOBALS['egw']->x; sessions::appsession('cmds','admin');
|
|
if (!is_array($content['nm']))
|
|
{
|
|
$content['nm'] = array(
|
|
'get_rows' => 'admin.admin_cmds.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows'
|
|
'no_filter' => true, // I disable the 1. filter
|
|
'no_filter2' => true, // I disable the 2. filter (params are the same as for filter)
|
|
'no_cat' => true, // I disable the cat-selectbox
|
|
'order' => 'cmd_created',
|
|
'sort' => 'DESC',
|
|
);
|
|
}
|
|
}
|
|
$tpl->exec('admin.admin_cmds.index',$content,array(
|
|
'status' => admin_cmd::$stati,
|
|
));
|
|
}
|
|
}
|