3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2016 Kern Sibbald
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.
23 Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
24 Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
25 Prado::using('Application.Web.Portlets.Portlets');
27 class PoolConfiguration extends Portlets {
29 public function configure($poolId) {
30 $pooldata = $this->Application->getModule('api')->get(array('pools', $poolId))->output;
31 $this->PoolName->Text = $pooldata->name;
32 $this->PoolID->Text = $pooldata->poolid;
33 $this->Enabled->Checked = $pooldata->enabled == 1;
34 $this->MaxVolumes->Text = $pooldata->maxvols;
35 $this->MaxVolJobs->Text = $pooldata->maxvoljobs;
36 $this->MaxVolBytes->Text = $pooldata->maxvolbytes;
37 $this->UseDuration->Text = intval($pooldata->voluseduration / 3600); // conversion to hours;
38 $this->RetentionPeriod->Text = intval($pooldata->volretention / 3600); // conversion to hours;
39 $this->LabelFormat->Text = $pooldata->labelformat;
40 if ($pooldata->scratchpoolid > 0) {
41 $pools = $this->Application->getModule('api')->get(array('pools', $pooldata->scratchpoolid))->output;
42 $this->ScratchPool->Text = $pools->name;
44 if ($pooldata->recyclepoolid > 0) {
45 $pools = $this->Application->getModule('api')->get(array('pools', $pooldata->recyclepoolid))->output;
46 $this->RecyclePool->Text = $pools->name;
48 $this->Recycle->Checked = $pooldata->recycle == 1;
49 $this->AutoPrune->Checked = $pooldata->autoprune == 1;
50 $this->ActionOnPurge->Checked = $pooldata->actiononpurge == 1;
53 public function restore_configuration($sender, $param) {
54 $this->Application->getModule('api')->set(array('pools', 'update', $this->PoolID->Text), array(''));
57 public function update_volumes($sender, $param) {
58 $this->Application->getModule('api')->set(array('pools', 'update', 'volumes', $this->PoolID->Text), array(''));
61 public function maxVolumesValidator($sender, $param) {
62 $isValid = preg_match('/^\d+$/', $this->MaxVolumes->Text) && $this->MaxVolumes->Text >= 0;
63 $param->setIsValid($isValid);
66 public function maxVolJobsValidator($sender, $param) {
67 $isValid = preg_match('/^\d+$/', $this->MaxVolJobs->Text) && $this->MaxVolJobs->Text >= 0;
68 $param->setIsValid($isValid);
71 public function maxVolBytesValidator($sender, $param) {
72 $isValid = preg_match('/^\d+$/', $this->MaxVolBytes->Text) && $this->MaxVolBytes->Text >= 0;
73 $param->setIsValid($isValid);
76 public function useDurationValidator($sender, $param) {
77 $isValid = preg_match('/^\d+$/', $this->UseDuration->Text) && $this->UseDuration->Text >= 0;
78 $param->setIsValid($isValid);
81 public function retentionPeriodValidator($sender, $param) {
82 $isValid = preg_match('/^\d+$/', $this->RetentionPeriod->Text) && $this->RetentionPeriod->Text >= 0;
83 $param->setIsValid($isValid);
86 public function labelFormatValidator($sender, $param) {
87 $value = trim($this->LabelFormat->Text);
88 $isValid = !empty($value);
89 $param->setIsValid($isValid);