From: Marcin Haba Date: Sun, 22 Apr 2018 19:40:16 +0000 (+0200) Subject: baculum: Adapt Web and API to new framework version X-Git-Tag: Release-9.2.0~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7aa86aeed9928fafbb9b3cbaca5979ba4d0168f;p=thirdparty%2Fbacula.git baculum: Adapt Web and API to new framework version --- diff --git a/gui/baculum/index.php b/gui/baculum/index.php index 054752f399..dcff5387c2 100644 --- a/gui/baculum/index.php +++ b/gui/baculum/index.php @@ -26,9 +26,7 @@ */ define('APPLICATION_DIRECTORY', __DIR__); -require_once('./framework/prado.php'); - -// Start application -$application=new TApplication; +require 'framework/autoload.php'; +$application = new \Prado\TApplication; $application->run(); ?> diff --git a/gui/baculum/protected/API/Class/APIUrlMapping.php b/gui/baculum/protected/API/Class/APIUrlMapping.php index c07af0c842..5d4ba9c2a0 100644 --- a/gui/baculum/protected/API/Class/APIUrlMapping.php +++ b/gui/baculum/protected/API/Class/APIUrlMapping.php @@ -26,7 +26,7 @@ class APIUrlMapping extends TUrlMappingPattern { const SERVICE_ID = 'api'; - public function __construct(TUrlManager $manager) { + public function __construct(BaculumUrlMapping $manager) { parent::__construct($manager); $this->setServiceID(self::SERVICE_ID); } diff --git a/gui/baculum/protected/API/Class/Database.php b/gui/baculum/protected/API/Class/Database.php index be46e4f7b6..eea4cef3b0 100644 --- a/gui/baculum/protected/API/Class/Database.php +++ b/gui/baculum/protected/API/Class/Database.php @@ -20,7 +20,6 @@ * Bacula(R) is a registered trademark of Kern Sibbald. */ -Prado::using('System.interfaces'); Prado::using('Application.Common.Class.Errors'); Prado::using('Application.API.Class.BException'); Prado::using('Application.API.Class.APIModule'); diff --git a/gui/baculum/protected/Web/Class/WebUrlMapping.php b/gui/baculum/protected/Web/Class/WebUrlMapping.php index dd1068d68f..89cb6c4350 100644 --- a/gui/baculum/protected/Web/Class/WebUrlMapping.php +++ b/gui/baculum/protected/Web/Class/WebUrlMapping.php @@ -26,7 +26,7 @@ class WebUrlMapping extends TUrlMappingPattern { const SERVICE_ID = 'web'; - public function __construct(TUrlManager $manager) { + public function __construct(BaculumUrlMapping $manager) { parent::__construct($manager); $this->setServiceID(self::SERVICE_ID); } diff --git a/gui/baculum/protected/Web/Pages/RestoreWizard.page b/gui/baculum/protected/Web/Pages/RestoreWizard.page index 289bf9e9bc..100c330546 100644 --- a/gui/baculum/protected/Web/Pages/RestoreWizard.page +++ b/gui/baculum/protected/Web/Pages/RestoreWizard.page @@ -344,7 +344,8 @@ oJobsToRestoreList.init(); ShowHeader="false" CssClass="file-browser-detail" ItemStyle.CssClass="file-browser-element" - DataKeyField="fileid"> + DataKeyField="fileid" + >
<%[ It seems that there is no files for choosing or file records in database for this job has been purged (file retention period expired) ]%> @@ -352,7 +353,7 @@ oJobsToRestoreList.init(); - + <%=$this->getParent()->Data['type'] == 'dir' ? 'directory' : 'file' %> <%=($this->getParent()->Data['name'] != '/') ? preg_replace('/\/$/', '', $this->getParent()->Data['name']) : '/'%>
<%=isset($this->getParent()->Data['lstat']['size']) ? $this->getParent()->Data['lstat']['size'] : '0'%>
-
- - - document.getElementById('restore-browser-files-loading').style.display = 'block'; - - - document.getElementById('restore-browser-files-loading').style.display = 'none'; - - +
@@ -481,8 +465,8 @@ oJobsToRestoreList.init();
- @@ -496,7 +480,7 @@ oJobsToRestoreList.init(); DataKeyField="fileid" > -
+
<%[ For add a file to restore please click 'Add' link or drag a file from frame on left or from above frame and drop it here ]%>
@@ -515,13 +499,10 @@ oJobsToRestoreList.init(); - - +
@@ -530,6 +511,15 @@ oJobsToRestoreList.init(); var browser = document.getElementById('restore-browser-files'); document.getElementById('restore-browser-files-loading').style.width = browser.offsetWidth + 'px'; document.getElementById('restore-browser-files-loading').style.height = browser.offsetHeight + 'px'; + function make_draggable() { + $('.draggable').draggable({ + 'helper':"clone", + 'scroll':false, + 'appendTo':"body", + 'containment':"window" + }); + } + make_draggable('<%=$this->getPage()->DataGridFiles->ClientID%>'); @@ -557,8 +547,8 @@ oJobsToRestoreList.init(); - - + + diff --git a/gui/baculum/protected/Web/Pages/RestoreWizard.php b/gui/baculum/protected/Web/Pages/RestoreWizard.php index 8e023cae3d..b92b480833 100644 --- a/gui/baculum/protected/Web/Pages/RestoreWizard.php +++ b/gui/baculum/protected/Web/Pages/RestoreWizard.php @@ -24,11 +24,11 @@ Prado::using('Application.Web.Class.BaculumWebPage'); Prado::using('System.Exceptions.TException'); Prado::using('System.Web.UI.WebControls.TWizard'); Prado::using('System.Web.UI.WebControls.TDataGrid'); +Prado::using('System.Web.UI.JuiControls.TJuiDroppable'); Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton'); Prado::using('System.Web.UI.ActiveControls.TActiveImageButton'); -Prado::using('System.Web.UI.ActiveControls.TDropContainer'); -Prado::using('System.Web.UI.ActiveControls.TDraggable'); Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid'); +Prado::using('System.Web.UI.ActiveControls.TActiveRepeater'); Prado::using('System.Web.UI.ActiveControls.TCallback'); Prado::using('System.Web.UI.ActiveControls.TActiveTextBox'); @@ -486,17 +486,17 @@ class RestoreWizard extends BaculumWebPage $fileid = null; $source_element_id = null; $file_prop = array(); - if (isset($param->CallbackParameter)) { + if (get_class($param) == 'Prado\Web\UI\ActiveControls\TCallbackEventParameter') { $id_parts = explode('_', $sender->ClientID, 6); $source_element_id = $id_parts[3]; $fileid = $param->CallbackParameter; } else { - $control = $param->getDroppedControl(); + $control = $param->DraggableControl; $item = $control->getNamingContainer(); - $id_parts = explode('_', $param->getDragElementID(), 6); + $id_parts = explode('_', $control->ClientID, 6); $source_element_id = $id_parts[3]; } - if($source_element_id == $this->VersionsDataGrid->ID) { + if ($source_element_id == $this->VersionsDataGrid->ID) { if (is_null($fileid)) { $fileid = $this->VersionsDataGrid->getDataKeys()->itemAt($item->getItemIndex()); } diff --git a/gui/baculum/protected/Web/Pages/StorageView.page b/gui/baculum/protected/Web/Pages/StorageView.page index 466b111814..2f4cbc7e5e 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.page +++ b/gui/baculum/protected/Web/Pages/StorageView.page @@ -128,9 +128,9 @@ - <%#$this->DataItem%> + <%#$this->Data%> <%=$this->TemplateControl->IsAutochanger ? $this->TemplateControl->getDeviceName() : '-'%> - + diff --git a/gui/baculum/protected/Web/Pages/Users.page b/gui/baculum/protected/Web/Pages/Users.page index f92d7a3d33..13f85fa031 100644 --- a/gui/baculum/protected/Web/Pages/Users.page +++ b/gui/baculum/protected/Web/Pages/Users.page @@ -49,20 +49,20 @@ - <%=$this->DataItem['user']%> - <%=$this->DataItem['admin'] ? Prado::localize('Administrator') : Prado::localize('Normal user')%> + <%=$this->Data['user']%> + <%=$this->Data['admin'] ? Prado::localize('Administrator') : Prado::localize('Normal user')%> - + Main - - - + @@ -70,7 +70,7 @@ - DataItem['admin'] ? 'style="visibility: hidden"' : ''%> onclick="Users.rmUser('<%=$this->DataItem['user']%>')"> + Data['admin'] ? 'style="visibility: hidden"' : ''%> onclick="Users.rmUser('<%=$this->Data['user']%>')">  <%[ Remove user ]%> @@ -79,8 +79,8 @@
<%[ Password: ]%> - - + +  <%[ Save ]%> diff --git a/gui/baculum/protected/Web/Portlets/BConditional.php b/gui/baculum/protected/Web/Portlets/BConditional.php index 329a1b0433..dc36213455 100644 --- a/gui/baculum/protected/Web/Portlets/BConditional.php +++ b/gui/baculum/protected/Web/Portlets/BConditional.php @@ -46,8 +46,8 @@ class BConditional extends TTemplateControl implements IActiveControl { parent::onLoad($param); } - public function bubbleEvent($sender,$param) { - if ($param instanceof TCommandEventParameter) { + public function bubbleEvent($sender, $param) { + if ($param instanceof Prado\Web\UI\TCommandEventParameter) { $this->raiseBubbleEvent($this, $param); return true; } else { @@ -91,7 +91,7 @@ class BConditional extends TTemplateControl implements IActiveControl { } public function setTrueTemplate($template) { - if ($template instanceof ITemplate) { + if ($template instanceof Prado\Web\UI\ITemplate) { $this->item_true_template = $template; } } @@ -101,7 +101,7 @@ class BConditional extends TTemplateControl implements IActiveControl { } public function setFalseTemplate($template) { - if ($template instanceof ITemplate) { + if ($template instanceof Prado\Web\UI\ITemplate) { $this->item_false_template = $template; } } @@ -112,8 +112,7 @@ class BConditional extends TTemplateControl implements IActiveControl { } public function getBCondition() { - $value = $this->getViewState(self::BCONDITION); - return $value; + return $this->getViewState(self::BCONDITION); } public function dataBind() { @@ -151,7 +150,7 @@ class BConditionalItem extends TTemplateControl implements IDataRenderer, INamin } public function bubbleEvent($sender,$param) { - if ($param instanceof TCommandEventParameter) { + if ($param instanceof Prado\Web\UI\TCommandEventParameter) { $this->raiseBubbleEvent($this, $param); return true; } else { diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.php b/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.php index c0872e3f16..dba176a42e 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.php +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.php @@ -67,9 +67,9 @@ class BaculaConfigComponents extends ComponentListTemplate { for ($i = 0; $i < count($controls); $i++) { $control = $this->getChildControl($param->Item, $controls[$i]); if (is_object($control)) { - $control->setHost($param->Item->DataItem['host']); - $control->setComponentType($param->Item->DataItem['component_type']); - $control->setComponentName($param->Item->DataItem['component_name']); + $control->setHost($param->Item->Data['host']); + $control->setComponentType($param->Item->Data['component_type']); + $control->setComponentName($param->Item->Data['component_name']); } } } diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.tpl b/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.tpl index 24b5892c64..425fc6450d 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.tpl +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigComponents.tpl @@ -12,7 +12,7 @@ ClientSide.OnLoading="BaculaConfig.loader_start(sender.options.ID);" ClientSide.OnComplete="BaculaConfig.set_config_items(sender.options.ID);" Attributes.onclick="return BaculaConfig.unset_config_items(this.id);" - Text="<%=$this->DataItem['label']%>: <%=$this->DataItem['component_name']%>" + Text="<%=$this->Data['label']%>: <%=$this->Data['component_name']%>" Style="text-decoration: none" />