]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Tweak end of lines (CF+LF => LF)
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 28 Sep 2014 08:56:44 +0000 (10:56 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 28 Sep 2014 08:57:52 +0000 (10:57 +0200)
15 files changed:
gui/baculum/protected/Class/FileSetRecord.php
gui/baculum/protected/Class/JobRecord.php
gui/baculum/protected/Class/PoolRecord.php
gui/baculum/protected/Class/VolumeRecord.php
gui/baculum/protected/Portlets/ClientConfiguration.php
gui/baculum/protected/Portlets/ClientList.php
gui/baculum/protected/Portlets/JobList.php
gui/baculum/protected/Portlets/JobRunConfiguration.php
gui/baculum/protected/Portlets/JobRunList.php
gui/baculum/protected/Portlets/PoolConfiguration.php
gui/baculum/protected/Portlets/PoolList.php
gui/baculum/protected/Portlets/StorageConfiguration.php
gui/baculum/protected/Portlets/StorageList.php
gui/baculum/protected/Portlets/VolumeConfiguration.php
gui/baculum/protected/Portlets/VolumeList.php

index 841ab02fd39a3fdcd09903c5ca436b4b7b0dfb5d..a6adc1c1cfc0186c8fec33f5593ef4e75bcba34e 100644 (file)
@@ -1,32 +1,32 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
 class FileSetRecord extends ActiveRecord {
-       const TABLE = 'FileSet';\r
-\r
-       public $filesetid;\r
-       public $fileset;\r
-       public $md5;\r
-       public $createtime;\r
-       \r
+       const TABLE = 'FileSet';
+
+       public $filesetid;
+       public $fileset;
+       public $md5;
+       public $createtime;
+
        public static function finder($className = __CLASS__) {
                return parent::finder($className);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index 7b4b746dfe304b6c745b3657c00dd84642f2d294..cd8acaf13b9063f4acc82448d8afead3b6b01a2f 100644 (file)
@@ -1,56 +1,56 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
 class JobRecord extends ActiveRecord {
-       const TABLE = 'Job';\r
-\r
-       public $jobid;\r
-       public $job;\r
-       public $name;\r
-       public $type;\r
-       public $level;\r
-       public $clientid;\r
-       public $jobstatus;\r
-       public $schedtime;\r
-       public $starttime;\r
-       public $endtime;\r
-       public $realendtime;\r
-       public $jobtdate;\r
-       public $volsessionid;\r
-       public $volsessiontime;\r
-       public $jobfiles;\r
-       public $jobbytes;\r
-       public $readbytes;\r
-       public $joberrors;\r
-       public $jobmissingfiles;\r
-       public $poolid;\r
-       public $filesetid;\r
-       public $priorjobid;\r
-       public $purgedfiles;\r
-       public $hasbase;\r
-       public $hascache;\r
-       public $reviewed;\r
-       public $comment;\r
-       public $filetable;\r
-       \r
+       const TABLE = 'Job';
+
+       public $jobid;
+       public $job;
+       public $name;
+       public $type;
+       public $level;
+       public $clientid;
+       public $jobstatus;
+       public $schedtime;
+       public $starttime;
+       public $endtime;
+       public $realendtime;
+       public $jobtdate;
+       public $volsessionid;
+       public $volsessiontime;
+       public $jobfiles;
+       public $jobbytes;
+       public $readbytes;
+       public $joberrors;
+       public $jobmissingfiles;
+       public $poolid;
+       public $filesetid;
+       public $priorjobid;
+       public $purgedfiles;
+       public $hasbase;
+       public $hascache;
+       public $reviewed;
+       public $comment;
+       public $filetable;
+
        public static function finder($className = __CLASS__) {
                return parent::finder($className);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index d6a146901ba9ff64083ed8243e51648c1156d9f0..61a66af8f7f566498c724dee2cace55c2fbf2deb 100644 (file)
@@ -1,53 +1,53 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
 class PoolRecord extends ActiveRecord {
-       const TABLE = 'Pool';\r
-\r
-       public $poolid;\r
-       public $name;\r
-       public $numvols;\r
-       public $maxvols;\r
-       public $useonce;\r
-       public $usecatalog;\r
-       public $acceptanyvolume;\r
-       public $volretention;\r
-       public $voluseduration;\r
-       public $maxvoljobs;\r
-       public $maxvolfiles;\r
-       public $maxvolbytes;\r
-       public $autoprune;\r
-       public $recycle;\r
-       public $actiononpurge;\r
-       public $pooltype;\r
-       public $labeltype;\r
-       public $labelformat;\r
-       public $enabled;\r
-       public $scratchpoolid;\r
-       public $recyclepoolid;\r
-       public $nextpoolid;\r
-       public $migrationhighbytes;\r
-       public $migrationlowbytes;\r
-       public $migrationtime;\r
-       \r
+       const TABLE = 'Pool';
+
+       public $poolid;
+       public $name;
+       public $numvols;
+       public $maxvols;
+       public $useonce;
+       public $usecatalog;
+       public $acceptanyvolume;
+       public $volretention;
+       public $voluseduration;
+       public $maxvoljobs;
+       public $maxvolfiles;
+       public $maxvolbytes;
+       public $autoprune;
+       public $recycle;
+       public $actiononpurge;
+       public $pooltype;
+       public $labeltype;
+       public $labelformat;
+       public $enabled;
+       public $scratchpoolid;
+       public $recyclepoolid;
+       public $nextpoolid;
+       public $migrationhighbytes;
+       public $migrationlowbytes;
+       public $migrationtime;
+
        public static function finder($className = __CLASS__) {
                return parent::finder($className);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index a28c4e88ab2b4badc4a28ba60a6a3853f35c58dc..45df3e23859585f6e4c0ff37d54d0a6e4a464bc8 100644 (file)
@@ -1,77 +1,77 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
 class VolumeRecord extends ActiveRecord {
-       const TABLE = 'Media';\r
-\r
-       public $mediaid;\r
-       public $volumename;\r
-       public $slot;\r
-       public $poolid;\r
-       public $mediatype;\r
-       public $mediatypeid;\r
-       public $labeltype;\r
-       public $firstwritten;\r
-       public $lastwritten;\r
-       public $labeldate;\r
-       public $voljobs;\r
-       public $volfiles;\r
-       public $volblocks;\r
-       public $volmounts;\r
-       public $volbytes;\r
-       public $volabytes;\r
-       public $volapadding;\r
-       public $volholebytes;\r
-       public $volholes;\r
-       public $volparts;\r
-       public $volerrors;\r
-       public $volwrites;\r
-       public $maxvolbytes;\r
-       public $volcapacitybytes;\r
-       public $volstatus;\r
-       public $enabled;\r
-       public $recycle;\r
-       public $actiononpurge;\r
-       public $volretention;\r
-       public $voluseduration;\r
-       public $maxvoljobs;\r
-       public $maxvolfiles;\r
-       public $inchanger;\r
-       public $storageid;\r
-       public $deviceid;\r
-       public $mediaaddressing;\r
-       public $volreadtime;\r
-       public $volwritetime;\r
-       public $endfile;\r
-       public $endblock;\r
-       public $locationid;\r
-       public $recyclecount;\r
-       public $initialwrite;\r
-       public $scratchpoolid;\r
-       public $recyclepoolid;\r
-       public $comment;\r
-\r
-       public $pool;\r
-       public $whenexpire;\r
-\r
+       const TABLE = 'Media';
+
+       public $mediaid;
+       public $volumename;
+       public $slot;
+       public $poolid;
+       public $mediatype;
+       public $mediatypeid;
+       public $labeltype;
+       public $firstwritten;
+       public $lastwritten;
+       public $labeldate;
+       public $voljobs;
+       public $volfiles;
+       public $volblocks;
+       public $volmounts;
+       public $volbytes;
+       public $volabytes;
+       public $volapadding;
+       public $volholebytes;
+       public $volholes;
+       public $volparts;
+       public $volerrors;
+       public $volwrites;
+       public $maxvolbytes;
+       public $volcapacitybytes;
+       public $volstatus;
+       public $enabled;
+       public $recycle;
+       public $actiononpurge;
+       public $volretention;
+       public $voluseduration;
+       public $maxvoljobs;
+       public $maxvolfiles;
+       public $inchanger;
+       public $storageid;
+       public $deviceid;
+       public $mediaaddressing;
+       public $volreadtime;
+       public $volwritetime;
+       public $endfile;
+       public $endblock;
+       public $locationid;
+       public $recyclecount;
+       public $initialwrite;
+       public $scratchpoolid;
+       public $recyclepoolid;
+       public $comment;
+
+       public $pool;
+       public $whenexpire;
+
        public static function finder($className = __CLASS__) {
                return parent::finder($className);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index e2a6c44beb2df1f8b786740d32f582ba4a692903..4d61010c477b51685f254c8144812b2b07eb9642 100644 (file)
@@ -1,75 +1,75 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveCustomValidator');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveCustomValidator');
+Prado::using('Application.Portlets.Portlets');
+
 class ClientConfiguration extends Portlets {
-\r
+
        public function onInit($param) {
-               parent::onInit($param);\r
-               $this->Status->setActionClass($this);\r
-               $this->Apply->setActionClass($this);\r
-       }\r
-\r
-       public function configure($clientId) {\r
-               $clientdata = $this->Application->getModule('api')->get(array('clients', 'show', $clientId))->output;\r
-               $this->ShowClient->Text = implode(PHP_EOL, $clientdata);\r
-               $client = $this->Application->getModule('api')->get(array('clients', $clientId))->output;\r
-               $this->ClientName->Text = $client->name;\r
-               $this->ClientIdentifier->Text = $client->clientid;\r
-               $this->ClientDescription->Text = $client->uname;\r
-               $this->FileRetention->Text = intval($client->fileretention / 86400); // conversion to days\r
-               $this->JobRetention->Text = intval($client->jobretention / 86400); // conversion to days\r
-               $this->AutoPrune->Checked = $client->autoprune == 1;\r
-       }\r
-\r
-       public function save($sender, $param) {\r
-               switch($sender->getParent()->ID) {\r
-                       case $this->Status->ID: {\r
-                               $status = $this->Application->getModule('api')->get(array('clients', 'status', $this->ClientIdentifier->Text))->output;\r
-                               $this->ShowClient->Text = implode(PHP_EOL, $status);\r
-                               break;\r
-                       }\r
-                       case $this->Apply->ID: {\r
-                               if($this->JobRetentionValidator->IsValid === false || $this->FileRetentionValidator->IsValid === false) {\r
-                                       return false;\r
-                               }\r
-                               $client = array();\r
-                               $client['clientid'] = $this->ClientIdentifier->Text;\r
-                               $client['fileretention'] = $this->FileRetention->Text * 86400; // conversion to seconds\r
-                               $client['jobretention'] = $this->JobRetention->Text * 86400; // conversion to seconds\r
-                               $client['autoprune'] = (integer)$this->AutoPrune->Checked;\r
-                               $this->Application->getModule('api')->set(array('clients', $client['clientid']), $client);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function fileRetentionValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->FileRetention->Text) && $this->FileRetention->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
+               parent::onInit($param);
+               $this->Status->setActionClass($this);
+               $this->Apply->setActionClass($this);
+       }
+
+       public function configure($clientId) {
+               $clientdata = $this->Application->getModule('api')->get(array('clients', 'show', $clientId))->output;
+               $this->ShowClient->Text = implode(PHP_EOL, $clientdata);
+               $client = $this->Application->getModule('api')->get(array('clients', $clientId))->output;
+               $this->ClientName->Text = $client->name;
+               $this->ClientIdentifier->Text = $client->clientid;
+               $this->ClientDescription->Text = $client->uname;
+               $this->FileRetention->Text = intval($client->fileretention / 86400); // conversion to days
+               $this->JobRetention->Text = intval($client->jobretention / 86400); // conversion to days
+               $this->AutoPrune->Checked = $client->autoprune == 1;
+       }
+
+       public function save($sender, $param) {
+               switch($sender->getParent()->ID) {
+                       case $this->Status->ID: {
+                               $status = $this->Application->getModule('api')->get(array('clients', 'status', $this->ClientIdentifier->Text))->output;
+                               $this->ShowClient->Text = implode(PHP_EOL, $status);
+                               break;
+                       }
+                       case $this->Apply->ID: {
+                               if($this->JobRetentionValidator->IsValid === false || $this->FileRetentionValidator->IsValid === false) {
+                                       return false;
+                               }
+                               $client = array();
+                               $client['clientid'] = $this->ClientIdentifier->Text;
+                               $client['fileretention'] = $this->FileRetention->Text * 86400; // conversion to seconds
+                               $client['jobretention'] = $this->JobRetention->Text * 86400; // conversion to seconds
+                               $client['autoprune'] = (integer)$this->AutoPrune->Checked;
+                               $this->Application->getModule('api')->set(array('clients', $client['clientid']), $client);
+                               break;
+                       }
+               }
+       }
+
+       public function fileRetentionValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->FileRetention->Text) && $this->FileRetention->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
        public function jobRetentionValidator($sender, $param) {
-               $isValid = preg_match('/^\d+$/', $this->JobRetention->Text) && $this->JobRetention->Text >= 0;\r
+               $isValid = preg_match('/^\d+$/', $this->JobRetention->Text) && $this->JobRetention->Text >= 0;
                $param->setIsValid($isValid);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index 021c7a10b639f8e0042f77fbf194614fb59381bc..01c152b05388a133c8d723153e2a7e058f7a2db0 100644 (file)
@@ -1,78 +1,78 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
+Prado::using('Application.Portlets.Portlets');
+
 class ClientList extends Portlets {
-\r
-       public $ShowID, $windowTitle;\r
-\r
+
+       public $ShowID, $windowTitle;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-       }\r
-\r
-       public function setWindowTitle($param) {\r
-               $this->windowTitle = $param;\r
-       }\r
-\r
-       public function prepareData($forceReload = false) {\r
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
+       public function setWindowTitle($param) {
+               $this->windowTitle = $param;
+       }
+
+       public function prepareData($forceReload = false) {
                $allowedButtons = array('ClientBtn', 'ReloadClients');
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);\r
-                               $clients = $this->Application->getModule('api')->get($params);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->ClientWindow->ID] == 'details';\r
-                               $clientsList = $this->Application->getModule('misc')->objectToArray($clients->output);\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $isDetailView === false ? $clientsList : array();\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $isDetailView === true ?  $clientsList : array();\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
+                               $clients = $this->Application->getModule('api')->get($params);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->ClientWindow->ID] == 'details';
+                               $clientsList = $this->Application->getModule('misc')->objectToArray($clients->output);
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $isDetailView === false ? $clientsList : array();
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $isDetailView === true ?  $clientsList : array();
+                               $this->DataGrid->dataBind();
+                       }
                }
-       }\r
-\r
-       public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->Application->getModule('misc')->objectToArray($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->ClientConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+       }
+
+       public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID);
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->Application->getModule('misc')->objectToArray($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->ClientConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>
\ No newline at end of file
index 3ce0091d6ed543275cff4f17e7e7b1230a37262c..484e92152cc8caa8faa555580fe46aa421ac078a 100644 (file)
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');\r
-Prado::using('System.Web.UI.ActiveControls.TActivePanel');\r
-Prado::using('System.Web.UI.ActiveControls.TCallback');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.Portlets');
+
 class JobList extends Portlets {
-\r
-       public $ShowID, $windowTitle;\r
-\r
-       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');\r
-\r
-       private $jobStates;\r
-\r
-       public $jobLevels;\r
-\r
+
+       public $ShowID, $windowTitle;
+
+       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');
+
+       private $jobStates;
+
+       public $jobLevels;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-               $this->jobLevels = $this->Application->getModule('misc')->getJobLevels();\r
-       }\r
-\r
-       public function setWindowTitle($param) {\r
-               $this->windowTitle = $param;\r
-       }\r
-\r
+               parent::onLoad($param);
+               $this->prepareData();
+               $this->jobLevels = $this->Application->getModule('misc')->getJobLevels();
+       }
+
+       public function setWindowTitle($param) {
+               $this->windowTitle = $param;
+       }
+
        public function getJobType($jobLetter) {
                return array_key_exists($jobLetter, $this->jobTypes) ? $this->jobTypes[$jobLetter] : null;
-       }\r
-\r
-       public function getJobState($jobStateLetter) {\r
-               $jobstates =  array(\r
-               'C' => (object)array('value' => 'Created', 'description' =>'Created but not yet running'),\r
-               'R' => (object)array('value' => 'Running', 'description' => 'Running'),\r
-               'B' => (object)array('value' => 'Blocked', 'description' => 'Blocked'),\r
-               'T' => (object)array('value' => 'Terminated', 'description' =>'Terminated normally'),\r
-               'W' => (object)array('value' => 'Terminated with warnings', 'description' =>'Terminated normally with warnings'),\r
-               'E' => (object)array('value' => 'Error', 'description' =>'Terminated in Error'),\r
-               'e' => (object)array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'),\r
-               'f' => (object)array('value' => 'Fatal error', 'description' =>'Fatal error'),\r
-               'D' => (object)array('value' => 'Verify', 'description' =>'Verify Differences'),\r
-               'A' => (object)array('value' => 'Canceled by user', 'description' =>'Canceled by the user'),\r
-               'I' => (object)array('value' => 'Incomplete', 'description' =>'Incomplete Job'),\r
-               'F' => (object)array('value' => 'Waiting on FD', 'description' =>'Waiting on the File daemon'),\r
-               'S' => (object)array('value' => 'Waiting on SD', 'description' =>'Waiting on the Storage daemon'),\r
-               'm' => (object)array('value' => 'Waiting for new vol.', 'description' =>'Waiting for a new Volume to be mounted'),\r
-               'M' => (object)array('value' => 'Waiting for mount', 'description' =>'Waiting for a Mount'),\r
-               's' => (object)array('value' => 'Waiting for storage', 'description' =>'Waiting for Storage resource'),\r
-               'j' => (object)array('value' => 'Waiting for job', 'description' =>'Waiting for Job resource'),\r
-               'c' => (object)array('value' => 'Waiting for client', 'description' =>'Waiting for Client resource'),\r
-               'd' => (object)array('value' => 'Waiting for Max. jobs', 'description' =>'Wating for Maximum jobs'),\r
-               't' => (object)array('value' => 'Waiting for start', 'description' =>'Waiting for Start Time'),\r
-               'p' => (object)array('value' => 'Waiting for higher priority', 'description' =>'Waiting for higher priority job to finish'),\r
-               'i' => (object)array('value' => 'Batch insert', 'description' =>'Doing batch insert file records'),\r
-               'a' => (object)array('value' => 'Despooling attributes', 'description' =>'SD despooling attributes'),\r
-               'l' => (object)array('value' => 'Data despooling', 'description' =>'Doing data despooling'),\r
-               'L' => (object)array('value' => 'Commiting data', 'description' =>'Committing data (last despool)')\r
-       );\r
-               return array_key_exists($jobStateLetter, $jobstates) ? $jobstates[$jobStateLetter] : null;\r
-       }\r
-\r
-       public function prepareData($forceReload = false) {\r
-               $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run');\r
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);\r
-                               $jobs = $this->Application->getModule('api')->get($params);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->JobWindow->ID] == 'details';\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $isDetailView == false ? $jobs->output : array();\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($jobs->output) : array();\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
-               }\r
-       }\r
\r
-    public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->Application->getModule('misc')->objectToArray($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->JobConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+       }
+
+       public function getJobState($jobStateLetter) {
+               $jobstates =  array(
+               'C' => (object)array('value' => 'Created', 'description' =>'Created but not yet running'),
+               'R' => (object)array('value' => 'Running', 'description' => 'Running'),
+               'B' => (object)array('value' => 'Blocked', 'description' => 'Blocked'),
+               'T' => (object)array('value' => 'Terminated', 'description' =>'Terminated normally'),
+               'W' => (object)array('value' => 'Terminated with warnings', 'description' =>'Terminated normally with warnings'),
+               'E' => (object)array('value' => 'Error', 'description' =>'Terminated in Error'),
+               'e' => (object)array('value' => 'Non-fatal error', 'description' =>'Non-fatal error'),
+               'f' => (object)array('value' => 'Fatal error', 'description' =>'Fatal error'),
+               'D' => (object)array('value' => 'Verify', 'description' =>'Verify Differences'),
+               'A' => (object)array('value' => 'Canceled by user', 'description' =>'Canceled by the user'),
+               'I' => (object)array('value' => 'Incomplete', 'description' =>'Incomplete Job'),
+               'F' => (object)array('value' => 'Waiting on FD', 'description' =>'Waiting on the File daemon'),
+               'S' => (object)array('value' => 'Waiting on SD', 'description' =>'Waiting on the Storage daemon'),
+               'm' => (object)array('value' => 'Waiting for new vol.', 'description' =>'Waiting for a new Volume to be mounted'),
+               'M' => (object)array('value' => 'Waiting for mount', 'description' =>'Waiting for a Mount'),
+               's' => (object)array('value' => 'Waiting for storage', 'description' =>'Waiting for Storage resource'),
+               'j' => (object)array('value' => 'Waiting for job', 'description' =>'Waiting for Job resource'),
+               'c' => (object)array('value' => 'Waiting for client', 'description' =>'Waiting for Client resource'),
+               'd' => (object)array('value' => 'Waiting for Max. jobs', 'description' =>'Wating for Maximum jobs'),
+               't' => (object)array('value' => 'Waiting for start', 'description' =>'Waiting for Start Time'),
+               'p' => (object)array('value' => 'Waiting for higher priority', 'description' =>'Waiting for higher priority job to finish'),
+               'i' => (object)array('value' => 'Batch insert', 'description' =>'Doing batch insert file records'),
+               'a' => (object)array('value' => 'Despooling attributes', 'description' =>'SD despooling attributes'),
+               'l' => (object)array('value' => 'Data despooling', 'description' =>'Doing data despooling'),
+               'L' => (object)array('value' => 'Commiting data', 'description' =>'Committing data (last despool)')
+       );
+               return array_key_exists($jobStateLetter, $jobstates) ? $jobstates[$jobStateLetter] : null;
+       }
+
+       public function prepareData($forceReload = false) {
+               $allowedButtons = array('JobBtn', 'ReloadJobs', 'Run');
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);
+                               $jobs = $this->Application->getModule('api')->get($params);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->JobWindow->ID] == 'details';
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $isDetailView == false ? $jobs->output : array();
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($jobs->output) : array();
+                               $this->DataGrid->dataBind();
+                       }
+               }
+       }
+
+    public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID);
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->Application->getModule('misc')->objectToArray($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->JobConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>
index ff8ef6f929b13ac4c3efed20d1e81dbd8e34fe41..4797ef886ebe956a21f1cea907cb25e9536f11d5 100644 (file)
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('Application.Portlets.Portlets');
+
 class JobRunConfiguration extends Portlets {
-\r
-       const DEFAULT_JOB_PRIORITY = 10;\r
-\r
+
+       const DEFAULT_JOB_PRIORITY = 10;
+
        public function onInit($param) {
-               parent::onInit($param);\r
-               $this->Run->setActionClass($this);\r
-               $this->Estimate->setActionClass($this);\r
-       }\r
-\r
-       public function configure($jobname) {\r
-               $this->JobName->Text = $jobname;\r
-               $this->Estimation->Text = '';\r
-\r
-               $this->Level->dataSource = $this->Application->getModule('misc')->getJobLevels();\r
-               $this->Level->dataBind();\r
-               \r
-               $clients = $this->Application->getModule('api')->get(array('clients'))->output;\r
-               $clientsList = array();\r
-               foreach($clients as $client) {\r
-                       $clientsList[$client->clientid] = $client->name;\r
-               }\r
-               $this->Client->dataSource = $clientsList;\r
-               $this->Client->dataBind();\r
-\r
-               $filesetsAll = $this->Application->getModule('api')->get(array('filesets'))->output;\r
-               $filesetsList = array();\r
-               foreach($filesetsAll as $director => $filesets) {\r
-                       $filesetsList = array_merge($filesets, $filesetsList);\r
-               }\r
-               $this->FileSet->dataSource = array_combine($filesetsList, $filesetsList);\r
-               $this->FileSet->dataBind();\r
-\r
-               $pools = $this->Application->getModule('api')->get(array('pools'))->output;\r
-               $poolList = array();\r
-               foreach($pools as $pool) {\r
-                       $poolList[$pool->poolid] = $pool->name;\r
-               }\r
-               $this->Pool->dataSource = $poolList;\r
-               $this->Pool->dataBind();\r
-\r
-               $storages = $this->Application->getModule('api')->get(array('storages'))->output;\r
-               $storagesList = array();\r
-               foreach($storages as $storage) {\r
-                       $storagesList[$storage->storageid] = $storage->name;\r
-               }\r
-               $this->Storage->dataSource = $storagesList;\r
-               $this->Storage->dataBind();\r
-\r
-               $this->Priority->Text = self::DEFAULT_JOB_PRIORITY;\r
-       }\r
-\r
-       public function save($sender, $param) {\r
-               switch($sender->getParent()->ID) {\r
-                       case $this->Estimate->ID: {\r
-                               $params = array();\r
-                               $params['name'] = $this->JobName->Text;\r
-                               $params['level'] = $this->Level->SelectedValue;\r
-                               $params['fileset'] = $this->FileSet->SelectedValue;\r
-                               $params['clientid'] = $this->Client->SelectedValue;\r
-                               $params['accurate'] = (integer)$this->Accurate->Checked;\r
-                               var_dump($params);\r
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;\r
-                               $this->Estimation->Text = implode(PHP_EOL, $result);\r
-                               break;\r
-                       }\r
-                       case $this->Run->ID: {\r
-                               if($this->PriorityValidator->IsValid === false) {\r
-                                       return false;\r
-                               }\r
-                               $params = array();\r
-                               $params['name'] = $this->JobName->Text;\r
-                               $params['level'] = $this->Level->SelectedValue;\r
-                               $params['fileset'] = $this->FileSet->SelectedValue;\r
-                               $params['clientid'] = $this->Client->SelectedValue;\r
-                               $params['storageid'] = $this->Storage->SelectedValue;\r
-                               $params['poolid'] = $this->Pool->SelectedValue;\r
-                               $params['priority'] = $this->Priority->Text;\r
-                               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;\r
-                               $this->Estimation->Text = implode(PHP_EOL, $result);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
+               parent::onInit($param);
+               $this->Run->setActionClass($this);
+               $this->Estimate->setActionClass($this);
+       }
+
+       public function configure($jobname) {
+               $this->JobName->Text = $jobname;
+               $this->Estimation->Text = '';
+
+               $this->Level->dataSource = $this->Application->getModule('misc')->getJobLevels();
+               $this->Level->dataBind();
+
+               $clients = $this->Application->getModule('api')->get(array('clients'))->output;
+               $clientsList = array();
+               foreach($clients as $client) {
+                       $clientsList[$client->clientid] = $client->name;
+               }
+               $this->Client->dataSource = $clientsList;
+               $this->Client->dataBind();
+
+               $filesetsAll = $this->Application->getModule('api')->get(array('filesets'))->output;
+               $filesetsList = array();
+               foreach($filesetsAll as $director => $filesets) {
+                       $filesetsList = array_merge($filesets, $filesetsList);
+               }
+               $this->FileSet->dataSource = array_combine($filesetsList, $filesetsList);
+               $this->FileSet->dataBind();
+
+               $pools = $this->Application->getModule('api')->get(array('pools'))->output;
+               $poolList = array();
+               foreach($pools as $pool) {
+                       $poolList[$pool->poolid] = $pool->name;
+               }
+               $this->Pool->dataSource = $poolList;
+               $this->Pool->dataBind();
+
+               $storages = $this->Application->getModule('api')->get(array('storages'))->output;
+               $storagesList = array();
+               foreach($storages as $storage) {
+                       $storagesList[$storage->storageid] = $storage->name;
+               }
+               $this->Storage->dataSource = $storagesList;
+               $this->Storage->dataBind();
+
+               $this->Priority->Text = self::DEFAULT_JOB_PRIORITY;
+       }
+
+       public function save($sender, $param) {
+               switch($sender->getParent()->ID) {
+                       case $this->Estimate->ID: {
+                               $params = array();
+                               $params['name'] = $this->JobName->Text;
+                               $params['level'] = $this->Level->SelectedValue;
+                               $params['fileset'] = $this->FileSet->SelectedValue;
+                               $params['clientid'] = $this->Client->SelectedValue;
+                               $params['accurate'] = (integer)$this->Accurate->Checked;
+                               var_dump($params);
+                               $result = $this->Application->getModule('api')->create(array('jobs', 'estimate'), $params)->output;
+                               $this->Estimation->Text = implode(PHP_EOL, $result);
+                               break;
+                       }
+                       case $this->Run->ID: {
+                               if($this->PriorityValidator->IsValid === false) {
+                                       return false;
+                               }
+                               $params = array();
+                               $params['name'] = $this->JobName->Text;
+                               $params['level'] = $this->Level->SelectedValue;
+                               $params['fileset'] = $this->FileSet->SelectedValue;
+                               $params['clientid'] = $this->Client->SelectedValue;
+                               $params['storageid'] = $this->Storage->SelectedValue;
+                               $params['poolid'] = $this->Pool->SelectedValue;
+                               $params['priority'] = $this->Priority->Text;
+                               $result = $this->Application->getModule('api')->create(array('jobs', 'run'), $params)->output;
+                               $this->Estimation->Text = implode(PHP_EOL, $result);
+                               break;
+                       }
+               }
+       }
+
        public function priorityValidator($sender, $param) {
-               $isValid = preg_match('/^[0-9]+$/', $this->Priority->Text) === 1 && $this->Priority->Text > 0;\r
+               $isValid = preg_match('/^[0-9]+$/', $this->Priority->Text) === 1 && $this->Priority->Text > 0;
                $param->setIsValid($isValid);
-       }\r
-}\r
+       }
+}
 ?>
\ No newline at end of file
index c0af626398627297e64ce649d3b3ca906836da92..307c4e9297aa9956d1e3e2438b4387590f285d98 100644 (file)
@@ -1,94 +1,94 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');\r
-Prado::using('System.Web.UI.ActiveControls.TActivePanel');\r
-Prado::using('System.Web.UI.ActiveControls.TCallback');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.Portlets');
+
 class JobRunList extends Portlets {
-\r
-       public $ShowID, $windowTitle, $oldDirector;\r
-\r
-       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');\r
-\r
-       private $jobStates;\r
-       \r
+
+       public $ShowID, $windowTitle, $oldDirector;
+
+       private $jobTypes = array('B' => 'Backup', 'M' => 'Migrated', 'V' => 'Verify', 'R' => 'Restore', 'I' => 'Internal', 'D' => 'Admin', 'A' => 'Archive', 'C' => 'Copy', 'g' => 'Migration');
+
+       private $jobStates;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-       }\r
-\r
-       public function setWindowTitle($param) {\r
-               $this->windowTitle = $param;\r
-       }\r
-\r
-       public function prepareData($forceReload = false) {\r
-               $allowedButtons = array('JobRunBtn');\r
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);\r
-                               $jobTasks = $this->Application->getModule('api')->get($params)->output;\r
-                               $jobs = $this->prepareJobs($jobTasks);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->JobRunWindow->ID] == 'details';\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $isDetailView === false ? $jobs : array();\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $isDetailView === true ? $jobs : array();\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
-               }\r
-       }\r
\r
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
+       public function setWindowTitle($param) {
+               $this->windowTitle = $param;
+       }
+
+       public function prepareData($forceReload = false) {
+               $allowedButtons = array('JobRunBtn');
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
+                               $jobTasks = $this->Application->getModule('api')->get($params)->output;
+                               $jobs = $this->prepareJobs($jobTasks);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->JobRunWindow->ID] == 'details';
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $isDetailView === false ? $jobs : array();
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $isDetailView === true ? $jobs : array();
+                               $this->DataGrid->dataBind();
+                       }
+               }
+       }
+
        private function prepareJobs($jobTasks) {
-               $jobs = array();\r
-               foreach($jobTasks as $director => $tasks) {\r
-                       for($i = 0; $i < count($tasks); $i++) {\r
-                               $jobs[] = array('name' => $tasks[$i], 'director' => $director);\r
-                       }\r
-               }\r
+               $jobs = array();
+               foreach($jobTasks as $director => $tasks) {
+                       for($i = 0; $i < count($tasks); $i++) {
+                               $jobs[] = array('name' => $tasks[$i], 'director' => $director);
+                       }
+               }
                return $jobs;
-       }\r
\r
-    public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->prepareJobs($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->JobRunConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+       }
+
+    public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID);
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->prepareJobs($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->JobRunConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>
index ecf608cf263ab8e1abff566c7ba897d00b1cf80b..12ec4d8e105b05638fe5ece32660ca4761f00f9d 100644 (file)
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveLabel');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
+Prado::using('Application.Portlets.Portlets');
+
 class PoolConfiguration extends Portlets {
-\r
+
        public function onInit($param) {
-               parent::onInit($param);\r
-               $this->Apply->setActionClass($this);\r
-               $this->RestoreConfiguration->setActionClass($this);\r
-               $this->UpdateVolumes->setActionClass($this);\r
-       }\r
-\r
-       public function configure($poolId) {\r
-               $pooldata = $this->Application->getModule('api')->get(array('pools', $poolId))->output;\r
-               $this->PoolName->Text = $pooldata->name;\r
-               $this->PoolID->Text = $pooldata->poolid;\r
-               $this->Enabled->Checked = $pooldata->enabled == 1;\r
-               $this->MaxVolumes->Text = $pooldata->maxvols;\r
-               $this->MaxVolJobs->Text = $pooldata->maxvoljobs;\r
-               $this->MaxVolBytes->Text = $pooldata->maxvolbytes;\r
-               $this->UseDuration->Text = intval($pooldata->voluseduration / 3600); // conversion to hours;\r
-               $this->RetentionPeriod->Text = intval($pooldata->volretention / 3600); // conversion to hours;\r
-               $this->LabelFormat->Text = $pooldata->labelformat;\r
-               $pools = $this->Application->getModule('api')->get(array('pools'))->output;\r
-               $poolList = array('none' => Prado::localize('select pool'));\r
-               foreach($pools as $pool) {\r
-                       $poolList[$pool->poolid] = $pool->name;\r
-               }\r
-               $this->ScratchPool->dataSource = $poolList;\r
-               $this->ScratchPool->SelectedValue = $pooldata->scratchpoolid;\r
-               $this->ScratchPool->dataBind();\r
-               $this->RecyclePool->dataSource = $poolList;\r
-               $this->RecyclePool->SelectedValue = $pooldata->recyclepoolid;\r
-               $this->RecyclePool->dataBind();\r
-               $this->Recycle->Checked = $pooldata->recycle == 1;\r
-               $this->AutoPrune->Checked = $pooldata->autoprune == 1;\r
-               $this->ActionOnPurge->Checked = $pooldata->actiononpurge == 1;\r
-       }\r
-\r
-       public function save($sender, $param) {\r
-               if(($sender->getParent()->ID == $this->Apply->ID) || ($sender->getParent()->ID == $this->UpdateVolumes->ID)) {\r
-                       if($this->MaxVolumesValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->RetentionPeriodValidator->IsValid === false || $this->LabelFormatValidator->IsValid === false) {\r
-                               return false;\r
-                       }\r
-                       $pooldata = array();\r
-                       $pooldata['poolid'] = $this->PoolID->Text;\r
-                       $pooldata['enabled'] = (integer)$this->Enabled->Checked;\r
-                       $pooldata['maxvols'] = $this->MaxVolumes->Text;\r
-                       $pooldata['maxvoljobs'] = $this->MaxVolJobs->Text;\r
-                       $pooldata['maxvolbytes'] = $this->MaxVolBytes->Text;\r
-                       $pooldata['voluseduration'] = $this->UseDuration->Text * 3600; // conversion to seconds\r
-                       $pooldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds\r
-                       $pooldata['labelformat'] = $this->LabelFormat->Text;\r
-                       $pooldata['scratchpoolid'] = (integer)$this->ScratchPool->SelectedValue;\r
-                       $pooldata['recyclepoolid'] = (integer)$this->RecyclePool->SelectedValue;\r
-                       $pooldata['recycle'] = (integer)$this->Recycle->Checked;\r
-                       $pooldata['autoprune'] = (integer)$this->AutoPrune->Checked;\r
-                       $pooldata['actiononpurge'] = (integer)$this->ActionOnPurge->Checked;\r
-                       $this->Application->getModule('api')->set(array('pools', $this->PoolID->Text), $pooldata);\r
-                       if($sender->getParent()->ID == $this->UpdateVolumes->ID) {\r
-                               $this->Application->getModule('api')->set(array('pools', 'update', 'volumes', $this->PoolID->Text),  array(''));\r
-                       }\r
-               } elseif($sender->getParent()->ID == $this->RestoreConfiguration->ID) {\r
-                       $this->Application->getModule('api')->set(array('pools', 'update', $this->PoolID->Text),  array(''));\r
-                       //@TOFIX $this->configure($this->PoolID->Text);\r
-               }\r
-       }\r
-\r
-       public function maxVolumesValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolumes->Text) && $this->MaxVolumes->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function maxVolJobsValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolJobs->Text) && $this->MaxVolJobs->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function maxVolBytesValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolBytes->Text) && $this->MaxVolBytes->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function useDurationValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->UseDuration->Text) && $this->UseDuration->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function retentionPeriodValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->RetentionPeriod->Text) && $this->RetentionPeriod->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function labelFormatValidator($sender, $param) {\r
-               $value = trim($this->LabelFormat->Text);\r
-               $isValid = !empty($value);\r
-               $param->setIsValid($isValid);\r
-       }\r
-}\r
+               parent::onInit($param);
+               $this->Apply->setActionClass($this);
+               $this->RestoreConfiguration->setActionClass($this);
+               $this->UpdateVolumes->setActionClass($this);
+       }
+
+       public function configure($poolId) {
+               $pooldata = $this->Application->getModule('api')->get(array('pools', $poolId))->output;
+               $this->PoolName->Text = $pooldata->name;
+               $this->PoolID->Text = $pooldata->poolid;
+               $this->Enabled->Checked = $pooldata->enabled == 1;
+               $this->MaxVolumes->Text = $pooldata->maxvols;
+               $this->MaxVolJobs->Text = $pooldata->maxvoljobs;
+               $this->MaxVolBytes->Text = $pooldata->maxvolbytes;
+               $this->UseDuration->Text = intval($pooldata->voluseduration / 3600); // conversion to hours;
+               $this->RetentionPeriod->Text = intval($pooldata->volretention / 3600); // conversion to hours;
+               $this->LabelFormat->Text = $pooldata->labelformat;
+               $pools = $this->Application->getModule('api')->get(array('pools'))->output;
+               $poolList = array('none' => Prado::localize('select pool'));
+               foreach($pools as $pool) {
+                       $poolList[$pool->poolid] = $pool->name;
+               }
+               $this->ScratchPool->dataSource = $poolList;
+               $this->ScratchPool->SelectedValue = $pooldata->scratchpoolid;
+               $this->ScratchPool->dataBind();
+               $this->RecyclePool->dataSource = $poolList;
+               $this->RecyclePool->SelectedValue = $pooldata->recyclepoolid;
+               $this->RecyclePool->dataBind();
+               $this->Recycle->Checked = $pooldata->recycle == 1;
+               $this->AutoPrune->Checked = $pooldata->autoprune == 1;
+               $this->ActionOnPurge->Checked = $pooldata->actiononpurge == 1;
+       }
+
+       public function save($sender, $param) {
+               if(($sender->getParent()->ID == $this->Apply->ID) || ($sender->getParent()->ID == $this->UpdateVolumes->ID)) {
+                       if($this->MaxVolumesValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->RetentionPeriodValidator->IsValid === false || $this->LabelFormatValidator->IsValid === false) {
+                               return false;
+                       }
+                       $pooldata = array();
+                       $pooldata['poolid'] = $this->PoolID->Text;
+                       $pooldata['enabled'] = (integer)$this->Enabled->Checked;
+                       $pooldata['maxvols'] = $this->MaxVolumes->Text;
+                       $pooldata['maxvoljobs'] = $this->MaxVolJobs->Text;
+                       $pooldata['maxvolbytes'] = $this->MaxVolBytes->Text;
+                       $pooldata['voluseduration'] = $this->UseDuration->Text * 3600; // conversion to seconds
+                       $pooldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds
+                       $pooldata['labelformat'] = $this->LabelFormat->Text;
+                       $pooldata['scratchpoolid'] = (integer)$this->ScratchPool->SelectedValue;
+                       $pooldata['recyclepoolid'] = (integer)$this->RecyclePool->SelectedValue;
+                       $pooldata['recycle'] = (integer)$this->Recycle->Checked;
+                       $pooldata['autoprune'] = (integer)$this->AutoPrune->Checked;
+                       $pooldata['actiononpurge'] = (integer)$this->ActionOnPurge->Checked;
+                       $this->Application->getModule('api')->set(array('pools', $this->PoolID->Text), $pooldata);
+                       if($sender->getParent()->ID == $this->UpdateVolumes->ID) {
+                               $this->Application->getModule('api')->set(array('pools', 'update', 'volumes', $this->PoolID->Text),  array(''));
+                       }
+               } elseif($sender->getParent()->ID == $this->RestoreConfiguration->ID) {
+                       $this->Application->getModule('api')->set(array('pools', 'update', $this->PoolID->Text),  array(''));
+                       //@TOFIX $this->configure($this->PoolID->Text);
+               }
+       }
+
+       public function maxVolumesValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolumes->Text) && $this->MaxVolumes->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function maxVolJobsValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolJobs->Text) && $this->MaxVolJobs->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function maxVolBytesValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolBytes->Text) && $this->MaxVolBytes->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function useDurationValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->UseDuration->Text) && $this->UseDuration->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function retentionPeriodValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->RetentionPeriod->Text) && $this->RetentionPeriod->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function labelFormatValidator($sender, $param) {
+               $value = trim($this->LabelFormat->Text);
+               $isValid = !empty($value);
+               $param->setIsValid($isValid);
+       }
+}
 ?>
