diff options
Diffstat (limited to 'modules-available/rebootcontrol/pages/exec.inc.php')
-rw-r--r-- | modules-available/rebootcontrol/pages/exec.inc.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/pages/exec.inc.php b/modules-available/rebootcontrol/pages/exec.inc.php new file mode 100644 index 00000000..58053072 --- /dev/null +++ b/modules-available/rebootcontrol/pages/exec.inc.php @@ -0,0 +1,57 @@ +<?php + +class SubPage +{ + + public static function doPreprocess() + { + $action = Request::post('action', false, 'string'); + if ($action === 'exec') { + self::execExec(); + } + } + + private static function execExec() + { + $id = Request::post('id', Request::REQUIRED, 'int'); + $machines = Session::get('exec-' . $id); + if (!is_array($machines)) { + Message::addError('unknown-exec-job', $id); + return; + } + $script = Request::post('script', Request::REQUIRED, 'string'); + $task = RebootControl::runScript($machines, $script); + if (Taskmanager::isTask($task)) { + Util::redirect("?do=rebootcontrol&show=task&what=task&taskid=" . $task["id"]); + } + } + + /* + * Render + */ + + public static function doRender() + { + $what = Request::get('what', 'list', 'string'); + if ($what === 'prepare') { + self::showPrepare(); + } + } + + private static function showPrepare() + { + $id = Request::get('id', Request::REQUIRED, 'int'); + $machines = Session::get('exec-' . $id); + if (!is_array($machines)) { + Message::addError('unknown-exec-job', $id); + return; + } + Render::addTemplate('exec-enter-command', ['clients' => $machines, 'id' => $id]); + } + + public static function doAjax() + { + + } + +}
\ No newline at end of file |