3 * Bacula® - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2014 Marcin Haba
8 * The main author of Baculum is Marcin Haba.
9 * The main author of Bacula is Kern Sibbald, with contributions from many
10 * others, a complete list can be found in the file AUTHORS.
12 * You may use this file and others of this release according to the
13 * license defined in the LICENSE file, which includes the Affero General
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
15 * terms pursuant to its AGPLv3 Section 7.
17 * Bacula® is a registered trademark of Kern Sibbald.
21 Prado::using('System.Web.UI.WebControls.TCompareValidator');
22 Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
23 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
24 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
25 Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
26 Prado::using('System.Web.UI.ActiveControls.TActiveRadioButton');
27 Prado::using('System.Web.UI.ActiveControls.TCallback');
29 Prado::using('Application.Portlets.Portlets');
31 class SlideWindow extends Portlets {
33 public $elementsLimit = array(
37 100 => '100 elements',
38 200 => '200 elements',
39 500 => '500 elements',
40 1000 => '1000 elements',
41 'unlimited' => 'unlimited'
43 public $actions = array(
44 'VolumeWindow' => array(
45 'NoAction' => 'select action',
51 'NoAction' => 'select action',
56 const NORMAL_VIEW = 'simple';
57 const DETAIL_VIEW = 'details';
59 public function onInit($param) {
60 parent::onInit($param);
61 if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) {
62 $_SESSION['view' . $this->getParent()->ID] = self::NORMAL_VIEW;
63 $_SESSION['limit' . $this->getParent()->ID] = $this->elementsLimit['unlimited'];
67 public function onLoad($param) {
68 parent::onLoad($param);
69 if(!$this->getPage()->IsPostBack) {
70 $limitKeys = array_keys($this->elementsLimit);
71 $limitValues = array();
72 foreach($this->elementsLimit as $val) {
73 $limitValues[] = Prado::localize($val);
75 $this->Limit->dataSource = array_combine($limitKeys, $limitValues);
76 $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID];
77 $this->Limit->dataBind();
78 $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW);
79 $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW);
80 $actions = array_key_exists($this->getParent()->ID, $this->actions) ? $this->actions[$this->getParent()->ID] : array();
81 $actionsLang = array();
82 foreach($actions as $key => $val) {
83 $actionsLang[$key] = Prado::localize($val);
85 $this->Actions->dataSource = $actionsLang;
86 $this->Actions->dataBind();
90 public function switchView($sender, $param) {
91 $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW;
92 $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
93 $this->getParent()->prepareData(true);
96 public function action($sender, $param) {
97 if(method_exists($this->getParent(), 'executeAction')) {
98 $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param);