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;
},
}.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'});
},
}
});
+var ConfigurationWindow = new ConfigurationWindowClass();
loadRequest : null,
repeaterEl: null,
gridEl: null,
+ checked: [],
+ objects: {},
size: {
widthNormal : '437px',
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);
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();
this.repeaterEl = repeaterEl;
this.gridEl = gridEl;
this.loadRequest = requestObj;
+ this.markAllChecked(false);
this.setLoadRequest();
+ this.postWindowOpen();
},
setLoadRequest: function() {
}
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;
} 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));
$(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) {
<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>
$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) {
$param->setIsValid($isValid);
}
}
-?>
\ No newline at end of file
+?>
<%@ 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>
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) {
$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);
<%@ 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>
</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>
-<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>
--- /dev/null
+<?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);
+}
+?>
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;
$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) {
<%@ 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">
<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>
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;
}
$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 = "";
+ }
}
?>
<%@ 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>
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 = '';
$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) {
$param->setIsValid($isValid);
}
}
-?>
\ No newline at end of file
+?>
<%@ 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">
<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>
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) {
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);
$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);
<%@ 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>
</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>
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;
$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;
}
$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) {
$param->setIsValid($isValid);
}
}
-?>
\ No newline at end of file
+?>
<%@ 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 ]%>" />
- <com:Application.Portlets.BActiveButton ID="UpdateVolumes" Text="<%[ Update volumes ]%>" />
- <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>
*/
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) {
<%@ 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>
</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>
return $data;
}
}
-?>
\ No newline at end of file
+?>
*
* 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');
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';
$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();
}
}
$_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
+?>
-<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>
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);
$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) {
$param->setIsValid($isValid);
}
}
-?>
\ No newline at end of file
+?>
</div>
</com:TActivePanel>
<div class="button-center">
- <com:Application.Portlets.BActiveButton ID="Mount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Mount ]%>" /> <com:Application.Portlets.BActiveButton ID="Release" Text="<%[ Release ]%>" /> <com:Application.Portlets.BActiveButton ID="Umount" ValidationGroup="AutoChangerGroup" CausesValidation="true" Text="<%[ Umount ]%>" /> <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>
*/
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) {
$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);
<%@ 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>
</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>
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;
$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) {
$param->setIsValid($isValid);
}
}
-?>
\ No newline at end of file
+?>
<%@ 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
<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 ]%>" /> <com:Application.Portlets.BActiveButton ID="Prune" Text="<%[ Prune ]%>" /> <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>
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) {
$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 = "";
+ }
}
?>
<%@ 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>