\ No newline at end of file
index 240e63ca51820b59da3d7dcf5264af47105a2e99..98d5147798a307c3d0bbdf747834cc027b4ff450 100644 (file)
@@ -1,75 +1,75 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('Application.Portlets.Portlets');
+
 class PoolList extends Portlets {
-\r
-       public $ShowID, $windowTitle;\r
-\r
+
+       public $ShowID, $windowTitle;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-       }\r
-\r
-       public function setWindowTitle($param) {\r
-               $this->windowTitle = $param;\r
-       }\r
-\r
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
+       public function setWindowTitle($param) {
+               $this->windowTitle = $param;
+       }
+
        public function prepareData($forceReload = false) {
-               $allowedButtons = array('PoolBtn', 'ReloadPools');\r
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams('pools', $this->getPage()->PoolWindow->ID);\r
-                               $pools = $this->Application->getModule('api')->get($params);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->PoolWindow->ID] == 'details';\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $isDetailView === false ? $pools->output : array();\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($pools->output) : array();\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
+               $allowedButtons = array('PoolBtn', 'ReloadPools');
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams('pools', $this->getPage()->PoolWindow->ID);
+                               $pools = $this->Application->getModule('api')->get($params);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->PoolWindow->ID] == 'details';
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $isDetailView === false ? $pools->output : array();
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($pools->output) : array();
+                               $this->DataGrid->dataBind();
+                       }
                }
