3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2015 Marcin Haba
8 * The main author of Baculum is Marcin Haba.
9 * The original author of Bacula is Kern Sibbald, with contributions
10 * from many 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 * This notice must be preserved when any source code is
18 * conveyed and/or propagated.
20 * Bacula(R) is a registered trademark of Kern Sibbald.
24 Prado::using('System.Web.UI.WebControls.TCompareValidator');
25 Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
26 Prado::using('System.Web.UI.ActiveControls.TActivePanel');
27 Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
28 Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
29 Prado::using('System.Web.UI.ActiveControls.TActiveRadioButton');
30 Prado::using('System.Web.UI.ActiveControls.TCallback');
32 Prado::using('Application.Portlets.Portlets');
34 class SlideWindow extends Portlets {
36 public $elementsLimit = array(
40 100 => '100 elements',
41 200 => '200 elements',
42 500 => '500 elements',
43 1000 => '1000 elements',
44 'unlimited' => 'unlimited'
47 private $defaultElementsLimit = 500;
49 public $actions = array(
50 'VolumeWindow' => array(
51 'NoAction' => 'select action',
57 'NoAction' => 'select action',
62 const NORMAL_VIEW = 'simple';
63 const DETAIL_VIEW = 'details';
65 public function onInit($param) {
66 parent::onInit($param);
67 if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) {
68 $_SESSION['view' . $this->getParent()->ID] = self::DETAIL_VIEW;
69 $_SESSION['limit' . $this->getParent()->ID] = $this->defaultElementsLimit;
73 public function onLoad($param) {
74 parent::onLoad($param);
75 if(!$this->getPage()->IsPostBack) {
76 $limitKeys = array_keys($this->elementsLimit);
77 $limitValues = array();
78 foreach($this->elementsLimit as $val) {
79 $limitValues[] = Prado::localize($val);
81 $this->Limit->dataSource = array_combine($limitKeys, $limitValues);
82 $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID];
83 $this->Limit->dataBind();
84 $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW);
85 $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW);
86 $actions = array_key_exists($this->getParent()->ID, $this->actions) ? $this->actions[$this->getParent()->ID] : array();
87 $actionsLang = array();
88 foreach($actions as $key => $val) {
89 $actionsLang[$key] = Prado::localize($val);
91 $this->Actions->dataSource = $actionsLang;
92 $this->Actions->dataBind();
96 public function switchView($sender, $param) {
97 $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW;
98 $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
99 $this->getParent()->prepareData(true);
102 public function action($sender, $param) {
103 if(method_exists($this->getParent(), 'executeAction')) {
104 $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param);