]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Portlets/SlideWindow.php
baculum: Implement Polish language support
[bacula/bacula] / gui / baculum / protected / Portlets / SlideWindow.php
index 56a8c59768af45e3452f358b47dda46e4c6c18ed..17ee34e7e8e539a05ee2d16d60ded6e3d841610c 100644 (file)
@@ -16,7 +16,9 @@
  *
  * Bacula® is a registered trademark of Kern Sibbald.
  */
+
  
+Prado::using('System.Web.UI.WebControls.TCompareValidator');
 Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
@@ -28,38 +30,69 @@ Prado::using('Application.Portlets.Portlets');
 
 class SlideWindow extends Portlets {
 
-       public $elementsLimits = array(10, 25, 50, 100, 200, 500, 1000, 'unlimited');
-
-       public $ShowID;
-       public $Title;
-       public $WindowTitle;
+       public $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'
+       );
+        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';
 
        public function onInit($param) {
                parent::onInit($param);
-               if(empty($this->Session['view' . $this->getParent()->ID]) && empty($this->Session['limit' . $this->getParent()->ID])) {
-                       $this->Session['view' . $this->getParent()->ID] = self::NORMAL_VIEW;
-                       $this->Session['limit' . $this->getParent()->ID] = 'unlimited';
+               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] = $this->elementsLimit['unlimited'];
                }
        }
 
        public function onLoad($param) {
                parent::onLoad($param);
                if(!$this->getPage()->IsPostBack) {
-                       $this->Limit->dataSource = array_combine($this->elementsLimits, $this->elementsLimits);
-                       $this->Limit->SelectedValue = $this->Session['limit' . $this->getParent()->ID];
+                       $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 = ($this->Session['view' . $this->getParent()->ID] == self::NORMAL_VIEW);
-                       $this->Details->Checked = ($this->Session['view' . $this->getParent()->ID] == self::DETAIL_VIEW);
+                       $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();
                }
        }
 
        public function switchView($sender, $param) {
-               $this->Session['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW;
-               $this->Session['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
+               $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW;
+               $_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
+?>