add field in configuration for hidden other fields in settings form

This commit is contained in:
Uwe Steinmann 2021-06-23 16:27:09 +02:00
parent f8d81bd734
commit 932835ef03
2 changed files with 24 additions and 0 deletions

View File

@ -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');

View File

@ -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;
?>
<tr title="<?= getMLText($title."_desc") ?>">
<td><?= getMLText($title) ?>:</td>