mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
system: gateways widgets hide/show tweaks
This commit is contained in:
parent
3192f8f5cc
commit
3b1e9d3ad7
@ -33,6 +33,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig = array();
|
||||
$pconfig['gatewaysfilter'] = !empty($config['widgets']['gatewaysfilter']) ?
|
||||
explode(',', $config['widgets']['gatewaysfilter']) : array();
|
||||
$pconfig['gatewaysinvert'] = !empty($config['widgets']['gatewaysinvert']) ? '1' : '';
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$pconfig = $_POST;
|
||||
if (!empty($pconfig['gatewaysfilter'])) {
|
||||
@ -40,6 +41,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
} elseif (isset($config['widgets']['gatewaysfilter'])) {
|
||||
unset($config['widgets']['gatewaysfilter']);
|
||||
}
|
||||
if (!empty($pconfig['gatewaysinvert'])) {
|
||||
$config['widgets']['gatewaysinvert'] = 1;
|
||||
} elseif (isset($config['widgets']['gatewaysinvert'])) {
|
||||
unset($config['widgets']['gatewaysinvert']);
|
||||
}
|
||||
write_config("Saved Gateways Filter via Dashboard");
|
||||
header(url_safe('Location: /index.php'));
|
||||
exit;
|
||||
@ -105,12 +111,16 @@ $gateways = return_gateways_array();
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<td>
|
||||
<select id="gatewaysfilter" name="gatewaysfilter[]" multiple="multiple" class="selectpicker_widget" title="<?= html_safe(gettext('All')) ?>">
|
||||
<select id="gatewaysinvert" name="gatewaysinvert" class="selectpicker_widget">
|
||||
<option value="" <?= empty($pconfig['gatewaysinvert']) ? 'selected="selected"' : '' ?>><?= gettext('Hide') ?></option>
|
||||
<option value="yes" <?= !empty($pconfig['gatewaysinvert']) ? 'selected="selected"' : '' ?>><?= gettext('Show') ?></option>
|
||||
</select>
|
||||
<select id="gatewaysfilter" name="gatewaysfilter[]" multiple="multiple" class="selectpicker_widget">
|
||||
<?php foreach ($gateways as $gwname => $unused): ?>
|
||||
<option value="<?= html_safe($gwname) ?>" <?= in_array($gwname, $pconfig['gatewaysfilter']) ? 'selected="selected"' : '' ?>><?= html_safe($gwname) ?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<input id="submitd" name="submitd" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" />
|
||||
<button id="submitd" name="submitd" type="submit" class="btn btn-primary" value="yes"><?= gettext('Save') ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -128,8 +138,12 @@ $gateways = return_gateways_array();
|
||||
<th><?=gettext('Loss')?></th>
|
||||
<th><?=gettext('Status')?></th>
|
||||
</tr>
|
||||
<?php foreach ($gateways as $gwname => $unused): ?>
|
||||
<? if (!count($pconfig['gatewaysfilter']) || in_array($gwname, $pconfig['gatewaysfilter'])): ?>
|
||||
<?php foreach ($gateways as $gwname => $unused):
|
||||
$listed = in_array($gwname, $pconfig['gatewaysfilter']);
|
||||
$listed = !empty($pconfig['gatewaysinvert']) ? $listed : !$listed;
|
||||
if (!$listed) {
|
||||
continue;
|
||||
} ?>
|
||||
<tr id="gateways_widget_gw_<?= html_safe($gwname) ?>">
|
||||
<td><small><strong><?= $gwname ?></strong><br/>~</small></td>
|
||||
<td class="text-nowrap">~</td>
|
||||
@ -139,7 +153,6 @@ $gateways = return_gateways_array();
|
||||
<td class="text-nowrap">~</td>
|
||||
<td><span class="label label-default"><?= gettext('Unknown') ?></span></td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user