]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Tweak split volume tools actions for new buttons
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 17:17:09 +0000 (18:17 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 29 Nov 2014 17:17:09 +0000 (18:17 +0100)
gui/baculum/protected/Portlets/VolumesTools.php
gui/baculum/protected/Portlets/VolumesTools.tpl

index 538f135cb5ba103436ac8d643fd12611c6c9c79b..ba2a614e28b715ff88b1b9b5349537099fe81622 100644 (file)
@@ -29,13 +29,6 @@ class VolumesTools extends Portlets {
        public $slotsPattern = '^[0-9\-\,]+$';
        public $drivePattern = '^[0-9]+$';
 
-       public function onInit($param) {
-               parent::onInit($param);
-               $this->LabelButton->setActionClass($this);
-               $this->UpdateSlotsButton->setActionClass($this);
-               $this->UpdateSlotsScanButton->setActionClass($this);
-       }
-
        public function onLoad($param) {
                parent::onLoad($param);
                if(!$this->getPage()->IsPostBack) {
@@ -61,46 +54,41 @@ class VolumesTools extends Portlets {
                }
        }
 
-       public function save($sender, $param) {
-               switch($sender->getParent()->ID) {
-                       case $this->LabelButton->ID: {
-                               if($this->LabelNameValidator->isValid === false) {
-                                       return;
-                               }
-                               $cmd = array('label');
-                               if($this->Barcodes->Checked == true) {
-                                       $cmd[] = 'barcodes';
-                                       $cmd[] = 'slots="' . $this->SlotsLabel->Text . '"';
-                               } else {
-                                       $cmd[] = 'volume="' . $this->LabelName->Text . '"';
-                               }
-                               $cmd[] = 'drive="' . $this->DriveLabel->Text . '"';
-                               $cmd[] = 'storage="'. $this->StorageLabel->SelectedItem->Text . '"';
-                               $cmd[] = 'pool="'. $this->PoolLabel->SelectedItem->Text . '"';
-                               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
-                               $this->getPage()->Console->sendCommand($sender, $param);
-                               break;
-                       }
-                       case $this->UpdateSlotsButton->ID: {
-                               $cmd = array('update');
-                               $cmd[] = 'slots="' . $this->SlotsUpdateSlots->Text . '"';
-                               $cmd[] = 'drive="' . $this->DriveUpdateSlots->Text . '"';
-                               $cmd[] = 'storage="'. $this->StorageUpdateSlots->SelectedItem->Text . '"';
-                               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
-                               $this->getPage()->Console->sendCommand($sender, $param);
-                               break;
-                       }
-                       case $this->UpdateSlotsScanButton->ID: {
-                               $cmd = array('update');
-                               $cmd[] = 'slots="' . $this->SlotsUpdateSlotsScan->Text . '"';
-                               $cmd[] = 'scan';
-                               $cmd[] = 'drive="' . $this->DriveUpdateSlotsScan->Text . '"';
-                               $cmd[] = 'storage="'. $this->StorageUpdateSlotsScan->SelectedItem->Text . '"';
-                               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
-                               $this->getPage()->Console->sendCommand($sender, $param);
-                               break;
-                       }
+       public function labelVolume($sender, $param) {
+               if($this->LabelNameValidator->isValid === false) {
+                       return;
                }
+               $cmd = array('label');
+               if($this->Barcodes->Checked == true) {
+                       $cmd[] = 'barcodes';
+                       $cmd[] = 'slots="' . $this->SlotsLabel->Text . '"';
+               } else {
+                       $cmd[] = 'volume="' . $this->LabelName->Text . '"';
+               }
+               $cmd[] = 'drive="' . $this->DriveLabel->Text . '"';
+               $cmd[] = 'storage="'. $this->StorageLabel->SelectedItem->Text . '"';
+               $cmd[] = 'pool="'. $this->PoolLabel->SelectedItem->Text . '"';
+               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
+               $this->getPage()->Console->sendCommand($sender, $param);
+       }
+
+       public function updateSlots($sender, $param) {
+               $cmd = array('update');
+               $cmd[] = 'slots="' . $this->SlotsUpdateSlots->Text . '"';
+               $cmd[] = 'drive="' . $this->DriveUpdateSlots->Text . '"';
+               $cmd[] = 'storage="'. $this->StorageUpdateSlots->SelectedItem->Text . '"';
+               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
+               $this->getPage()->Console->sendCommand($sender, $param);
+       }
+
+       public function updateSlotsScan($sender, $param) {
+               $cmd = array('update');
+               $cmd[] = 'slots="' . $this->SlotsUpdateSlotsScan->Text . '"';
+               $cmd[] = 'scan';
+               $cmd[] = 'drive="' . $this->DriveUpdateSlotsScan->Text . '"';
+               $cmd[] = 'storage="'. $this->StorageUpdateSlotsScan->SelectedItem->Text . '"';
+               $this->getPage()->Console->CommandLine->Text = implode(' ', $cmd);
+               $this->getPage()->Console->sendCommand($sender, $param);
        }
 
        public function setBarcodes($sender, $param) {
@@ -183,4 +171,4 @@ class VolumesTools extends Portlets {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 55f361b5a1a50b7314cd639ea227a8dac445de2e..96ad58bc37765a97b7d049769b7b45fc34f0f2f1 100644 (file)
@@ -44,7 +44,7 @@
                        <div class="field"><com:TActiveDropDownList ID="PoolLabel" CssClass="textbox" /></div>
                </div>
                <div class="button" style="margin-top: 10px;">
-                               <com:BActiveButton ID="LabelButton" Text="<%[ Label ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
+                               <com:BActiveButton ID="LabelButton" Text="<%[ Label ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" OnClick="labelVolume" />
                </div>
        </com:TActivePanel>
        <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>
@@ -62,7 +62,7 @@
                                <div class="field"><com:TActiveTextBox ID="SlotsUpdateSlots" CssClass="textbox" /></div>
                        </div>
                        <div class="button" style="margin-top: 10px;">
-                               <com:BActiveButton ID="UpdateSlotsButton" Text="<%[ Update barcodes slots ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
+                               <com:BActiveButton ID="UpdateSlotsButton" Text="<%[ Update barcodes slots ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" OnClick="updateSlots" />
                </div>
        </com:TActivePanel>
        <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>
@@ -80,7 +80,7 @@
                                <div class="field"><com:TActiveTextBox ID="SlotsUpdateSlotsScan" CssClass="textbox" /></div>
                        </div>
                        <div class="button" style="margin-top: 10px;">
-                               <com:BActiveButton ID="UpdateSlotsScanButton" Text="<%[ Update slots scan ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" />
+                               <com:BActiveButton ID="UpdateSlotsScanButton" Text="<%[ Update slots scan ]%>" CausesValidation="true" ValidationGroup="VolumesActionGroup" OnClick="updateSlotsScan" />
                </div>
        </com:TActivePanel>
 </com:TActivePanel>