From: Marcin Haba Date: Thu, 9 Nov 2017 20:14:23 +0000 (+0100) Subject: baculum: Fix numeric password setting bug reported by Heitor Faria X-Git-Tag: Release-9.0.6~62 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=41a17e491c44b6a17190661e5349a4c5298afbfa;p=bacula%2Fbacula baculum: Fix numeric password setting bug reported by Heitor Faria Add integer type control. --- diff --git a/gui/baculum/protected/API/Class/BaculaSetting.php b/gui/baculum/protected/API/Class/BaculaSetting.php index 48ccaa9798..5ce79633f2 100644 --- a/gui/baculum/protected/API/Class/BaculaSetting.php +++ b/gui/baculum/protected/API/Class/BaculaSetting.php @@ -385,7 +385,7 @@ class BaculaSetting extends APIModule { $directive_value = null; if (is_bool($value)) { $directive_value = ($value === true) ? 'yes' : 'no'; - } elseif (is_numeric($value)) { + } elseif (is_int($value)) { $directive_value = $value; } elseif (is_string($value)) { $value = str_replace('"', '\"', $value); diff --git a/gui/baculum/protected/Web/Data/data_desc.json b/gui/baculum/protected/Web/Data/data_desc.json index e3ff2f9a0c..74a3317899 100644 --- a/gui/baculum/protected/Web/Data/data_desc.json +++ b/gui/baculum/protected/Web/Data/data_desc.json @@ -87,19 +87,19 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 1, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumReloadRequests": { "Required": false, "ValueType": "pint32", "DefaultValue": 32, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumConsoleConnections": { "Required": false, "ValueType": "pint32", "DefaultValue": 20, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Password": { "Required": true, @@ -227,7 +227,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 9102, - "FieldType": "TextBox" + "FieldType": "Integer" }, "fdpassword": { "Required": false, @@ -293,7 +293,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 1, - "FieldType": "TextBox" + "FieldType": "Integer" }, "TlsAuthenticate": { "Required": false, @@ -736,13 +736,13 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 1, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumSpawnedJobs": { "Required": false, "ValueType": "pint32", "DefaultValue": 600, - "FieldType": "TextBox" + "FieldType": "Integer" }, "RescheduleOnError": { "Required": false, @@ -766,13 +766,13 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Priority": { "Required": false, "ValueType": "pint32", "DefaultValue": 10, - "FieldType": "TextBox" + "FieldType": "Integer" }, "AllowMixedPriority": { "Required": false, @@ -866,7 +866,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 9103, - "FieldType": "TextBox" + "FieldType": "Integer" }, "sdaddress": { "Required": false, @@ -944,19 +944,19 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 1, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumConcurrentReadjobs": { "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "sddport": { "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "TlsAuthenticate": { "Required": false, @@ -1030,7 +1030,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "dbpassword": { "Required": false, @@ -1366,7 +1366,7 @@ "Required": false, "ValueType": "int32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" } } }, @@ -1455,19 +1455,19 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumVolumeJobs": { "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumVolumeFiles": { "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumVolumeBytes": { "Required": false, @@ -1625,13 +1625,13 @@ "Required": false, "ValueType": "int32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Maximum": { "Required": false, "ValueType": "pint32", "DefaultValue": 2147483647, - "FieldType": "TextBox" + "FieldType": "Integer" }, "WrapCounter": { "Required": false, @@ -2168,13 +2168,13 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 1, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumSpawnedJobs": { "Required": false, "ValueType": "pint32", "DefaultValue": 600, - "FieldType": "TextBox" + "FieldType": "Integer" }, "RescheduleOnError": { "Required": false, @@ -2198,13 +2198,13 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Priority": { "Required": false, "ValueType": "pint32", "DefaultValue": 10, - "FieldType": "TextBox" + "FieldType": "Integer" }, "AllowMixedPriority": { "Required": false, @@ -2440,7 +2440,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 20, - "FieldType": "TextBox" + "FieldType": "Integer" }, "ClientConnectTimeout": { "Required": false, @@ -2749,7 +2749,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "VolumePollInterval": { "Required": false, @@ -2815,7 +2815,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "SpoolDirectory": { "Required": false, @@ -2839,7 +2839,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "MaximumPartSize": { "Required": false, @@ -3144,7 +3144,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 20, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Messages": { "Required": false, @@ -3168,7 +3168,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "PkiSignatures": { "Required": false, @@ -3322,7 +3322,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 9101, - "FieldType": "TextBox" + "FieldType": "Integer" }, "TlsAuthenticate": { "Required": false, @@ -3462,7 +3462,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 20, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Messages": { "Required": false, @@ -3486,7 +3486,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 0, - "FieldType": "TextBox" + "FieldType": "Integer" }, "PkiSignatures": { "Required": false, @@ -3684,7 +3684,7 @@ "Required": false, "ValueType": "pint32", "DefaultValue": 9101, - "FieldType": "TextBox" + "FieldType": "Integer" }, "Address": { "Required": false, diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index b0210ab00f..3d7319622b 100644 Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/en/messages.po b/gui/baculum/protected/Web/Lang/en/messages.po index 2e7e436ed7..b588d8968e 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -1414,3 +1414,9 @@ msgstr "API host:" msgid "Select host" msgstr "Select host" + +msgid "Field required." +msgstr "Field required." + +msgid "Invalid value. Integer value required." +msgstr "Invalid value. Integer value required." diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index 2063d2634f..02a0e29f7d 100644 Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ja/messages.po b/gui/baculum/protected/Web/Lang/ja/messages.po index 044f2d8618..a4eab462d5 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -1165,3 +1165,9 @@ msgstr "OAuth2 scopes (space separated):" msgid "Please enter OAuth2 scopes." msgstr "Please enter OAuth2 scopes." + +msgid "Field required." +msgstr "Field required." + +msgid "Invalid value. Integer value required." +msgstr "Invalid value. Integer value required." diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index bfc88600fa..15040e0681 100644 Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pl/messages.po b/gui/baculum/protected/Web/Lang/pl/messages.po index eb416ab76a..84f967b446 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -1421,3 +1421,9 @@ msgstr "Zakresy OAuth2 (oddzielone spacją):" msgid "Please enter OAuth2 scopes." msgstr "Proszę wprowadzić zakresy OAuth2." + +msgid "Field required." +msgstr "Pole wymagane." + +msgid "Invalid value. Integer value required." +msgstr "Niepoprawna wartość. Wymagane jest podanie liczby całkowitej." diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index cc548ba2d6..2b901fd01c 100644 Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pt/messages.po b/gui/baculum/protected/Web/Lang/pt/messages.po index dda003ead0..09cb86ec7e 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -1429,3 +1429,9 @@ msgstr "Escopo OAuth2 (separado por espaço):" msgid "Please enter OAuth2 scopes." msgstr "Informe o escopo OAuth2." + +msgid "Field required." +msgstr "Field required." + +msgid "Invalid value. Integer value required." +msgstr "Invalid value. Integer value required." diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php index 45906f07ec..befe637a22 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php @@ -25,6 +25,8 @@ Prado::using('System.Web.UI.ActiveControls.TActiveLabel'); Prado::using('Application.Web.Portlets.BConditional'); Prado::using('Application.Web.Portlets.DirectiveListTemplate'); Prado::using('Application.Web.Portlets.DirectiveBoolean'); +Prado::using('Application.Web.Portlets.DirectiveComboBox'); +Prado::using('Application.Web.Portlets.DirectiveInteger'); Prado::using('Application.Web.Portlets.DirectiveText'); Prado::using('Application.Web.Portlets.DirectiveTimePeriod'); Prado::using('Application.Web.Portlets.DirectiveRunscript'); @@ -42,6 +44,7 @@ class BaculaConfigDirectives extends DirectiveListTemplate { private $directive_types = array( 'DirectiveBoolean', 'DirectiveComboBox', + 'DirectiveInteger', 'DirectiveText', 'DirectiveTimePeriod' ); @@ -243,6 +246,8 @@ class BaculaConfigDirectives extends DirectiveListTemplate { } if ($this->directive_types[$i] === 'DirectiveBoolean') { settype($default_value, 'bool'); + } elseif ($this->directive_types[$i] === 'DirectiveInteger') { + settype($directive_value, 'int'); } if ($directive_value === $default_value && $in_config === false) { // value the same as default value, skip it diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.tpl b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.tpl index 3c25ff40b7..3c0c69f278 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.tpl +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.tpl @@ -10,6 +10,11 @@ + + + + + diff --git a/gui/baculum/protected/Web/Portlets/DirectiveFileSet.php b/gui/baculum/protected/Web/Portlets/DirectiveFileSet.php index 538d9b7906..e0244e2be6 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveFileSet.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveFileSet.php @@ -23,6 +23,10 @@ Prado::using('System.Web.UI.ActiveControls.TActiveRepeater'); Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton'); Prado::using('Application.Web.Portlets.DirectiveListTemplate'); +Prado::using('Application.Web.Portlets.DirectiveBoolean'); +Prado::using('Application.Web.Portlets.DirectiveText'); +Prado::using('Application.Web.Portlets.DirectiveComboBox'); +Prado::using('Application.Web.Portlets.DirectiveInteger'); class DirectiveFileSet extends DirectiveListTemplate { @@ -31,7 +35,8 @@ class DirectiveFileSet extends DirectiveListTemplate { private $directive_types = array( 'DirectiveBoolean', 'DirectiveText', - 'DirectiveComboBox' + 'DirectiveComboBox', + 'DirectiveInteger' ); private $directive_inc_exc_types = array( diff --git a/gui/baculum/protected/Web/Portlets/DirectiveFileSet.tpl b/gui/baculum/protected/Web/Portlets/DirectiveFileSet.tpl index 5efe8a5bbf..548fbb0c8c 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveFileSet.tpl +++ b/gui/baculum/protected/Web/Portlets/DirectiveFileSet.tpl @@ -24,6 +24,11 @@ + + + + + diff --git a/gui/baculum/protected/Web/Portlets/DirectiveInteger.php b/gui/baculum/protected/Web/Portlets/DirectiveInteger.php new file mode 100644 index 0000000000..e55df26123 --- /dev/null +++ b/gui/baculum/protected/Web/Portlets/DirectiveInteger.php @@ -0,0 +1,54 @@ +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(); + settype($default_value, 'int'); + if ($this->getInConfig() === false) { + 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/DirectiveInteger.tpl b/gui/baculum/protected/Web/Portlets/DirectiveInteger.tpl new file mode 100644 index 0000000000..56ffbee189 --- /dev/null +++ b/gui/baculum/protected/Web/Portlets/DirectiveInteger.tpl @@ -0,0 +1,29 @@ +
+
:
+
+ + <%[ Reset to default value ]%> + <%[ Remove directive ]%> + + +
+
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveRunscript.php b/gui/baculum/protected/Web/Portlets/DirectiveRunscript.php index 9c10e1612c..2e6b227f83 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveRunscript.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveRunscript.php @@ -21,6 +21,9 @@ */ Prado::using('Application.Web.Portlets.DirectiveListTemplate'); +Prado::using('Application.Web.Portlets.DirectiveBoolean'); +Prado::using('Application.Web.Portlets.DirectiveText'); +Prado::using('Application.Web.Portlets.DirectiveComboBox'); class DirectiveRunscript extends DirectiveListTemplate { diff --git a/gui/baculum/themes/Baculum-v1/bacula-config.css b/gui/baculum/themes/Baculum-v1/bacula-config.css index bf5a964eda..daad126082 100644 --- a/gui/baculum/themes/Baculum-v1/bacula-config.css +++ b/gui/baculum/themes/Baculum-v1/bacula-config.css @@ -93,7 +93,7 @@ div.directive_setting fieldset { margin-left: 64px; } -input.ftype_textbox, input.ftype_timeperiod, select.ftype_combobox { +input.ftype_textbox, input.ftype_timeperiod, input.ftype_integer, select.ftype_combobox { font-size: 12px; } @@ -110,6 +110,10 @@ select.ftype_combobox { min-width: 265px; } +input.ftype_integer { + width: 161px; +} + table.host td:nth-of-type(1) { width: 205px; }