-       }\r
\r
-    public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams('pools', $this->getPage()->PoolWindow->ID);\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->Application->getModule('misc')->objectToArray($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->PoolConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+       }
+
+    public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams('pools', $this->getPage()->PoolWindow->ID);
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->Application->getModule('misc')->objectToArray($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->PoolConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>
\ No newline at end of file
index ae9eb7b6daa01b1c3449fe263bf13c22af1e33e8..32656c1bac5031fc0edeb904c241eaabd473da0e 100644 (file)
@@ -1,87 +1,87 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveCustomValidator');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveCustomValidator');
+Prado::using('Application.Portlets.Portlets');
+
 class StorageConfiguration extends Portlets {
-\r
+
        public function onInit($param) {
-               parent::onInit($param);\r
-               $this->Mount->setActionClass($this);\r
-               $this->Release->setActionClass($this);\r
-               $this->Umount->setActionClass($this);\r
-               $this->Status->setActionClass($this);\r
-       }\r
-\r
-       public function configure($storageId) {\r
-               $storagedata = $this->Application->getModule('api')->get(array('storages', 'show', $storageId))->output;\r
-               $this->ShowStorage->Text = implode(PHP_EOL, $storagedata);\r
-               $storage = $this->Application->getModule('api')->get(array('storages', $storageId))->output;\r
-               $this->StorageName->Text = $storage->name;\r
-               $this->StorageID->Text = $storage->storageid;\r
-               $this->AutoChanger->Visible = (boolean)$storage->autochanger;\r
-       }\r
-\r
-       public function save($sender, $param) {\r
-               $isValid = $this->DriveValidator->IsValid === true && $this->SlotValidator->IsValid === true;\r
-               switch($sender->getParent()->ID) {\r
-                       case $this->Status->ID: {\r
-                               $status = $this->Application->getModule('api')->get(array('storages', 'status', $this->StorageID->Text))->output;\r
-                               $this->ShowStorage->Text = implode(PHP_EOL, $status);\r
-                               break;\r
-                       }\r
-                       case $this->Mount->ID: {\r
-                               if($isValid === false) {\r
-                                       return;\r
-                               }\r
-                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;\r
-                               $slot = ($this->AutoChanger->Visible === true) ? intval($this->Slot->Text) : 0;\r
-                               $mount = $this->Application->getModule('api')->get(array('storages', 'mount', $this->StorageID->Text, $drive, $slot))->output;\r
-                               $this->ShowStorage->Text = implode(PHP_EOL, $mount);\r
-                               break;\r
-                       }\r
-                       case $this->Umount->ID: {\r
-                               if($isValid === false) {\r
-                                       return;\r
-                               }\r
-                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;\r
-                               $umount = $this->Application->getModule('api')->get(array('storages', 'umount', $this->StorageID->Text, $drive))->output;\r
-                               $this->ShowStorage->Text = implode(PHP_EOL, $umount);\r
-                               break;\r
-                       }\r
-                       case $this->Release->ID: {\r
-                               $release = $this->Application->getModule('api')->get(array('storages', 'release', $this->StorageID->Text))->output;\r
-                               $this->ShowStorage->Text = implode(PHP_EOL, $release);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function driveValidator($sender, $param) {\r
+               parent::onInit($param);
+               $this->Mount->setActionClass($this);
+               $this->Release->setActionClass($this);
+               $this->Umount->setActionClass($this);
+               $this->Status->setActionClass($this);
+       }
+
+       public function configure($storageId) {
+               $storagedata = $this->Application->getModule('api')->get(array('storages', 'show', $storageId))->output;
+               $this->ShowStorage->Text = implode(PHP_EOL, $storagedata);
+               $storage = $this->Application->getModule('api')->get(array('storages', $storageId))->output;
+               $this->StorageName->Text = $storage->name;
+               $this->StorageID->Text = $storage->storageid;
+               $this->AutoChanger->Visible = (boolean)$storage->autochanger;
+       }
+
+       public function save($sender, $param) {
+               $isValid = $this->DriveValidator->IsValid === true && $this->SlotValidator->IsValid === true;
+               switch($sender->getParent()->ID) {
+                       case $this->Status->ID: {
+                               $status = $this->Application->getModule('api')->get(array('storages', 'status', $this->StorageID->Text))->output;
+                               $this->ShowStorage->Text = implode(PHP_EOL, $status);
+                               break;
+                       }
+                       case $this->Mount->ID: {
+                               if($isValid === false) {
+                                       return;
+                               }
+                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
+                               $slot = ($this->AutoChanger->Visible === true) ? intval($this->Slot->Text) : 0;
+                               $mount = $this->Application->getModule('api')->get(array('storages', 'mount', $this->StorageID->Text, $drive, $slot))->output;
+                               $this->ShowStorage->Text = implode(PHP_EOL, $mount);
+                               break;
+                       }
+                       case $this->Umount->ID: {
+                               if($isValid === false) {
+                                       return;
+                               }
+                               $drive = ($this->AutoChanger->Visible === true) ? intval($this->Drive->Text) : 0;
+                               $umount = $this->Application->getModule('api')->get(array('storages', 'umount', $this->StorageID->Text, $drive))->output;
+                               $this->ShowStorage->Text = implode(PHP_EOL, $umount);
+                               break;
+                       }
+                       case $this->Release->ID: {
+                               $release = $this->Application->getModule('api')->get(array('storages', 'release', $this->StorageID->Text))->output;
+                               $this->ShowStorage->Text = implode(PHP_EOL, $release);
+                               break;
+                       }
+               }
+       }
+
+       public function driveValidator($sender, $param) {
                $isValid = is_numeric($this->Drive->Text);
                $param->setIsValid($isValid);
-       }\r
-\r
-       public function slotValidator($sender, $param) {\r
-               $isValid = is_numeric($this->Slot->Text);\r
-               $param->setIsValid($isValid);\r
-       }\r
-}\r
+       }
+
+       public function slotValidator($sender, $param) {
+               $isValid = is_numeric($this->Slot->Text);
+               $param->setIsValid($isValid);
+       }
+}
 ?>
\ No newline at end of file
index 14c2309ad412094edebc1343fb135d2e5fd4c301..33050d93fb7af18d40be4ee5c81d689ce4560928 100644 (file)
@@ -1,75 +1,75 @@
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('Application.Portlets.Portlets');
+
 class StorageList extends Portlets {
-\r
-       public $ShowID, $windowTitle;\r
-\r
+
+       public $ShowID, $windowTitle;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-       }\r
-\r
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
        public function setWindowTitle($param) {
                $this->windowTitle = $param;
-       }\r
-\r
+       }
+
        public function prepareData($forceReload = false) {
-               $allowedButtons = array('StorageBtn');\r
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);\r
-                               $storages = $this->Application->getModule('api')->get($params);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->StorageWindow->ID] == 'details';\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $isDetailView === false ? $storages->output : array();\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($storages->output) : array();\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
+               $allowedButtons = array('StorageBtn');
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
+                               $storages = $this->Application->getModule('api')->get($params);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->StorageWindow->ID] == 'details';
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $isDetailView === false ? $storages->output : array();
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $isDetailView === true ? $this->Application->getModule('misc')->objectToArray($storages->output) : array();
+                               $this->DataGrid->dataBind();
+                       }
                }
