From 52b3a02fb2dbb0eca3fb4effbe7c6b60a5ecf168 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 20 Sep 2024 17:08:51 +0200 Subject: [rebootcontrol/statistics] Add templates for useful remote exec commands --- modules-available/statistics/page.inc.php | 4 ++++ modules-available/statistics/pages/machine.inc.php | 3 ++- .../statistics/templates/machine-main.html | 24 ++++++++++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'modules-available/statistics') diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php index 4f11e835..f07dca56 100644 --- a/modules-available/statistics/page.inc.php +++ b/modules-available/statistics/page.inc.php @@ -97,6 +97,10 @@ class Page_Statistics extends Page if (Module::isAvailable('rebootcontrol')) { RebootControl::prepareExec(); } + } elseif (substr($action, 0, 12) === 'exec-preset-') { + if (Module::isAvailable('rebootcontrol')) { + RebootControl::prepareExec(substr($action, 12)); + } } // Make sure we don't render any content for POST requests - should be handled above and then diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php index 34ed63da..77d9b28e 100644 --- a/modules-available/statistics/pages/machine.inc.php +++ b/modules-available/statistics/pages/machine.inc.php @@ -164,12 +164,13 @@ class SubPage } } // Rebootcontrol - if (Module::get('rebootcontrol') !== false) { + if (Module::isAvailable('rebootcontrol')) { $client['canReboot'] = (User::hasPermission('.rebootcontrol.action.reboot', (int)$client['locationid'])); $client['canShutdown'] = (User::hasPermission('.rebootcontrol.action.shutdown', (int)$client['locationid'])); $client['canWol'] = (User::hasPermission('.rebootcontrol.action.wol', (int)$client['locationid'])); $client['canExec'] = (User::hasPermission('.rebootcontrol.action.exec', (int)$client['locationid'])); $client['rebootcontrol'] = $client['canReboot'] || $client['canShutdown'] || $client['canWol'] || $client['canExec']; + $client['execList'] = ExecTemplate::list(); } // Baseconfig if (Module::get('baseconfig') !== false diff --git a/modules-available/statistics/templates/machine-main.html b/modules-available/statistics/templates/machine-main.html index be32f9c7..1139d5b9 100644 --- a/modules-available/statistics/templates/machine-main.html +++ b/modules-available/statistics/templates/machine-main.html @@ -153,10 +153,26 @@ {{/canWol}} {{#canExec}} - +