Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Add new config variable to set pooltype for label autochanger.
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Bergkemper <frank.bergkemper@bareos.com>
  • Loading branch information
Marco van Wieringen authored and fbergkemper committed Aug 4, 2016
1 parent c75c38e commit 4d97049
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions config/autoload/global.php
Expand Up @@ -93,6 +93,10 @@ function read_configuration_ini($configuration, $configuration_ini)
$arr['tables']['save_previous_state'] = false;
}

if( array_key_exists('autochanger', $configuration) && array_key_exists('labelpooltype', $configuration['autochanger']) && isset($configuration['autochanger']['labelpooltype']) ) {
$arr['autochanger']['labelpooltype'] = $configuration['autochanger']['labelpooltype'];
}

return $arr;
}

Expand Down
5 changes: 5 additions & 0 deletions install/configuration.ini
Expand Up @@ -15,3 +15,8 @@ pagination_default_value=25
# State saving - restore table state on page reload.
# Default: false
save_previous_state=false

[autochanger]
# Pooltype for label to use as filter.
# Default: none
#labelpooltype=scratch
17 changes: 8 additions & 9 deletions module/Auth/src/Auth/Controller/AuthController.php
Expand Up @@ -77,7 +77,6 @@ public function loginAction()
$this->bsock->set_user_credentials($username, $password);

if($this->bsock->auth($username, $password)) {

$_SESSION['bareos']['director'] = $director;
$_SESSION['bareos']['username'] = $username;
$_SESSION['bareos']['password'] = $password;
Expand All @@ -88,7 +87,6 @@ public function loginAction()
$_SESSION['bareos']['dird-update-available'] = false;

if(isset($bareos_updates) && $bareos_updates != NULL) {

$updates = json_decode($bareos_updates, true);

try {
Expand All @@ -98,9 +96,6 @@ public function loginAction()
catch(Exception $e) {
echo $e->getMessage();
}
//$dird_dist = null;
//$dird_arch = null;
//$dird_vers = null;

if(array_key_exists('obsdistribution', $dird_version)) {
$dird_dist = $dird_version['obsdistribution'];
Expand Down Expand Up @@ -128,19 +123,23 @@ public function loginAction()
$_SESSION['bareos']['dird-update-available'] = true;
}
}

}

}

}

// Get the datatable settings and push them into the SESSION context.
// Get the config.
$configuration = $this->getServiceLocator()->get('configuration');

// Push the datatable settings into the SESSION context.
$_SESSION['bareos']['dt_lengthmenu'] = $configuration['configuration']['tables']['pagination_values'];
$_SESSION['bareos']['dt_pagelength'] = $configuration['configuration']['tables']['pagination_default_value'];
$_SESSION['bareos']['dt_statesave'] = ($configuration['configuration']['tables']['save_previous_state']) ? 'true' : 'false';

// Push the autochanger settings into the SESSION context.
if(isset($configuration['configuration']['autochanger']['labelpooltype'])) {
$_SESSION['bareos']['ac_labelpooltype'] = $configuration['configuration']['autochanger']['labelpooltype'];
}

if($this->params()->fromQuery('req')) {
return $this->redirect()->toUrl($this->params()->fromQuery('req'));
}
Expand Down
7 changes: 6 additions & 1 deletion module/Storage/src/Storage/Controller/StorageController.php
Expand Up @@ -70,7 +70,12 @@ public function detailsAction()
}

try {
$pools = $this->getPoolModel()->getDotPools($this->bsock, null);
if(isset($_SESSION['bareos']['ac_labelpooltype'])) {
$pools = $this->getPoolModel()->getDotPools($this->bsock, $_SESSION['bareos']['ac_labelpooltype']);
}
else {
$pools = $this->getPoolModel()->getDotPools($this->bsock, null);
}
}
catch(Exception $e) {
echo $e->getMessage();
Expand Down

0 comments on commit 4d97049

Please sign in to comment.