Merge pull request #1516 from bergware/master

UPS: fix PHP8 error
This commit is contained in:
tom mortensen
2023-11-20 12:40:06 -08:00
committed by GitHub
4 changed files with 28 additions and 34 deletions

View File

@@ -88,7 +88,7 @@ if (file_exists("/var/run/apcupsd.pid")) {
if (count($rows)%2==1) $result[] = "<td></td><td></td></tr>";
if ($power && isset($load)) $status[5] = ($load<90 ? "<td $green>" : "<td $red>").round($power*$load/100)." W (".$status[5].")</td>";
elseif (isset($load)) $status[5] = ($load<90 ? "<td $green>" : "<td $red>").$status[5]."</td>";
$status[6] = isset($output) ? ((!$volt || ($minv<$output && $output<$maxv) ? "<td $green>" : "<td $red>").$status[6].($freq ? " ~ $freq Hz" : "")."</td>") : $status[6];
$status[6] = isset($output) ? ((!$volt || ($minv<$output && $output<$maxv) ? "<td $green>" : "<td $red>").$status[6].(isset($freq) ? " ~ $freq Hz" : "")."</td>") : $status[6];
}
if (empty($rows)) $result[] = "<tr><td colspan='4' style='text-align:center'>"._('No information available')."</td></tr>";

View File

@@ -185,7 +185,7 @@ foreach ($vms as $vm) {
$changemedia = "getisoimageboth(\"{$uuid}\",\"hda\",\"{$cdbus}\",\"{$cdfile}\",\"hdb\",\"{$cdbus2}\",\"{$cdfile2}\")";
$title = _('Select ISO image');
$cdstr = $cdromcount." / 2<a class='hand' title='$title' href='#' onclick='$changemedia'>&nbsp;<i class='fa fa-circle-o'></i></a>";
$cdstr = $cdromcount." / 2<a class='hand' title='$title' href='#' onclick='$changemedia'><i class='fa fa-dot-circle-o'></i></a>";
echo "<tr parent-id='$i' class='sortable'><td class='vm-name' style='width:220px;padding:8px'><i class='fa fa-arrows-v mover orange-text'></i>";
echo "<span class='outer'><span id='vm-$uuid' $menu class='hand'>$image</span><span class='inner'><a href='#' onclick='return toggle_id(\"name-$i\")' title='click for more VM info'>$vm</a><br><i class='fa fa-$shape $status $color'></i><span class='state'>"._($status)." $snapshotstcount</span></span></span></td>";
echo "<td>$desc</td>";
@@ -248,7 +248,7 @@ foreach ($vms as $vm) {
$title = _('Insert CD');
$changemedia = "changemedia(\"{$uuid}\",\"{$dev}\",\"{$bus}\",\"--select\")";
$disk = _("No CD image inserted into drive");
echo "<tr><td>$disk<a title='$title' href='#' onclick='$changemedia'>&nbsp;<i class='fa fa-circle-o'></i></a></td><td></td><td>$bus</td><td>$capacity</td><td>$allocation</td><td>$boot</td></tr>";
echo "<tr><td>$disk<a title='$title' href='#' onclick='$changemedia'><i class='fa fa-dot-circle-o'></i></a></td><td></td><td>$bus</td><td>$capacity</td><td>$allocation</td><td>$boot</td></tr>";
}
}
echo "</tbody>";

View File

@@ -15,7 +15,7 @@ table.domdisk tbody tr:nth-child(even){background-color:transparent!important}
table.domdisk tbody tr:nth-child(4n-1){background-color:transparent!important}
table.snapshot{margin-top:0}
i.mover{margin-right:8px;display:none}
i.fa-floppy-o{padding-left:12px}
i.fa-dot-circle-o{padding-left:12px}
#resetsort{margin-left:12px;display:inline-block;width:32px}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset button[disabled]{cursor:default;color:#808080;background:-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 0 no-repeat,-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#404040),to(#404040)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#808080),to(#808080)) 100% 100% no-repeat;background:linear-gradient(90deg,#404040 0,#808080) 0 0 no-repeat,linear-gradient(90deg,#404040 0,#808080) 0 100% no-repeat,linear-gradient(0deg,#404040 0,#404040) 0 100% no-repeat,linear-gradient(0deg,#808080 0,#808080) 100% 100% no-repeat;background-size:100% 2px,100% 2px,2px 100%,2px 100%}
.dropdown-menu{z-index:10001}

View File

