From: Marcin Haba Date: Tue, 21 May 2019 05:10:41 +0000 (+0200) Subject: baculum: Add password field control and use it for password directives X-Git-Tag: Release-9.6.0~217 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fa2f3428720b401ea7498a07824d78f6903e8f6;p=thirdparty%2Fbacula.git baculum: Add password field control and use it for password directives --- diff --git a/gui/baculum/protected/Web/Data/data_desc.json b/gui/baculum/protected/Web/Data/data_desc.json index 192cb27f75..dac68c4d20 100644 --- a/gui/baculum/protected/Web/Data/data_desc.json +++ b/gui/baculum/protected/Web/Data/data_desc.json @@ -105,7 +105,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "FdConnectTimeout": { "Required": false, @@ -233,13 +233,13 @@ "Required": false, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Password": { "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "FdStorageAddress": { "Required": false, @@ -890,13 +890,13 @@ "Required": false, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Password": { "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Device": { "Required": true, @@ -1036,13 +1036,13 @@ "Required": false, "ValueType": "str", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Password": { "Required": false, "ValueType": "str", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "dbuser": { "Required": false, @@ -1664,7 +1664,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "JobAcl": { "Required": false, @@ -2301,7 +2301,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Monitor": { "Required": false, @@ -2970,7 +2970,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Address": { "Required": false, @@ -3312,7 +3312,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "Address": { "Required": false, @@ -3612,7 +3612,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "TlsAuthenticate": { "Required": false, @@ -3698,7 +3698,7 @@ "Required": true, "ValueType": "password", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Password" }, "TlsAuthenticate": { "Required": false, diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php index be72e3c7ba..233bd46e4e 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php @@ -29,6 +29,7 @@ Prado::using('Application.Web.Portlets.DirectiveCheckBox'); Prado::using('Application.Web.Portlets.DirectiveComboBox'); Prado::using('Application.Web.Portlets.DirectiveInteger'); Prado::using('Application.Web.Portlets.DirectiveListBox'); +Prado::using('Application.Web.Portlets.DirectivePassword'); Prado::using('Application.Web.Portlets.DirectiveSize'); Prado::using('Application.Web.Portlets.DirectiveTextBox'); Prado::using('Application.Web.Portlets.DirectiveMultiTextBox'); @@ -52,6 +53,7 @@ class BaculaConfigDirectives extends DirectiveListTemplate { 'DirectiveComboBox', 'DirectiveInteger', 'DirectiveListBox', + 'DirectivePassword', 'DirectiveTextBox', 'DirectiveSize', 'DirectiveTimePeriod' diff --git a/gui/baculum/protected/Web/Portlets/DirectivePassword.php b/gui/baculum/protected/Web/Portlets/DirectivePassword.php new file mode 100644 index 0000000000..1e3cf889bd --- /dev/null +++ b/gui/baculum/protected/Web/Portlets/DirectivePassword.php @@ -0,0 +1,53 @@ +Directive->getText(); + if (empty($value)) { + $value = null; + } + return $value; + } + + public function createDirective() { + $this->Label->Text = $this->getLabel(); + $directive_value = $this->getDirectiveValue(); + $default_value = $this->getDefaultValue(); + if ($this->getInConfig() === false && empty($directive_value)) { + if ($default_value !== 0) { + $directive_value = $default_value; + } else { + $directive_value = ''; + } + } + $this->Directive->setText($directive_value); + $validate = $this->getRequired(); + $this->DirectiveValidator->setVisible($validate); + } +} +?> diff --git a/gui/baculum/protected/Web/Portlets/DirectivePassword.tpl b/gui/baculum/protected/Web/Portlets/DirectivePassword.tpl new file mode 100644 index 0000000000..259b4e3986 --- /dev/null +++ b/gui/baculum/protected/Web/Portlets/DirectivePassword.tpl @@ -0,0 +1,26 @@ +
+
:
+
+ + <%=$this->getRequired() ? ' ' : ''%> + + + + <%[ Field required. ]%> +
+
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php b/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php index b0f5f31ca8..c9090a9f9c 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php @@ -29,6 +29,7 @@ Prado::using('Application.Web.Portlets.DirectiveCheckBox'); Prado::using('Application.Web.Portlets.DirectiveComboBox'); Prado::using('Application.Web.Portlets.DirectiveInteger'); Prado::using('Application.Web.Portlets.DirectiveListBox'); +Prado::using('Application.Web.Portlets.DirectivePassword'); Prado::using('Application.Web.Portlets.DirectiveSize'); Prado::using('Application.Web.Portlets.DirectiveTextBox'); Prado::using('Application.Web.Portlets.DirectiveMultiTextBox'); @@ -46,6 +47,7 @@ class DirectiveRenderer extends DirectiveListTemplate implements IItemDataRender 'DirectiveComboBox', 'DirectiveInteger', 'DirectiveListBox', + 'DirectivePassword', 'DirectiveTextBox', 'DirectiveSize', 'DirectiveTimePeriod'