From f8d81bd734e215db9009a5a32aaf1f4dc7b805a1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Jun 2021 14:49:53 +0200 Subject: [PATCH 1/3] theme can be set in user manager --- CHANGELOG | 1 + op/op.UsrMgr.php | 6 +++++- views/bootstrap/class.UsrMgr.php | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 45f2f2a19..4e864b567 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,7 @@ - much better form validation based on jquery validation - secure unlocking/locking of a documents with form token to prevent CSRF attacks - append referuri to base url to prevent redirects to arbitraty sites in op.Login.php +- theme can be set in user manager -------------------------------------------------------------------------------- Changes in version 5.1.22 diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index f5991e74a..d94614bd9 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -66,6 +66,7 @@ if ($action == "adduser") { UI::exitError(getMLText("admin_tools"),getMLText("user_email_missing")); } $comment = $_POST["comment"]; + $theme = $_POST["theme"]; if ($settings->_strictFormCheck && !$comment) { UI::exitError(getMLText("admin_tools"),getMLText("user_comment_missing")); } @@ -79,7 +80,7 @@ if ($action == "adduser") { UI::exitError(getMLText("admin_tools"),getMLText("user_exists")); } - $newUser = $dms->addUser($login, seed_pass_hash($pwd), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration, $quota, $homefolder); + $newUser = $dms->addUser($login, seed_pass_hash($pwd), $name, $email, $settings->_language, $theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration, $quota, $homefolder); if ($newUser) { /* Set user image if uploaded */ @@ -350,6 +351,7 @@ else if ($action == "edituser") { $name = $_POST["name"]; $email = $_POST["email"]; $comment = $_POST["comment"]; + $theme = $_POST["theme"]; $role = preg_replace('/[^0-2]+/', '', $_POST["role"]); $isHidden = (isset($_POST["ishidden"]) && $_POST["ishidden"]==1 ? 1 : 0); $isDisabled = (isset($_POST["isdisabled"]) && $_POST["isdisabled"]==1 ? 1 : 0); @@ -387,6 +389,8 @@ else if ($action == "edituser") { $editedUser->setEmail($email); if ($editedUser->getComment() != $comment) $editedUser->setComment($comment); + if ($editedUser->getTheme() != $theme) + $editedUser->setTheme($theme); if ($editedUser->getRole() != $role) $editedUser->setRole($role); if ($editedUser->getQuota() != $quota) diff --git a/views/bootstrap/class.UsrMgr.php b/views/bootstrap/class.UsrMgr.php index fa81cc378..acb4f0ed3 100644 --- a/views/bootstrap/class.UsrMgr.php +++ b/views/bootstrap/class.UsrMgr.php @@ -214,6 +214,7 @@ $(document).ready( function() { function showUserForm($currUser) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; + $settings = $this->params['settings']; $users = $this->params['allusers']; $groups = $this->params['allgroups']; $passwordstrength = $this->params['passwordstrength']; @@ -328,6 +329,19 @@ $(document).ready( function() { 'options'=>$options ) ); + $themes = UI::getStyles(); + $options = array(); + foreach ($themes as $currTheme) { + $options[] = array($currTheme, $currTheme, ($currUser && ($currTheme == $currUser->getTheme())) || ($currTheme == $settings->_theme)); + } + $this->formField( + getMLText("theme"), + array( + 'element'=>'select', + 'name'=>'theme', + 'options'=>$options + ) + ); $options = array(); foreach($groups as $group) { $options[] = array($group->getID(), htmlspecialchars($group->getName()), ($currUser && $group->isMember($currUser))); From 932835ef033f59db1c8703bdb95fa8baa6ff2c33 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Jun 2021 16:27:09 +0200 Subject: [PATCH 2/3] add field in configuration for hidden other fields in settings form --- inc/inc.ClassSettings.php | 4 ++++ views/bootstrap/class.Settings.php | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 230ed9465..bbc9333a5 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -24,6 +24,8 @@ class Settings { /* {{{ */ // Config File Path var $_configFilePath = null; + // Fields not shown in gui + var $_hiddenConfFields = ''; // Name of site var $_siteName = "SeedDMS"; // Message to display at the bottom of every page. @@ -669,6 +671,7 @@ class Settings { /* {{{ */ $this->_useHomeAsRootFolder = Settings::boolval($tab["useHomeAsRootFolder"]); $this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]); $this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]); + $this->_hiddenConfFields = strval($tab["hiddenConfFields"]); } // XML Path: /configuration/advanced/authentication @@ -1009,6 +1012,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "useHomeAsRootFolder", $this->_useHomeAsRootFolder); $this->setXMLAttributValue($node, "titleDisplayHack", $this->_titleDisplayHack); $this->setXMLAttributValue($node, "showMissingTranslations", $this->_showMissingTranslations); + $this->setXMLAttributValue($node, "hiddenConfFields", $this->_hiddenConfFields); // XML Path: /configuration/advanced/authentication $node = $this->getXMLNode($xml, '/configuration/advanced', 'authentication'); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 09635aa50..3f0f25313 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -88,6 +88,24 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style { $this->showRawConfigHeadline(htmlspecialchars(getMLText($title))); } /* }}} */ + /** + * Show a text input configuration option + * + * @param string $title title of the option + * @param string $name name of html input field + * @param string $type can be 'password', 'array' + * @param string $placeholder placeholder for input field + */ + protected function isVisible($name) { /* {{{ */ + $settings = $this->params['settings']; + if(!($hcf = $settings->_hiddenConfFields)) + return true; + $hcfa = explode(';', $hcf); + if(in_array($name, $hcfa)) + return false; + return true; + } /* }}} */ + /** * Show a text input configuration option * @@ -98,6 +116,8 @@ class SeedDMS_View_Settings extends SeedDMS_Theme_Style { */ protected function showConfigText($title, $name, $type='', $placeholder='') { /* {{{ */ $settings = $this->params['settings']; + if(!$this->isVisible($name)) + return; ?> "> : From 5baac2b4ff0646dcdfcfae30dcc771d4d6070fa8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Jun 2021 17:17:16 +0200 Subject: [PATCH 3/3] add entry for 5.1.23 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 4e864b567..a227957d6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ - secure unlocking/locking of a documents with form token to prevent CSRF attacks - append referuri to base url to prevent redirects to arbitraty sites in op.Login.php - theme can be set in user manager +- fields in configuration can be omitted from display -------------------------------------------------------------------------------- Changes in version 5.1.22