"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Job"
},
"ClientAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Client"
},
"StorageAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Storage"
},
"ScheduleAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Schedule"
},
"RunAcl": {
"Required": false,
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Pool"
},
"CommandAcl": {
"Required": false,
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Fileset"
},
"CatalogAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Catalog"
},
"WhereAcl": {
"Required": false,
"DefaultValue": 0,
"FieldType": "MultiTextBox"
},
- "RestoreClientAcl": {
+ "BackupClientAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Client"
},
- "BackupClientAcl": {
+ "RestoreClientAcl": {
"Required": false,
"ValueType": "acl",
"DefaultValue": 0,
- "FieldType": "MultiTextBox"
+ "FieldType": "MultiComboBox",
+ "Resource": "Client"
},
"DirectoryAcl": {
"Required": false,
msgid "Version:"
msgstr "Version:"
+
+msgid "Add directive"
+msgstr "Add directive"
msgid "Version:"
msgstr "Version:"
+
+msgid "Add directive"
+msgstr "Add directive"
msgid "Version:"
msgstr "Wersja:"
+
+msgid "Add directive"
+msgstr "Dodaj dyrektywÄ™"
msgid "Version:"
msgstr "Version:"
+
+msgid "Add directive"
+msgstr "Add directive"
Prado::using('Application.Web.Portlets.DirectiveSize');
Prado::using('Application.Web.Portlets.DirectiveSpeed');
Prado::using('Application.Web.Portlets.DirectiveTextBox');
+Prado::using('Application.Web.Portlets.DirectiveMultiComboBox');
Prado::using('Application.Web.Portlets.DirectiveMultiTextBox');
Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
Prado::using('Application.Web.Portlets.DirectiveRunscript');
'DirectiveSchedule',
'DirectiveMessages',
'DirectiveRunscript',
+ 'DirectiveMultiComboBox',
'DirectiveMultiTextBox'
);
$directives[$directive_name] = $directive_value[$directive_name];
} elseif ($this->directive_list_types[$i] === 'DirectiveSchedule') {
$directives[$directive_name] = $directive_value[$directive_name];
- } elseif ($this->directive_list_types[$i] === 'DirectiveMultiTextBox') {
+ } elseif ($this->directive_list_types[$i] === 'DirectiveMultiTextBox' || $this->directive_list_types[$i] === 'DirectiveMultiComboBox') {
if (key_exists($directive_name, $directives)) {
$directive_value = array_merge($directives[$directive_name], $directive_value);
}
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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.TActiveDropDownList');
+Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
+Prado::using('Application.Web.Portlets.DirectiveListTemplate');
+
+class DirectiveMultiComboBox extends DirectiveListTemplate {
+
+ public function onLoad($param) {
+ parent::onLoad($param);
+ if ($this->getCmdParam() !== 'add_multicombobox') {
+ $this->loadConfig();
+ }
+ }
+
+ public function getDirectiveValue() {
+ $values = array();
+ $controls = $this->MultiComboBoxRepeater->getItems();
+ foreach ($controls as $control) {
+ $val = $control->Directive->getSelectedValue();
+ if (!empty($val)) {
+ $values[] = $val;
+ }
+ }
+ return $values;
+ }
+
+ public function loadConfig() {
+ $resource_type = $this->getResourceType();
+ $resource_name = $this->getResourceName();
+ $directive_name = $this->getDirectiveName();
+ $resource = $this->getResource();
+ $resource_names = $this->getResourceNames();
+ $data = $this->getData();
+ $items = array();
+
+ if (!is_array($data)) {
+ $data = array($data);
+ }
+ if (is_array($resource_names)) {
+ if (key_exists($directive_name, $resource_names)) {
+ $items = $resource_names[$directive_name];
+ } elseif (key_exists($resource, $resource_names)) {
+ $items = $resource_names[$resource];
+ }
+ }
+
+ /**
+ * Dirty hack to support *all* keyword in resource name list
+ * @TODO: Add an control property to support this type cases
+ */
+ if ($resource_type == 'Console' && preg_match('/Acl$/i', $directive_name) == 1) {
+ array_unshift($items, '*all*');
+ }
+
+ array_unshift($items, '');
+ $values = array();
+ for ($i = 0; $i < count($data); $i++) {
+ $values[] = array(
+ 'items' => $items,
+ 'directive_value' => $data[$i],
+ 'label' => $this->getDirectiveName(),
+ 'show' => $this->getShow()
+ );
+ }
+ $this->MultiComboBoxRepeater->DataSource = $values;
+ $this->MultiComboBoxRepeater->dataBind();
+ }
+
+ public function createMultiComboBoxElement($sender, $param) {
+ $param->Item->Label->Text = $param->Item->Data['label'];
+ $param->Item->Directive->DataSource = array_combine($param->Item->Data['items'], $param->Item->Data['items']);
+ $param->Item->Directive->setSelectedValue($param->Item->Data['directive_value']);
+ $param->Item->Directive->dataBind();
+ }
+
+ public function addField($sender, $param) {
+ $data = $this->getDirectiveValue();
+ $data[] = '';
+ $this->setData($data);
+ $this->loadConfig();
+ }
+}
+?>
--- /dev/null
+<com:TActiveRepeater ID="MultiComboBoxRepeater" OnItemDataBound="createMultiComboBoxElement">
+ <prop:ItemTemplate>
+ <div class="w3-row w3-margin-bottom<%=!$this->Data['show'] ? ' hide' : '';%>">
+ <div class="w3-col w3-quarter"><com:TActiveLabel ID="Label" ActiveControl.EnableUpdate="false" />:</div>
+ <div class="w3-col w3-threequarter directive_value">
+ <com:TActiveDropDownList ID="Directive"
+ CssClass="w3-input w3-border w3-twothird"
+ AutoPostBack="false"
+ ActiveControl.EnableUpdate="false"
+ /> <com:TActiveLinkButton ID="AddFieldBtn"
+ OnCommand="SourceTemplateControl.addField"
+ CommandParameter="add_multicombobox"
+ >
+ <i class="fa fa-plus" title="<%[ Add directive ]%>" alt="<%[ Add directive ]%>"></i>
+ </com:TActiveLinkButton>
+ <i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
+ </div>
+ </div>
+ </prop:ItemTemplate>
+</com:TActiveRepeater>
}
public function loadConfig() {
- $load_values = $this->getLoadValues();
- $host = $this->getHost();
- $component_type = $this->getComponentType();
- $component_name = $this->getComponentName();
$resource_type = $this->getResourceType();
$resource_name = $this->getResourceName();
$directive_name = $this->getDirectiveName();
Prado::using('Application.Web.Portlets.DirectiveSize');
Prado::using('Application.Web.Portlets.DirectiveSpeed');
Prado::using('Application.Web.Portlets.DirectiveTextBox');
+Prado::using('Application.Web.Portlets.DirectiveMultiComboBox');
Prado::using('Application.Web.Portlets.DirectiveMultiTextBox');
Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
Prado::using('Application.Web.Portlets.DirectiveRunscript');
'DirectiveSchedule',
'DirectiveMessages',
'DirectiveRunscript',
+ 'DirectiveMultiComboBox',
'DirectiveMultiTextBox'
);
$control->setResourceNames($this->SourceTemplateControl->getResourceNames());
$control->setShow($data['show']);
$control->setGroupName($data['group_name']);
+ $control->setResource($data['resource']);
$this->getControls()->add($control);
if (!$this->getPage()->IsCallBack || $this->getPage()->getCallbackEventParameter() === 'show_all_directives' || $this->getCmdParam() === 'show') {
/*