]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/protected/Portlets/VolumesTools.tpl
baculum: Update buttons in wizards and volumes tools panel
[bacula/bacula] / gui / baculum / protected / Portlets / VolumesTools.tpl
1 <com:TActivePanel ID="Tools" Style="text-align: left; display: none; width: 492px; margin: 0 auto;">
2         <com:TValidationSummary
3                         ID="ValidationSummary"
4                         CssClass="validation-error-summary"
5                         ValidationGroup="VolumesActionGroup"
6                         AutoUpdate="true"
7                         Display="Dynamic"
8                         HeaderText="<%[ There is not possible to run selected action because: ]%>" />
9                         <com:TActiveCustomValidator ID="LabelNameValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="LabelName" ErrorMessage="<%[ Label name have to contain string value from set [0-9a-zA-Z_-]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="labelNameValidator" />
10                         <com:TActiveCustomValidator ID="SlotsLabelValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="SlotsLabel" ErrorMessage="<%[ Slots for label have to contain string value from set [0-9-,]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="slotsLabelValidator" />
11                         <com:TActiveCustomValidator ID="DriveLabelValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="DriveLabel" ErrorMessage="<%[ Drive has to contain digit value from set [0-9]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="driveLabelValidator" />
12                         <com:TActiveCustomValidator ID="SlotsUpdateSlotsValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="SlotsUpdateSlots" ErrorMessage="<%[ Slots for update have to contain string value from set [0-9-,]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="slotsUpdateSlotsValidator" />
13                         <com:TActiveCustomValidator ID="DriveUpdateSlotsValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="DriveUpdateSlots" ErrorMessage="<%[ Drive has to contain digit value from set [0-9]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="driveUpdateSlotsValidator" />
14                         <com:TActiveCustomValidator ID="SlotsUpdateSlotsScanValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="SlotsUpdateSlotsScan" ErrorMessage="<%[ Slots for update have to contain string value from set [0-9-,]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="slotsUpdateSlotsScanValidator" />
15                         <com:TActiveCustomValidator ID="DriveUpdateSlotsScanValidator" ValidationGroup="VolumesActionGroup" ControlToValidate="DriveUpdateSlotsScan" ErrorMessage="<%[ Drive has to contain digit value from set [0-9]. ]%>" ControlCssClass="validation-error" Display="None" OnServerValidate="driveUpdateSlotsScanValidator" />
16         <div class="line"><com:TActiveRadioButton ID="LabelVolume" GroupName="VolumeAction" OnCallback="setLabelVolume" ActiveControl.ClientSide.OnComplete="window.scrollTo(0, document.body.scrollHeight);" /><com:TLabel ForControl="LabelVolume" Text="<%[ Label volume(s) ]%>" /></div>
17         <com:TActivePanel ID="Labeling" Display="None" Style="margin-left: 20px">
18                 <div class="line">
19                         <div class="text"><com:TLabel ForControl="Barcodes" Text="<%[ Use barcodes as label: ]%>" /></div>
20                         <div class="field"><com:TActiveCheckBox ID="Barcodes" OnCallback="setBarcodes" /></div>
21                 </div>
22                 <com:TActivePanel ID="LabelNameField">
23                         <div class="line">
24                                 <div class="text"><com:TLabel ForControl="LabelName" Text="<%[ Label name: ]%>" /></div>
25                                 <div class="field"><com:TActiveTextBox ID="LabelName" CssClass="textbox" /></div>
26                         </div>
27                 </com:TActivePanel>
28                 <com:TActivePanel ID="BarcodeSlotsField" Display="None">
29                         <div class="line">
30                                 <div class="text"><com:TLabel ForControl="SlotsLabel" Text="<%[ Slots for label: ]%>" /></div>
31                                 <div class="field"><com:TActiveTextBox ID="SlotsLabel" CssClass="textbox" /></div>
32                         </div>
33                 </com:TActivePanel>
34                 <div class="line">
35                         <div class="text"><com:TLabel ForControl="StorageLabel" Text="<%[ Storage: ]%>" /></div>
36                         <div class="field"><com:TActiveDropDownList ID="StorageLabel" CssClass="textbox" /></div>
37                 </div>
38                 <div class="line">
39                                 <div class="text"><com:TLabel ForControl="DriveLabel" Text="<%[ Drive number: ]%>" /></div>
40                                 <div class="field"><com:TActiveTextBox ID="DriveLabel" CssClass="textbox" Text="0" /></div>
41                         </div>
42                 <div class="line">
43                         <div class="text"><com:TLabel ForControl="PoolLabel" Text="<%[ Pool: ]%>" /></div>
44                         <div class="field"><com:TActiveDropDownList ID="PoolLabel" CssClass="textbox" /></div>
45                 </div>
46                 <div class="button" style="margin-top: 10px;">
47                                 <com:BActiveButton ID="LabelButton" Text="<%[ Label ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
48                 </div>
49         </com:TActivePanel>
50         <div class="line"><com:TActiveRadioButton ID="UpdateSlots" GroupName="VolumeAction" OnCallback="setUpdateSlots" ActiveControl.ClientSide.OnComplete="window.scrollTo(0, document.body.scrollHeight);" /><com:TLabel ForControl="UpdateSlots" Text="<%[ Update slots using barcodes ]%>" /></div>
51         <com:TActivePanel ID="UpdatingSlots" Display="None" Style="margin-left: 20px">
52                         <div class="line">
53                                 <div class="text"><com:TLabel ForControl="StorageUpdateSlots" Text="<%[ Storage: ]%>" /></div>
54                                 <div class="field"><com:TActiveDropDownList ID="StorageUpdateSlots" CssClass="textbox" /></div>
55                         </div>
56                         <div class="line">
57                                 <div class="text"><com:TLabel ForControl="DriveUpdateSlots" Text="<%[ Drive number: ]%>" /></div>
58                                 <div class="field"><com:TActiveTextBox ID="DriveUpdateSlots" CssClass="textbox" Text="0" /></div>
59                         </div>
60                         <div class="line">
61                                 <div class="text"><com:TLabel ForControl="SlotsUpdateSlots" Text="<%[ Slots for update: ]%>" /></div>
62                                 <div class="field"><com:TActiveTextBox ID="SlotsUpdateSlots" CssClass="textbox" /></div>
63                         </div>
64                         <div class="button" style="margin-top: 10px;">
65                                 <com:BActiveButton ID="UpdateSlotsButton" Text="<%[ Update barcodes slots ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
66                 </div>
67         </com:TActivePanel>
68         <div class="line"><com:TActiveRadioButton ID="UpdateSlotsScan" GroupName="VolumeAction" OnCallback="setUpdateSlotsScan" ActiveControl.ClientSide.OnComplete="window.scrollTo(0, document.body.scrollHeight);" /><com:TLabel ForControl="UpdateSlotsScan" Text="<%[ Update slots without barcodes ]%>" /></div>
69         <com:TActivePanel ID="UpdatingSlotsScan" Display="None" Style="margin-left: 20px">
70                         <div class="line">
71                                 <div class="text"><com:TLabel ForControl="StorageUpdateSlotsScan" Text="<%[ Storage: ]%>" /></div>
72                                 <div class="field"><com:TActiveDropDownList ID="StorageUpdateSlotsScan" CssClass="textbox" /></div>
73                         </div>
74                         <div class="line">
75                                 <div class="text"><com:TLabel ForControl="DriveUpdateSlotsScan" Text="<%[ Drive number: ]%>" /></div>
76                                 <div class="field"><com:TActiveTextBox ID="DriveUpdateSlotsScan" CssClass="textbox" Text="0" /></div>
77                         </div>
78                         <div class="line">
79                                 <div class="text"><com:TLabel ForControl="SlotsUpdateSlotsScan" Text="<%[ Slots for update: ]%>" /></div>
80                                 <div class="field"><com:TActiveTextBox ID="SlotsUpdateSlotsScan" CssClass="textbox" /></div>
81                         </div>
82                         <div class="button" style="margin-top: 10px;">
83                                 <com:BActiveButton ID="UpdateSlotsScanButton" Text="<%[ Update slots scan ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
84                 </div>
85         </com:TActivePanel>
86 </com:TActivePanel>
87 <script type="text/javascript">
88         $$('#volumes_tools_launcher', '#<%=$this->LabelButton->ClientID%>', '#<%=$this->UpdateSlotsButton->ClientID%>', '#<%=$this->UpdateSlotsScanButton->ClientID%>').each(function(el){
89                 el.observe('click', function(){
90                         if(VolumesToolsValidation(el) === true) {
91                                 $('<%=$this->getPage()->Console->ConsoleContainer->ClientID%>').hide();
92                                 $('console_launcher').down('span').innerHTML = '<%[ show console ]%>';
93                                 Effect.toggle('<%=$this->Tools->ClientID%>', 'slide', {'duration': 0.2, afterFinish: function(){
94                                         window.scrollTo(0, document.body.scrollHeight);
95                                 }});
96                         
97                                 if(el.id != 'volumes_tools_launcher') {
98                                         Effect.toggle('<%=$this->getPage()->Console->ConsoleContainer->ClientID%>', 'slide', {'duration': 0.3, afterFinish: function(){
99                                                 window.scrollTo(0, document.body.scrollHeight);
100                                         }});
101                                 }
102                         }
103                 }.bind(el));
104         });
105
106         function VolumesToolsValidation(el) {
107                 var validation = true;
108                 var slotsPattern = new RegExp("<%=$this->slotsPattern%>");
109                 var drivePattern = new RegExp("<%=$this->drivePattern%>");
110                 var labelNamePattern = new RegExp("<%=$this->labelVolumePattern%>");
111                 if(el.id == '<%=$this->LabelButton->ClientID%>') {
112                         if($('<%=$this->Barcodes->ClientID%>').checked === true) {
113                                 if(slotsPattern.test($('<%=$this->SlotsLabel->ClientID%>').value) === false) {
114                                         var validation = false;
115                                 }
116                         } else {
117                                 if(labelNamePattern.test($('<%=$this->LabelName->ClientID%>').value) === false) {
118                                         var validation = false;
119                                 }
120                         }
121                         if(drivePattern.test($('<%=$this->DriveLabel->ClientID%>').value) === false) {
122                                 var validation = false;
123                         }
124                 } else if(el.id == '<%=$this->UpdateSlotsButton->ClientID%>') {
125                         if(drivePattern.test($('<%=$this->DriveUpdateSlots->ClientID%>').value) === false || slotsPattern.test($('<%=$this->SlotsUpdateSlots->ClientID%>').value) === false) {
126                                 var validation = false;
127                         }
128                 } else if(el.id == '<%=$this->UpdateSlotsScanButton->ClientID%>') {
129                         if(drivePattern.test($('<%=$this->DriveUpdateSlotsScan->ClientID%>').value) === false || slotsPattern.test($('<%=$this->SlotsUpdateSlotsScan->ClientID%>').value) === false) {
130                                 var validation = false;
131                         }
132                 }
133                 return validation;
134         }
135 </script>