},
"Base": {
"Required": false,
- "ValueType": "alist_res",
+ "ValueType": "res",
"DefaultValue": 0,
- "FieldType": "ComboBox",
+ "FieldType": "ListBox",
"Resource": "Job"
}
},
},
"Base": {
"Required": false,
- "ValueType": "alist_res",
+ "ValueType": "res",
"DefaultValue": 0,
- "FieldType": "ComboBox",
+ "FieldType": "ListBox",
"Resource": "Job"
}
}
},
"Device": {
"Required": true,
- "ValueType": "alist_res",
+ "ValueType": "res",
"DefaultValue": 0,
- "FieldType": "ComboBox"
+ "FieldType": "ListBox",
+ "Resource": "Device"
},
"ChangerDevice": {
"Required": true,
msgid "During restore there will be used following volumes:"
msgstr "During restore there will be used following volumes:"
+
+msgid "Use Ctrl + Mouse Click to change selection"
+msgstr "Use Ctrl + Mouse Click to change selection"
msgid "During restore there will be used following volumes:"
msgstr "During restore there will be used following volumes:"
+
+msgid "Use Ctrl + Mouse Click to change selection"
+msgstr "Use Ctrl + Mouse Click to change selection"
msgid "During restore there will be used following volumes:"
msgstr "Podczas zadania przywracania danych potrzebne będą następujące wolumeny:"
+
+msgid "Use Ctrl + Mouse Click to change selection"
+msgstr "Aby zmienić wybór, użyj Ctrl + klik myszy"
msgid "During restore there will be used following volumes:"
msgstr "During restore there will be used following volumes:"
+
+msgid "Use Ctrl + Mouse Click to change selection"
+msgstr "Use Ctrl + Mouse Click to change selection"
Prado::using('Application.Web.Portlets.DirectiveBoolean');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
Prado::using('Application.Web.Portlets.DirectiveInteger');
+Prado::using('Application.Web.Portlets.DirectiveListBox');
Prado::using('Application.Web.Portlets.DirectiveText');
Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
Prado::using('Application.Web.Portlets.DirectiveRunscript');
'DirectiveBoolean',
'DirectiveComboBox',
'DirectiveInteger',
+ 'DirectiveListBox',
'DirectiveText',
'DirectiveTimePeriod'
);
'DirectiveRunscript'
);
+ private $field_multple_values = array(
+ 'ListBox'
+ );
+
private function getConfigData($host, array $parameters) {
$default_params = array('config');
$params = array_merge($default_params, $parameters);
}
}
- if (!is_array($directive_value) && !is_object($directive_value)) {
+ if ((!is_array($directive_value) && !is_object($directive_value)) || in_array($field_type, $this->field_multple_values)) {
$directive_value = array($directive_value);
}
if (is_object($directive_value)) {
<com:Application.Web.Portlets.DirectiveComboBox />
</prop:TrueTemplate>
</com:Application.Web.Portlets.BConditional>
+ <com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'ListBox')%>">
+ <prop:TrueTemplate>
+ <com:Application.Web.Portlets.DirectiveListBox />
+ </prop:TrueTemplate>
+ </com:Application.Web.Portlets.BConditional>
<com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'FileSet')%>">
<prop:TrueTemplate>
<com:Application.Web.Portlets.DirectiveFileSet />
'DirectiveBoolean',
'DirectiveText',
'DirectiveComboBox',
+ 'DirectiveListBox',
'DirectiveInteger'
);
<com:Application.Web.Portlets.DirectiveInteger />
</prop:TrueTemplate>
</com:Application.Web.Portlets.BConditional>
+ <com:Application.Web.Portlets.BConditional BCondition="<%#($this->DataItem['field_type'] === 'ListBox')%>">
+ <prop:TrueTemplate>
+ <com:Application.Web.Portlets.DirectiveListBox />
+ </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.TActiveListBox');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+class DirectiveListBox extends DirectiveTemplate {
+
+ public function getValue() {
+ $value = array();
+ $values = $this->Directive->getSelectedIndices();
+ $items = $this->Directive->getItems();
+ for ($i = 0; $i < count($values); $i++) {
+ $value[] = $items[$values[$i]]->getValue();
+ }
+ return $value;
+ }
+
+ public function createDirective() {
+ $this->Label->Text = $this->getLabel();
+ $data = $this->getData();
+ $resource_names = $this->getResourceNames();
+ $directive_name = $this->getDirectiveName();
+ $resource = $this->getResource();
+ $in_config = $this->getInConfig();
+ $items = array();
+ if (is_array($data)) {
+ $items = $data;
+ } elseif (is_array($resource_names)) {
+ if (array_key_exists($directive_name, $resource_names)) {
+ $items = $resource_names[$directive_name];
+ } elseif (array_key_exists($resource, $resource_names)) {
+ $items = $resource_names[$resource];
+ }
+ }
+ $this->Directive->dataSource = array_combine($items, $items);
+
+ $directive_value = $this->getDirectiveValue();
+ $default_value = $this->getDefaultValue();
+ if ($in_config === false) {
+ if ($default_value !== 0) {
+ $directive_value = $default_value;
+ } else {
+ $directive_value = array();
+ }
+ }
+ $selected_indices = array();
+ for ($i = 0; $i < count($items); $i++) {
+ if (in_array($items[$i], $directive_value)) {
+ $selected_indices[] = $i;
+ }
+ }
+ if (!empty($directive_value)) {
+ $this->Directive->setSelectedIndices($selected_indices);
+ }
+ $this->Directive->dataBind();
+ $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:TActiveListBox ID="Directive"
+ SelectionMode="Multiple"
+ OnSelectedIndexChanged="saveValue"
+ CssClass="ftype_listbox"
+ Visible="<%=$this->display_directive%>"
+ AutoPostBack="false"
+ ActiveControl.EnableUpdate="false"
+ /> <%=$this->getRequired() ? '*' : ''%>
+ <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()%>"
+ />
+ <p class="smalldesc"><%[ Use Ctrl + Mouse Click to change selection ]%></p>
+ </div>
+</div>
margin-left: 64px;
}
-input.ftype_textbox, input.ftype_timeperiod, input.ftype_integer, select.ftype_combobox {
+input.ftype_textbox, input.ftype_timeperiod, input.ftype_integer, select.ftype_combobox, select.ftype_listbox {
font-size: 12px;
}
width: 161px;
}
+select.ftype_combobox, select.ftype_listbox {
+ min-width: 265px;
+}
+
select.ftype_combobox {
height: 29px;
- min-width: 265px;
}
input.ftype_integer {
width: 161px;
}
+select.ftype_listbox {
+ height: 100px;
+}
+
table.host td:nth-of-type(1) {
width: 205px;
}
img.reset_btn, img.remove_btn {
display: none;
cursor: pointer;
+ vertical-align: middle;
}
div.directive_value {
#new_host {
padding: 26px;
}
+
+p.smalldesc {
+ margin: 0;
+ font-style: italic;
+}