@@ -546,34 +546,32 @@ function digits(number) {
if (number < 100) return 'two';
return 'three';
}
function openNotifier(filter) {
function openNotifier() {
$.post('/webGui/include/Notify.php',{cmd:'get',csrf_token:csrf_token},function(msg) {
$.each($.parseJSON(msg), function(i, notify) {
if (notify.importance==filter) {
$.jGrowl(notify.subject+'<br>'+notify.description, {
group: notify.importance,
header: notify.event+': '+notify.timestamp,
theme: notify.file,
sticky: true,
beforeOpen: function(e,m,o){if ($('div.jGrowl-notification').hasClass(notify.file)) return(false);},
afterOpen: function(e,m,o){if (notify.link) $(e).css('cursor','pointer');},
click: function(e,m,o){if (notify.link) location.replace(notify.link);},
close: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});}
});
}
$.each($.parseJSON(msg), function(i, notify){
$.jGrowl(notify.subject+'<br>'+notify.description,{
group: notify.importance,
header: notify.event+': '+notify.timestamp,
theme: notify.file,
sticky: true,
beforeOpen: function(e,m,o){if ($('div.jGrowl-notification').hasClass(notify.file)) return(false);},
afterOpen: function(e,m,o){if (notify.link) $(e).css('cursor','pointer');},
click: function(e,m,o){if (notify.link) location.replace(notify.link);},
close: function(e,m,o){$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});}
});
});
});
}
function closeNotifier(filter) {
function closeNotifier() {
$.post('/webGui/include/Notify.php',{cmd:'get',csrf_token:csrf_token},function(msg) {
$.each($.parseJSON(msg), function(i, notify) {
if (notify.importance==filter) $.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});
$.each($.parseJSON(msg), function(i, notify){
$.post('/webGui/include/Notify.php',{cmd:'archive',file:notify.file,csrf_token:csrf_token});
});
$('div.jGrowl').find('.'+filter).find('div.jGrowl-close').trigger('click');
$('div.jGrowl').find('div.jGrowl-close').trigger('click');
});
}
function viewHistory(filter) {
location.replace('/Tools/NotificationsArchive?filter='+filter);
function viewHistory() {
location.replace('/Tools/NotificationsArchive');
}
function flashReport() {
$.post('/webGui/include/Report.php',{cmd:'config'},function(check){
@@ -873,7 +871,7 @@ defaultPage.on('message', function(msg,meta) {
case 2:
// notifications
var bell1 = 0, bell2 = 0, bell3 = 0;
$.each($.parseJSON(msg), function(i, notify) {
$.each($.parseJSON(msg), function(i, notify){
switch (notify.importance) {
case 'alert' : bell1++; break;
case 'warning': bell2++; break;
@@ -881,7 +879,7 @@ defaultPage.on('message', function(msg,meta) {
}
<?if ($notify['display']==0):?>
if (notify.show) {
$.jGrowl(notify.subject+'<br>'+notify.description, {
$.jGrowl(notify.subject+'<br>'+notify.description,{
group: notify.importance,
header: notify.event+': '+notify.timestamp,
theme: notify.file,
@@ -893,14 +891,10 @@ defaultPage.on('message', function(msg,meta) {
}
<?endif;?>
});
$('#bell').removeClass('red-orb yellow-orb green-orb').prop('title',"<?=_('Alerts')?> ["+bell1+']\n'+"<?=_('Warnings')?> ["+bell2+']\n'+"<?=_('Notices')?> ["+bell3+']');;
$('#bell').removeClass('red-orb yellow-orb green-orb').prop('title',"<?=_('Alerts')?> ["+bell1+']\n'+"<?=_('Warnings')?> ["+bell2+']\n'+"<?=_('Notices')?> ["+bell3+']');
if (bell1) $('#bell').addClass('red-orb'); else
if (bell2) $('#bell').addClass('yellow-orb'); else
if (bell3) $('#bell').addClass('green-orb');
if (bell1) $('#dropdown-board li.dropdown-submenu:eq(0)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(0)').addClass('disabled').find('.dropdown-menu').hide();
if (bell2) $('#dropdown-board li.dropdown-submenu:eq(1)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(1)').addClass('disabled').find('.dropdown-menu').hide();
if (bell3) $('#dropdown-board li.dropdown-submenu:eq(2)').removeClass('disabled'); else $('#dropdown-board li.dropdown-submenu:eq(2)').addClass('disabled').find('.dropdown-menu').hide();
break;
}
});
@@ -1081,9 +1075,9 @@ $(function() {
var opts = [];
context.settings({above:false});
opts.push({header:"<?=_('Notifications')?>"});
opts.push({text:"<?=_('Alerts')?>",icon:'fa-bell-o',subMenu:[{text:"<?=_('View')?>",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('alert');}},{text:"<?=_('History')?>",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('alert');}},{text:"<?=_('Acknowledge')?>",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('alert');}}]});
opts.push({text:"<?=_('Warnings')?>",icon:'fa-star-o',subMenu:[{text:"<?=_('View')?>",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('warning');}},{text:"<?=_('History')?>",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('warning');}},{text:"<?=_('Acknowledge')?>",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('warning');}}]});
opts.push({text:"<?=_('Notices')?>",icon:'fa-sun-o',subMenu:[{text:"<?=_('View')?>",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('normal');}},{text:"<?=_('History')?>",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('normal');}},{text:"<?=_('Acknowledge')?>",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('normal');}}]});
opts.push({text:"<?=_('View')?>",icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier();}});
opts.push({text:"<?=_('History')?>",icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory();}});
opts.push({text:"<?=_('Acknowledge')?>",icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier();}});
context.attach('#board',opts);
if (location.pathname.search(/\/(AddVM|UpdateVM|AddContainer|UpdateContainer)/)==-1) {
$('blockquote.inline_help').each(function(i) {