Add integer type control.
$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);
"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,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 9102,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"fdpassword": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 1,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"TlsAuthenticate": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 1,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"MaximumSpawnedJobs": {
"Required": false,
"ValueType": "pint32",
"DefaultValue": 600,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"RescheduleOnError": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Priority": {
"Required": false,
"ValueType": "pint32",
"DefaultValue": 10,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"AllowMixedPriority": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 9103,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"sdaddress": {
"Required": false,
"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,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"dbpassword": {
"Required": false,
"Required": false,
"ValueType": "int32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
}
}
},
"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,
"Required": false,
"ValueType": "int32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Maximum": {
"Required": false,
"ValueType": "pint32",
"DefaultValue": 2147483647,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"WrapCounter": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 1,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"MaximumSpawnedJobs": {
"Required": false,
"ValueType": "pint32",
"DefaultValue": 600,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"RescheduleOnError": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Priority": {
"Required": false,
"ValueType": "pint32",
"DefaultValue": 10,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"AllowMixedPriority": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 20,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"ClientConnectTimeout": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"VolumePollInterval": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"SpoolDirectory": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"MaximumPartSize": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 20,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Messages": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"PkiSignatures": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 9101,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"TlsAuthenticate": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 20,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Messages": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 0,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"PkiSignatures": {
"Required": false,
"Required": false,
"ValueType": "pint32",
"DefaultValue": 9101,
- "FieldType": "TextBox"
+ "FieldType": "Integer"
},
"Address": {
"Required": false,
msgid "Select host"
msgstr "Select host"
+
+msgid "Field required."
+msgstr "Field required."
+
+msgid "Invalid value. Integer value required."
+msgstr "Invalid value. Integer value required."
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."
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."
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."
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');
private $directive_types = array(
'DirectiveBoolean',
'DirectiveComboBox',
+ 'DirectiveInteger',
'DirectiveText',
'DirectiveTimePeriod'
);
}
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
<com:Application.Web.Portlets.DirectiveText />
</prop:TrueTemplate>
</com:Application.Web.Portlets.BConditional>
+ <com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'Integer')%>">
+ <prop:TrueTemplate>
+ <com:Application.Web.Portlets.DirectiveInteger />
+ </prop:TrueTemplate>
+ </com:Application.Web.Portlets.BConditional>
<com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'CheckBox')%>">
<prop:TrueTemplate>
<com:Application.Web.Portlets.DirectiveBoolean />
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 {
private $directive_types = array(
'DirectiveBoolean',
'DirectiveText',
- 'DirectiveComboBox'
+ 'DirectiveComboBox',
+ 'DirectiveInteger'
);
private $directive_inc_exc_types = array(
<com:Application.Web.Portlets.DirectiveBoolean />
</prop:TrueTemplate>
</com:Application.Web.Portlets.BConditional>
+ <com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'Integer')%>">
+ <prop:TrueTemplate>
+ <com:Application.Web.Portlets.DirectiveInteger />
+ </prop:TrueTemplate>
+ </com:Application.Web.Portlets.BConditional>
</prop:ItemTemplate>
<prop:FooterTemplate>
</fieldset>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2017 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+class DirectiveInteger extends DirectiveTemplate {
+
+ public function getValue() {
+ $value = $this->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);
+ }
+}
+?>
--- /dev/null
+<div class="line<%=!$this->display_directive ? ' hide' : '';%>">
+ <div class="text"><com:TActiveLabel ID="Label" ActiveControl.EnableUpdate="false" Visible="<%=$this->display_directive%>" />:</div>
+ <div class="field directive_value">
+ <com:TActiveTextBox ID="Directive"
+ OnTextChanged="saveValue"
+ CssClass="ftype_integer"
+ Visible="<%=$this->display_directive%>"
+ ActiveControl.EnableUpdate="false"
+ AutoTrim="true"
+ />
+ <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/switch.png" class="reset_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '<%=$this->getDefaultValue() === 0 ? '' : $this->getDefaultValue()%>';" alt="<%[ Reset to default value ]%>" title="<%[ Reset to default value ]%>" />
+ <img src="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_err.png" class="remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>" />
+ <com:TRequiredFieldValidator
+ ID="DirectiveValidator"
+ ValidationGroup="Directive"
+ Display="Dynamic"
+ ControlToValidate="Directive"
+ FocusOnError="true"
+ Text="<%[ Field required. ]%>"
+ Enabled="<%=$this->getRequired() && $this->getShow()%>"
+ />
+ <com:TDataTypeValidator
+ ValidationGroup="Directive"
+ ControlToValidate="Directive"
+ DataType="Integer"
+ Text="<%[ Invalid value. Integer value required. ]%>"
+ />
+ </div>
+</div>
*/
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 {
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;
}
min-width: 265px;
}
+input.ftype_integer {
+ width: 161px;
+}
+
table.host td:nth-of-type(1) {
width: 205px;
}