-       }\r
\r
-    public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->Application->getModule('misc')->objectToArray($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->StorageConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+       }
+
+    public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID);
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->Application->getModule('misc')->objectToArray($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->StorageConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>
index 0cb702a5623653c64fcb5f3152c2cfb4fddf2fa7..4c2aae8c534f6beb46c95c625a4cbaf70dcfd9ea 100644 (file)
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveLabel');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');\r
-Prado::using('System.Web.UI.ActiveControls.TCallback');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.Portlets');
+
 class VolumeConfiguration extends Portlets {
-\r
-       private $volumeStatesByDirectorOnly = array('Recycle', 'Purged', 'Error', 'Busy');\r
-\r
-       private $volumeStatesForSet = array('Append', 'Archive', 'Disabled', 'Full', 'Used', 'Cleaning', 'Read-Only');\r
-\r
+
+       private $volumeStatesByDirectorOnly = array('Recycle', 'Purged', 'Error', 'Busy');
+
+       private $volumeStatesForSet = array('Append', 'Archive', 'Disabled', 'Full', 'Used', 'Cleaning', 'Read-Only');
+
        public function onInit($param) {
-               parent::onInit($param);\r
-               $this->Apply->setActionClass($this);\r
-               $this->Prune->setActionClass($this);\r
-               $this->Purge->setActionClass($this);\r
-       }\r
-\r
-       public function configure($mediaId) {\r
-               $voldata = $this->Application->getModule('api')->get(array('volumes', $mediaId))->output;\r
-               $this->VolumeID->Text = $voldata->mediaid;\r
-               $this->VolumeName->Text = $voldata->volumename;\r
-               $volstates = $this->getVolumeStates(true);\r
-               if (!in_array($voldata->volstatus, $volstates)) {\r
-                       array_push($volstates, $voldata->volstatus);\r
-               }\r
-               $volstatesSelect = array();\r
-               for($i = 0; $i < count($volstates); $i++) {\r
-                       $volstatesSelect[$volstates[$i]] = $volstates[$i];\r
-               }\r
-               $this->VolumeStatus->DataSource = $volstatesSelect;\r
-               $this->VolumeStatus->SelectedValue = $voldata->volstatus;\r
-               $this->VolumeStatus->dataBind();\r
-               $this->RetentionPeriod->Text = intval($voldata->volretention / 3600); // conversion to hours\r
-               $this->UseDuration->Text = intval($voldata->voluseduration / 3600);  // conversion to hours\r
-               $this->MaxVolJobs->Text = $voldata->maxvoljobs;\r
-               $this->MaxVolFiles->Text = $voldata->maxvolfiles;\r
-               $this->MaxVolBytes->Text = $voldata->maxvolbytes;\r
-               $this->Slot->Text = $voldata->slot;\r
-               $this->Recycle->Checked = ($voldata->recycle == 1);\r
-               $this->Enabled->Checked = ($voldata->enabled == 1);\r
-               $this->InChanger->Checked = ($voldata->inchanger == 1);\r
-               $pools = $this->Application->getModule('api')->get(array('pools'))->output;\r
-               $poolList = array();\r
-               foreach($pools as $pool) {\r
-                       $poolList[$pool->poolid] = $pool->name;\r
-               }\r
-               $this->Pool->dataSource = $poolList;\r
-               $this->Pool->SelectedValue = $voldata->poolid;\r
-               $this->Pool->dataBind();\r
-       }\r
-\r
-       public function save($sender, $param) {\r
-               switch($sender->getParent()->ID) {\r
-                       case $this->Apply->ID: {\r
+               parent::onInit($param);
+               $this->Apply->setActionClass($this);
+               $this->Prune->setActionClass($this);
+               $this->Purge->setActionClass($this);
+       }
+
+       public function configure($mediaId) {
+               $voldata = $this->Application->getModule('api')->get(array('volumes', $mediaId))->output;
+               $this->VolumeID->Text = $voldata->mediaid;
+               $this->VolumeName->Text = $voldata->volumename;
+               $volstates = $this->getVolumeStates(true);
+               if (!in_array($voldata->volstatus, $volstates)) {
+                       array_push($volstates, $voldata->volstatus);
+               }
+               $volstatesSelect = array();
+               for($i = 0; $i < count($volstates); $i++) {
+                       $volstatesSelect[$volstates[$i]] = $volstates[$i];
+               }
+               $this->VolumeStatus->DataSource = $volstatesSelect;
+               $this->VolumeStatus->SelectedValue = $voldata->volstatus;
+               $this->VolumeStatus->dataBind();
+               $this->RetentionPeriod->Text = intval($voldata->volretention / 3600); // conversion to hours
+               $this->UseDuration->Text = intval($voldata->voluseduration / 3600);  // conversion to hours
+               $this->MaxVolJobs->Text = $voldata->maxvoljobs;
+               $this->MaxVolFiles->Text = $voldata->maxvolfiles;
+               $this->MaxVolBytes->Text = $voldata->maxvolbytes;
+               $this->Slot->Text = $voldata->slot;
+               $this->Recycle->Checked = ($voldata->recycle == 1);
+               $this->Enabled->Checked = ($voldata->enabled == 1);
+               $this->InChanger->Checked = ($voldata->inchanger == 1);
+               $pools = $this->Application->getModule('api')->get(array('pools'))->output;
+               $poolList = array();
+               foreach($pools as $pool) {
+                       $poolList[$pool->poolid] = $pool->name;
+               }
+               $this->Pool->dataSource = $poolList;
+               $this->Pool->SelectedValue = $voldata->poolid;
+               $this->Pool->dataBind();
+       }
+
+       public function save($sender, $param) {
+               switch($sender->getParent()->ID) {
+                       case $this->Apply->ID: {
                                $isInvalid = $this->RetentionPeriodValidator->IsValid === false || $this->UseDurationValidator->IsValid === false || $this->MaxVolJobsValidator->IsValid === false || $this->MaxVolFilesValidator->IsValid === false || $this->MaxVolBytesValidator->IsValid === false || $this->SlotValidator->IsValid === false;
-                               if($isInvalid) {\r
-                                       return false;\r
-                               }\r
-                               $voldata = array();\r
-                               $voldata['mediaid'] = $this->VolumeID->Text;\r
-                               $voldata['volstatus'] = $this->VolumeStatus->SelectedValue;\r
-                               $voldata['poolid'] = $this->Pool->SelectedValue;\r
-                               $voldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds\r
-                               $voldata['voluseduration'] = $this->UseDuration->Text * 3600;  // conversion to seconds\r
-                               $voldata['maxvoljobs'] = $this->MaxVolJobs->Text;\r
-                               $voldata['maxvolfiles'] = $this->MaxVolFiles->Text;\r
-                               $voldata['maxvolbytes'] = $this->MaxVolBytes->Text;\r
-                               $voldata['slot'] = $this->Slot->Text;\r
-                               $voldata['recycle'] = (integer)$this->Recycle->Checked;\r
-                               $voldata['enabled'] = (integer)$this->Enabled->Checked;\r
-                               $voldata['inchanger'] = (integer)$this->InChanger->Checked;\r
-                               $this->Application->getModule('api')->set(array('volumes', $voldata['mediaid']), $voldata);\r
-                               break;\r
-                       }\r
-                       case $this->Prune->ID: {\r
-                               $this->Application->getModule('api')->get(array('volumes', 'prune', $this->VolumeID->Text));\r
-                               break;\r
-                       }\r
-                       case $this->Purge->ID: {\r
-                               $this->Application->getModule('api')->get(array('volumes', 'purge', $this->VolumeID->Text));\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       public function getVolumeStates($forSetOnly = false) {\r
-               $states = ($forSetOnly === true ) ? $this->volumeStatesForSet : array_merge($this->volumeStatesByDirectorOnly, $this->volumeStatesForSet);\r
-               return $states;\r
-       }\r
-\r
-       public function retentionPeriodValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->RetentionPeriod->Text) && $this->RetentionPeriod->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-       \r
-       public function useDurationValidator($sender, $param) {\r
+                               if($isInvalid) {
+                                       return false;
+                               }
+                               $voldata = array();
+                               $voldata['mediaid'] = $this->VolumeID->Text;
+                               $voldata['volstatus'] = $this->VolumeStatus->SelectedValue;
+                               $voldata['poolid'] = $this->Pool->SelectedValue;
+                               $voldata['volretention'] = $this->RetentionPeriod->Text * 3600; // conversion to seconds
+                               $voldata['voluseduration'] = $this->UseDuration->Text * 3600;  // conversion to seconds
+                               $voldata['maxvoljobs'] = $this->MaxVolJobs->Text;
+                               $voldata['maxvolfiles'] = $this->MaxVolFiles->Text;
+                               $voldata['maxvolbytes'] = $this->MaxVolBytes->Text;
+                               $voldata['slot'] = $this->Slot->Text;
+                               $voldata['recycle'] = (integer)$this->Recycle->Checked;
+                               $voldata['enabled'] = (integer)$this->Enabled->Checked;
+                               $voldata['inchanger'] = (integer)$this->InChanger->Checked;
+                               $this->Application->getModule('api')->set(array('volumes', $voldata['mediaid']), $voldata);
+                               break;
+                       }
+                       case $this->Prune->ID: {
+                               $this->Application->getModule('api')->get(array('volumes', 'prune', $this->VolumeID->Text));
+                               break;
+                       }
+                       case $this->Purge->ID: {
+                               $this->Application->getModule('api')->get(array('volumes', 'purge', $this->VolumeID->Text));
+                               break;
+                       }
+               }
+       }
+
+       public function getVolumeStates($forSetOnly = false) {
+               $states = ($forSetOnly === true ) ? $this->volumeStatesForSet : array_merge($this->volumeStatesByDirectorOnly, $this->volumeStatesForSet);
+               return $states;
+       }
+
+       public function retentionPeriodValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->RetentionPeriod->Text) && $this->RetentionPeriod->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function useDurationValidator($sender, $param) {
                $isValid = preg_match('/^\d+$/', $this->UseDuration->Text) && $this->UseDuration->Text >= 0;
                $param->setIsValid($isValid);
-       }\r
-\r
-       public function maxVolJobsValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolJobs->Text) && $this->MaxVolJobs->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function maxVolFilesValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolFiles->Text) && $this->MaxVolFiles->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function maxVolBytesValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->MaxVolBytes->Text) && $this->MaxVolBytes->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-\r
-       public function slotValidator($sender, $param) {\r
-               $isValid = preg_match('/^\d+$/', $this->Slot->Text) && $this->Slot->Text >= 0;\r
-               $param->setIsValid($isValid);\r
-       }\r
-}\r
+       }
+
+       public function maxVolJobsValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolJobs->Text) && $this->MaxVolJobs->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function maxVolFilesValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolFiles->Text) && $this->MaxVolFiles->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function maxVolBytesValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->MaxVolBytes->Text) && $this->MaxVolBytes->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+
+       public function slotValidator($sender, $param) {
+               $isValid = preg_match('/^\d+$/', $this->Slot->Text) && $this->Slot->Text >= 0;
+               $param->setIsValid($isValid);
+       }
+}
 ?>
