From: Marcin Haba Date: Sat, 19 Dec 2015 18:59:01 +0000 (+0100) Subject: baculum: Add possibility to open configuration windows from URL X-Git-Tag: Release-7.4.0~104 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bcdcd816568d25c035ba382f295df2e165cb083e;p=bacula%2Fbacula baculum: Add possibility to open configuration windows from URL The URL format is: ?open=(Storage|Client|Volume|Pool|Job)&id=(storageid|clientid|volumeid|poolid|jobid) --- diff --git a/gui/baculum/protected/JavaScript/configuration-window.js b/gui/baculum/protected/JavaScript/configuration-window.js index cd4ff3fb3a..2acb06db4b 100644 --- a/gui/baculum/protected/JavaScript/configuration-window.js +++ b/gui/baculum/protected/JavaScript/configuration-window.js @@ -93,6 +93,21 @@ var ConfigurationWindowClass = new Class.create({ $(tab_rel).show(); }, + switchTabByNo: function(tab_no) { + var tab_rel; + var tabs = $$('div[id=' + this.window_id + '] span.tab'); + for (var i = 0, j = 1; i < tabs.length; i++, j++) { + if (tab_no === j) { + tab_rel = tabs[i].readAttribute('rel'); + break; + } + } + + if (tab_rel) { + this.switchTab(tab_rel); + } + }, + openConfigurationWindow: function(slideWindowObj) { if(this.is_progress() === false) { this.progress(true); diff --git a/gui/baculum/protected/JavaScript/slide-window.js b/gui/baculum/protected/JavaScript/slide-window.js index 504b23c719..202ee88845 100644 --- a/gui/baculum/protected/JavaScript/slide-window.js +++ b/gui/baculum/protected/JavaScript/slide-window.js @@ -18,6 +18,7 @@ var SlideWindowClass = Class.create({ checked: [], objects: {}, windowSize: null, + initElementId: null, size: { widthNormal : '53%', @@ -250,6 +251,14 @@ var SlideWindowClass = Class.create({ if (opts.hasOwnProperty('actions_obj')) { this.actionsRequest = opts.actions_obj; } + + if (this.initElementId) { + this.openConfigurationById(this.initElementId); + this.initElementId = null; + // for open window by init element, default set second tab + this.configurationObj.switchTabByNo(2); + } + this.showProgress(false); this.markAllChecked(false); this.setLoadRequest(); @@ -271,9 +280,7 @@ var SlideWindowClass = Class.create({ var el = $(element).down('input[type=hidden]') if(el) { var val = el.getValue(); - this.loadRequest.ActiveControl.CallbackParameter = val; - this.loadRequest.dispatch(); - this.configurationObj.openConfigurationWindow(this); + this.openConfigurationById(val); } }.bind(this); this.setSearch(); @@ -292,6 +299,12 @@ var SlideWindowClass = Class.create({ this.revertSortingFromCookie(); }, + openConfigurationById: function(id) { + this.loadRequest.ActiveControl.CallbackParameter = id; + this.loadRequest.dispatch(); + this.configurationObj.openConfigurationWindow(this); + }, + isConfigurationOpen: function() { var is_open = false; $$(this.elements.configurationWindows, this.elements.configurationProgress).each(function(el) { @@ -580,6 +593,9 @@ var SlideWindowClass = Class.create({ } } return el; + }, + setInitElementId: function(id) { + this.initElementId = id; } }); diff --git a/gui/baculum/protected/Pages/Home.page b/gui/baculum/protected/Pages/Home.page index 3923aa6fe3..cadfe132f7 100644 --- a/gui/baculum/protected/Pages/Home.page +++ b/gui/baculum/protected/Pages/Home.page @@ -51,7 +51,7 @@ }); - + showTip( this, @@ -151,7 +151,7 @@
- + @@ -227,9 +227,12 @@ diff --git a/gui/baculum/protected/Pages/Home.php b/gui/baculum/protected/Pages/Home.php index 9cf0aaeac2..666ceee417 100644 --- a/gui/baculum/protected/Pages/Home.php +++ b/gui/baculum/protected/Pages/Home.php @@ -32,7 +32,11 @@ class Home extends BaculumPage public $openWindow = null; - public $windowIds = array('Storage', 'Client', 'Media', 'Pool', 'Job', 'JobRun'); + public $initWindowId = null; + + public $initElementId = null; + + public $windowIds = array('Storage', 'Client', 'Volume', 'Pool', 'Job', 'JobRun'); public function onInit($param) { parent::onInit($param); @@ -49,7 +53,7 @@ class Home extends BaculumPage $appConfig = $this->getModule('configuration')->getApplicationConfig(); $this->SettingsWizardBtn->Visible = $this->User->getIsAdmin(); - $this->MediaBtn->Visible = $this->User->getIsAdmin(); + $this->VolumeBtn->Visible = $this->User->getIsAdmin(); $this->ClearBvfsCache->Visible = $this->User->getIsAdmin(); $this->Logging->Visible = $this->User->getIsAdmin(); @@ -122,9 +126,13 @@ class Home extends BaculumPage } public function setWindowOpen() { - if (isset($this->Request['open']) && in_array($this->Request['open'], $this->windowIds)) { + if (isset($this->Request['open']) && in_array($this->Request['open'], $this->windowIds) && $this->Request['open'] != 'JobRun') { $btn = $this->Request['open'] . 'Btn'; $this->openWindow = $this->{$btn}->ClientID; + if (isset($this->Request['id']) && (is_numeric($this->Request['id']))) { + $this->initWindowId = $this->Request['open']; + $this->initElementId = $this->Request['id']; + } } } } diff --git a/gui/baculum/protected/Portlets/VolumeList.php b/gui/baculum/protected/Portlets/VolumeList.php index 0465e03990..78929a3406 100644 --- a/gui/baculum/protected/Portlets/VolumeList.php +++ b/gui/baculum/protected/Portlets/VolumeList.php @@ -68,7 +68,7 @@ class VolumeList extends Portlets implements ISlideWindow { } public function prepareData($forceReload = false) { - $allowedButtons = array('MediaBtn', 'ReloadVolumes'); + $allowedButtons = array('VolumeBtn', 'ReloadVolumes'); if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) { if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) { $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID);