diff options
author | Jared Dillard <jdillard@netgate.com> | 2015-12-01 11:29:37 -0600 |
---|---|---|
committer | Jared Dillard <jdillard@netgate.com> | 2015-12-01 11:29:42 -0600 |
commit | 477db9337939aa606c76edba77394b39a03467a9 (patch) | |
tree | e9ba159b78499333300867df0f58265e240ebd76 /src/usr/local/www | |
parent | e226c360099cd3f412d9780f35e685f6461ec4b0 (diff) | |
download | pfsense-477db9337939aa606c76edba77394b39a03467a9.zip pfsense-477db9337939aa606c76edba77394b39a03467a9.tar.gz |
add option to choose number of dashboard columns
Diffstat (limited to 'src/usr/local/www')
-rw-r--r-- | src/usr/local/www/bootstrap/css/pfSense.css | 4 | ||||
-rw-r--r-- | src/usr/local/www/diag_backup.php | 6 | ||||
-rwxr-xr-x | src/usr/local/www/head.inc | 14 | ||||
-rw-r--r-- | src/usr/local/www/index.php | 22 | ||||
-rw-r--r-- | src/usr/local/www/system.php | 23 |
5 files changed, 58 insertions, 11 deletions
diff --git a/src/usr/local/www/bootstrap/css/pfSense.css b/src/usr/local/www/bootstrap/css/pfSense.css index cd4e840..f0f1425 100644 --- a/src/usr/local/www/bootstrap/css/pfSense.css +++ b/src/usr/local/www/bootstrap/css/pfSense.css @@ -331,6 +331,10 @@ footer a { /** Homepage / dashboard */ +[id^="widgets-col"] { + min-height: 300px; +} + .widget .panel-heading { background-color: #757575; } diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index d152f59..7e75e7e 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -735,7 +735,7 @@ $section->addInput(new Form_Input( $group = new Form_Group(''); $group->add(new Form_Button( 'Submit', - 'Restore configuration' + 'Restore Configuration' ))->setHelp('The firewall will reboot after restoring the configuration.')->removeClass('btn-primary')->addClass('btn-danger'); $section->add($group); @@ -749,8 +749,8 @@ if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("pack $group = new Form_Group(''); $group->add(new Form_Button( 'Submit', - 'Reinstall packages' - ))->setHelp('Click this button to reinstall all system packages. This may take a while.')->removeClass('btn-primary')->addClass('btn-warning'); + 'Reinstall Packages' + ))->setHelp('Click this button to reinstall all system packages. This may take a while.')->removeClass('btn-primary')->addClass('btn-danger'); $section->add($group); } diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index 2a4432e..fd79eaf 100755 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -77,6 +77,11 @@ if (isset($config['system']['webgui']['webguicss'])) { } } +// set default colmns to two if unset +if(!isset($config['system']['webgui']['dashboardcolumns'])) { + $config['system']['webgui']['dashboardcolumns'] = 2; +} + ?> <!DOCTYPE html> <html lang="en"> @@ -382,7 +387,14 @@ $menuclass = "static"; if (isset($config['system']['webgui']['webguifixedmenu'])) { $menuclass = "fixed"; } + +$numColumns = $config['system']['webgui']['dashboardcolumns']; + +if (($pagename === "index.php") && ($numColumns > 2)) { + $columnsContainer = 'style="width: ' . 585*$numColumns . 'px"'; +} ?> +<body id="<?=$numColumns?>"> <nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse"> <div class="container"> <div class="navbar-header"> @@ -434,7 +446,7 @@ if (isset($config['system']['webgui']['webguifixedmenu'])) { </div> </nav> -<div class="container <?=$menuclass?>"> +<div class="container <?=$menuclass?>" <?=$columnsContainer?>> <header class="header"> <?php diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index 43846fe..b98e0d3 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -370,8 +370,13 @@ foreach ($widgets as $widgetname => $widgetconfig) ?> <div class="row"> + <?php + $columnWidth = 12 / $numColumns; + $columnCounter = 0; + //TODO: account for user stepping # of columns down + ?> <?php foreach ($widgetColumns as $column => $columnWidgets):?> - <div class="col-md-6" id="widgets-<?=$column?>"> + <div class="col-md-<?=$columnWidth?>" id="widgets-<?=$column?>"> <?php foreach ($columnWidgets as $widgetname => $widgetconfig):?> <div class="panel panel-default" id="widget-<?=$widgetname?>"> <div class="panel-heading"> @@ -393,9 +398,16 @@ foreach ($widgets as $widgetname => $widgetconfig) <?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?> </div> </div> -<?php endforeach; ?> +<?php endforeach; + $columnCounter++; +?> </div> <?php endforeach; ?> +<?php + for($n = 1; $n <= ($numColumns - $columnCounter); $n++) { + echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . ($n + $columnCounter) . '"></div>'; + } +?> </div> <script type="text/javascript"> @@ -404,7 +416,7 @@ function updateWidgets(newWidget) { var sequence = ''; - $('.container .col-md-6').each(function(idx, col){ + $('.container .col-md-<?=$columnWidth?>').each(function(idx, col){ $('.panel', col).each(function(idx, widget){ var isOpen = $('.panel-body', widget).hasClass('in'); @@ -430,10 +442,10 @@ events.push(function() { }); // Make panels sortable - $('.container .col-md-6').sortable({ + $('.container .col-md-<?=$columnWidth?>').sortable({ handle: '.panel-heading', cursor: 'grabbing', - connectWith: '.container .col-md-6', + connectWith: '.container .col-md-<?=$columnWidth?>', update: updateWidgets }); diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index cc8a4f9..ba14770 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -79,6 +79,11 @@ list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $ $arr_gateways = return_gateways_array(); +// set default colmns to two if unset +if(!isset($config['system']['webgui']['dashboardcolumns'])) { + $config['system']['webgui']['dashboardcolumns'] = 2; +} + $pconfig['dns1gw'] = $config['system']['dns1gw']; $pconfig['dns2gw'] = $config['system']['dns2gw']; $pconfig['dns3gw'] = $config['system']['dns3gw']; @@ -90,6 +95,7 @@ $pconfig['timeservers'] = $config['system']['timeservers']; $pconfig['language'] = $config['system']['language']; $pconfig['webguicss'] = $config['system']['webgui']['webguicss']; $pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu']; +$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns']; $pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']); if (!$pconfig['timezone']) { @@ -149,6 +155,12 @@ if ($_POST) { } else { unset($config['system']['webgui']['webguifixedmenu']); } + + if ($_POST['dashboardcolumns']) { + $config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns']; + } else { + unset($config['system']['webgui']['dashboardcolumns']); + } if ($_POST['hostname']) { if (!is_hostname($_POST['hostname'])) { @@ -468,7 +480,7 @@ if (!isset($pconfig['webguicss']) || !isset($csslist[$pconfig['webguicss']])) { $pconfig['webguicss'] = "pfSense.css"; } -$section = new Form_Section('Web configurator'); +$section = new Form_Section('Web Configurator'); $section->addInput(new Form_Select( 'webguicss', @@ -479,11 +491,18 @@ $section->addInput(new Form_Select( $section->addInput(new Form_Select( 'webguifixedmenu', - 'Menu', + 'Top Navigation', $pconfig['webguifixedmenu'], ["" => "Scrolls with page", "fixed" => "Fixed (Remains visible at top of page)"] ))->setHelp("<span class=\"badge bg-danger\" title=\"This feature is in BETA\">BETA</span>"); +$section->addInput(new Form_Input( + 'dashboardcolumns', + 'Dashboard Columns', + 'text', + $pconfig['dashboardcolumns'] +))->setHelp("<span class=\"badge bg-danger\" title=\"This feature is in BETA\">BETA</span>"); + $form->add($section); print $form; |