]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Add possibility to execute actions on multiple volumes and jobs at a time...
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 15:38:42 +0000 (16:38 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 15:48:03 +0000 (16:48 +0100)
32 files changed:
gui/baculum/protected/JavaScript/configuration-window.js
gui/baculum/protected/JavaScript/slide-window.js
gui/baculum/protected/Pages/Home.page
gui/baculum/protected/Portlets/ClientConfiguration.php
gui/baculum/protected/Portlets/ClientConfiguration.tpl
gui/baculum/protected/Portlets/ClientList.php
gui/baculum/protected/Portlets/ClientList.tpl
gui/baculum/protected/Portlets/ConfigurationPanel.tpl
gui/baculum/protected/Portlets/ISlideWindow.php [new file with mode: 0644]
gui/baculum/protected/Portlets/JobConfiguration.php
gui/baculum/protected/Portlets/JobConfiguration.tpl
gui/baculum/protected/Portlets/JobList.php
gui/baculum/protected/Portlets/JobList.tpl
gui/baculum/protected/Portlets/JobRunConfiguration.php
gui/baculum/protected/Portlets/JobRunConfiguration.tpl
gui/baculum/protected/Portlets/JobRunList.php
gui/baculum/protected/Portlets/JobRunList.tpl
gui/baculum/protected/Portlets/PoolConfiguration.php
gui/baculum/protected/Portlets/PoolConfiguration.tpl
gui/baculum/protected/Portlets/PoolList.php
gui/baculum/protected/Portlets/PoolList.tpl
gui/baculum/protected/Portlets/Portlets.php
gui/baculum/protected/Portlets/SlideWindow.php
gui/baculum/protected/Portlets/SlideWindow.tpl
gui/baculum/protected/Portlets/StorageConfiguration.php
gui/baculum/protected/Portlets/StorageConfiguration.tpl
gui/baculum/protected/Portlets/StorageList.php
gui/baculum/protected/Portlets/StorageList.tpl
gui/baculum/protected/Portlets/VolumeConfiguration.php
gui/baculum/protected/Portlets/VolumeConfiguration.tpl
gui/baculum/protected/Portlets/VolumeList.php
gui/baculum/protected/Portlets/VolumeList.tpl

index 6bd47ae08260733481c477613dc837cf3493e6fa..dbbe28268d9afdd4bcb1d2e2f30516b38db2007f 100644 (file)
@@ -1,6 +1,12 @@
 var ConfigurationWindowClass = new Class.create({
+       objects: {},
+
        initialize: function(id) {
-               this.window_id = id + 'configuration';
+               if(typeof(id) == "undefined") {
+                       return;
+               }
+               var prefix = id.replace('Window', 'Configuration');
+               this.window_id = prefix + 'configuration';
                this.progress_id = 'configuration-progress';
                this.lock = false;
        },
@@ -15,6 +21,24 @@ var ConfigurationWindowClass = new Class.create({
                }.bind(this));
        },
 
+       objectExists: function(key) {
+               return this.objects.hasOwnProperty(key);
+       },
+
+       registerObj: function(key, obj) {
+               if(this.objectExists(key) === false) {
+                       this.objects[key] = obj;
+               }
+       },
+
+       getObj: function(key) {
+               var obj = null;
+               if(this.objectExists(key) === true) {
+                       obj = this.objects[key];
+               }
+               return obj;
+       },
+
        hide: function() {
                $(this.window_id).setStyle({'display' : 'none'});
        },
@@ -46,3 +70,4 @@ var ConfigurationWindowClass = new Class.create({
        }
 });
 
+var ConfigurationWindow = new ConfigurationWindowClass();
index 9a485546d90a7410249fc53cc16dedeaade9b592..ed9857410e0876fb141e444f39b3172492dc486f 100644 (file)
@@ -11,6 +11,8 @@ var SlideWindowClass = Class.create({
        loadRequest : null,
        repeaterEl: null,
        gridEl: null,
+       checked: [],
+       objects: {},
 
        size: {
                widthNormal : '437px',
@@ -28,11 +30,16 @@ var SlideWindowClass = Class.create({
                contentItems : 'slide-window-element',
                contentAlternatingItems : 'slide-window-element-alternating',
                toolsButtonSuffix : '-slide-window-tools',
+               actionsSuffix : '-slide-window-actions',
                toolbarSuffix : '-slide-window-toolbar',
                titleSuffix : '-slide-window-title'
        },
 
        initialize: function(windowId, data) {
+               if(typeof(windowId) == "undefined") {
+                       return;
+               }
+
                this.windowId = windowId;
                this.window = $(this.windowId + this.elements.containerSuffix);
                this.tools = $(this.windowId + this.elements.toolsButtonSuffix);
@@ -67,6 +74,24 @@ var SlideWindowClass = Class.create({
                this.setEvents();
        },
 
+       objectExists: function(key) {
+               return this.objects.hasOwnProperty(key);
+       },
+
+       registerObj: function(key, obj) {
+               if(this.objectExists(key) === false) {
+                       this.objects[key] = obj;
+               }
+       },
+
+       getObj: function(key) {
+               var obj = null;
+               if(this.objectExists(key) === true) {
+                       obj = this.objects[key];
+               }
+               return obj;
+       },
+
        setEvents: function() {
                this.showEl.observe('click', function(){
                        this.openWindow();
@@ -166,7 +191,9 @@ var SlideWindowClass = Class.create({
                this.repeaterEl = repeaterEl;
                this.gridEl = gridEl;
                this.loadRequest = requestObj;
+               this.markAllChecked(false);
                this.setLoadRequest();
+               this.postWindowOpen();
        },
 
        setLoadRequest: function() {
@@ -179,8 +206,15 @@ var SlideWindowClass = Class.create({
                }
 
                dataList.each(function(tr) {
-                       $(tr).observe('click', function() {
-                               var el = $(tr).down('input')
+                       $(tr).observe('click', function(index, clickedEl) {
+                               var target = clickedEl.target || clickedEl.srcElement;
+                               var clicked = $(target.id);
+                               // for element selection action (clicked checkbox) configuration window is not open
+                               if(clicked && clicked.hasAttribute('type') && clicked.readAttribute('type') == 'checkbox') {
+                                       return;
+                               }
+
+                               var el = $(tr).down('input[type=hidden]')
                                if(el) {
                                        var val = el.getValue();
                                        this.loadRequest.ActiveControl.CallbackParameter = val;
@@ -231,7 +265,7 @@ var SlideWindowClass = Class.create({
                } else {
                        return;
                }
-               while (--i >= 0) (function (i) {
+               while (--i >= 1) (function (i) {
                        var dir = 1;
                        th[i].addEventListener('click', function () {
                                self.sortTable(i, (dir = 1 - dir));
@@ -265,10 +299,120 @@ var SlideWindowClass = Class.create({
                $(count_el).update(' (' + elements_count + ')');
        },
        toggleToolbar: function() {
+               if (this.isToolbarOpen() === false) {
+                       this.markAllChecked(false);
+               }
                Effect.toggle($(this.windowId + this.elements.toolbarSuffix), 'slide', { duration: 0.2});
+       },
+       isToolbarOpen: function() {
+               return $(this.windowId + this.elements.toolbarSuffix).visible();
+       },
+       setActions: function() {
+               var table = $(this.window).down('table');
+               var checkboxes = table.select('input[name="actions_checkbox"]');
+               checkboxes.each(function(el) {
+                       el.observe('change', function() {
+                               var is_checked = this.is_any_checked(checkboxes);
+                               if(is_checked === true && !this.areActionsOpen()) {
+                                       this.showActions();
+                               } else if (is_checked === false && this.areActionsOpen()) {
+                                       this.hideActions();
+                               }
+                       }.bind(this));
+                }.bind(this));
+       },
+       is_any_checked: function(checkboxes) {
+               var is_checked = false;
+               checkboxes.each(function(ch) {
+                       if(ch.checked == true) {
+                               is_checked = true;
+                               throw $break;
+                       }
+               });
+               return is_checked;
+       },
+
+       markAllChecked: function(check) {
+               this.checked = [];
+               var table = $(this.window).down('table');
+               var checkboxes = table.select('input[name="actions_checkbox"]');
+               var containerId;
+               if(checkboxes.length > 0) {
+                       checkboxes.each(function(ch, index) {
+                               if (ch.up('tr').visible()) {
+                                       containerId = ch.getAttribute('rel');
+                                       if (ch.checked == false && check == true) {
+                                               ch.checked = true;
+                                       } else if (ch.checked == true && check == false) {
+                                               ch.checked = false;
+                                       }
+                                       this.markChecked(containerId, ch.checked, ch.value);
+                               }
+                       }.bind(this));
+                       this.packChecked(containerId);
+               }
+
+               if(check) {
+                       this.showActions();
+               } else {
+                       this.hideActions();
+               }
+       },
+       markChecked: function(containerId, checked, param, pack) {
+               if (this.checked.length == 0) {
+                       if(checked == true) {
+                               this.checked.push(param);
+                       }
+               } else {
+                       index = this.checked.indexOf(param);
+                       if(checked === true && index == -1) {
+                               this.checked.push(param);
+                       } else if (checked === false && index > -1) {
+                               this.checked.splice(index, 1);
+                       }
+               }
+
+               if(checked == true) {
+                       this.showActions();
+               } else if(this.checked.length == 0) {
+                       this.hideActions();
+               }
+
+               if (pack === true) {
+                       this.packChecked(containerId);
+               }
+       },
+       packChecked: function(containerId) {
+               var values_packed = this.checked.join(';');
+               $(containerId).setValue(values_packed);
+       },
+       showActions: function() {
+               if (this.areActionsOpen()) {
+                       return;
+               }
+               if (this.isToolbarOpen()) {
+                       this.toggleToolbar();
+               }
+               Effect.toggle($(this.windowId + this.elements.actionsSuffix), 'slide', { duration: 0.2});
+       },
+       hideActions: function() {
+               if (!this.areActionsOpen()) {
+                       return;
+               }
+               this.checked = [];
+               Effect.toggle($(this.windowId + this.elements.actionsSuffix), 'slide', { duration: 0.2});
+       },
+       areActionsOpen: function() {
+               return $(this.windowId + this.elements.actionsSuffix).visible();
+       },
+       postWindowOpen: function() {
+               this.setActions();
+               this.setElementsCount();
        }
 });
 
+var SlideWindow = new SlideWindowClass()
+
 document.observe("dom:loaded", function() {
        if(Prototype.Browser.IE  || Prototype.Browser.Gecko) {
                $$('input[type=checkbox], input[type=submit], input[type=radio], a').each(function(el) {
index ea96fb0a443f2a8bb0050ba349cd284c85f5bd32..7d6c0e3def1511aecf69f70e5b3b621636778cbb 100644 (file)
@@ -6,24 +6,24 @@
                <div id="directors"><com:TLabel ForControl="Director" Text="<%[ Director: ]%>" /> <com:TActiveDropDownList ID="Director" OnTextChanged="director" /></div>
                </div>
                <div id="menu-left">
-                       <com:TActiveButton ID="StorageBtn" CssClass="storage-btn" Attributes.onmouseover="javascript:showTip(this, 'Storage Daemons', 'Configuration of storage daemons.');" ClientSide.OnLoading="$('<%=$this->StorageWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->StorageWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->StorageBtn->ClientID%>SlideWindow.setElementsCount();storageSlideWindowObj.setWindowElementsEvent('<%=$this->StorageWindow->Repeater->ClientID%>', '<%=$this->StorageWindow->DataGrid->ClientID%>', <%=$this->StorageWindow->DataElementCall->ActiveControl->Javascript%>);" />
-                       <com:TActiveButton ID="ClientBtn" CssClass="client-btn" Attributes.onmouseover="javascript:showTip(this, 'Clients', 'Configuration of clients daemons.');" ClientSide.OnLoading="$('<%=$this->ClientWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->ClientWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->ClientBtn->ClientID%>SlideWindow.setElementsCount();clientSlideWindowObj.setWindowElementsEvent('<%=$this->ClientWindow->Repeater->ClientID%>', '<%=$this->ClientWindow->DataGrid->ClientID%>', <%=$this->ClientWindow->DataElementCall->ActiveControl->Javascript%>);" />
-                       <com:TActiveButton ID="MediaBtn" CssClass="media-btn" Attributes.onmouseover="javascript:showTip(this, 'Volumes', 'Management of volumes.');" ClientSide.OnLoading="$('<%=$this->VolumeWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->VolumeWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->MediaBtn->ClientID%>SlideWindow.setElementsCount();volumeSlideWindowObj.setWindowElementsEvent('<%=$this->VolumeWindow->Repeater->ClientID%>', '<%=$this->VolumeWindow->DataGrid->ClientID%>', <%=$this->VolumeWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="StorageBtn" CssClass="storage-btn" Attributes.onmouseover="javascript:showTip(this, 'Storage Daemons', 'Configuration of storage daemons.');" ClientSide.OnLoading="$('VolumeWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('StorageWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('StorageWindow').setWindowElementsEvent('<%=$this->StorageWindow->Repeater->ClientID%>', '<%=$this->StorageWindow->DataGrid->ClientID%>', <%=$this->StorageWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="ClientBtn" CssClass="client-btn" Attributes.onmouseover="javascript:showTip(this, 'Clients', 'Configuration of clients daemons.');" ClientSide.OnLoading="$('ClientWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('ClientWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('ClientWindow').setWindowElementsEvent('<%=$this->ClientWindow->Repeater->ClientID%>', '<%=$this->ClientWindow->DataGrid->ClientID%>', <%=$this->ClientWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="MediaBtn" CssClass="media-btn" Attributes.onmouseover="javascript:showTip(this, 'Volumes', 'Management of volumes.');" ClientSide.OnLoading="$('VolumeWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('VolumeWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('VolumeWindow').setWindowElementsEvent('<%=$this->VolumeWindow->Repeater->ClientID%>', '<%=$this->VolumeWindow->DataGrid->ClientID%>', <%=$this->VolumeWindow->DataElementCall->ActiveControl->Javascript%>);" />
 
-                       <com:TActiveButton ID="PoolBtn" CssClass="pool-btn" Attributes.onmouseover="javascript:showTip(this, 'Pools', 'Management of volumes pools.');" ClientSide.OnLoading="$('<%=$this->PoolWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->PoolWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->PoolBtn->ClientID%>SlideWindow.setElementsCount();poolSlideWindowObj.setWindowElementsEvent('<%=$this->PoolWindow->Repeater->ClientID%>', '<%=$this->PoolWindow->DataGrid->ClientID%>', <%=$this->PoolWindow->DataElementCall->ActiveControl->Javascript%>);" />
-                       <com:TActiveButton ID="JobBtn" CssClass="job-btn" Attributes.onmouseover="javascript:showTip(this, 'Jobs', 'Jobs settings.');" ClientSide.OnLoading="$('<%=$this->JobWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->JobWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->JobBtn->ClientID%>SlideWindow.setElementsCount();jobSlideWindowObj.setWindowElementsEvent('<%=$this->JobWindow->Repeater->ClientID%>', '<%=$this->JobWindow->DataGrid->ClientID%>', <%=$this->JobWindow->DataElementCall->ActiveControl->Javascript%>);" />
-                       <com:TActiveButton ID="JobRunBtn" CssClass="jobrun-btn" Attributes.onmouseover="javascript:showTip(this, 'Run job', 'Starting jobs.');" ClientSide.OnLoading="$('<%=$this->JobRunWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('<%=$this->JobRunWindow->Controls[0]->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});<%=$this->JobRunBtn->ClientID%>SlideWindow.setElementsCount();jobRunSlideWindowObj.setWindowElementsEvent('<%=$this->JobRunWindow->Repeater->ClientID%>', '<%=$this->JobRunWindow->DataGrid->ClientID%>', <%=$this->JobRunWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="PoolBtn" CssClass="pool-btn" Attributes.onmouseover="javascript:showTip(this, 'Pools', 'Management of volumes pools.');" ClientSide.OnLoading="$('PoolWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('PoolWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('PoolWindow').setWindowElementsEvent('<%=$this->PoolWindow->Repeater->ClientID%>', '<%=$this->PoolWindow->DataGrid->ClientID%>', <%=$this->PoolWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="JobBtn" CssClass="job-btn" Attributes.onmouseover="javascript:showTip(this, 'Jobs', 'Jobs settings.');" ClientSide.OnLoading="$('JobWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('JobWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('JobWindow').setWindowElementsEvent('<%=$this->JobWindow->Repeater->ClientID%>', '<%=$this->JobWindow->DataGrid->ClientID%>', <%=$this->JobWindow->DataElementCall->ActiveControl->Javascript%>);" />
+                       <com:TActiveButton ID="JobRunBtn" CssClass="jobrun-btn" Attributes.onmouseover="javascript:showTip(this, 'Run job', 'Starting jobs.');" ClientSide.OnLoading="$('JobRunWindow-slide-window-progress').setStyle({'display': 'block'});" ClientSide.OnComplete="$('JobRunWindow-slide-window-progress').setStyle({'display': 'none'});SlideWindow.getObj('JobRunWindow').setWindowElementsEvent('<%=$this->JobRunWindow->Repeater->ClientID%>', '<%=$this->JobRunWindow->DataGrid->ClientID%>', <%=$this->JobRunWindow->DataElementCall->ActiveControl->Javascript%>);" />
                        <com:TActiveButton CssClass="restore-btn" OnClick="restore" Attributes.onmouseover="javascript:showTip(this, 'Restore', 'Restore wizard.');" />
                        <com:TActiveButton ID="SettingsWizardBtn" CssClass="setting-btn" OnClick="configuration" Attributes.onmouseover="javascript:showTip(this, 'Settings', 'Management settings wizard.');" />
                </div>
                <com:TActivePanel ID="Content">
                        <div id="content">
-                               <com:Application.Portlets.StorageList ID="StorageWindow" ShowID="<%=$this->StorageBtn->ClientID%>" WindowTitle="<%[ Storage Daemons ]%>" />
-                               <com:Application.Portlets.ClientList ID="ClientWindow" ShowID="<%=$this->ClientBtn->ClientID%>" WindowTitle="<%[ Clients ]%>" />
-                               <com:Application.Portlets.VolumeList ID="VolumeWindow" ShowID="<%=$this->MediaBtn->ClientID%>" WindowTitle="<%[ Volumes ]%>" />
-                               <com:Application.Portlets.PoolList ID="PoolWindow" ShowID="<%=$this->PoolBtn->ClientID%>" WindowTitle="<%[ Pools ]%>" />
-                               <com:Application.Portlets.JobList ID="JobWindow" ShowID="<%=$this->JobBtn->ClientID%>" WindowTitle="<%[ Jobs ]%>" />
-                               <com:Application.Portlets.JobRunList ID="JobRunWindow" ShowID="<%=$this->JobRunBtn->ClientID%>" WindowTitle="<%[ Jobs for run ]%>" />
+                               <com:Application.Portlets.StorageList ID="StorageWindow" ButtonID="<%=$this->StorageBtn->ClientID%>" WindowTitle="<%[ Storage Daemons ]%>" />
+                               <com:Application.Portlets.ClientList ID="ClientWindow" ButtonID="<%=$this->ClientBtn->ClientID%>" WindowTitle="<%[ Clients ]%>" />
+                               <com:Application.Portlets.VolumeList ID="VolumeWindow" ButtonID="<%=$this->MediaBtn->ClientID%>" WindowTitle="<%[ Volumes ]%>" />
+                               <com:Application.Portlets.PoolList ID="PoolWindow" ButtonID="<%=$this->PoolBtn->ClientID%>" WindowTitle="<%[ Pools ]%>" />
+                               <com:Application.Portlets.JobList ID="JobWindow" ButtonID="<%=$this->JobBtn->ClientID%>" WindowTitle="<%[ Jobs ]%>" />
+                               <com:Application.Portlets.JobRunList ID="JobRunWindow" ButtonID="<%=$this->JobRunBtn->ClientID%>" WindowTitle="<%[ Jobs for run ]%>" />
                                <div id="configuration">
                                        <div id="configuration-box">
                                                <div id="configuration-progress" class="configuration-progress"></div>
index 4d61010c477b51685f254c8144812b2b07eb9642..9ed2c233ad1c344c40648ba84e05bb2651664810 100644 (file)
@@ -40,26 +40,21 @@ class ClientConfiguration extends Portlets {
                $this->AutoPrune->Checked = $client->autoprune == 1;
        }
 
-       public function save($sender, $param) {
-               switch($sender->getParent()->ID) {
-                       case $this->Status->ID: {
-                               $status = $this->Application->getModule('api')->get(array('clients', 'status', $this->ClientIdentifier->Text))->output;
-                               $this->ShowClient->Text = implode(PHP_EOL, $status);
-                               break;
-                       }
-                       case $this->Apply->ID: {
-                               if($this->JobRetentionValidator->IsValid === false || $this->FileRetentionValidator->IsValid === false) {
-                                       return false;
-                               }
-                               $client = array();
-                               $client['clientid'] = $this->ClientIdentifier->Text;
-                               $client['fileretention'] = $this->FileRetention->Text * 86400; // conversion to seconds
-                               $client['jobretention'] = $this->JobRetention->Text * 86400; // conversion to seconds
-                               $client['autoprune'] = (integer)$this->AutoPrune->Checked;
-                               $this->Application->getModule('api')->set(array('clients', $client['clientid']), $client);
-                               break;
-                       }
+       public function status($sender, $param) {
+               $status = $this->Application->getModule('api')->get(array('clients', 'status', $this->ClientIdentifier->Text))->output;
+               $this->ShowClient->Text = implode(PHP_EOL, $status);
+       }
+
+       public function apply($sender, $param) {
+               if($this->JobRetentionValidator->IsValid === false || $this->FileRetentionValidator->IsValid === false) {
+                       return false;
                }
+               $client = array();
+               $client['clientid'] = $this->ClientIdentifier->Text;
+               $client['fileretention'] = $this->FileRetention->Text * 86400; // conversion to seconds
+               $client['jobretention'] = $this->JobRetention->Text * 86400; // conversion to seconds
+               $client['autoprune'] = (integer)$this->AutoPrune->Checked;
+               $this->Application->getModule('api')->set(array('clients', $client['clientid']), $client);
        }
 
        public function fileRetentionValidator($sender, $param) {
@@ -72,4 +67,4 @@ class ClientConfiguration extends Portlets {
                $param->setIsValid($isValid);
        }
 }
-?>
\ No newline at end of file
+?>
index f98b8bf45bc4f0b93d99aa185b07649772d2701f..0660892bd4cfb291f256c9a09be153351ef8eda4 100644 (file)
@@ -1,6 +1,6 @@
 <%@ MasterClass="Application.Portlets.ConfigurationPanel"%>
 <com:TContent ID="ConfigurationWindowContent">
-       <com:TActivePanel DefaultButton="Apply.ApplyChanges">
+       <com:TActivePanel DefaultButton="Apply">
                <strong><%[ Client name: ]%> <com:TActiveLabel ID="ClientName" /><com:TActiveLabel ID="ClientIdentifier" Visible="false" /></strong><br />
                <com:TActiveLabel ID="ClientDescription" Style="font-style: italic; font-size: 12px"/>
                <hr />
                        <com:TActiveTextBox ID="ShowClient" TextMode="MultiLine" CssClass="textbox-auto" Style="height: 162px; font-size: 11px;" ReadOnly="true" />
                </div>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Status" Text="<%[ Status ]%>" />
+                       <com:BActiveButton ID="Status" Text="<%[ Status ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('ClientWindow').progress(false);" OnClick="status" />
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="FileRetention" Text="<%[ File retention (in days): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="FileRetention" MaxLength="14" AutoPostBack="false" CssClass="textbox-auto" Text="" />
-                               <com:TActiveCustomValidator ID="FileRetentionValidator" ValidationGroup="ClientGroup" ControlToValidate="FileRetention" ErrorMessage="<%[ File retention value must be positive integer or zero. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="fileRetentionValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="FileRetentionValidator" ValidationGroup="ClientGroup" ControlToValidate="FileRetention" ErrorMessage="<%[ File retention value must be positive integer or zero. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="fileRetentionValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="JobRetention" Text="<%[ Job retention (in days): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="JobRetention" MaxLength="14" AutoPostBack="false" CssClass="textbox-auto" Text="" />
-                               <com:TActiveCustomValidator ID="JobRetentionValidator" ValidationGroup="ClientGroup" ControlToValidate="JobRetention" ErrorMessage="<%[ Job retention value must be positive integer or zero. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="jobRetentionValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="JobRetentionValidator" ValidationGroup="ClientGroup" ControlToValidate="JobRetention" ErrorMessage="<%[ Job retention value must be positive integer or zero. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="jobRetentionValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="AutoPrune" Text="<%[ AutoPrune: ]%>" /></div>
                        <div class="field"><com:TActiveCheckBox ID="AutoPrune" AutoPostBack="false" /></div>
                </div>
-               <com:TCallback ID="ReloadClients" OnCallback="Page.ClientWindow.prepareData" ClientSide.OnComplete="clientSlideWindowObj.setLoadRequest();" />
+               <com:TCallback ID="ReloadClients" OnCallback="Page.ClientWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('ClientWindow').setLoadRequest();" />
                <script type="text/javascript">
-                               function <%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%>reloadWindow() {
-                                       var callback = <%= $this->ReloadClients->ActiveControl->Javascript %>;
-                                       if(typeof(IsInvalid<%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%>) == 'undefined') {
-                                               callback.dispatch();
-                                       } 
-                                       delete IsInvalid<%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%>;
+                       var client_callback_func = function() {
+                               var mainForm = Prado.Validation.getForm();
+                               var callback = <%=$this->ReloadClients->ActiveControl->Javascript%>;
+                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('ClientGroup').length == 0) {
+                                       callback.dispatch();
                                }
+                       }
                </script>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ValidationGroup="ClientGroup" CausesValidation="true" ID="Apply" Text="<%[ Apply ]%>" />
+                       <com:BActiveButton ValidationGroup="ClientGroup" OnClick="apply" CausesValidation="true" ID="Apply" Text="<%[ Apply ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('ClientWindow').progress(false);client_callback_func();" />
                </div>
        </com:TActivePanel>
 </com:TContent>
index 1ea74be41c8c3c521920daa7be6d01d491241f4f..f5fc17b37a2f9a6ce32655e7a6f34e1dca6b81d5 100644 (file)
 
 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
 Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class ClientList extends Portlets {
+class ClientList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $windowTitle;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
+       public function setID($id) {
+               $this->ID = $id;
+       }
+
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
+
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
+
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function prepareData($forceReload = false) {
                $allowedButtons = array('ClientBtn', 'ReloadClients');
                if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
@@ -64,15 +87,6 @@ class ClientList extends Portlets {
                $this->DataGrid->dataBind();
        }
 
-
-       public function setShowID($ShowID) {
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
-       }
-
-       public function getShowID() {
-               return $this->ShowID;
-       }
-
        public function configure($sender, $param) {
                if($this->Page->IsCallBack) {
                        $this->getPage()->ClientConfiguration->configure($param->CallbackParameter);
index 0c2341ebfd0c7142fef798b676212fb481d9a238..00571ad2934b1b5070e918c74306b163fcbfeac9 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow"%>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       clientConfigurationWindow = ConfigurationWindow<%=$this->getPage()->ClientConfiguration->getMaster()->ClientID%>;
-                       clientSlideWindowObj = <%=$this->getPage()->ClientWindow->ShowID%>SlideWindow;
-                       clientSlideWindowObj.setConfigurationObj(clientConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
                <com:TActiveRepeater ID="Repeater">
                        <prop:ItemTemplate>
@@ -52,6 +45,9 @@
                </com:TActiveDataGrid>
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.ClientWindow.configure">
-               <prop:ClientSide OnComplete="clientConfigurationWindow.show();clientConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('ClientWindow').show();
+                       ConfigurationWindow.getObj('ClientWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>
index 624db1cb84d57a40fbcd627f00162d211195ff35..95810b171cea8b9de62c7a9515df38e1ed94218c 100644 (file)
@@ -1,12 +1,8 @@
-<div id="<%=$this->ClientID%>configuration" class="configuration">
-       <div id="<%=$this->ClientID%>configuration-window-container" class="configuration-window-container">
+<div id="<%=$this->getParent()->getID()%>configuration" class="configuration">
+       <div id="configuration-window-container" class="configuration-window-container">
                <com:TActivePanel ID="ConfigurationWindowBox" CssClass="configuration-window-content">
-                       <com:TImageButton ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_close.png" ImageAlign="right" Attributes.onclick="ConfigurationWindow<%=$this->ClientID%>.hide(); return false;" ToolTip="<%[ Close]%>" />
+                       <com:TImageButton ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/icon_close.png" ImageAlign="right" Attributes.onclick="$('<%=$this->getParent()->getID()%>configuration').hide(); return false;" ToolTip="<%[ Close ]%>" />
                        <com:TContentPlaceHolder ID="ConfigurationWindowContent" />
-
                </com:TActivePanel>
        </div>
 </div>
-<script type="text/javascript">
-       var ConfigurationWindow<%=$this->ClientID%> = new ConfigurationWindowClass('<%=$this->ClientID%>');
-</script>
diff --git a/gui/baculum/protected/Portlets/ISlideWindow.php b/gui/baculum/protected/Portlets/ISlideWindow.php
new file mode 100644 (file)
index 0000000..785c420
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main 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.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+interface ISlideWindow {
+
+       public function setID($id);
+
+       public function getID();
+
+       public function setWindowTitle($title);
+
+       public function getWindowTitle();
+
+       public function prepareData($force = false);
+
+       public function configure($sender, $param);
+}
+?>
index c3eae555d247135213edf7a09ca2dae63c74c615..34a1a071ab0412799b95b879e00cd62fcf7f2c32 100644 (file)
@@ -25,15 +25,6 @@ class JobConfiguration extends Portlets {
 
        private $runningJobStates = array('C', 'R');
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->Run->setActionClass($this);
-               $this->Status->setActionClass($this);
-               $this->Cancel->setActionClass($this);
-               $this->Delete->setActionClass($this);
-               $this->Estimate->setActionClass($this);
-       }
-
        public function configure($jobId) {
                $jobdata = $this->Application->getModule('api')->get(array('jobs', $jobId))->output;
                $this->JobName->Text = $jobdata->job;
@@ -88,51 +79,46 @@ class JobConfiguration extends Portlets {
                $this->CancelButton->Visible = in_array($jobdata->jobstatus, $this->runningJobStates);
        }
 
-       public function save($sender, $param) {
-               switch($sender->getParent()->ID) {
-                       case $this->Estimate->ID: {
-                               $params = array();
-                               $params['id'] = $this->JobID->Text;
-                               $params['level'] = $this->Level->SelectedValue;
-                               $params['fileset'] = $this->FileSet->SelectedValue;
-                               $params['clientid'] = $this->Client->SelectedValue;
-                               $params['accurate'] = (integer)$this->Accurate->Checked;
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;
-                               $this->Estimation->Text = implode(PHP_EOL, $result);
-                               break;
-                       }
-                       case $this->Run->ID: {
-                               if($this->PriorityValidator->IsValid === false) {
-                                       return false;
-                               }
-                               $params = array();
-                               $params['id'] = $this->JobID->Text;
-                               $params['level'] = $this->Level->SelectedValue;
-                               $params['fileset'] = $this->FileSet->SelectedValue;
-                               $params['clientid'] = $this->Client->SelectedValue;
-                               $params['storageid'] = $this->Storage->SelectedValue;
-                               $params['poolid'] = $this->Pool->SelectedValue;
-                               $params['priority'] = $this->Priority->Text;
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
-                               $this->Estimation->Text = implode(PHP_EOL, $result);
-                               break;
-                       }
-                       case $this->Delete->ID: {
-                               $this->Application->getModule('api')->remove(array('jobs', $this->JobID->Text));
-                               $this->DeleteButton->Visible = false;
-                               break;
-                       }
-                       case $this->Cancel->ID: {
-                               $this->Application->getModule('api')->set(array('jobs', 'cancel', $this->JobID->Text), array('a' => 'b'));
-                               $this->CancelButton->Visible = false;
-                               break;
-                       }
-                       case $this->Status->ID: {
-                               $joblog = $this->Application->getModule('api')->get(array('joblog', $this->JobID->Text))->output;
-                               $this->Estimation->Text = is_array($joblog) ? implode(PHP_EOL, $joblog) : Prado::localize("Output for selected job is not available yet or you do not have enabled logging job logs to catalog database."  . PHP_EOL . PHP_EOL .  "For watching job log there is need to add to the job Messages resource next directive:" . PHP_EOL . PHP_EOL . "console = all, !skipped, !saved" . PHP_EOL);
-                               break;
-                       }
+       public function status($sender, $param) {
+               $joblog = $this->Application->getModule('api')->get(array('joblog', $this->JobID->Text))->output;
+               $this->Estimation->Text = is_array($joblog) ? implode(PHP_EOL, $joblog) : Prado::localize("Output for selected job is not available yet or you do not have enabled logging job logs to catalog database."  . PHP_EOL . PHP_EOL .  "For watching job log there is need to add to the job Messages resource next directive:" . PHP_EOL . PHP_EOL . "console = all, !skipped, !saved" . PHP_EOL);
+       }
+
+       public function delete($sender, $param) {
+               $this->Application->getModule('api')->remove(array('jobs', $this->JobID->Text));
+               $this->DeleteButton->Visible = false;
+       }
+
+       public function cancel($sender, $param) {
+               $this->Application->getModule('api')->set(array('jobs', 'cancel', $this->JobID->Text), array('a' => 'b'));
+               $this->CancelButton->Visible = false;
+       }
+
+       public function run_again($sender, $param) {
+               if($this->PriorityValidator->IsValid === false) {
+                       return false;
                }
+               $params = array();
+               $params['id'] = $this->JobID->Text;
+               $params['level'] = $this->Level->SelectedValue;
+               $params['fileset'] = $this->FileSet->SelectedValue;
+               $params['clientid'] = $this->Client->SelectedValue;
+               $params['storageid'] = $this->Storage->SelectedValue;
+               $params['poolid'] = $this->Pool->SelectedValue;
+               $params['priority'] = $this->Priority->Text;
+               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
+               $this->Estimation->Text = implode(PHP_EOL, $result);
+       }
+
+       public function estimate($sender, $param) {
+               $params = array();
+               $params['id'] = $this->JobID->Text;
+               $params['level'] = $this->Level->SelectedValue;
+               $params['fileset'] = $this->FileSet->SelectedValue;
+               $params['clientid'] = $this->Client->SelectedValue;
+               $params['accurate'] = (integer)$this->Accurate->Checked;
+               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;
+               $this->Estimation->Text = implode(PHP_EOL, $result);
        }
 
        public function priorityValidator($sender, $param) {
index f1bd05b433ba35f64bcfc12fb3378165db35d280..298d5fe4ac7cb490a50dae4e1436c752bb59c000 100644 (file)
@@ -1,6 +1,6 @@
 <%@ MasterClass="Application.Portlets.ConfigurationPanel"%>
 <com:TContent ID="ConfigurationWindowContent">
-       <com:TActivePanel DefaultButton="Run.ApplyChanges">
+       <com:TActivePanel DefaultButton="Run">
                <strong><%[ Job name: ]%> <com:TActiveLabel ID="JobName" /><com:TActiveLabel ID="JobID" Visible="false" /></strong>
                <hr />
                <com:TValidationSummary
                        <div class="text"><com:TLabel ForControl="Priority" Text="<%[ Priority: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="Priority" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="PriorityValidator" ValidationGroup="JobGroup" ControlToValidate="Priority" ErrorMessage="<%[ Priority value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="priorityValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->JobConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="PriorityValidator" ValidationGroup="JobGroup" ControlToValidate="Priority" ErrorMessage="<%[ Priority value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="priorityValidator" />
                        </div>
                </div>
-               <com:TCallback ID="ReloadJobs" OnCallback="Page.JobWindow.prepareData" ClientSide.OnComplete="jobSlideWindowObj.setLoadRequest();" />
+               <com:TCallback ID="ReloadJobs" OnCallback="Page.JobWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('JobWindow').setLoadRequest();" />
                <script type="text/javascript">
-                               function <%=$this->getPage()->JobConfiguration->getMaster()->ClientID%>reloadWindow() {
-                                       var callback = <%= $this->ReloadJobs->ActiveControl->Javascript %>;
-                                       if(typeof(IsInvalid<%=$this->getPage()->JobConfiguration->getMaster()->ClientID%>) == 'undefined') {
-                                               callback.dispatch();
-                                       }
-                                       delete IsInvalid<%=$this->getPage()->JobConfiguration->getMaster()->ClientID%>;
+                       var job_callback_func = function() {
+                               var mainForm = Prado.Validation.getForm();
+                               var callback = <%=$this->ReloadJobs->ActiveControl->Javascript%>;
+                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('JobGroup').length == 0) {
+                                       SlideWindow.getObj('JobWindow').markAllChecked(false);
+                                       callback.dispatch();
                                }
+                       }
                </script>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Status" Text="<%[ Job status ]%>" CausesValidation="false" /> 
-                       <com:TActiveLabel ID="DeleteButton"><com:Application.Portlets.BActiveButton ID="Delete" Text="<%[ Delete job ]%>" CausesValidation="false" /> </com:TActiveLabel>
-                       <com:TActiveLabel ID="CancelButton"><com:Application.Portlets.BActiveButton ID="Cancel" Text="<%[ Cancel job ]%>" CausesValidation="false" /> </com:TActiveLabel>
-                       <com:Application.Portlets.BActiveButton ID="Run" Text="<%[ Run job again ]%>" ValidationGroup="JobGroup" CausesValidation="true" />
+                       <com:BActiveButton ID="Status" Text="<%[ Job status ]%>" CausesValidation="false" OnClick="status" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();" CssClass="bbutton" />
+                       <com:TActiveLabel ID="DeleteButton"><com:BActiveButton ID="Delete" Text="<%[ Delete job ]%>" CausesValidation="false" OnClick="delete" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();" CssClass="bbutton" /> </com:TActiveLabel>
+                       <com:TActiveLabel ID="CancelButton"><com:BActiveButton ID="Cancel" Text="<%[ Cancel job ]%>" CausesValidation="false" OnClick="cancel" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();" CssClass="bbutton" /> </com:TActiveLabel>
+                       <com:BActiveButton ID="Run" Text="<%[ Run job again ]%>" ValidationGroup="JobGroup" CausesValidation="true" OnClick="run_again" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();"/>
                </div>
                <div class="text small"><%[ Console status ]%></div>
                <div class="field-full" style="min-height: 166px">
@@ -72,7 +73,7 @@
                        <div class="field"><com:TActiveCheckBox ID="Accurate" AutoPostBack="false" /></div>
                </div>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" />
+                       <com:BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" OnClick="estimate" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobWindow').progress(false);job_callback_func();" />
                </div>
        </com:TActivePanel>
 </com:TContent>
index 37b8777c27ccd3d19353c1cc13e4df94fdac5975..1748575f0ac9857920d34186575b785de47d13b6 100644 (file)
@@ -22,28 +22,58 @@ Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
 Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class JobList extends Portlets {
+class JobList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $windowTitle;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
+       public $jobLevels;
+       private $jobStates;
+       private $jobTypes = array(
+               'B' => 'Backup',
+               'M' => 'Migrated',
+               'V' => 'Verify',
+               'R' => 'Restore',
+               'I' => 'Internal',
+               'D' => 'Admin',
+               'A' => 'Archive',
+               'C' => 'Copy',
+               'g' => 'Migration'
+       );
 
-       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');
+       public function setID($id) {
+               $this->ID = $id;
+       }
 
-       private $jobStates;
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
 
-       public $jobLevels;
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
-               $this->jobLevels = $this->Application->getModule('misc')->getJobLevels();
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+               $this->jobLevels = $this->Application->getModule('misc')->getJobLevels();
+       }
+
        public function getJobType($jobLetter) {
                return array_key_exists($jobLetter, $this->jobTypes) ? $this->jobTypes[$jobLetter] : null;
        }
@@ -109,18 +139,30 @@ class JobList extends Portlets {
                $this->DataGrid->dataBind();
        }
 
-       public function setShowID($ShowID) {
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
-       }
-
-       public function getShowID() {
-               return $this->ShowID;
-       }
-
        public function configure($sender, $param) {
                if($this->Page->IsCallBack) {
                        $this->getPage()->JobConfiguration->configure($param->CallbackParameter);
                }
        }
+
+       public function executeAction($action) {
+               $params = explode(';', $this->CheckedValues->Value);
+               $commands = array();
+               switch($action) {
+                       case 'delete': {
+                               for($i = 0; $i < count($params); $i++) {
+                                       $cmd = array('delete');
+                                       $cmd[] = 'jobid="' . $params[$i] . '"';
+                                       $cmd[] = 'yes';
+                                       $cmd[] = PHP_EOL;
+                                       $commands[] = implode(' ', $cmd);
+                               }
+                               $this->getPage()->Console->CommandLine->Text = implode(' ', $commands);
+                               $this->getPage()->Console->sendCommand(null, null);
+                               break;
+                       }
+               }
+               $this->CheckedValues->Value = "";
+       }
 }
 ?>
index bd4bf6cf34282076dcd3532d5f60ef61caba1114..9ab4e66fa2ba1ae7d3016c7b7be69ba3a844375a 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow" %>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       jobConfigurationWindow = ConfigurationWindow<%=$this->getPage()->JobConfiguration->getMaster()->ClientID%>;
-                       jobSlideWindowObj = <%=$this->getPage()->JobWindow->ShowID%>SlideWindow;
-                       jobSlideWindowObj.setConfigurationObj(jobConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
        <com:TActiveRepeater ID="Repeater">
                <prop:ItemTemplate>
                ItemStyle.CssClass="slide-window-element"
                AlternatingItemStyle.CssClass="slide-window-element-alternating"
        >
+               <com:TActiveTemplateColumn HeaderText="<input type='checkbox' name='actions_checkbox' onclick=SlideWindow.getObj('JobWindow').markAllChecked(this.checked)>">
+                       <prop:ItemTemplate>
+                               <input type="checkbox" name="actions_checkbox" value="<%=$this->getParent()->Data['jobid']%>" id="<%=$this->getPage()->JobWindow->CheckedValues->ClientID%><%=$this->getParent()->Data['jobid']%>" rel="<%=$this->getPage()->JobWindow->CheckedValues->ClientID%>" onclick="SlideWindow.getObj('JobWindow').markChecked(this.getAttribute('rel'), this.checked, this.value, true);" />
+                       </prop:ItemTemplate>
+                </com:TActiveTemplateColumn>
                <com:TActiveBoundColumn
                        SortExpression="jobid"
                        HeaderText="ID"
                        DataField="endtime"
                />
        </com:TActiveDataGrid>
+       <com:TActiveHiddenField ID="CheckedValues" />
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.JobWindow.configure">
-               <prop:ClientSide OnComplete="jobConfigurationWindow.show();jobConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('JobWindow').show();
+                       ConfigurationWindow.getObj('JobWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>
index 4797ef886ebe956a21f1cea907cb25e9536f11d5..345a28e91f971796f9ab7cb588ab11283068b9d1 100644 (file)
@@ -23,12 +23,6 @@ class JobRunConfiguration extends Portlets {
 
        const DEFAULT_JOB_PRIORITY = 10;
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->Run->setActionClass($this);
-               $this->Estimate->setActionClass($this);
-       }
-
        public function configure($jobname) {
                $this->JobName->Text = $jobname;
                $this->Estimation->Text = '';
@@ -71,37 +65,31 @@ class JobRunConfiguration extends Portlets {
                $this->Priority->Text = self::DEFAULT_JOB_PRIORITY;
        }
 
-       public function save($sender, $param) {
-               switch($sender->getParent()->ID) {
-                       case $this->Estimate->ID: {
-                               $params = array();
-                               $params['name'] = $this->JobName->Text;
-                               $params['level'] = $this->Level->SelectedValue;
-                               $params['fileset'] = $this->FileSet->SelectedValue;
-                               $params['clientid'] = $this->Client->SelectedValue;
-                               $params['accurate'] = (integer)$this->Accurate->Checked;
-                               var_dump($params);
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;
-                               $this->Estimation->Text = implode(PHP_EOL, $result);
-                               break;
-                       }
-                       case $this->Run->ID: {
-                               if($this->PriorityValidator->IsValid === false) {
-                                       return false;
-                               }
-                               $params = array();
-                               $params['name'] = $this->JobName->Text;
-                               $params['level'] = $this->Level->SelectedValue;
-                               $params['fileset'] = $this->FileSet->SelectedValue;
-                               $params['clientid'] = $this->Client->SelectedValue;
-                               $params['storageid'] = $this->Storage->SelectedValue;
-                               $params['poolid'] = $this->Pool->SelectedValue;
-                               $params['priority'] = $this->Priority->Text;
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
-                               $this->Estimation->Text = implode(PHP_EOL, $result);
-                               break;
-                       }
+       public function run_job($sender, $param) {
+               if($this->PriorityValidator->IsValid === false) {
+                       return false;
                }
+               $params = array();
+               $params['name'] = $this->JobName->Text;
+               $params['level'] = $this->Level->SelectedValue;
+               $params['fileset'] = $this->FileSet->SelectedValue;
+               $params['clientid'] = $this->Client->SelectedValue;
+               $params['storageid'] = $this->Storage->SelectedValue;
+               $params['poolid'] = $this->Pool->SelectedValue;
+               $params['priority'] = $this->Priority->Text;
+               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
+               $this->Estimation->Text = implode(PHP_EOL, $result);
+       }
+
+       public function estimate($sender, $param) {
+               $params = array();
+               $params['name'] = $this->JobName->Text;
+               $params['level'] = $this->Level->SelectedValue;
+               $params['fileset'] = $this->FileSet->SelectedValue;
+               $params['clientid'] = $this->Client->SelectedValue;
+               $params['accurate'] = (integer)$this->Accurate->Checked;
+               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;
+               $this->Estimation->Text = implode(PHP_EOL, $result);
        }
 
        public function priorityValidator($sender, $param) {
@@ -109,4 +97,4 @@ class JobRunConfiguration extends Portlets {
                $param->setIsValid($isValid);
        }
 }
-?>
\ No newline at end of file
+?>
index 76c1bc902c233e61834e63210ca770eb0a2bec24..d83f29a540f79a0a2f2c8d57c0e9a2b3c0dbe18e 100644 (file)
@@ -1,6 +1,6 @@
 <%@ MasterClass="Application.Portlets.ConfigurationPanel"%>
 <com:TContent ID="ConfigurationWindowContent">
-       <com:TActivePanel DefaultButton="Run.ApplyChanges">
+       <com:TActivePanel DefaultButton="Run">
                <strong><%[ Job name: ]%> <com:TActiveLabel ID="JobName" /><com:TActiveLabel ID="JobID" Visible="false" /></strong>
                <hr />
                <com:TValidationSummary
                        <div class="text"><com:TLabel ForControl="Priority" Text="<%[ Priority: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="Priority" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="PriorityValidator" ValidationGroup="JobRunGroup" ControlToValidate="Priority" ErrorMessage="<%[ Priority value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="priorityValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->JobRunConfiguration->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="PriorityValidator" ValidationGroup="JobRunGroup" ControlToValidate="Priority" ErrorMessage="<%[ Priority value must be integer greather than 0. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="priorityValidator" />
                        </div>
                </div>
-               <com:TCallback ID="ReloadJobs" OnCallback="Page.JobRunWindow.prepareData" ClientSide.OnComplete="jobRunSlideWindowObj.setLoadRequest();" />
+               <com:TCallback ID="ReloadRunJobs" OnCallback="Page.JobRunWindow.prepareData" ClientSide.OnComplete="RunSlideWindow.getObj('JobRunWindow').setLoadRequest();" />
                <script type="text/javascript">
-                               function <%=$this->getPage()->JobRunConfiguration->ClientID%>reloadWindow() {
-                                       var callback = <%= $this->ReloadJobs->ActiveControl->Javascript %>;
-                                       if(typeof(IsInvalid<%=$this->getPage()->JobRunConfiguration->ClientID%>) == 'undefined') {
-                                               callback.dispatch();
-                                       }
-                                       delete IsInvalid<%=$this->getPage()->JobRunConfiguration->ClientID%>;
+                       var jobrun_callback_func = function() {
+                               var mainForm = Prado.Validation.getForm();
+                               var callback = <%=$this->ReloadRunJobs->ActiveControl->Javascript%>;
+                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('JobRunGroup').length == 0) {
+                                       callback.dispatch();
                                }
+                       }
                </script>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Run" Text="<%[ Run job ]%>" ValidationGroup="JobRunGroup" CausesValidation="true" />
+                       <com:BActiveButton ID="Run" Text="<%[ Run job ]%>" ValidationGroup="JobRunGroup" CausesValidation="true" OnClick="run_job" ClientSide.OnSuccess="ConfigurationWindow.getObj('JobRunWindow').progress(false);jobrun_callback_func();"/>
                </div>
                <div class="text small"><%[ Console status ]%></div>
                <div class="field-full" style="min-height: 90px">
@@ -69,7 +69,7 @@
                        <div class="field"><com:TActiveCheckBox ID="Accurate" AutoPostBack="false" /></div>
                </div>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" />
+                       <com:Application.Portlets.BActiveButton ID="Estimate" Text="<%[ Estimate job ]%>" OnClick="estimate"  ClientSide.OnSuccess="ConfigurationWindow.getObj('JobRunWindow').progress(false);jobrun_callback_func();" />
                </div>
        </com:TActivePanel>
 </com:TContent>
index fba2ef7f7886370e8e1f062e57ed20666070eaaf..39ac4c56c0a280940f1bab25e9bafab7b29198d1 100644 (file)
@@ -22,25 +22,57 @@ Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
 Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class JobRunList extends Portlets {
+class JobRunList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $windowTitle, $oldDirector;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
+       public $oldDirector;
+       private $jobStates;
+       private $jobTypes = array(
+               'B' => 'Backup',
+               'M' => 'Migrated',
+               'V' => 'Verify',
+               'R' => 'Restore',
+               'I' => 'Internal',
+               'D' => 'Admin',
+               'A' => 'Archive',
+               'C' => 'Copy',
+               'g' => 'Migration'
+       );
 
-       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');
+       public function setID($id) {
+               $this->ID = $id;
+       }
 
-       private $jobStates;
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
+
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function prepareData($forceReload = false) {
                $allowedButtons = array('JobRunBtn');
                if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
@@ -75,7 +107,7 @@ class JobRunList extends Portlets {
                return $jobs;
        }
 
-    public function sortDataGrid($sender, $param) {
+       public function sortDataGrid($sender, $param) {
                $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
                $data = $this->Application->getModule('api')->get($params)->output;
                $data = $this->prepareJobs($data);
@@ -83,14 +115,6 @@ class JobRunList extends Portlets {
                $this->DataGrid->dataBind();
        }
 
-       public function setShowID($ShowID) {
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
-       }
-
-       public function getShowID() {
-               return $this->ShowID;
-       }
-
        public function configure($sender, $param) {
                if($this->Page->IsCallBack) {
                        $this->getPage()->JobRunConfiguration->configure($param->CallbackParameter);
index 82fa83838d519cfaffeabf11f2c4ced29894d625..a7532370d646f62cc4381e2136a7f4af5e3b0e40 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow" %>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       jobRunConfigurationWindow = ConfigurationWindow<%=$this->getPage()->JobRunConfiguration->getMaster()->ClientID%>;
-                       jobRunSlideWindowObj = <%=$this->getPage()->JobRunWindow->ShowID%>SlideWindow;
-                       jobRunSlideWindowObj.setConfigurationObj(jobRunConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
        <com:TActiveRepeater ID="Repeater">
                <prop:ItemTemplate>
@@ -46,6 +39,9 @@
        </com:TActiveDataGrid>
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.JobRunWindow.configure">
-               <prop:ClientSide OnComplete="jobRunConfigurationWindow.show();jobRunConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('JobRunWindow').show();
+                       ConfigurationWindow.getObj('JobRunWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>
index 12ec4d8e105b05638fe5ece32660ca4761f00f9d..3e4d960d9d5a95724d340b8c297484716ed516ee 100644 (file)
@@ -23,13 +23,6 @@ Prado::using('Application.Portlets.Portlets');
 
 class PoolConfiguration extends Portlets {
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->Apply->setActionClass($this);
-               $this->RestoreConfiguration->setActionClass($this);
-               $this->UpdateVolumes->setActionClass($this);
-       }
-
        public function configure($poolId) {
                $pooldata = $this->Application->getModule('api')->get(array('pools', $poolId))->output;
                $this->PoolName->Text = $pooldata->name;
@@ -57,8 +50,33 @@ class PoolConfiguration extends Portlets {
                $this->ActionOnPurge->Checked = $pooldata->actiononpurge == 1;
        }
 
-       public function save($sender, $param) {
-               if(($sender->getParent()->ID == $this->Apply->ID) || ($sender->getParent()->ID == $this->UpdateVolumes->ID)) {
+       public function restore_configuration($sender, $param) {
+               $this->Application->getModule('api')->set(array('pools', 'update', $this->PoolID->Text),  array(''));
+       }
+
+       public function update_volumes($sender, $param) {
+               if($this->MaxVolumesValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->RetentionPeriodValidator->IsValid === false || $this->LabelFormatValidator->IsValid === false) {
+                       return false;
+               }
+               $pooldata = array();
+               $pooldata['poolid'] = $this->PoolID->Text;
+               $pooldata['enabled'] = (integer)$this->Enabled->Checked;
+               $pooldata['maxvols'] = $this->MaxVolumes->Text;
+               $pooldata['maxvoljobs'] = $this->MaxVolJobs->Text;
+               $pooldata['maxvolbytes'] = $this->MaxVolBytes->Text;
+               $pooldata['voluseduration'] = $this->UseDuration->Text * 3600; // conversion to seconds
+               $pooldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds
+               $pooldata['labelformat'] = $this->LabelFormat->Text;
+               $pooldata['scratchpoolid'] = (integer)$this->ScratchPool->SelectedValue;
+               $pooldata['recyclepoolid'] = (integer)$this->RecyclePool->SelectedValue;
+               $pooldata['recycle'] = (integer)$this->Recycle->Checked;
+               $pooldata['autoprune'] = (integer)$this->AutoPrune->Checked;
+               $pooldata['actiononpurge'] = (integer)$this->ActionOnPurge->Checked;
+               $this->Application->getModule('api')->set(array('pools', $this->PoolID->Text), $pooldata);
+               $this->Application->getModule('api')->set(array('pools', 'update', 'volumes', $this->PoolID->Text),  array(''));
+       }
+
+       public function apply($sender, $param) {
                        if($this->MaxVolumesValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->RetentionPeriodValidator->IsValid === false || $this->LabelFormatValidator->IsValid === false) {
                                return false;
                        }
@@ -77,13 +95,7 @@ class PoolConfiguration extends Portlets {
                        $pooldata['autoprune'] = (integer)$this->AutoPrune->Checked;
                        $pooldata['actiononpurge'] = (integer)$this->ActionOnPurge->Checked;
                        $this->Application->getModule('api')->set(array('pools', $this->PoolID->Text), $pooldata);
-                       if($sender->getParent()->ID == $this->UpdateVolumes->ID) {
-                               $this->Application->getModule('api')->set(array('pools', 'update', 'volumes', $this->PoolID->Text),  array(''));
-                       }
-               } elseif($sender->getParent()->ID == $this->RestoreConfiguration->ID) {
-                       $this->Application->getModule('api')->set(array('pools', 'update', $this->PoolID->Text),  array(''));
-                       //@TOFIX $this->configure($this->PoolID->Text);
-               }
+
        }
 
        public function maxVolumesValidator($sender, $param) {
@@ -117,4 +129,4 @@ class PoolConfiguration extends Portlets {
                $param->setIsValid($isValid);
        }
 }
-?>
\ No newline at end of file
+?>
index fea8b97880c91a1c36e6030ea8e509e9843b3a95..34f06a6b4e7741f2189203ed49fc2639bc96c912 100644 (file)
@@ -1,6 +1,6 @@
 <%@ MasterClass="Application.Portlets.ConfigurationPanel"%>
 <com:TContent ID="ConfigurationWindowContent">
-       <com:TActivePanel DefaultButton="Apply.ApplyChanges">
+       <com:TActivePanel DefaultButton="Apply">
                <strong><%[ Pool name: ]%> <com:TActiveLabel ID="PoolName" /><com:TActiveLabel ID="PoolID" Visible="false" /></strong><br />
                <hr />
                <com:TValidationSummary
                        <div class="text"><com:TLabel ForControl="MaxVolumes" Text="<%[ Maximum volumes: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolumes" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="MaxVolumesValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolumes" ErrorMessage="<%[ Max volumes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolumesValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolumesValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolumes" ErrorMessage="<%[ Max volumes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolumesValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="MaxVolJobs" Text="<%[ Max vol. jobs: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolJobs" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="MaxVolJobsValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolJobs" ErrorMessage="<%[ Max vol. jobs value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolJobsValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolJobsValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolJobs" ErrorMessage="<%[ Max vol. jobs value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolJobsValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="MaxVolBytes" Text="<%[ Max vol. bytes: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolBytes" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="MaxVolBytesValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolBytes" ErrorMessage="<%[ Max vol. bytes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolBytesValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolBytesValidator" ValidationGroup="PoolGroup" ControlToValidate="MaxVolBytes" ErrorMessage="<%[ Max vol. bytes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolBytesValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="UseDuration" Text="<%[ Vol. use duration (in hours): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="UseDuration" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="UseDurationValidator" ValidationGroup="PoolGroup" ControlToValidate="UseDuration" ErrorMessage="<%[ Use duration value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="useDurationValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="UseDurationValidator" ValidationGroup="PoolGroup" ControlToValidate="UseDuration" ErrorMessage="<%[ Use duration value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="useDurationValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="RetentionPeriod" Text="<%[ Retention period (in hours): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="RetentionPeriod" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="RetentionPeriodValidator" ValidationGroup="PoolGroup" ControlToValidate="RetentionPeriod" ErrorMessage="<%[ Retention period value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="retentionPeriodValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="RetentionPeriodValidator" ValidationGroup="PoolGroup" ControlToValidate="RetentionPeriod" ErrorMessage="<%[ Retention period value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="retentionPeriodValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="LabelFormat" Text="<%[ Label format: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="LabelFormat" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="LabelFormatValidator" ValidationGroup="PoolGroup" ControlToValidate="LabelFormat" ErrorMessage="<%[ Label format value must not be empty. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="labelFormatValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="LabelFormatValidator" ValidationGroup="PoolGroup" ControlToValidate="LabelFormat" ErrorMessage="<%[ Label format value must not be empty. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="labelFormatValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="ActionOnPurge" Text="<%[ Action on purge: ]%>" /></div>
                        <div class="field"><com:TActiveCheckBox ID="ActionOnPurge" AutoPostBack="false" /></div>
                </div>
-               <com:TCallback ID="ReloadPools" OnCallback="Page.PoolWindow.prepareData" ClientSide.OnComplete="poolSlideWindowObj.setLoadRequest();" />
+               <com:TCallback ID="ReloadPools" OnCallback="Page.PoolWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('PoolWindow').setLoadRequest();" />
                <script type="text/javascript">
-                               function <%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%>reloadWindow() {
-                                       var callback = <%= $this->ReloadPools->ActiveControl->Javascript %>;
-                                       if(typeof(IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%>) == 'undefined') {
-                                               callback.dispatch();
-                                       }
-                                       delete IsInvalid<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%>;
+                       var pool_callback_func = function() {
+                               var mainForm = Prado.Validation.getForm();
+                               var callback = <%=$this->ReloadPools->ActiveControl->Javascript%>;
+                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('PoolGroup').length == 0) {
+                                       callback.dispatch();
                                }
+                       }
                </script>
                <div class="button-center">
-                       <com:Application.Portlets.BActiveButton ID="RestoreConfiguration" Text="<%[ Restore configuration ]%>" />&nbsp;
-                       <com:Application.Portlets.BActiveButton ID="UpdateVolumes" Text="<%[ Update volumes ]%>" />&nbsp;
-                       <com:Application.Portlets.BActiveButton ID="Apply" ValidationGroup="PoolGroup" CausesValidation="true" Text="<%[ Apply ]%>" />
+                       <com:BActiveButton ID="RestoreConfiguration" Text="<%[ Restore configuration ]%>" OnClick="restore_configuration" ClientSide.OnSuccess="ConfigurationWindow.getObj('PoolWindow').progress(false); pool_callback_func();" />
+                       <com:BActiveButton ID="UpdateVolumes" Text="<%[ Update volumes ]%>" OnClick="update_volumes" ClientSide.OnSuccess="ConfigurationWindow.getObj('PoolWindow').progress(false); pool_callback_func();"/>
+                       <com:BActiveButton ID="Apply" ValidationGroup="PoolGroup" CausesValidation="true" Text="<%[ Apply ]%>" OnClick="apply" ClientSide.OnSuccess="ConfigurationWindow.getObj('PoolWindow').progress(false); pool_callback_func();"/>
                </div>
        </com:TActivePanel>
 </com:TContent>
index 7a1dd0437f056ff4f198b28167c3fa34604f624c..73c602d84cb849609ad78859f6169488107f1655 100644 (file)
  */
 
 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class PoolList extends Portlets {
+class PoolList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $windowTitle;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
+       public function setID($id) {
+               $this->ID = $id;
+       }
+
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
+
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
+
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function prepareData($forceReload = false) {
                $allowedButtons = array('PoolBtn', 'ReloadPools');
                if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
index 1d5dd63bc47d0ba6c8ff8f96e3cdef336b0802a2..fa147f84d387c6ead3adc62f4b7c8dfc5020bfa1 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow"%>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       poolConfigurationWindow = ConfigurationWindow<%=$this->getPage()->PoolConfiguration->getMaster()->ClientID%>;
-                       poolSlideWindowObj = <%=$this->getPage()->PoolWindow->ShowID%>SlideWindow;
-                       poolSlideWindowObj.setConfigurationObj(poolConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
                <com:TActiveRepeater ID="Repeater">
                        <prop:ItemTemplate>
@@ -59,6 +52,9 @@
                </com:TActiveDataGrid>
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.PoolWindow.configure">
-               <prop:ClientSide OnComplete="poolConfigurationWindow.show();poolConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('PoolWindow').show();
+                       ConfigurationWindow.getObj('PoolWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>
index 9c15722cc77ac97c61dff9f0a382e1b62341ae18..56723bd7e84429974bfec15a148a3ceb5ec059ff 100644 (file)
@@ -59,4 +59,4 @@ class Portlets extends TTemplateControl {
                return $data;
        }
 }
-?>
\ No newline at end of file
+?>
index ea2b0fa4477df2ace1e4df3f391dc6ed1c1a73a8..ef12015e7552cc19700892f13ad30000d91fe180 100644 (file)
@@ -16,7 +16,9 @@
  *
  * Bacula® is a registered trademark of Kern Sibbald.
  */
+
  
+Prado::using('System.Web.UI.WebControls.TCompareValidator');
 Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
@@ -29,10 +31,18 @@ Prado::using('Application.Portlets.Portlets');
 class SlideWindow extends Portlets {
 
        public $elementsLimits = array(10, 25, 50, 100, 200, 500, 1000, 'unlimited');
-
-       public $ShowID;
-       public $Title;
-       public $WindowTitle;
+        public $actions = array(
+               'VolumeWindow' => array(
+                       'NoAction' => 'select action',
+                       'delete' => 'Delete',
+                       'prune' => 'Prune',
+                       'purge' => 'Purge'
+               ),
+               'JobWindow' => array(
+                       'NoAction' => 'select action',
+                       'delete' => 'Delete'
+               )
+       );
 
        const NORMAL_VIEW = 'simple';
        const DETAIL_VIEW = 'details';
@@ -53,6 +63,9 @@ class SlideWindow extends Portlets {
                        $this->Limit->dataBind();
                        $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW);
                        $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW);
+                       $actions = array_key_exists($this->getParent()->ID, $this->actions) ? $this->actions[$this->getParent()->ID] : array();
+                       $this->Actions->dataSource = $actions;
+                       $this->Actions->dataBind();
                }
        }
 
@@ -61,5 +74,11 @@ class SlideWindow extends Portlets {
                $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
                $this->getParent()->prepareData(true);
        }
+
+       public function action($sender, $param) {
+               if(method_exists($this->getParent(), 'executeAction')) {
+                       $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param);
+               }
+       }
 }
-?>
\ No newline at end of file
+?>
index 73d618eddbd8a54685a1fe7a4061634e551ed647..01e06f7f92d7abf804b786e769022c4cd00f80da 100644 (file)
-<div id="<%=$this->UniqueID%>-slide-window-container" class="slide-window-container" style="display: none">
-       <div id="<%=$this->UniqueID%>-slide-window-progress" class="slide-window-progress"></div>
+<div id="<%=$this->getParent()->getID()%>-slide-window-container" class="slide-window-container" style="display: none">
+       <div id="<%=$this->getParent()->getID()%>-slide-window-progress" class="slide-window-progress"></div>
        <div class="slide-window-content">
                <com:TContentPlaceHolder ID="SlideWindowContent" />
-               <div id="<%=$this->UniqueID%>-slide-window-toolbar" class="slide-window-toolbar" style="display: none">
-                       <com:TImageButton ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/close.png" Style="margin: 5px 5px 0 0;float: right;" Attributes.onclick="<%=$this->ShowID%>SlideWindow.toggleToolbar(); return false;" Attributes.alt="<%[ Close ]%>" ToolTip="<%[ Close ]%>" />
+               <div id="<%=$this->getParent()->getID()%>-slide-window-toolbar" class="slide-window-toolbar" style="display: none">
+                       <com:TImageButton ImageUrl="<%=$this->getPage()->getTheme()->getBaseUrl()%>/close.png" Style="margin: 5px 5px 0 0;float: right;" Attributes.onclick="SlideWindow.getObj('<%=$this->getParent()->getID()%>').toggleToolbar(); return false;" Attributes.alt="<%[ Close ]%>" ToolTip="<%[ Close ]%>" />
                        <table>
                                <tr>
-                                       <td><%[ Limit: ]%></td><td><com:TActiveDropDownList ID="Limit" ClientSide.OnComplete="<%=$this->ShowID%>SlideWindow.setElementsCount();" /></td>
+                                       <td><%[ Limit: ]%></td>
+                                       <td><com:TActiveDropDownList ID="Limit" ClientSide.OnComplete="SlideWindow.getObj('<%=$this->getParent()->getID()%>').setElementsCount();" /></td>
                                </tr>
                                <tr>
-                                       <td><%[ Search: ]%></td><td><com:TActiveTextBox ID="Search" /></td>
+                                       <td><%[ Search: ]%></td>
+                                       <td><com:TActiveTextBox ID="Search" /></td>
                                </tr>
                                <tr>
-                                       <td><%[ View mode: ]%></td><td><com:TLabel ForControl="Simple" Text="<%[ simple ]%>" /> <com:TActiveRadioButton ID="Simple" GroupName="views" ActiveControl.CallbackParameter="simple" /> <com:TLabel ForControl="Details" Text="<%[ details ]%>" /><com:TActiveRadioButton ID="Details" GroupName="views" ActiveControl.CallbackParameter="details" /></td>
+                                       <td><%[ View mode: ]%></td>
+                                       <td><com:TLabel ForControl="Simple" Text="<%[ simple ]%>" /> <com:TActiveRadioButton ID="Simple" GroupName="views" ActiveControl.CallbackParameter="simple" /> <com:TLabel ForControl="Details" Text="<%[ details ]%>" /><com:TActiveRadioButton ID="Details" GroupName="views" ActiveControl.CallbackParameter="details" /></td>
+                               </tr>
+                       </table>
+               </div>
+               <div id="<%=$this->getParent()->getID()%>-slide-window-actions" class="slide-window-actions" style="display: none">
+                       <table>
+                               <tr>
+                                       <td><%[ Action: ]%></td>
+                                       <td>
+                                               <com:TDropDownList ID="Actions"/>
+                                               <com:TRequiredFieldValidator
+                                                       ID="ActionsValidator"
+                                                       ValidationGroup="ActionsGroup<%=$this->ApplyAction->ClientID%>"
+                                                       ControlToValidate="Actions"
+                                                       InitialValue="NoAction"
+                                                       ErrorMessage="Please select action."
+                                                       ClientSide.ObserveChanges="false"
+                                                       ClientSide.OnValidationSuccess="<%=$this->ApplyAction->ClientID%>_actions_func()"
+                                                />
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td></td>
+                                       <td>
+                                               <com:BActiveButton ID="ApplyAction" Text="<%[ Apply ]%>" OnClick="action" ValidationGroup="ActionsGroup<%=$this->ApplyAction->ClientID%>" Attributes.onclick="return SlideWindow.getObj('<%=$this->getParent()->getID()%>').checked.length > 50 ? confirm('Warning!\n\nYou checked over 50 elements.\nPlease note, that in case more time consuming actions, web browser request may timed out after 30 seconds. It this case action will be canceled and in consequence the action may not touch all selected elements.\n\nAre you sure you want to continue?') : true;" ClientSide.OnSuccess="<%=$this->getParent()->getID()%>_refresh_window_func();" />
+                                               <script type="text/javascript">
+                                                       var <%=$this->ApplyAction->ClientID%>_actions_func = function() {
+                                                               var console_visible = $('<%=$this->getPage()->Console->ConsoleContainer->ClientID%>').visible();
+                                                               if (console_visible === false) {
+                                                                       $('console_launcher').click();
+                                                               } else {
+                                                                       window.scrollTo(0, document.body.scrollHeight);
+                                                               }
+                                                               SlideWindow.getObj('<%=$this->getParent()->getID()%>').hideActions();
+                                                       }
+                                               </script>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td></td>
+                                       <td><a href="javascript:SlideWindow.getObj('<%=$this->getParent()->getID()%>').markAllChecked(false);"><%[ unmark all and close ]%></a></td>
                                </tr>
                        </table>
                </div>
        </div>
        <div class="slide-window-bar">
-               <div id="<%=$this->UniqueID%>-slide-window-title" class="slide-window-bar-title"><%=$this->getParent()->windowTitle%><span></span></div>
-               <div id="<%=$this->UniqueID%>-slide-window-close" title="Close the window" class="slide-window-close"></div>
-               <div id="<%=$this->UniqueID%>-slide-window-fullsize" title="Change the window size" class="slide-window-fullsize"></div>
-               <div id="<%=$this->UniqueID%>-slide-window-tools" title="<%[ Switch the window view (normal/details) ]%>" class="slide-window-sort"></div>
+               <div id="<%=$this->getParent()->getID()%>-slide-window-title" class="slide-window-bar-title"><%=$this->getParent()->getWindowTitle()%><span></span></div>
+               <div id="<%=$this->getParent()->getID()%>-slide-window-close" title="Close the window" class="slide-window-close"></div>
+               <div id="<%=$this->getParent()->getID()%>-slide-window-fullsize" title="Change the window size" class="slide-window-fullsize"></div>
+               <div id="<%=$this->getParent()->getID()%>-slide-window-tools" title="<%[ Switch the window view (normal/details) ]%>" class="slide-window-sort"></div>
                <com:TCallback ID="DetailView" OnCallback="switchView">
                        <prop:ClientSide.OnLoading>
-                               $('<%=$this->UniqueID%>-slide-window-progress').setStyle({'display': 'block'});
+                               $('<%=$this->getParent()->getID()%>-slide-window-progress').setStyle({'display': 'block'});
                        </prop:ClientSide.OnLoading>
                        <prop:ClientSide.OnComplete>
-                               $('<%=$this->UniqueID%>-slide-window-progress').setStyle({'display': 'none'});
-                               <%=$this->ShowID%>SlideWindow.setLoadRequest();
+                               $('<%=$this->getParent()->getID()%>-slide-window-progress').setStyle({'display': 'none'});
+                               SlideWindow.getObj('<%=$this->getParent()->getID()%>').setLoadRequest();
                        </prop:ClientSide.OnComplete>
                </com:TCallback>
                        <script type="text/javascript">
-                               $$('input[id=<%=$this->Simple->ClientID%>], input[id=<%=$this->Details->ClientID%>], select[id=<%=$this->Limit->ClientID%>]').each(function(el) { 
-                                       el.observe('change', function() {
+                               <%=$this->getParent()->getID()%>_refresh_window_func = function() {
                                                var request = <%= $this->DetailView->ActiveControl->Javascript %>;
                                                request.dispatch();
-                                       });
+                                       }
+                               $$('input[id=<%=$this->Simple->ClientID%>], input[id=<%=$this->Details->ClientID%>], select[id=<%=$this->Limit->ClientID%>]').each(function(el) {
+                                       el.observe('change', <%=$this->getParent()->getID()%>_refresh_window_func);
                                });
                        </script>
        </div>
 </div>
 <script type="text/javascript">
-       var <%=$this->ShowID%>SlideWindow = new SlideWindowClass('<%=$this->UniqueID%>', {'showId' : '<%=$this->ShowID%>', 'hideId': '<%=$this->UniqueID%>-slide-window-close', 'fullSizeId' : '<%=$this->UniqueID%>-slide-window-fullsize', 'search' : '<%=$this->Search->ClientID%>'});
+       var id = '<%=$this->getParent()->getID()%>';
+
+       var windowObj = new SlideWindowClass(id, {
+               'showId': '<%=$this->getParent()->getButtonID()%>',
+               'hideId': id + '-slide-window-close',
+               'fullSizeId': id + '-slide-window-fullsize',
+               'search': '<%=$this->Search->ClientID%>'}
+       );
+       var configWindowObj = new ConfigurationWindowClass(id);
+
+       SlideWindow.registerObj(id, windowObj);
+       ConfigurationWindow.registerObj(id, configWindowObj);
+       SlideWindow.getObj(id).setConfigurationObj(configWindowObj);
 </script>
index 32656c1bac5031fc0edeb904c241eaabd473da0e..9002ab8452aefdd85aa962b44170f38fba2e6bdc 100644 (file)
@@ -22,14 +22,6 @@ Prado::using('Application.Portlets.Portlets');
 
 class StorageConfiguration extends Portlets {
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->Mount->setActionClass($this);
-               $this->Release->setActionClass($this);
-               $this->Umount->setActionClass($this);
-               $this->Status->setActionClass($this);
-       }
-
        public function configure($storageId) {
                $storagedata = $this->Application->getModule('api')->get(array('storages', 'show', $storageId))->output;
                $this->ShowStorage->Text = implode(PHP_EOL, $storagedata);
@@ -39,39 +31,36 @@ class StorageConfiguration extends Portlets {
                $this->AutoChanger->Visible = (boolean)$storage->autochanger;
        }
 
-       public function save($sender, $param) {
+       public function mount($sender, $param) {
+               $isValid = $this->DriveValidator->IsValid === true && $this->SlotValidator->IsValid === true;
+               if($isValid === false) {
+                       return;
+               }
+               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
+               $slot = ($this->AutoChanger->Visible === true) ? intval($this->Slot->Text) : 0;
+               $mount = $this->Application->getModule('api')->get(array('storages', 'mount', $this->StorageID->Text, $drive, $slot))->output;
+               $this->ShowStorage->Text = implode(PHP_EOL, $mount);
+       }
+
+       public function umount($sender, $param) {
                $isValid = $this->DriveValidator->IsValid === true && $this->SlotValidator->IsValid === true;
-               switch($sender->getParent()->ID) {
-                       case $this->Status->ID: {
-                               $status = $this->Application->getModule('api')->get(array('storages', 'status', $this->StorageID->Text))->output;
-                               $this->ShowStorage->Text = implode(PHP_EOL, $status);
-                               break;
-                       }
-                       case $this->Mount->ID: {
-                               if($isValid === false) {
-                                       return;
-                               }
-                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
-                               $slot = ($this->AutoChanger->Visible === true) ? intval($this->Slot->Text) : 0;
-                               $mount = $this->Application->getModule('api')->get(array('storages', 'mount', $this->StorageID->Text, $drive, $slot))->output;
-                               $this->ShowStorage->Text = implode(PHP_EOL, $mount);
-                               break;
-                       }
-                       case $this->Umount->ID: {
-                               if($isValid === false) {
-                                       return;
-                               }
-                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
-                               $umount = $this->Application->getModule('api')->get(array('storages', 'umount', $this->StorageID->Text, $drive))->output;
-                               $this->ShowStorage->Text = implode(PHP_EOL, $umount);
-                               break;
-                       }
-                       case $this->Release->ID: {
-                               $release = $this->Application->getModule('api')->get(array('storages', 'release', $this->StorageID->Text))->output;
-                               $this->ShowStorage->Text = implode(PHP_EOL, $release);
-                               break;
-                       }
+               if($isValid === false) {
+                       return;
                }
+               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
+               $umount = $this->Application->getModule('api')->get(array('storages', 'umount', $this->StorageID->Text, $drive))->output;
+               $this->ShowStorage->Text = implode(PHP_EOL, $umount);
+
+       }
+
+       public function release($sender, $param) {
+               $release = $this->Application->getModule('api')->get(array('storages', 'release', $this->StorageID->Text))->output;
+               $this->ShowStorage->Text = implode(PHP_EOL, $release);
+       }
+
+       public function status($sender, $param) {
+               $status = $this->Application->getModule('api')->get(array('storages', 'status', $this->StorageID->Text))->output;
+               $this->ShowStorage->Text = implode(PHP_EOL, $status);
        }
 
        public function driveValidator($sender, $param) {
@@ -84,4 +73,4 @@ class StorageConfiguration extends Portlets {
                $param->setIsValid($isValid);
        }
 }
-?>
\ No newline at end of file
+?>
index 94cd6355210e949bab50680d1cd0462b32b64063..6c5e9feb6d50feddac2b67b99b70eba6d84712e4 100644 (file)
@@ -30,6 +30,9 @@
                        </div>
                </com:TActivePanel>
                <div class="button-center">
-                       <com:Application.Portlets.BActiveButton ID="Mount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Mount ]%>" />&nbsp;&nbsp;<com:Application.Portlets.BActiveButton ID="Release" Text="<%[ Release ]%>" />&nbsp;&nbsp;<com:Application.Portlets.BActiveButton ID="Umount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Umount ]%>" />&nbsp;&nbsp;<com:Application.Portlets.BActiveButton ID="Status" Text="<%[ Status ]%>" />
+                       <com:BActiveButton ID="Mount" OnClick="mount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Mount ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('StorageWindow').progress(false);" />
+                       <com:BActiveButton ID="Release" OnClick="release" Text="<%[ Release ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('StorageWindow').progress(false);" />
+                       <com:BActiveButton ID="Umount" OnClick="umount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Umount ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('StorageWindow').progress(false);" />
+                       <com:BActiveButton ID="Status" OnClick="status" Text="<%[ Status ]%>" ClientSide.OnSuccess="ConfigurationWindow.getObj('StorageWindow').progress(false);" />
                </div>
 </com:TContent>
index 6180afe5afd7778f9f22f6e872b0605921e6c8ab..04f7aea0faf525ad5dde19ca450f8298bb036454 100644 (file)
  */
 
 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class StorageList extends Portlets {
+class StorageList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $windowTitle;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
+       public function setID($id) {
+               $this->ID = $id;
+       }
+
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
+
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
+
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function prepareData($forceReload = false) {
                $allowedButtons = array('StorageBtn');
                if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
@@ -63,14 +86,6 @@ class StorageList extends Portlets {
                $this->DataGrid->dataBind();
        }
 
-       public function setShowID($ShowID) {
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
-       }
-
-       public function getShowID() {
-               return $this->ShowID;
-       }
-
        public function configure($sender, $param) {
                if($this->Page->IsCallBack) {
                        $this->getPage()->StorageConfiguration->configure($param->CallbackParameter);
index f4e573f1eb72160f7b012cea46d27f2064bc8d1d..be04f4697ed85aa1f54169cb1f9071df945d9bec 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow" %>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       storageConfigurationWindow = ConfigurationWindow<%=$this->getPage()->StorageConfiguration->getMaster()->ClientID%>;
-                       storageSlideWindowObj = <%=$this->getPage()->StorageWindow->ShowID%>SlideWindow;
-                       storageSlideWindowObj.setConfigurationObj(storageConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
                <com:TActiveRepeater ID="Repeater">
                        <prop:ItemTemplate>
@@ -42,6 +35,9 @@
                </com:TActiveDataGrid>
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.StorageWindow.configure">
-               <prop:ClientSide OnComplete="storageConfigurationWindow.show();storageConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('StorageWindow').show();
+                       ConfigurationWindow.getObj('StorageWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>
index 4c2aae8c534f6beb46c95c625a4cbaf70dcfd9ea..c4b60d2bdaf5cd59c39aaaaf2050e955928c118b 100644 (file)
@@ -30,13 +30,6 @@ class VolumeConfiguration extends Portlets {
 
        private $volumeStatesForSet = array('Append', 'Archive', 'Disabled', 'Full', 'Used', 'Cleaning', 'Read-Only');
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->Apply->setActionClass($this);
-               $this->Prune->setActionClass($this);
-               $this->Purge->setActionClass($this);
-       }
-
        public function configure($mediaId) {
                $voldata = $this->Application->getModule('api')->get(array('volumes', $mediaId))->output;
                $this->VolumeID->Text = $voldata->mediaid;
@@ -71,38 +64,33 @@ class VolumeConfiguration extends Portlets {
                $this->Pool->dataBind();
        }
 
-       public function save($sender, $param) {
-               switch($sender->getParent()->ID) {
-                       case $this->Apply->ID: {
-                               $isInvalid = $this->RetentionPeriodValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolFilesValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->SlotValidator->IsValid === false;
-                               if($isInvalid) {
-                                       return false;
-                               }
-                               $voldata = array();
-                               $voldata['mediaid'] = $this->VolumeID->Text;
-                               $voldata['volstatus'] = $this->VolumeStatus->SelectedValue;
-                               $voldata['poolid'] = $this->Pool->SelectedValue;
-                               $voldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds
-                               $voldata['voluseduration'] = $this->UseDuration->Text * 3600;  // conversion to seconds
-                               $voldata['maxvoljobs'] = $this->MaxVolJobs->Text;
-                               $voldata['maxvolfiles'] = $this->MaxVolFiles->Text;
-                               $voldata['maxvolbytes'] = $this->MaxVolBytes->Text;
-                               $voldata['slot'] = $this->Slot->Text;
-                               $voldata['recycle'] = (integer)$this->Recycle->Checked;
-                               $voldata['enabled'] = (integer)$this->Enabled->Checked;
-                               $voldata['inchanger'] = (integer)$this->InChanger->Checked;
-                               $this->Application->getModule('api')->set(array('volumes', $voldata['mediaid']), $voldata);
-                               break;
-                       }
-                       case $this->Prune->ID: {
-                               $this->Application->getModule('api')->get(array('volumes', 'prune', $this->VolumeID->Text));
-                               break;
-                       }
-                       case $this->Purge->ID: {
-                               $this->Application->getModule('api')->get(array('volumes', 'purge', $this->VolumeID->Text));
-                               break;
-                       }
+       public function prune($sender, $param) {
+               $this->Application->getModule('api')->get(array('volumes', 'prune', $this->VolumeID->Text));
+       }
+
+       public function purge($sender, $param) {
+               $this->Application->getModule('api')->get(array('volumes', 'purge', $this->VolumeID->Text));
+       }
+
+       public function apply($sender, $param) {
+               $isInvalid = $this->RetentionPeriodValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolFilesValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->SlotValidator->IsValid === false;
+               if($isInvalid) {
+                       return false;
                }
+               $voldata = array();
+               $voldata['mediaid'] = $this->VolumeID->Text;
+               $voldata['volstatus'] = $this->VolumeStatus->SelectedValue;
+               $voldata['poolid'] = $this->Pool->SelectedValue;
+               $voldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds
+               $voldata['voluseduration'] = $this->UseDuration->Text * 3600;  // conversion to seconds
+               $voldata['maxvoljobs'] = $this->MaxVolJobs->Text;
+               $voldata['maxvolfiles'] = $this->MaxVolFiles->Text;
+               $voldata['maxvolbytes'] = $this->MaxVolBytes->Text;
+               $voldata['slot'] = $this->Slot->Text;
+               $voldata['recycle'] = (integer)$this->Recycle->Checked;
+               $voldata['enabled'] = (integer)$this->Enabled->Checked;
+               $voldata['inchanger'] = (integer)$this->InChanger->Checked;
+               $this->Application->getModule('api')->set(array('volumes', $voldata['mediaid']), $voldata);
        }
 
        public function getVolumeStates($forSetOnly = false) {
@@ -140,4 +128,4 @@ class VolumeConfiguration extends Portlets {
                $param->setIsValid($isValid);
        }
 }
-?>
\ No newline at end of file
+?>
index 14e18eef5f4014f8b0b92a096059f11b1f81814c..9b97d40a0355fc60ce4671f45e33177563cfaefe 100644 (file)
@@ -1,6 +1,6 @@
 <%@ MasterClass="Application.Portlets.ConfigurationPanel"%>
 <com:TContent ID="ConfigurationWindowContent">
-       <com:TActivePanel DefaultButton="Apply.ApplyChanges">
+       <com:TActivePanel DefaultButton="Apply">
                <strong><%[ Volume name: ]%> <com:TActiveLabel ID="VolumeName" /><com:TActiveLabel ID="VolumeID" Visible="false" /></strong>
                <hr />
                <com:TValidationSummary
@@ -20,7 +20,7 @@
                        <div class="text"><com:TLabel ForControl="RetentionPeriod" Text="<%[ Retention period (in hours): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="RetentionPeriod" MaxLength="20" CssClass="textbox-auto" AutoPostBack="false" />
-                               <com:TActiveCustomValidator ID="RetentionPeriodValidator" ValidationGroup="VolumeGroup" ControlToValidate="RetentionPeriod" ErrorMessage="<%[ Retention period value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="retentionPeriodValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="RetentionPeriodValidator" ValidationGroup="VolumeGroup" ControlToValidate="RetentionPeriod" ErrorMessage="<%[ Retention period value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="retentionPeriodValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="UseDuration" Text="<%[ Vol. use duration (in hours): ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="UseDuration" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="UseDurationValidator" ValidationGroup="VolumeGroup" ControlToValidate="UseDuration" ErrorMessage="<%[ Vol. use duration value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="useDurationValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="UseDurationValidator" ValidationGroup="VolumeGroup" ControlToValidate="UseDuration" ErrorMessage="<%[ Vol. use duration value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="useDurationValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="MaxVolJobs" Text="<%[ Max vol. jobs: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolJobs" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="MaxVolJobsValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolJobs" ErrorMessage="<%[ Max vol. jobs value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolJobsValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolJobsValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolJobs" ErrorMessage="<%[ Max vol. jobs value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolJobsValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="MaxVolFiles" Text="<%[ Max vol. files: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolFiles" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="MaxVolFilesValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolFiles" ErrorMessage="<%[ Max vol. files value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolFilesValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolFilesValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolFiles" ErrorMessage="<%[ Max vol. files value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolFilesValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="MaxVolBytes" Text="<%[ Max vol. bytes: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="MaxVolBytes" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="MaxVolBytesValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolBytes" ErrorMessage="<%[ Max vol. bytes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolBytesValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="MaxVolBytesValidator" ValidationGroup="VolumeGroup" ControlToValidate="MaxVolBytes" ErrorMessage="<%[ Max vol. bytes value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="maxVolBytesValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="Slot" Text="<%[ Slot number: ]%>" /></div>
                        <div class="field">
                                <com:TActiveTextBox ID="Slot" AutoPostBack="false" CssClass="textbox-auto" />
-                               <com:TActiveCustomValidator ID="SlotValidator" ValidationGroup="VolumeGroup" ControlToValidate="Slot" ErrorMessage="<%[ Slot value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="slotValidator" ClientSide.OnValidationError="IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%> = true" />
+                               <com:TActiveCustomValidator ID="SlotValidator" ValidationGroup="VolumeGroup" ControlToValidate="Slot" ErrorMessage="<%[ Slot value must be integer. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="slotValidator" />
                        </div>
                </div>
                <div class="line">
                        <div class="text"><com:TLabel ForControl="InChanger" Text="<%[ In changer: ]%>" /></div>
                        <div class="field"><com:TActiveCheckBox ID="InChanger" AutoPostBack="false" /></div>
                </div>
-               <com:TCallback ID="ReloadVolumes" OnCallback="Page.VolumeWindow.prepareData" ClientSide.OnComplete="volumeSlideWindowObj.setLoadRequest();" />
+               <com:TCallback ID="ReloadVolumes" OnCallback="Page.VolumeWindow.prepareData" ClientSide.OnComplete="SlideWindow.getObj('VolumeWindow').setLoadRequest();" />
                <script type="text/javascript">
-                               function <%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%>reloadWindow() {
-                                       if(typeof(IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%>) == 'undefined') {
-                                               var callback = <%= $this->ReloadVolumes->ActiveControl->Javascript %>;
-                                               callback.dispatch();
-                                       }
-                                       delete IsInvalid<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%>;
+                       var volume_callback_func = function() {
+                               var mainForm = Prado.Validation.getForm();
+                               var callback = <%=$this->ReloadVolumes->ActiveControl->Javascript%>;
+                               if (Prado.Validation.managers[mainForm].getValidatorsWithError('VolumeGroup').length == 0) {
+                                       SlideWindow.getObj('VolumeWindow').markAllChecked(false);
+                                       callback.dispatch();
                                }
+                       }
                </script>
                <div class="button">
-                       <com:Application.Portlets.BActiveButton ID="Purge" Text="<%[ Purge ]%>" />&nbsp;<com:Application.Portlets.BActiveButton ID="Prune" Text="<%[ Prune ]%>" />&nbsp;<com:Application.Portlets.BActiveButton ValidationGroup="VolumeGroup" CausesValidation="true" ID="Apply" Text="<%[ Apply ]%>" />
+                       <com:Application.Portlets.BActiveButton ID="Purge" Text="<%[ Purge ]%>" OnClick="purge" ClientSide.OnSuccess="ConfigurationWindow.getObj('VolumeWindow').progress(false);volume_callback_func()" />
+                       <com:Application.Portlets.BActiveButton ID="Prune" Text="<%[ Prune ]%>" OnClick="prune" ClientSide.OnSuccess="ConfigurationWindow.getObj('VolumeWindow').progress(false);volume_callback_func()" />
+                       <com:Application.Portlets.BActiveButton ValidationGroup="VolumeGroup" CausesValidation="true" ID="Apply" Text="<%[ Apply ]%>" OnClick="apply" ClientSide.OnSuccess="ConfigurationWindow.getObj('VolumeWindow').progress(false);volume_callback_func()" />
                </div>
        </com:TActivePanel>
 </com:TContent>
index 9272ebbc1efb60aab33500f3e60f2c2323bdd091..66d6bdd5fad7cd0409b58242c44dac8be1bfd7c4 100644 (file)
@@ -21,22 +21,49 @@ Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TActiveHiddenField');
 Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.ISlideWindow');
 Prado::using('Application.Portlets.Portlets');
 
-class VolumeList extends Portlets {
+class VolumeList extends Portlets implements ISlideWindow {
 
-       public $ShowID, $pools, $oldPool, $view, $windowTitle;
+       public $ID;
+       public $buttonID;
+       public $windowTitle;
+       public $pools;
+       public $oldPool;
+       public $view;
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->prepareData();
+       public function setID($id) {
+               $this->ID = $id;
+       }
+
+       public function getID($hideAutoID = true) {
+               return $this->ID;
+       }
+
+       public function setButtonID($id) {
+               $this->buttonID = $id;
+       }
+
+       public function getButtonID() {
+               return $this->buttonID;
        }
 
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
        }
 
+       public function getWindowTitle() {
+               return $this->windowTitle;
+       }
+
+       public function onLoad($param) {
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function prepareData($forceReload = false) {
                $allowedButtons = array('MediaBtn', 'ReloadVolumes');
                if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
@@ -90,18 +117,54 @@ class VolumeList extends Portlets {
                $this->DataGrid->dataBind();
        }
 
-       public function setShowID($ShowID) {
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
-       }
-
-       public function getShowID() {
-               return $this->ShowID;
-       }
-
        public function configure($sender, $param) {
                if($this->Page->IsCallBack) {
                        $this->getPage()->VolumeConfiguration->configure($param->CallbackParameter);
                }
        }
+
+       public function executeAction($action) {
+               $params = explode(';', $this->CheckedValues->Value);
+               $commands = array();
+               switch($action) {
+                       case 'prune': {
+                               for($i = 0; $i < count($params); $i++) {
+                                       $cmd = array('prune');
+                                       $cmd[] = 'volume="' . $params[$i] . '"';
+                                       $cmd[] = 'yes';
+                                       $cmd[] = PHP_EOL;
+                                       $commands[] = implode(' ', $cmd);
+                               }
+                               $this->getPage()->Console->CommandLine->Text = implode(' ', $commands);
+                               $this->getPage()->Console->sendCommand(null, null);
+                               break;
+                       }
+                       case 'purge': {
+                               for($i = 0; $i < count($params); $i++) {
+                                       $cmd = array('purge');
+                                       $cmd[] = 'volume="' . $params[$i] . '"';
+                                       $cmd[] = 'yes';
+                                       $cmd[] = PHP_EOL;
+                                       $commands[] = implode(' ', $cmd);
+                               }
+                               $this->getPage()->Console->CommandLine->Text = implode(' ', $commands);
+                               $this->getPage()->Console->sendCommand(null, null);
+                               break;
+                       }
+                       case 'delete': {
+                               for($i = 0; $i < count($params); $i++) {
+                                       $cmd = array('delete');
+                                       $cmd[] = 'volume="' . $params[$i] . '"';
+                                       $cmd[] = 'yes';
+                                       $cmd[] = PHP_EOL;
+                                       $commands[] = implode(' ', $cmd);
+                               }
+                               $this->getPage()->Console->CommandLine->Text = implode(' ', $commands);
+                               $this->getPage()->Console->sendCommand(null, null);
+                               break;
+                       }
+               }
+               $this->CheckedValues->Value = "";
+       }
 }
 ?>
index 1a60b7c46aa802e6c266d65920da677516608ada..aecacfc3fc3df7ed22efce4585ae84b4a9b6d4f0 100644 (file)
@@ -1,12 +1,5 @@
 <%@ MasterClass="Application.Portlets.SlideWindow" %>
 <com:TContent ID="SlideWindowContent">
-       <script type="text/javascript">
-               document.observe("dom:loaded", function() {
-                       volumeConfigurationWindow = ConfigurationWindow<%=$this->getPage()->VolumeConfiguration->getMaster()->ClientID%>;
-                       volumeSlideWindowObj = <%=$this->getPage()->VolumeWindow->ShowID%>SlideWindow;
-                       volumeSlideWindowObj.setConfigurationObj(volumeConfigurationWindow);
-               });
-       </script>
        <com:TActivePanel ID="RepeaterShow">
        <com:TActiveRepeater ID="Repeater">
                <prop:ItemTemplate>
                ItemStyle.CssClass="slide-window-element"
                AlternatingItemStyle.CssClass="slide-window-element-alternating"
        >
+               <com:TActiveTemplateColumn HeaderText="<input type='checkbox' name='actions_checkbox' onclick=SlideWindow.getObj('VolumeWindow').markAllChecked(this.checked)>">
+                       <prop:ItemTemplate>
+                               <input type="checkbox" name="actions_checkbox" value="<%=$this->getParent()->Data['volumename']%>" id="<%=$this->getPage()->VolumeWindow->CheckedValues->ClientID%><%=$this->getParent()->Data['volumename']%>" rel="<%=$this->getPage()->VolumeWindow->CheckedValues->ClientID%>" onclick="SlideWindow.getObj('VolumeWindow').markChecked(this.getAttribute('rel'), this.checked, this.value, true);" />
+                       </prop:ItemTemplate>
+                </com:TActiveTemplateColumn>
                <com:TActiveTemplateColumn HeaderText="Volume name" SortExpression="volumename">
                        <prop:ItemTemplate>
                                <div><%=$this->getParent()->Data['volumename']%></div>
                        DataField="whenexpire"
                />
        </com:TActiveDataGrid>
+       <com:TActiveHiddenField ID="CheckedValues" />
        </com:TActivePanel>
        <com:TCallback ID="DataElementCall" OnCallback="Page.VolumeWindow.configure">
-               <prop:ClientSide OnComplete="volumeConfigurationWindow.show();volumeConfigurationWindow.progress(false);" />
+               <prop:ClientSide.OnComplete>
+                       ConfigurationWindow.getObj('VolumeWindow').show();
+                       ConfigurationWindow.getObj('VolumeWindow').progress(false);
+               </prop:ClientSide.OnComplete>
        </com:TCallback>
 </com:TContent>