From: Marcin Haba Date: Sun, 4 Aug 2019 08:49:06 +0000 (+0200) Subject: baculum: Change way of working directive renderer X-Git-Tag: Release-9.6.0~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86fbac388cb030f79a32dd559df2cf47f6af086;p=thirdparty%2Fbacula.git baculum: Change way of working directive renderer --- diff --git a/gui/baculum/protected/Web/Pages/JobHistoryView.page b/gui/baculum/protected/Web/Pages/JobHistoryView.page index 5468ff2c0..cb7a83c2d 100644 --- a/gui/baculum/protected/Web/Pages/JobHistoryView.page +++ b/gui/baculum/protected/Web/Pages/JobHistoryView.page @@ -16,7 +16,6 @@ Text="<%[ Configure job ]%>" Visible="<%=!empty($_SESSION['dir'])%>" OnClick="loadJobConfig" - CommandParameter="show" />
diff --git a/gui/baculum/protected/Web/Pages/JobView.page b/gui/baculum/protected/Web/Pages/JobView.page index a79f5c1a8..95310957b 100644 --- a/gui/baculum/protected/Web/Pages/JobView.page +++ b/gui/baculum/protected/Web/Pages/JobView.page @@ -16,7 +16,6 @@ Text="<%[ Configure job ]%>" Visible="<%=!empty($_SESSION['dir'])%>" OnClick="loadJobConfig" - CommandParameter="show" />
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveCheckBox.tpl b/gui/baculum/protected/Web/Portlets/DirectiveCheckBox.tpl index 27e7a8337..dd124839b 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveCheckBox.tpl +++ b/gui/baculum/protected/Web/Portlets/DirectiveCheckBox.tpl @@ -1,4 +1,4 @@ -
+
:
+
:
+
:
+
:
-
+
:
-
+
:
+
:
createItemInternal(); + } + + public function createItemInternal() { $data = $this->getData(); - $this->createItem($data); + $item = $this->createItem($data); + + $this->addParsedObject($item); + + if ($item instanceof DirectiveTemplate) { + $item->createDirective(); + } elseif ($item instanceof DirectiveListTemplate) { + $item->loadConfig(null, null); + } } public function createItem($data) { @@ -96,8 +107,6 @@ class DirectiveRenderer extends DirectiveListTemplate implements IItemDataRender $control->setGroupName($data['group_name']); $control->setParentName($data['parent_name']); $control->setResourceNames($this->SourceTemplateControl->getResourceNames()); - $this->getControls()->add($control); - $control->createDirective(); } elseif (in_array($type, $this->directive_list_types)) { $control->setHost($data['host']); $control->setComponentType($data['component_type']); @@ -112,29 +121,8 @@ class DirectiveRenderer extends DirectiveListTemplate implements IItemDataRender $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') { - /* - * List types should be loaded only by load request, not by callback request. - * Otherwise OnLoad above is called during callback and overwrites data in controls. - */ - $control->raiseEvent('OnDirectiveListLoad', $this, null); - } } - } - - public function getItemIndex() { - return $this->getViewState(self::ITEM_INDEX, 0); - } - - public function setItemIndex($item_index) { - $this->setViewState(self::ITEM_INDEX, $item_index); - } - - public function getItemType() { - } - - public function setItemType($item_type) { + return $control; } public function getData() { diff --git a/gui/baculum/protected/Web/Portlets/DirectiveSize.tpl b/gui/baculum/protected/Web/Portlets/DirectiveSize.tpl index d481c68ff..695702a04 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveSize.tpl +++ b/gui/baculum/protected/Web/Portlets/DirectiveSize.tpl @@ -1,4 +1,4 @@ -
+
:
+
:
+
:
+
:
clientid] = $clients[$i]->name; } - asort($client_list); - $this->Client->dataSource = $client_list; + uksort($client_list, 'sort_client_list'); + $this->Client->DataSource = $client_list; $this->Client->dataBind(); } @@ -99,4 +99,12 @@ class FileSetBrowser extends Portlets { return $this->getViewState(self::PATH, '/'); } } + +function sort_client_list($a, $b) { + if ($a === 'none') { + return -1; + } else { + return strcmp($a, $b); + } +} ?> diff --git a/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl b/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl index 4fae10dd8..61fe5a424 100644 --- a/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl +++ b/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl @@ -1,5 +1,5 @@
-
+
Client->ClientID%>').value = ''; + document.getElementById('<%=$this->Client->ClientID%>').value = 'none'; }, ls_items: function(path) { var dpath;