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'
46 public $actions = array(
47 'VolumeWindow' => array(
48 'NoAction' => 'select action',
54 'NoAction' => 'select action',
59 const NORMAL_VIEW = 'simple';
60 const DETAIL_VIEW = 'details';
62 public function onInit($param) {
63 parent::onInit($param);
64 if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) {
65 $_SESSION['view' . $this->getParent()->ID] = self::DETAIL_VIEW;
66 $_SESSION['limit' . $this->getParent()->ID] = $this->elementsLimit['unlimited'];
70 public function onLoad($param) {
71 parent::onLoad($param);
72 if(!$this->getPage()->IsPostBack) {
73 $limitKeys = array_keys($this->elementsLimit);
74 $limitValues = array();
75 foreach($this->elementsLimit as $val) {
76 $limitValues[] = Prado::localize($val);
78 $this->Limit->dataSource = array_combine($limitKeys, $limitValues);
79 $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID];
80 $this->Limit->dataBind();
81 $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW);
82 $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW);
83 $actions = array_key_exists($this->getParent()->ID, $this->actions) ? $this->actions[$this->getParent()->ID] : array();
84 $actionsLang = array();
85 foreach($actions as $key => $val) {
86 $actionsLang[$key] = Prado::localize($val);
88 $this->Actions->dataSource = $actionsLang;
89 $this->Actions->dataBind();
93 public function switchView($sender, $param) {
94 $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW;
95 $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue;
96 $this->getParent()->prepareData(true);
99 public function action($sender, $param) {
100 if(method_exists($this->getParent(), 'executeAction')) {
101 $this->getParent()->executeAction($this->Actions->SelectedValue, $sender, $param);