summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-13 18:59:47 -0200
committerRenato Botelho <renato@netgate.com>2017-01-13 18:59:47 -0200
commiteab2d5fd08faf441acc63508cd699db9d26c4819 (patch)
treeec9909192b39b1e9548510685a61d643bab468d1 /src/usr
parent372b3a4b1280231f132b32e25f7b4ca63a5265af (diff)
parent35310a493f19d6758747cbc8e9961c2ca3395246 (diff)
downloadpfsense-eab2d5fd08faf441acc63508cd699db9d26c4819.zip
pfsense-eab2d5fd08faf441acc63508cd699db9d26c4819.tar.gz
Merge pull request #3374 from phil-davis/interfaces_widget
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/widgets/widgets/interfaces.widget.php87
1 files changed, 85 insertions, 2 deletions
diff --git a/src/usr/local/www/widgets/widgets/interfaces.widget.php b/src/usr/local/www/widgets/widgets/interfaces.widget.php
index 0220794..41dc871 100644
--- a/src/usr/local/www/widgets/widgets/interfaces.widget.php
+++ b/src/usr/local/www/widgets/widgets/interfaces.widget.php
@@ -28,11 +28,38 @@ require_once("functions.inc");
require_once("/usr/local/www/widgets/include/interfaces.inc");
$ifdescrs = get_configured_interface_with_descr();
+
+if ($_POST) {
+
+ $validNames = array();
+
+ foreach ($ifdescrs as $ifdescr => $ifname) {
+ array_push($validNames, $ifdescr);
+ }
+
+ if (is_array($_POST['show'])) {
+ $user_settings['widgets']['interfaces']['iffilter'] = implode(',', array_diff($validNames, $_POST['show']));
+ } else {
+ $user_settings['widgets']['interfaces']['iffilter'] = "";
+ }
+
+ save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved Interfaces Filter via Dashboard."));
+ header("Location: /index.php");
+}
+
?>
-<table class="table table-striped table-hover">
+<div class="table-responsive">
+ <table class="table table-striped table-hover table-condensed">
+ <tbody>
<?php
+$skipinterfaces = explode(",", $user_settings['widgets']['interfaces']['iffilter']);
+
foreach ($ifdescrs as $ifdescr => $ifname):
+ if (in_array($ifdescr, $skipinterfaces)) {
+ continue;
+ }
+
$ifinfo = get_interface_info($ifdescr);
if ($ifinfo['pppoelink'] || $ifinfo['pptplink'] || $ifinfo['l2tplink']) {
/* PPP link (non-cell) - looks like a modem */
@@ -97,4 +124,60 @@ foreach ($ifdescrs as $ifdescr => $ifname):
<?php
endforeach;
?>
-</table>
+ </tbody>
+ </table>
+</div>
+<!-- close the body we're wrapped in and add a configuration-panel -->
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
+
+<form action="/widgets/widgets/interfaces.widget.php" method="post" class="form-horizontal">
+ <div class="panel panel-default col-sm-10">
+ <div class="panel-body">
+ <div class="table responsive">
+ <table class="table table-striped table-hover table-condensed">
+ <thead>
+ <tr>
+ <th><?=gettext("Interface")?></th>
+ <th><?=gettext("Show")?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $skipinterfaces = explode(",", $user_settings['widgets']['interfaces']['iffilter']);
+ $idx = 0;
+
+ foreach ($ifdescrs as $ifdescr => $ifname):
+?>
+ <tr>
+ <td><?=$ifname?></td>
+ <td class="col-sm-2"><input id="show[]" name ="show[]" value="<?=$ifdescr?>" type="checkbox" <?=(!in_array($ifdescr, $skipinterfaces) ? 'checked':'')?>></td>
+ </tr>
+<?php
+ endforeach;
+?>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="col-sm-offset-3 col-sm-6">
+ <button type="submit" class="btn btn-primary"><i class="fa fa-save icon-embed-btn"></i><?=gettext('Save')?></button>
+ <button id="showallinterfaces" type="button" class="btn btn-info"><i class="fa fa-undo icon-embed-btn"></i><?=gettext('All')?></button>
+ </div>
+ </div>
+</form>
+
+<script>
+//<![CDATA[
+ events.push(function(){
+ $("#showallinterfaces").click(function() {
+ $("[id^=show]").each(function() {
+ $(this).prop("checked", true);
+ });
+ });
+
+ });
+//]]>
+</script>
OpenPOWER on IntegriCloud