diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-01-21 10:41:26 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-01-21 10:41:26 -0500 |
commit | c19802a9f4e042e991a5e2dbf04ae5632ac26299 (patch) | |
tree | f9cc30bac0318d0d4dd80d2d2841dcf5c9590d06 /src | |
parent | 0b6221bd46e74e4c15bbd871877c60939721375f (diff) | |
parent | 54bf231216500ba4a2836ad9e9cdc8a12f8327bd (diff) | |
download | pfsense-c19802a9f4e042e991a5e2dbf04ae5632ac26299.zip pfsense-c19802a9f4e042e991a5e2dbf04ae5632ac26299.tar.gz |
Merge pull request #2486 from NOYB/Special_Panels_-_Show/Hide
Diffstat (limited to 'src')
-rwxr-xr-x | src/usr/local/www/head.inc | 26 | ||||
-rw-r--r-- | src/usr/local/www/index.php | 15 | ||||
-rwxr-xr-x | src/usr/local/www/status_logs.php | 10 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_common.inc | 66 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_filter.php | 10 | ||||
-rwxr-xr-x | src/usr/local/www/status_logs_filter_dynamic.php | 10 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_vpn.php | 28 | ||||
-rw-r--r-- | src/usr/local/www/system.php | 40 |
8 files changed, 181 insertions, 24 deletions
diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index e94cf22..cd9e453 100755 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -461,8 +461,32 @@ if (($pagename === "index.php") && ($numColumns > 2)) { } ?> <ul class="context-links"> -<?php + <?php if ($dashboard_available_widgets_hidden): ?> + <li> + <a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available Widgets")?>"> + <i style="cursor:pointer" class="fa fa-plus"></i> + </a> + </li> + <?php endif?> + + <?php if ($system_logs_filter_form_hidden): ?> + <li> + <a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log Filter")?>"> + <i style="cursor:pointer" class="fa fa-filter"></i> + </a> + </li> + <?php endif ?> + + <?php if ($system_logs_manage_log_form_hidden): ?> + <li> + <a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage Log")?>"> + <i style="cursor:pointer" class="fa fa-wrench"></i> + </a> + </li> + <?php endif ?> + +<?php if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { $ssvc = array(); switch ($shortcut_section) { diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index c9b60a8..e2e792b 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -300,6 +300,17 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") { } } +## Get the configured options for Show/Hide available widgets panel. +$dashboard_available_widgets_hidden = isset($config['system']['webgui']['dashboardavailablewidgetspanel']) ? false : true; + +if ($dashboard_available_widgets_hidden) { + $panel_state = 'out'; + $panel_body_state = 'in'; +} else { + $panel_state = 'in'; + $panel_body_state = 'out'; +} + ## Set Page Title and Include Header $pgtitle = array(gettext("Status"), gettext("Dashboard")); include("head.inc"); @@ -312,7 +323,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); ?> -<div class="panel panel-default" id="widget-available"> +<div class="panel panel-default collapse <?=$panel_state?>" id="widget-available"> <div class="panel-heading"> <h2 class="panel-title"><?=gettext("Available Widgets"); ?> <span class="widget-heading-icon"> @@ -322,7 +333,7 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); </span> </h2> </div> - <div id="widget-available_panel-body" class="panel-body collapse out"> + <div id="widget-available_panel-body" class="panel-body collapse <?=$panel_body_state?>"> <div class="content"> <div class="row"> <?php diff --git a/src/usr/local/www/status_logs.php b/src/usr/local/www/status_logs.php index 9ae722d..35e969e 100755 --- a/src/usr/local/www/status_logs.php +++ b/src/usr/local/www/status_logs.php @@ -137,6 +137,12 @@ if (!$input_errors && $savemsg) { tab_array_logs_common(); +// Manage Log - Section/Form +if ($system_logs_manage_log_form_hidden) { + manage_log_section(); +} + + // Filter Section/Form - System filter_form_system(); @@ -248,7 +254,9 @@ if (!$rawfilter) { <?php # Manage Log - Section/Form -manage_log_section(); +if (!$system_logs_manage_log_form_hidden) { + manage_log_section(); +} ?> <?php include("foot.inc"); ?> diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc index c3f6a83..1e4a930 100644 --- a/src/usr/local/www/status_logs_common.inc +++ b/src/usr/local/www/status_logs_common.inc @@ -63,6 +63,7 @@ require_once("filter_log.inc"); // Status Logs Common - Code function status_logs_common_code() { global $g, $config, $specific_log, $nentries, $filterlogentries_qty, $logfile_path, $shortcut_section, $allowed_logs, $logfile; + global $system_logs_filter_form_hidden, $system_logs_manage_log_form_hidden, $view; $logfile_path = "{$g['varlog_path']}/" . basename($logfile) . ".log"; @@ -86,6 +87,15 @@ function status_logs_common_code() { if (!empty($allowed_logs[$logfile]["shortcut"])) { $shortcut_section = $allowed_logs[$logfile]["shortcut"]; } + + // Get the configured options for Show/Hide Log Filter and Manage Log panels. + $system_logs_filter_form_hidden = isset($config['system']['webgui']['systemlogsfilterpanel']) ? false : true; + $system_logs_manage_log_form_hidden = isset($config['system']['webgui']['systemlogsmanagelogpanel']) ? false : true; + + if ($logfile == 'filter' && $view == 'summary') { + $system_logs_filter_form_hidden = false; + $system_logs_manage_log_form_hidden = false; + } } // Tab Array @@ -176,17 +186,26 @@ function log_filter_form_system_submit() { function filter_form_system() { global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter; + global $system_logs_filter_form_hidden; if ($filter_active) { - $filter_state = SEC_OPEN; + $panel_state = 'in'; + $panel_body_state = SEC_OPEN; } else { - $filter_state = SEC_CLOSED; + if ($system_logs_filter_form_hidden) { + $panel_state = 'out'; + $panel_body_state = SEC_OPEN; + } else { + $panel_state = 'in'; + $panel_body_state = SEC_CLOSED; + } } if (!$rawfilter) { // Advanced log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); $group = new Form_Group(''); @@ -238,8 +257,9 @@ function filter_form_system() { ); } else { // Simple log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); $group = new Form_Group(''); @@ -322,6 +342,7 @@ function log_filter_form_firewall_submit() { function filter_form_firewall() { global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $interfacefilter; + global $system_logs_filter_form_hidden; $Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act'])); if ($filterfieldsarray['interface'] == "All") { @@ -329,15 +350,23 @@ function filter_form_firewall() { } if ($filter_active) { - $filter_state = SEC_OPEN; + $panel_state = 'in'; + $panel_body_state = SEC_OPEN; } else { - $filter_state = SEC_CLOSED; + if ($system_logs_filter_form_hidden) { + $panel_state = 'out'; + $panel_body_state = SEC_OPEN; + } else { + $panel_state = 'in'; + $panel_body_state = SEC_CLOSED; + } } if (!$rawfilter) { // Advanced log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); $group = new Form_Group(''); @@ -436,8 +465,9 @@ function filter_form_firewall() { ); } else { // Simple log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); $group = new Form_Group(''); @@ -700,20 +730,30 @@ function manage_log_code() { function manage_log_section() { global $input_errors, $allowed_logs, $logfile, $config, $pconfig; + global $system_logs_manage_log_form_hidden; if ($input_errors) { print_input_errors($input_errors); $manage_log_active = true; } - if ($manage_log_active) - $manage_log_state = SEC_OPEN; - else - $manage_log_state = SEC_CLOSED; + if ($filter_active) { + $panel_state = 'in'; + $panel_body_state = SEC_OPEN; + } else { + if ($system_logs_manage_log_form_hidden) { + $panel_state = 'out'; + $panel_body_state = SEC_OPEN; + } else { + $panel_state = 'in'; + $panel_body_state = SEC_CLOSED; + } + } $form = new Form(false); + $form->setAttribute('id', 'manage-log-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section(gettext('Manage') . ' ' . gettext($allowed_logs[$logfile]["name"]) . ' ' . gettext('Log'), 'log-manager-panel', COLLAPSIBLE|$manage_log_state); + $section = new Form_Section(gettext('Manage') . ' ' . gettext($allowed_logs[$logfile]["name"]) . ' ' . gettext('Log'), 'manage-log-panel', COLLAPSIBLE|$panel_body_state); $section->addInput(new Form_StaticText( '', diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php index 48f808c..e964442 100644 --- a/src/usr/local/www/status_logs_filter.php +++ b/src/usr/local/www/status_logs_filter.php @@ -145,6 +145,12 @@ if (!$input_errors && $savemsg) { tab_array_logs_common(); +// Manage Log - Section/Form +if ($system_logs_manage_log_form_hidden) { + manage_log_section(); +} + + // Filter Section/Form - Firewall filter_form_firewall(); @@ -359,7 +365,9 @@ print_info_box('<a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F <?php # Manage Log - Section/Form -manage_log_section(); +if (!$system_logs_manage_log_form_hidden) { + manage_log_section(); +} ?> <!-- AJAXY STUFF --> diff --git a/src/usr/local/www/status_logs_filter_dynamic.php b/src/usr/local/www/status_logs_filter_dynamic.php index a8845f6..b4be38a 100755 --- a/src/usr/local/www/status_logs_filter_dynamic.php +++ b/src/usr/local/www/status_logs_filter_dynamic.php @@ -125,6 +125,12 @@ if (!$input_errors && $savemsg) { tab_array_logs_common(); +// Manage Log - Section/Form +if ($system_logs_manage_log_form_hidden) { + manage_log_section(); +} + + // Log Filter Submit - Firewall filter_form_firewall(); @@ -489,7 +495,9 @@ if ($tcpcnt > 0) { <?php # Manage Log - Section/Form -manage_log_section(); +if (!$system_logs_manage_log_form_hidden) { + manage_log_section(); +} ?> <script type="text/javascript"> diff --git a/src/usr/local/www/status_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php index 2bd8a09..cce15dd 100644 --- a/src/usr/local/www/status_logs_vpn.php +++ b/src/usr/local/www/status_logs_vpn.php @@ -127,6 +127,12 @@ if (!$input_errors && $savemsg) { tab_array_logs_common(); +// Manage Log - Section/Form +if ($system_logs_manage_log_form_hidden) { + manage_log_section(); +} + + // Filter Section/Form - VPN filter_form_vpn(); @@ -272,7 +278,9 @@ if (!$rawfilter) { <?php # Manage Log - Section/Form -manage_log_section(); +if (!$system_logs_manage_log_form_hidden) { + manage_log_section(); +} ?> <?php @@ -354,17 +362,26 @@ function filter_form_vpn() { global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter; global $logfile; + global $system_logs_filter_form_hidden; if ($filter_active) { - $filter_state = SEC_OPEN; + $panel_state = 'in'; + $panel_body_state = SEC_OPEN; } else { - $filter_state = SEC_CLOSED; + if ($system_logs_filter_form_hidden) { + $panel_state = 'out'; + $panel_body_state = SEC_OPEN; + } else { + $panel_state = 'in'; + $panel_body_state = SEC_CLOSED; + } } if (!$rawfilter) { // Advanced log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); if ($logfile == "vpn") { $group = new Form_Group(''); @@ -460,8 +477,9 @@ function filter_form_vpn() { ); } else { // Simple log filter form $form = new Form(false); + $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state); - $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state); + $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state); $group = new Form_Group(''); diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index 7c56b93..a8d16bf 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -93,6 +93,9 @@ $pconfig['webguicss'] = $config['system']['webgui']['webguicss']; $pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu']; $pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns']; $pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']); +$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']); +$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']); +$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']); $pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']); if (!$pconfig['timezone']) { @@ -235,6 +238,15 @@ if ($_POST) { unset($config['system']['webgui']['webguileftcolumnhyper']); $config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false; + unset($config['system']['webgui']['dashboardavailablewidgetspanel']); + $config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false; + + unset($config['system']['webgui']['systemlogsfilterpanel']); + $config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false; + + unset($config['system']['webgui']['systemlogsmanagelogpanel']); + $config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false; + /* XXX - billm: these still need updating after figuring out how to check if they actually changed */ $olddnsservers = $config['system']['dnsserver']; unset($config['system']['dnsserver']); @@ -506,6 +518,34 @@ $section->addInput(new Form_Input( [min => 1, max => 4] ))->setHelp('<span class="badge" title="This feature is in BETA">BETA</span>'); +$group = new Form_Group('Associated Panels Show/Hide'); + +$group->add(new Form_Checkbox( + 'dashboardavailablewidgetspanel', + null, + 'Available Widgets', + $pconfig['dashboardavailablewidgetspanel'] + ))->setHelp('Show the Available Widgets panel on the Dashboard.'); + +$group->add(new Form_Checkbox( + 'systemlogsfilterpanel', + null, + 'Log Filter', + $pconfig['systemlogsfilterpanel'] +))->setHelp('Show the Log Filter panel in System Logs.'); + +$group->add(new Form_Checkbox( + 'systemlogsmanagelogpanel', + null, + 'Manage Log', + $pconfig['systemlogsmanagelogpanel'] +))->setHelp('Show the Manage Log panel in System Logs.'); + +$group->setHelp('These options allow certain panels to be automatically hidden on page load. A control is provided in the title bar to un-hide the panel. +<br /><span class="badge" title="This feature is in BETA">BETA</span>'); + +$section->add($group); + $section->addInput(new Form_Checkbox( 'webguileftcolumnhyper', 'Left Column Labels', |