summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2016-06-30 00:20:40 -0500
committerChris Buechler <cmb@pfsense.org>2016-06-30 00:20:40 -0500
commit50d369744e40acae883a91cb3d8bcd51b0b80c66 (patch)
tree9c2c342a366d93cab0c39034330fed9efdbee30f /src/usr/local
parent7685fd4eced7e122ee151eb281523594f0c1d7d1 (diff)
parent8bab524e06831489a882e7d65e9cbd52d39febbd (diff)
downloadpfsense-50d369744e40acae883a91cb3d8bcd51b0b80c66.zip
pfsense-50d369744e40acae883a91cb3d8bcd51b0b80c66.tar.gz
Merge pull request #3018 from phil-davis/usersettings
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/classes/Form/Group.class.php4
-rw-r--r--src/usr/local/www/head.inc20
-rw-r--r--src/usr/local/www/index.php15
-rw-r--r--src/usr/local/www/status_logs_common.inc6
-rw-r--r--src/usr/local/www/system.php111
-rw-r--r--src/usr/local/www/system_advanced_admin.php9
-rw-r--r--src/usr/local/www/system_user_settings.php212
-rw-r--r--src/usr/local/www/system_usermanager.php118
8 files changed, 367 insertions, 128 deletions
diff --git a/src/usr/local/www/classes/Form/Group.class.php b/src/usr/local/www/classes/Form/Group.class.php
index d07010a..813ace9 100644
--- a/src/usr/local/www/classes/Form/Group.class.php
+++ b/src/usr/local/www/classes/Form/Group.class.php
@@ -108,7 +108,7 @@ EOT;
public function __toString()
{
- global $config;
+ global $config, $user_settings;
$element = parent::__toString();
@@ -142,7 +142,7 @@ EOT;
$inputs = implode('', $this->_inputs);
$help = $this->_getHelp();
- if (!isset($config['system']['webgui']['webguileftcolumnhyper']))
+ if (!$user_settings['webgui']['webguileftcolumnhyper'])
$target = null;
$label = new Form_Element('label', false, ['for' => $target]);
diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc
index 2f6e46b..ca0f7e4 100644
--- a/src/usr/local/www/head.inc
+++ b/src/usr/local/www/head.inc
@@ -60,7 +60,7 @@ header('Content-Type: text/html; charset=utf-8');
$pagetitle = gentitle($pgtitle);
-if (isset($config['system']['webgui']['pagenamefirst'])) {
+if ($user_settings['webgui']['pagenamefirst']) {
$tabtitle = $pagetitle . " - " . htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
} else {
$tabtitle = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']) . " - " . $pagetitle;
@@ -68,9 +68,9 @@ if (isset($config['system']['webgui']['pagenamefirst'])) {
$cssfile = "/css/pfSense.css";
-if (isset($config['system']['webgui']['webguicss'])) {
- if (file_exists("/usr/local/www/css/" . $config['system']['webgui']['webguicss'])) {
- $cssfile = "/css/" . $config['system']['webgui']['webguicss'];
+if (isset($user_settings['webgui']['webguicss'])) {
+ if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
+ $cssfile = "/css/" . $user_settings['webgui']['webguicss'];
}
}
@@ -255,6 +255,10 @@ if (!isAllowedPage("system_usermanager.php*")) {
$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
}
+if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*")) {
+ $system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
+}
+
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
// Interfaces
@@ -424,11 +428,11 @@ if (!$g['disablehelpmenu']) {
$menuclass = "static";
-if (isset($config['system']['webgui']['webguifixedmenu'])) {
+if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
$menuclass = "fixed";
}
-$numColumns = $config['system']['webgui']['dashboardcolumns'];
+$numColumns = $user_settings['webgui']['dashboardcolumns'];
if (($pagename === "index.php") && ($numColumns > 2)) {
$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
@@ -449,10 +453,10 @@ if (($pagename === "index.php") && ($numColumns > 2)) {
<div class="collapse navbar-collapse" id="pf-navbar">
<ul class="nav navbar-nav">
<?php
- if ($config['system']['webgui']['webguihostnamemenu'] == 'hostonly') {
+ if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
$help_menu_title = htmlspecialchars($config['system']['hostname']);
}
- elseif ($config['system']['webgui']['webguihostnamemenu'] == 'fqdn') {
+ elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
$help_menu_title = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
}
else {
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 0cd459c..345a8c6 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -155,15 +155,16 @@ if (!is_array($config['widgets'])) {
if ($_POST && $_POST['sequence']) {
- $config['widgets']['sequence'] = rtrim($_POST['sequence'], ',');
+ $widget_settings = array();
+ $widget_settings['sequence'] = rtrim($_POST['sequence'], ',');
foreach ($widgets as $widgetname => $widgetconfig) {
if ($_POST[$widgetname . '-config']) {
- $config['widgets'][$widgetname . '-config'] = $_POST[$widgetname . '-config'];
+ $widget_settings[$widgetname . '-config'] = $_POST[$widgetname . '-config'];
}
}
- write_config(gettext("Widget configuration has been changed."));
+ save_widget_settings($_SESSION['Username'], $widget_settings);
header("Location: /");
exit;
}
@@ -251,9 +252,9 @@ if ($fd) {
}
##build widget saved list information
-if ($config['widgets'] && $config['widgets']['sequence'] != "") {
- $dashboardcolumns = isset($config['system']['webgui']['dashboardcolumns']) ? $config['system']['webgui']['dashboardcolumns'] : 2;
- $pconfig['sequence'] = $config['widgets']['sequence'];
+if ($user_settings['widgets']['sequence'] != "") {
+ $dashboardcolumns = isset($user_settings['webgui']['dashboardcolumns']) ? $user_settings['webgui']['dashboardcolumns'] : 2;
+ $pconfig['sequence'] = $user_settings['widgets']['sequence'];
$widgetsfromconfig = array();
foreach (explode(',', $pconfig['sequence']) as $line) {
@@ -307,7 +308,7 @@ 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;
+$dashboard_available_widgets_hidden = !$user_settings['webgui']['dashboardavailablewidgetspanel'];
if ($dashboard_available_widgets_hidden) {
$panel_state = 'out';
diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc
index 75422ba..cfa6b8c 100644
--- a/src/usr/local/www/status_logs_common.inc
+++ b/src/usr/local/www/status_logs_common.inc
@@ -62,7 +62,7 @@ require_once("filter_log.inc");
// Status Logs Common - Code
function status_logs_common_code() {
- global $g, $config, $specific_log, $nentries, $rawfilter, $filterlogentries_qty, $logfile_path, $shortcut_section, $allowed_logs, $logfile;
+ global $g, $config, $user_settings, $specific_log, $nentries, $rawfilter, $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";
@@ -91,8 +91,8 @@ function status_logs_common_code() {
}
// 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;
+ $system_logs_filter_form_hidden = !$user_settings['webgui']['systemlogsfilterpanel'];
+ $system_logs_manage_log_form_hidden = !$user_settings['webgui']['systemlogsmanagelogpanel'];
if ($logfile == 'filter' && $view == 'summary') {
$system_logs_filter_form_hidden = false;
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index cd40c49..586d186 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -496,108 +496,19 @@ $section->addInput(new Form_Select(
$form->add($section);
-$csslist = array();
-
-// List pfSense files, then any BETA files followed by any user-contributed files
-$cssfiles = glob("/usr/local/www/css/*.css");
-
-if(is_array($cssfiles)) {
- arsort($cssfiles);
- $usrcss = $pfscss = $betacss = array();
-
- foreach ($cssfiles as $css) {
- if (strpos($css, "BETA") != 0) {
- array_push($betacss, $css);
- } else if (strpos($css, "pfSense") != 0) {
- array_push($pfscss, $css);
- } else {
- array_push($usrcss, $css);
- }
- }
-
- $css = array_merge($pfscss, $betacss, $usrcss);
-
- foreach ($css as $file) {
- $file = basename($file);
- $csslist[$file] = pathinfo($file, PATHINFO_FILENAME);
- }
-}
-
-if (!isset($pconfig['webguicss']) || !isset($csslist[$pconfig['webguicss']])) {
- $pconfig['webguicss'] = "pfSense.css";
-}
-
$section = new Form_Section('webConfigurator');
-$section->addInput(new Form_Select(
- 'webguicss',
- 'Theme',
- $pconfig['webguicss'],
- $csslist
-))->setHelp(sprintf(gettext('Choose an alternative css file (if installed) to change the appearance of the webConfigurator. css files are located in /usr/local/www/css/%s'), '<span id="csstxt"></span>'));
-
-$section->addInput(new Form_Select(
- 'webguifixedmenu',
- 'Top Navigation',
- $pconfig['webguifixedmenu'],
- ["" => gettext("Scrolls with page"), "fixed" => gettext("Fixed (Remains visible at top of page)")]
-))->setHelp("The fixed option is intended for large screens only.");
-
-$section->addInput(new Form_Select(
- 'webguihostnamemenu',
- 'Hostname in Menu',
- $pconfig['webguihostnamemenu'],
- ["" => gettext("Default (No hostname)"), "hostonly" => gettext("Hostname only"), "fqdn" => gettext("Fully Qualified Domain Name")]
-))->setHelp("Replaces the Help menu title in the Navbar with the system hostname or FQDN.");
-
-$section->addInput(new Form_Input(
- 'dashboardcolumns',
- 'Dashboard Columns',
- 'number',
- $pconfig['dashboardcolumns'],
- [min => 1, max => 4]
-));
-
-$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->add(new Form_Checkbox(
- 'statusmonitoringsettingspanel',
- null,
- 'Monitoring Settings',
- $pconfig['statusmonitoringsettingspanel']
-))->setHelp('Show the Settings panel in Status Monitoring.');
-
-$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.');
-
-$section->add($group);
-
-$section->addInput(new Form_Checkbox(
- 'webguileftcolumnhyper',
- 'Left Column Labels',
- 'Active',
- $pconfig['webguileftcolumnhyper']
-))->setHelp('If selected, clicking a label in the left column will select/toggle the first item of the group.');
+gen_webguicss_field($section, $pconfig['webguicss']);
+gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
+gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
+gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
+gen_associatedpanels_fields(
+ $section,
+ $pconfig['dashboardavailablewidgetspanel'],
+ $pconfig['systemlogsfilterpanel'],
+ $pconfig['systemlogsmanagelogpanel'],
+ $pconfig['statusmonitoringsettingspanel']);
+gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
$form->add($section);
diff --git a/src/usr/local/www/system_advanced_admin.php b/src/usr/local/www/system_advanced_admin.php
index 4af0c12..c926e5b 100644
--- a/src/usr/local/www/system_advanced_admin.php
+++ b/src/usr/local/www/system_advanced_admin.php
@@ -472,14 +472,7 @@ $section->addInput(new Form_Checkbox(
'information on HTTP_REFERER is available from <a target="_blank" '.
'href="http://en.wikipedia.org/wiki/HTTP_referrer">Wikipedia</a>.');
-$section->addInput(new Form_Checkbox(
- 'pagenamefirst',
- 'Browser tab text',
- 'Display page name first in browser tab',
- $pconfig['pagenamefirst']
-))->setHelp('When this is unchecked, the browser tab shows the host name followed '.
- 'by the current page. Check this box to display the current page followed by the '.
- 'host name.');
+gen_pagenamefirst_field($section, $pconfig['pagenamefirst']);
$form->add($section);
$section = new Form_Section('Secure Shell');
diff --git a/src/usr/local/www/system_user_settings.php b/src/usr/local/www/system_user_settings.php
new file mode 100644
index 0000000..80fd241
--- /dev/null
+++ b/src/usr/local/www/system_user_settings.php
@@ -0,0 +1,212 @@
+<?php
+/*
+ system_user_settings.php
+*/
+/* ====================================================================
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution. (http://www.pfsense.org/).
+ *
+ * 4. The names "pfSense" and "pfSense Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * coreteam@pfsense.org.
+ *
+ * 5. Products derived from this software may not be called "pfSense"
+ * nor may "pfSense" appear in their names without prior written
+ * permission of the Electric Sheep Fencing, LLC.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ *
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution (http://www.pfsense.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ */
+
+##|+PRIV
+##|*IDENT=page-system-user-settings
+##|*NAME=System: User Settings
+##|*DESCR=Allow access to the 'System: User Settings' page.
+##|*MATCH=system_user_settings.php*
+##|-PRIV
+
+ require_once("auth.inc");
+ require_once("guiconfig.inc");
+
+$pgtitle = array(gettext("System"), gettext("User Settings"));
+
+$a_user = &$config['system']['user'];
+
+if (isset($_SESSION['Username']) && isset($userindex[$_SESSION['Username']])) {
+ $id = $userindex[$_SESSION['Username']];
+}
+
+if (isset($id) && $a_user[$id]) {
+ $pconfig['webguicss'] = $a_user[$id]['webguicss'];
+ $pconfig['webguifixedmenu'] = $a_user[$id]['webguifixedmenu'];
+ $pconfig['webguihostnamemenu'] = $a_user[$id]['webguihostnamemenu'];
+ $pconfig['dashboardcolumns'] = $a_user[$id]['dashboardcolumns'];
+ $pconfig['dashboardavailablewidgetspanel'] = isset($a_user[$id]['dashboardavailablewidgetspanel']);
+ $pconfig['systemlogsfilterpanel'] = isset($a_user[$id]['systemlogsfilterpanel']);
+ $pconfig['systemlogsmanagelogpanel'] = isset($a_user[$id]['systemlogsmanagelogpanel']);
+ $pconfig['statusmonitoringsettingspanel'] = isset($a_user[$id]['statusmonitoringsettingspanel']);
+ $pconfig['webguileftcolumnhyper'] = isset($a_user[$id]['webguileftcolumnhyper']);
+ $pconfig['pagenamefirst'] = isset($a_user[$id]['pagenamefirst']);
+} else {
+ echo gettext("The settings cannot be managed for a non-local user.");
+ include("foot.inc");
+ exit;
+}
+
+if (isset($_POST['save'])) {
+ unset($input_errors);
+ /* input validation */
+
+ $reqdfields = explode(" ", "webguicss dashboardcolumns");
+ $reqdfieldsn = array(gettext("Theme"), gettext("Dashboard Columns"));
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+
+ $userent = $a_user[$id];
+
+ if (!$input_errors) {
+ $pconfig['webguicss'] = $userent['webguicss'] = $_POST['webguicss'];
+
+ if ($_POST['webguifixedmenu']) {
+ $pconfig['webguifixedmenu'] = $userent['webguifixedmenu'] = $_POST['webguifixedmenu'];
+ } else {
+ $pconfig['webguifixedmenu'] = "";
+ unset($userent['webguifixedmenu']);
+ }
+
+ if ($_POST['webguihostnamemenu']) {
+ $pconfig['webguihostnamemenu'] = $userent['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
+ } else {
+ $pconfig['webguihostnamemenu'] = "";
+ unset($userent['webguihostnamemenu']);
+ }
+
+ $pconfig['dashboardcolumns'] = $userent['dashboardcolumns'] = $_POST['dashboardcolumns'];
+
+ if ($_POST['dashboardavailablewidgetspanel']) {
+ $pconfig['dashboardavailablewidgetspanel'] = $userent['dashboardavailablewidgetspanel'] = true;
+ } else {
+ $pconfig['dashboardavailablewidgetspanel'] = false;
+ unset($userent['dashboardavailablewidgetspanel']);
+ }
+
+ if ($_POST['systemlogsfilterpanel']) {
+ $pconfig['systemlogsfilterpanel'] = $userent['systemlogsfilterpanel'] = true;
+ } else {
+ $pconfig['systemlogsfilterpanel'] = false;
+ unset($userent['systemlogsfilterpanel']);
+ }
+
+ if ($_POST['systemlogsmanagelogpanel']) {
+ $pconfig['systemlogsmanagelogpanel'] = $userent['systemlogsmanagelogpanel'] = true;
+ } else {
+ $pconfig['systemlogsmanagelogpanel'] = false;
+ unset($userent['systemlogsmanagelogpanel']);
+ }
+
+ if ($_POST['statusmonitoringsettingspanel']) {
+ $pconfig['statusmonitoringsettingspanel'] = $userent['statusmonitoringsettingspanel'] = true;
+ } else {
+ $pconfig['statusmonitoringsettingspanel'] = false;
+ unset($userent['statusmonitoringsettingspanel']);
+ }
+
+ if ($_POST['webguileftcolumnhyper']) {
+ $pconfig['webguileftcolumnhyper'] = $userent['webguileftcolumnhyper'] = true;
+ } else {
+ $pconfig['webguileftcolumnhyper'] = false;
+ unset($userent['webguileftcolumnhyper']);
+ }
+
+ if ($_POST['pagenamefirst']) {
+ $pconfig['pagenamefirst'] = $userent['pagenamefirst'] = true;
+ } else {
+ $pconfig['pagenamefirst'] = false;
+ unset($userent['pagenamefirst']);
+ }
+
+ $a_user[$id] = $userent;
+ $savemsg = sprintf(gettext("User settings successfully changed for user %s."), $_SESSION['Username']);
+ write_config($savemsg);
+ }
+}
+
+include("head.inc");
+
+if ($input_errors) {
+ print_input_errors($input_errors);
+}
+
+if ($savemsg) {
+ print_info_box($savemsg, 'success');
+}
+
+$form = new Form();
+
+$section = new Form_Section('User Settings for ' . $_SESSION['Username']);
+
+gen_user_settings_fields($section, $pconfig);
+
+$form->add($section);
+print($form);
+$csswarning = sprintf(gettext("%sUser-created themes are unsupported, use at your own risk."), "<br />");
+?>
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+
+ // Handle displaying a warning message if a user-created theme is selected.
+ function setThemeWarning() {
+ if ($('#webguicss').val().startsWith("pfSense")) {
+ $('#csstxt').html("").addClass("text-default");
+ } else {
+ $('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
+ }
+ }
+
+ $('#webguicss').change(function() {
+ setThemeWarning();
+ });
+
+ // ---------- On initial page load ------------------------------------------------------------
+ setThemeWarning();
+
+});
+//]]>
+</script>
+<?php
+include("foot.inc");
diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php
index 4f06569..17b2db0 100644
--- a/src/usr/local/www/system_usermanager.php
+++ b/src/usr/local/www/system_usermanager.php
@@ -94,6 +94,17 @@ if (isset($id) && $a_user[$id]) {
$pconfig['usernamefld'] = $a_user[$id]['name'];
$pconfig['descr'] = $a_user[$id]['descr'];
$pconfig['expires'] = $a_user[$id]['expires'];
+ $pconfig['customsettings'] = isset($a_user[$id]['customsettings']);
+ $pconfig['webguicss'] = $a_user[$id]['webguicss'];
+ $pconfig['webguifixedmenu'] = $a_user[$id]['webguifixedmenu'];
+ $pconfig['webguihostnamemenu'] = $a_user[$id]['webguihostnamemenu'];
+ $pconfig['dashboardcolumns'] = $a_user[$id]['dashboardcolumns'];
+ $pconfig['dashboardavailablewidgetspanel'] = isset($a_user[$id]['dashboardavailablewidgetspanel']);
+ $pconfig['systemlogsfilterpanel'] = isset($a_user[$id]['systemlogsfilterpanel']);
+ $pconfig['systemlogsmanagelogpanel'] = isset($a_user[$id]['systemlogsmanagelogpanel']);
+ $pconfig['statusmonitoringsettingspanel'] = isset($a_user[$id]['statusmonitoringsettingspanel']);
+ $pconfig['webguileftcolumnhyper'] = isset($a_user[$id]['webguileftcolumnhyper']);
+ $pconfig['pagenamefirst'] = isset($a_user[$id]['pagenamefirst']);
$pconfig['groups'] = local_user_get_groups($a_user[$id]);
$pconfig['utype'] = $a_user[$id]['scope'];
$pconfig['uid'] = $a_user[$id]['uid'];
@@ -330,6 +341,7 @@ if ($_POST['save']) {
$userent['name'] = $_POST['usernamefld'];
$userent['expires'] = $_POST['expires'];
+ $userent['dashboardcolumns'] = $_POST['dashboardcolumns'];
$userent['authorizedkeys'] = base64_encode($_POST['authorizedkeys']);
$userent['ipsecpsk'] = $_POST['ipsecpsk'];
@@ -339,6 +351,66 @@ if ($_POST['save']) {
unset($userent['disabled']);
}
+ if ($_POST['customsettings']) {
+ $userent['customsettings'] = true;
+ } else {
+ unset($userent['customsettings']);
+ }
+
+ if ($_POST['webguicss']) {
+ $userent['webguicss'] = $_POST['webguicss'];
+ } else {
+ unset($userent['webguicss']);
+ }
+
+ if ($_POST['webguifixedmenu']) {
+ $userent['webguifixedmenu'] = $_POST['webguifixedmenu'];
+ } else {
+ unset($userent['webguifixedmenu']);
+ }
+
+ if ($_POST['webguihostnamemenu']) {
+ $userent['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
+ } else {
+ unset($userent['webguihostnamemenu']);
+ }
+
+ if ($_POST['dashboardavailablewidgetspanel']) {
+ $userent['dashboardavailablewidgetspanel'] = true;
+ } else {
+ unset($userent['dashboardavailablewidgetspanel']);
+ }
+
+ if ($_POST['systemlogsfilterpanel']) {
+ $userent['systemlogsfilterpanel'] = true;
+ } else {
+ unset($userent['systemlogsfilterpanel']);
+ }
+
+ if ($_POST['systemlogsmanagelogpanel']) {
+ $userent['systemlogsmanagelogpanel'] = true;
+ } else {
+ unset($userent['systemlogsmanagelogpanel']);
+ }
+
+ if ($_POST['statusmonitoringsettingspanel']) {
+ $userent['statusmonitoringsettingspanel'] = true;
+ } else {
+ unset($userent['statusmonitoringsettingspanel']);
+ }
+
+ if ($_POST['webguileftcolumnhyper']) {
+ $userent['webguileftcolumnhyper'] = true;
+ } else {
+ unset($userent['webguileftcolumnhyper']);
+ }
+
+ if ($_POST['pagenamefirst']) {
+ $userent['pagenamefirst'] = true;
+ } else {
+ unset($userent['pagenamefirst']);
+ }
+
if (isset($id) && $a_user[$id]) {
$a_user[$id] = $userent;
} else {
@@ -710,6 +782,15 @@ if ($act == "new" || $act == "edit" || $input_errors):
))->setHelp('Leave blank if the account shouldn\'t expire, otherwise enter '.
'the expiration date');
+ $section->addInput(new Form_Checkbox(
+ 'customsettings',
+ 'Custom Settings',
+ 'Use individual customized GUI options and dashboard layout for this user.',
+ $pconfig['customsettings']
+ ));
+
+ gen_user_settings_fields($section, $pconfig);
+
// ==== Group membership ==================================================
$group = new Form_Group('Group membership');
@@ -888,12 +969,48 @@ $section->addInput(new Form_Input(
$form->add($section);
print $form;
+
+$csswarning = sprintf(gettext("%sUser-created themes are unsupported, use at your own risk."), "<br />");
?>
<script type="text/javascript">
//<![CDATA[
events.push(function() {
+ function setcustomoptions() {
+ var adv = $('#customsettings').prop('checked');
+
+ hideInput('webguicss', !adv);
+ hideInput('webguifixedmenu', !adv);
+ hideInput('webguihostnamemenu', !adv);
+ hideInput('dashboardcolumns', !adv);
+ hideCheckbox('dashboardavailablewidgetspanel', !adv);
+ hideCheckbox('systemlogsfilterpanel', !adv);
+ hideCheckbox('systemlogsmanagelogpanel', !adv);
+ hideCheckbox('statusmonitoringsettingspanel', !adv);
+ hideCheckbox('webguileftcolumnhyper', !adv);
+ hideCheckbox('pagenamefirst', !adv);
+ }
+
+ // Handle displaying a warning message if a user-created theme is selected.
+ function setThemeWarning() {
+ if ($('#webguicss').val().startsWith("pfSense")) {
+ $('#csstxt').html("").addClass("text-default");
+ } else {
+ $('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
+ }
+ }
+
+ $('#webguicss').change(function() {
+ setThemeWarning();
+ });
+
+ setThemeWarning();
+
// On click . .
+ $('#customsettings').click(function () {
+ setcustomoptions();
+ });
+
$("#movetodisabled").click(function() {
moveOptions($('[name="groups[]"] option'), $('[name="sysgroups[]"]'));
});
@@ -936,6 +1053,7 @@ events.push(function() {
hideClass('cert-options', true);
//hideInput('authorizedkeys', true);
hideCheckbox('showkey', true);
+ setcustomoptions();
// On submit mark all the user's groups as "selected"
$('form').submit(function() {
OpenPOWER on IntegriCloud