* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2020 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
*/
const DEFAULT_AUTH_USER = 'admin';
- private $config = array();
+ protected $web_config = array();
public function onPreInit($param) {
parent::onPreInit($param);
- $this->config = $this->getModule('web_config')->getConfig();
+ $this->web_config = $this->getModule('web_config')->getConfig();
$this->Application->getGlobalization()->Culture = $this->getLanguage();
- if (count($this->config) === 0) {
+ if (count($this->web_config) === 0) {
if (isset($_SERVER['PHP_AUTH_USER'])) {
if ($this->Service->getRequestedPagePath() != 'WebConfigWizard') {
$this->goToPage('WebConfigWizard');
self::accessDenied();
}
}
- Logging::$debug_enabled = (isset($this->config['baculum']['debug']) && $this->config['baculum']['debug'] == 1);
+ Logging::$debug_enabled = (isset($this->web_config['baculum']['debug']) && $this->web_config['baculum']['debug'] == 1);
if (!$this->IsPostBack && !$this->IsCallBack) {
$this->getModule('api')->initSessionCache(true);
$this->setSessionUserVars();
if (isset($_SESSION['language']) && !empty($_SESSION['language'])) {
$language = $_SESSION['language'];
} else {
- if (isset($this->config['baculum']) && key_exists('lang', $this->config['baculum'])) {
- $language = $this->config['baculum']['lang'];
+ if (isset($this->web_config['baculum']) && key_exists('lang', $this->web_config['baculum'])) {
+ $language = $this->web_config['baculum']['lang'];
}
if (is_null($language)) {
$language = WebConfig::DEFAULT_LANGUAGE;
*/
private function setSessionUserVars() {
// NOTE. For oauth2 callback, the PHP_AUTH_USER is empty because no user/pass.
- if (count($this->config) > 0 && isset($_SERVER['PHP_AUTH_USER'])) {
+ if (count($this->web_config) > 0 && isset($_SERVER['PHP_AUTH_USER'])) {
// Set administrator role
- $_SESSION['admin'] = ($_SERVER['PHP_AUTH_USER'] === $this->config['baculum']['login']);
+ $_SESSION['admin'] = ($_SERVER['PHP_AUTH_USER'] === $this->web_config['baculum']['login']);
// Set api host for normal user
- if (!$_SESSION['admin'] && key_exists('users', $this->config) && array_key_exists($_SERVER['PHP_AUTH_USER'], $this->config['users'])) {
- $_SESSION['api_host'] = $this->config['users'][$_SERVER['PHP_AUTH_USER']];
+ if (!$_SESSION['admin'] && key_exists('users', $this->web_config) && array_key_exists($_SERVER['PHP_AUTH_USER'], $this->web_config['users'])) {
+ $_SESSION['api_host'] = $this->web_config['users'][$_SERVER['PHP_AUTH_USER']];
} elseif ($_SESSION['admin']) {
$_SESSION['api_host'] = 'Main';
}
msgid "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
msgstr "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
+
+msgid "Show time in job log:"
+msgstr "Show time in job log:"
msgid "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
msgstr "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
+
+msgid "Show time in job log:"
+msgstr "Show time in job log:"
msgid "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
msgstr "Tip: Użyj lewego przycisku myszy, aby wybrać wiersz tabeli. Użyj CTRL + lewy przycisk myszy, aby zaznaczyć wiele wierszy. Użyj SHIFT + lewy przycisk myszy, aby dodać zakres wierszy do zaznaczenia."
+
+msgid "Show time in job log:"
+msgstr "Pokaż czas w dzienniku zadania:"
msgid "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
msgstr "Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection."
+
+msgid "Show time in job log:"
+msgstr "Show time in job log:"
/> <com:TLabel ForControl="BinaryBytes"><%[ Binary Bytes (1 mebi = 2<sup>20</sup>) ]%></com:TLabel></p>
</div>
</div>
+ <div class="w3-container w3-row w3-padding">
+ <div class="w3-third w3-col"><%[ Show time in job log: ]%></div>
+ <div class="w3-third w3-col">
+ <com:TCheckBox
+ ID="TimeInJobLog"
+ CssClass="w3-check"
+ />
+ </div>
+ </div>
<div class="w3-center">
<com:TActiveLinkButton
CssClass="w3-button w3-green"
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2020 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
protected $admin = true;
- public $web_config;
-
public function onInit($param) {
parent::onInit($param);
- $this->web_config = $this->getModule('web_config')->getConfig();
$this->DecimalBytes->Checked = true;
if(count($this->web_config) > 0) {
$this->Debug->Checked = ($this->web_config['baculum']['debug'] == 1);
$this->DecimalBytes->Checked = ($this->web_config['baculum']['size_values_unit'] === 'decimal');
$this->BinaryBytes->Checked = ($this->web_config['baculum']['size_values_unit'] === 'binary');
}
+ if (key_exists('time_in_job_log', $this->web_config['baculum'])) {
+ $this->TimeInJobLog->Checked = ($this->web_config['baculum']['time_in_job_log'] == 1);
+ }
}
}
$max_jobs = intval($this->MaxJobs->Text);
$this->web_config['baculum']['max_jobs'] = $max_jobs;
$this->web_config['baculum']['size_values_unit'] = $this->BinaryBytes->Checked ? 'binary' : 'decimal';
+ $this->web_config['baculum']['time_in_job_log'] = ($this->TimeInJobLog->Checked === true) ? 1 : 0;
$this->getModule('web_config')->setConfig($this->web_config);
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2020 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
* @param $param TCallbackParameter parameter object
*/
public function refreshJobLog($sender, $param) {
- $log = $this->getModule('api')->get(array('joblog', $this->getJobId()));
+ $params = ['joblog', $this->getJobId()];
+
+ // add time to log if defiend in configuration
+ if (key_exists('time_in_job_log', $this->web_config['baculum'])) {
+ $query_params = [
+ 'show_time' => $this->web_config['baculum']['time_in_job_log']
+ ];
+ $params[] = '?' . http_build_query($query_params);
+ }
+ $log = $this->getModule('api')->get($params);
+
if (!is_array($log->output) || count($log->output) == 0) {
$msg = Prado::localize("Output for selected job is not available yet or you do not have enabled logging job logs to the catalog database.\n\nTo watch job log you need to add to the job Messages resource the following directive:\n\nCatalog = all, !debug, !skipped, !saved");
$joblog = array($msg);
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2020 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
protected $admin = true;
- public $web_config;
-
- public function onInit($param) {
- parent::onInit($param);
- $this->web_config = $this->getModule('web_config')->getConfig();
- }
-
public function setUsers() {
$all_users = $this->getModule('basic_webuser')->getAllUsers();
$users = array_keys($all_users);
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2020 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
* Bacula(R) is a registered trademark of Kern Sibbald.
*/
-// @TODO: move this page to API part before any release.
-
Prado::using('Application.Web.Class.BaculumWebPage');
Prado::using('Application.Web.Class.HostConfig');
Prado::using('Application.Web.Class.BasicWebUserConfig');
protected $admin = false;
public $first_run;
- public $web_config;
public $host_config;
public function onInit($param) {
parent::onInit($param);
$this->Lang->SelectedValue = $this->getLanguage();
- $config = $this->getModule('web_config');
- $this->web_config = $config->getConfig();
$this->host_config = $this->getModule('host_config')->getConfig();
$this->first_run = (count($this->host_config) == 0 || !key_exists(HostConfig::MAIN_CATALOG_HOST, $this->host_config));
Logging::$debug_enabled = Logging::$debug_enabled ?: $this->first_run;
$host_config[$host] = $cfg_host;
$ret = $this->getModule('host_config')->setConfig($host_config);
if($ret === true) {
- $web_config = $this->getModule('web_config')->getConfig();
$cfg_web = array('baculum' => array(), 'users' => array());
- if (count($web_config) > 0) {
- $cfg_web = $web_config;
+ if (count($this->web_config) > 0) {
+ $cfg_web = $this->web_config;
}
$cfg_web['baculum']['login'] = $this->WebLogin->Text;
$cfg_web['baculum']['debug'] = 0;