3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2016 Kern Sibbald
8 * The main author of Baculum is Marcin Haba.
9 * The original author of Bacula is Kern Sibbald, with contributions
10 * from many others, a complete list can be found in the file AUTHORS.
12 * You may use this file and others of this release according to the
13 * license defined in the LICENSE file, which includes the Affero General
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
15 * terms pursuant to its AGPLv3 Section 7.
17 * This notice must be preserved when any source code is
18 * conveyed and/or propagated.
20 * Bacula(R) is a registered trademark of Kern Sibbald.
23 Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
24 Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
25 Prado::using('Application.Web.Class.HostConfig');
26 Prado::using('Application.Web.Portlets.HostListTemplate');
28 class BaculaHosts extends HostListTemplate {
30 const CHILD_CONTROL = 'BaculaConfigComponents';
34 public function loadConfig($sender, $param) {
35 if(!$_SESSION['admin']) {
38 $this->config = $this->getModule('host_config')->getConfig();
39 $hosts = array_keys($this->config);
40 $this->RepeaterHosts->DataSource = $hosts;
41 $this->RepeaterHosts->dataBind();
44 public function createHostListElement($sender, $param) {
45 $control = $this->getChildControl($param->Item, self::CHILD_CONTROL);
46 if (is_object($control)) {
47 $control->setHost($param->Item->DataItem);
49 $param->Item->RemoveHost->setCommandParameter($param->Item->DataItem);
52 public function getComponents($sender, $param) {
53 $control = $this->getChildControl($sender->getParent(), self::CHILD_CONTROL);
54 if (is_object($control)) {
55 $control->raiseEvent('OnComponentListLoad', $this, null);
59 public function bubbleEvent($sender, $param) {
60 if ($param instanceof TCommandEventParameter) {
61 $this->loadConfig(null, null);
68 public function removeHost($sender, $param) {
69 if(!$_SESSION['admin']) {
72 $host = $param->getCommandParameter();
74 $host_config = $this->getModule('host_config');
75 $config = $host_config->getConfig();
76 unset($config[$host]);
77 $host_config->setConfig($config);
78 $this->loadConfig(null, null);
79 if ($host === HostConfig::MAIN_CATALOG_HOST) {
80 $url = $this->Service->constructUrl('WebConfigWizard', array(), false);
81 $this->getResponse()->redirect($url);