]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Portlets/SlideWindow.php
baculum: Assign Baculum copyright to Kern Sibbald
[bacula/bacula] / gui / baculum / protected / Portlets / SlideWindow.php
index ea2b0fa4477df2ace1e4df3f391dc6ed1c1a73a8..546e3d9c171b8fb16e4eb39d1ec5801fabcfcfe9 100644 (file)
@@ -1,22 +1,27 @@
 <?php
-/**
- * Bacula® - The Network Backup Solution
- * Baculum - Bacula web interface
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2014 Marcin Haba
+ * Copyright (C) 2013-2016 Kern Sibbald
  *
  * 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.
+ * The original 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.
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) 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');
@@ -28,11 +33,31 @@ Prado::using('Application.Portlets.Portlets');
 
 class SlideWindow extends Portlets {
 
-       public $elementsLimits = array(10, 25, 50, 100, 200, 500, 1000, 'unlimited');
+       public $elementsLimit = array(
+               10 => '10 elements',
+               25 => '25 elements',
+               50 => '50 elements',
+               100 => '100 elements',
+               200 => '200 elements',
+               500 => '500 elements',
+               1000 => '1000 elements',
+               'unlimited' => 'unlimited'
+       );
+
+       private $defaultElementsLimit = 500;
 
-       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';
@@ -40,19 +65,31 @@ class SlideWindow extends Portlets {
        public function onInit($param) {
                parent::onInit($param);
                if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) {
-                       $_SESSION['view' . $this->getParent()->ID] = self::NORMAL_VIEW;
-                       $_SESSION['limit' . $this->getParent()->ID] = 'unlimited';
+                       $_SESSION['view' . $this->getParent()->ID] = self::DETAIL_VIEW;
+                       $_SESSION['limit' . $this->getParent()->ID] = $this->defaultElementsLimit;
                }
        }
 
        public function onLoad($param) {
                parent::onLoad($param);
                if(!$this->getPage()->IsPostBack) {
-                       $this->Limit->dataSource = array_combine($this->elementsLimits, $this->elementsLimits);
+                       $limitKeys = array_keys($this->elementsLimit);
+                       $limitValues = array();
+                       foreach($this->elementsLimit as $val) {
+                               $limitValues[] = Prado::localize($val);
+                       }
+                       $this->Limit->dataSource = array_combine($limitKeys, $limitValues);
                        $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID];
                        $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();
+                       $actionsLang = array();
+                       foreach($actions as $key => $val) {
+                               $actionsLang[$key] = Prado::localize($val);
+                       }
+                       $this->Actions->dataSource = $actionsLang;
+                       $this->Actions->dataBind();
                }
        }
 
@@ -61,5 +98,11 @@ class SlideWindow extends Portlets {
                $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
                $this->getParent()->prepareData(true);
        }
+
+       public function action($sender, $param) {
+               if(method_exists($this->getParent(), 'executeAction')) {
+                       $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param);
+               }
+       }
 }
-?>
\ No newline at end of file
+?>