Miscellaneous corrections and optimizations

This commit is contained in:
bergware
2018-03-10 15:03:09 +01:00
parent 58ec529b67
commit 58e006a54b
5 changed files with 34 additions and 34 deletions

View File

@@ -18,14 +18,13 @@ Code="f1e6"
*/
?>
<?
$empty = "<tr><td colspan='6' style='text-align:center;padding-top:12px'><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving and updating plugin information ...</em></td><tr>";
// Remove stale /tmp/plugin/*.plg entries
foreach (glob("/tmp/plugins/*.{plg,txt}", GLOB_NOSORT+GLOB_BRACE) as $entry) if (!file_exists("/var/log/plugins/".basename($entry))) @unlink($entry);
?>
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.filetree.css">
<style>#plugin_tree{width:33%;height:200px;overflow-y:scroll;}</style>
<script src="/webGui/javascript/jquery.filetree.js"></script>
<script src="<?autov('/webGui/javascript/jquery.filetree.js')?>"></script>
<script>
<?if ($display['resize']):?>
function resize(bind) {
@@ -72,5 +71,5 @@ $(function() {
</script>
<table class='tablesorter plugins shift' id='plugin_table'>
<thead><tr><th></th><th>Plugin</th><th>Author</th><th>Version</th><th>Status</th><th>Uninstall</th></tr></thead>
<tbody id="plugin_list"><?=$empty?></tbody>
<tbody id="plugin_list"><tr><td colspan='6' style='text-align:center;padding-top:12px'><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving and updating plugin information ...</em></td><tr></tbody>
</table>

View File

@@ -12,10 +12,12 @@
*/
?>
<?
$prefs = '/boot/config/plugins/dynamix.vm.manager';
$names = explode(';',$_POST['names']);
$index = explode(';',$_POST['index']);
$save = []; $i = 0;
foreach ($names as $name) if ($name) $save[] = "$name=\"".$index[$i++]."\"";
file_put_contents('/boot/config/plugins/dynamix.vm.manager/userprefs.txt', implode("\n",$save)."\n");
foreach ($names as $name) if ($name) $save[] = $index[$i++]."=\"".$name."\"";
if (!is_dir($prefs)) mkdir($prefs);
file_put_contents("$prefs/userprefs.cfg", implode("\n",$save)."\n");
?>

View File

@@ -16,15 +16,15 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
$txt = '/boot/config/plugins/dynamix.vm.manager/userprefs.txt';
$cfg = '/boot/config/plugins/dynamix.vm.manager/userprefs.cfg';
$vms = $lv->get_domains();
if (empty($vms)) {
echo '<tr><td colspan="8" style="text-align:center;padding-top:12px">No Virtual Machines installed</td></tr>';
return;
}
if (file_exists($txt)) {
$prefs = parse_ini_file($txt); $sort = [];
foreach ($vms as $vm) $sort[] = $prefs[$vm] ?? 999;
if (file_exists($cfg)) {
$prefs = parse_ini_file($cfg); $sort = [];
foreach ($vms as $vm) $sort[] = array_search($vm,$prefs) ?: 999;
array_multisort($sort,SORT_NUMERIC,$vms);
} else {
natsort($vms);

View File

@@ -7,25 +7,25 @@ Markdown="false"
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.ui.css">
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.switchbutton.css">
<style>
body{-webkit-overflow-scrolling: touch;}
label{display:inline;}
iframe{overflow:scroll;-webkit-overflow-scrolling:touch;}
h2{color:#625D5D;letter-spacing:0;font-family:arimo;font-size:32px;line-height: 1.2em;font-weight:300;padding:0 0 20px;margin:0;}
.iconstatus{position:absolute;z-index:2;bottom:-4px;right:-4px;font-size:1.2em;text-shadow:0 0 2px #FFF;}
.iconstatus.started{font-size:1.3em;}
img.started{opacity:1.0;}
img.stopped{opacity:0.3;}
img.paused{opacity:1.0;}
.started{color:#009900;}
.paused{color:#F0DD33;}
.stopped{color:#EF3D47;}
.update{color:#3300FF;}
.show{display:block;}
div.Panel{float:none;display:inline-block;margin:0 18px 15px 0;height:90px;overflow:hidden;vertical-align:top;width:94px;word-wrap:break-word;border:none;}
div.Panel:hover{overflow:visible;z-index:10;background-color:unset;}
#noapps{display:none;font-style:italic;font-size:16px;opacity:0.5;padding:5px;}
.switch-button-label.off{color:inherit;}
.switch-button-label.on{color:#009900;}
body{-webkit-overflow-scrolling:touch}
label{display:inline}
iframe{overflow:scroll;-webkit-overflow-scrolling:touch}
h2{color:#625D5D;letter-spacing:0;font-family:arimo;font-size:32px;line-height:1.2em;font-weight:300;padding:0 0 20px;margin:0}
.iconstatus{position:absolute;z-index:2;bottom:-4px;right:-4px;font-size:1.2em;text-shadow:0 0 2px #FFF}
.iconstatus.started{font-size:1.3em}
img.started{opacity:1.0}
img.stopped{opacity:0.3}
img.paused{opacity:1.0}
.started{color:#009900}
.paused{color:#F0DD33}
.stopped{color:#EF3D47}
.update{color:#3300FF}
.show{display:block}
div.Panel{float:none;display:inline-block;margin:0 18px 15px 0;height:90px;overflow:hidden;vertical-align:top;width:94px;word-wrap:break-word;border:none}
div.Panel:hover{overflow:visible;z-index:10;background-color:unset}
#noapps{display:none;font-style:italic;font-size:16px;opacity:0.5;padding:5px}
.switch-button-label.off{color:inherit}
.switch-button-label.on{color:#009900}
</style>
<form method="POST" id="formStartStop" action="/update.php" target="progressFrame">
<input type="hidden" id="cmdStartStop" name="#command" value="">
@@ -46,7 +46,7 @@ div.Panel:hover{overflow:visible;z-index:10;background-color:unset;}
<script src="<?autov('/plugins/dynamix.vm.manager/javascript/vmmanager.js')?>"></script>
<script>
function loadlist() {
$.get('/webGui/include/DashboardApps.php',function(d) {
$.post('/webGui/include/DashboardApps.php',{display:'<?=$display['dashapps']?>'},function(d) {
var data = d.split(/\0/);
$('#apps_icons').html(data[0]);
$('head').append('<script>'+data[1]+'<\/script>');

View File

@@ -17,14 +17,13 @@ require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
// Get the webGui configuration preferences
extract(parse_plugin_cfg('dynamix',true));
$display = $_POST['display'];
if (pgrep('dockerd')!==false && ($display['dashapps']=='icons' || $display['dashapps']=='docker')) {
if (pgrep('dockerd')!==false && ($display=='icons' || $display=='docker')) {
$DockerClient = new DockerClient();
$DockerTemplates = new DockerTemplates();
$containers = $DockerClient->getDockerContainers() ?: [];
ksort($containers);
ksort($containers,SORT_NATURAL);
$Allinfo = $DockerTemplates->getAllInfo();
$menu = [];
foreach ($containers as $ct) {
@@ -51,7 +50,7 @@ if (pgrep('dockerd')!==false && ($display['dashapps']=='icons' || $display['dash
}
}
if (pgrep('libvirtd')!==false && ($display['dashapps']=='icons' || $display['dashapps']=='vms')) {
if (pgrep('libvirtd')!==false && ($display=='icons' || $display=='vms')) {
$txt = '/boot/config/plugins/dynamix.vm.manager/userprefs.txt';
$vms = $lv->get_domains();
if (file_exists($txt)) {