\ No newline at end of file
index dbf77393221efc6db7d118301bce52a149c8431d..c805e8cd15a8b12663109dea11410bb777bb4ced 100644 (file)
-<?php\r
-/**\r
- * Bacula® - The Network Backup Solution\r
- * Baculum - Bacula web interface\r
- *\r
- * Copyright (C) 2013-2014 Marcin Haba\r
- *\r
- * The main author of Baculum is Marcin Haba.\r
- * The main author of Bacula is Kern Sibbald, with contributions from many\r
- * others, a complete list can be found in the file AUTHORS.\r
- *\r
- * You may use this file and others of this release according to the\r
- * license defined in the LICENSE file, which includes the Affero General\r
- * Public License, v3.0 ("AGPLv3") and some additional permissions and\r
- * terms pursuant to its AGPLv3 Section 7.\r
- *\r
- * Bacula® is a registered trademark of Kern Sibbald.\r
- */\r
\r
-Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');\r
-Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');\r
-Prado::using('System.Web.UI.ActiveControls.TActivePanel');\r
-Prado::using('System.Web.UI.ActiveControls.TCallback');\r
-Prado::using('Application.Portlets.Portlets');\r
-\r
+<?php
+/**
+ * Bacula® - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2014 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The main author of Bacula is Kern Sibbald, with contributions from many
+ * others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * Bacula® is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveDataGrid');
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TCallback');
+Prado::using('Application.Portlets.Portlets');
+
 class VolumeList extends Portlets {
-\r
-       public $ShowID, $pools, $oldPool, $view, $windowTitle;\r
-\r
+
+       public $ShowID, $pools, $oldPool, $view, $windowTitle;
+
        public function onLoad($param) {
-               parent::onLoad($param);\r
-               $this->prepareData();\r
-       }\r
-\r
-       public function setWindowTitle($param) {\r
-               $this->windowTitle = $param;\r
-       }\r
-\r
-       public function prepareData($forceReload = false) {\r
-               $allowedButtons = array('MediaBtn', 'ReloadVolumes');\r
-               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {\r
-                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {\r
-                               $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID);\r
-                               array_push($params, '?showpools=1');\r
-                               $volumes = $this->Application->getModule('api')->get($params);\r
-                               $isDetailView = $_SESSION['view' . $this->getPage()->VolumeWindow->ID] == 'details';\r
-                               $this->RepeaterShow->Visible = !$isDetailView;\r
-                               $this->Repeater->DataSource = $volumes->output;\r
-                               $this->Repeater->dataBind();\r
-                               $this->DataGridShow->Visible = $isDetailView;\r
-                               $this->DataGrid->DataSource = $this->Application->getModule('misc')->objectToArray($volumes->output);\r
-                               $this->DataGrid->dataBind();\r
-                       }\r
-               }\r
-       }\r
-\r
-       protected function sortData($data, $key, $id) {\r
-               if($this->getSortOrder($id) == parent::SORT_DESC) {\r
-                       if($key == 'pool') {\r
-                               $key = 'name';\r
-                               $compare = create_function('$a,$b','if ($a["pool"]["'.$key.'"] == $b["pool"]["'.$key.'"]) {return 0;}else {return ($a["pool"]["'.$key.'"] < $b["pool"]["'.$key.'"]) ? 1 : -1;}');\r
-                       } else {\r
-                               $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] < $b["'.$key.'"]) ? 1 : -1;}');\r
-                       }\r
-               } else {\r
-                       if($key == 'pool') {\r
-                               $key = 'name';\r
-                               $compare = create_function('$a,$b','if ($a["pool"]["'.$key.'"] == $b["pool"]["'.$key.'"]) {return 0;}else {return ($a["pool"]["'.$key.'"] > $b["pool"]["'.$key.'"]) ? 1 : -1;}');\r
-                       } else {\r
-                               $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');\r
-                       }\r
-               }\r
-               usort($data,$compare);\r
-               return $data;\r
-       }\r
\r
-    public function sortDataGrid($sender, $param) {\r
-               $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID);\r
-               array_push($params, '?showpools=1');\r
-               $data = $this->Application->getModule('api')->get($params)->output;\r
-               $data = $this->Application->getModule('misc')->objectToArray($data);\r
-               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);\r
-               $this->DataGrid->dataBind();\r
-       }\r
-\r
-       public function setShowID($ShowID) {\r
-               $this->ShowID = $this->getMaster()->ShowID = $ShowID;\r
-       }\r
-\r
-       public function getShowID() {\r
-               return $this->ShowID;\r
-       }\r
-\r
-       public function configure($sender, $param) {\r
-               if($this->Page->IsCallBack) {\r
-                       $this->getPage()->VolumeConfiguration->configure($param->CallbackParameter);\r
-               }\r
-       }\r
-}\r
+               parent::onLoad($param);
+               $this->prepareData();
+       }
+
+       public function setWindowTitle($param) {
+               $this->windowTitle = $param;
+       }
+
+       public function prepareData($forceReload = false) {
+               $allowedButtons = array('MediaBtn', 'ReloadVolumes');
+               if($this->Page->IsPostBack || $this->Page->IsCallBack || $forceReload) {
+                       if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) {
+                               $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID);
+                               array_push($params, '?showpools=1');
+                               $volumes = $this->Application->getModule('api')->get($params);
+                               $isDetailView = $_SESSION['view' . $this->getPage()->VolumeWindow->ID] == 'details';
+                               $this->RepeaterShow->Visible = !$isDetailView;
+                               $this->Repeater->DataSource = $volumes->output;
+                               $this->Repeater->dataBind();
+                               $this->DataGridShow->Visible = $isDetailView;
+                               $this->DataGrid->DataSource = $this->Application->getModule('misc')->objectToArray($volumes->output);
+                               $this->DataGrid->dataBind();
+                       }
+               }
+       }
+
+       protected function sortData($data, $key, $id) {
+               if($this->getSortOrder($id) == parent::SORT_DESC) {
+                       if($key == 'pool') {
+                               $key = 'name';
+                               $compare = create_function('$a,$b','if ($a["pool"]["'.$key.'"] == $b["pool"]["'.$key.'"]) {return 0;}else {return ($a["pool"]["'.$key.'"] < $b["pool"]["'.$key.'"]) ? 1 : -1;}');
+                       } else {
+                               $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] < $b["'.$key.'"]) ? 1 : -1;}');
+                       }
+               } else {
+                       if($key == 'pool') {
+                               $key = 'name';
+                               $compare = create_function('$a,$b','if ($a["pool"]["'.$key.'"] == $b["pool"]["'.$key.'"]) {return 0;}else {return ($a["pool"]["'.$key.'"] > $b["pool"]["'.$key.'"]) ? 1 : -1;}');
+                       } else {
+                               $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
+                       }
+               }
+               usort($data,$compare);
+               return $data;
+       }
+
+    public function sortDataGrid($sender, $param) {
+               $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID);
+               array_push($params, '?showpools=1');
+               $data = $this->Application->getModule('api')->get($params)->output;
+               $data = $this->Application->getModule('misc')->objectToArray($data);
+               $this->DataGrid->DataSource = $this->sortData($data, $param->SortExpression, $sender->UniqueID);
+               $this->DataGrid->dataBind();
+       }
+
+       public function setShowID($ShowID) {
+               $this->ShowID = $this->getMaster()->ShowID = $ShowID;
+       }
+
+       public function getShowID() {
+               return $this->ShowID;
+       }
+
+       public function configure($sender, $param) {
+               if($this->Page->IsCallBack) {
+                       $this->getPage()->VolumeConfiguration->configure($param->CallbackParameter);
+               }
+       }
+}
 ?>