Commit 6042b711 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(management) Add a switch to disable management configuration

Will be used by services management

issue #5980
parent e6ae3fbf
......@@ -70,6 +70,9 @@ class management
public static $skipTemplates = TRUE;
/* Disable and hide configuration system */
protected $skipConfiguration = FALSE;
/* Default columns */
public static $columns = [
['ObjectTypeColumn', []],
......@@ -317,7 +320,9 @@ class management
$this->registerAction(new HiddenAction('cancel', 'cancelEdit'));
$this->registerAction(new HiddenAction('cancelDelete', 'cancelEdit'));
$this->registerAction(new HiddenAction('removeConfirmed', 'removeConfirmed'));
$this->registerAction(new HiddenAction('configure', 'configureDialog'));
if (!$this->skipConfiguration) {
$this->registerAction(new HiddenAction('configure', 'configureDialog'));
}
}
/*!
......@@ -491,7 +496,7 @@ class management
$smarty->assign('FILTER', $filterRender);
$smarty->assign('ACTIONS', $actionMenu);
$smarty->assign('SIZELIMIT', $ui->getSizeLimitHandler()->renderWarning());
$smarty->assign('NAVIGATION', $this->listing->renderNavigation());
$smarty->assign('NAVIGATION', $this->listing->renderNavigation($this->skipConfiguration));
$smarty->assign('BASE', $this->listing->renderBase());
$smarty->assign('HEADLINE', $this->headline);
......@@ -986,7 +991,9 @@ class management
function configureDialog (array $action)
{
$this->dialogObject = new ManagementConfigurationDialog($this);
if (!$this->skipConfiguration) {
$this->dialogObject = new ManagementConfigurationDialog($this);
}
}
/*! \brief This method is used to queue and process copy&paste actions.
......
......@@ -359,28 +359,28 @@ class managementListing
return $this->baseSelector->render();
}
function renderNavigation (): array
function renderNavigation (bool $skipConfiguration = FALSE): array
{
$enableBack = TRUE;
$enableRoot = TRUE;
$enableHome = TRUE;
global $ui;
$ui = get_userinfo();
if ($this->baseMode) {
$enableBack = TRUE;
$enableRoot = TRUE;
$enableHome = TRUE;
/* Check if base = first available base */
$deps = array_keys($this->bases);
/* Check if base = first available base */
$deps = array_keys($this->bases);
if (!count($deps) || $deps[0] == $this->base) {
$enableBack = FALSE;
$enableRoot = FALSE;
}
if (!count($deps) || $deps[0] == $this->base) {
$enableBack = FALSE;
$enableRoot = FALSE;
}
/* Check if we are in users home department */
if (!count($deps) || ($this->base == $ui->getBase()) || !in_array_ics($ui->getBase(), $deps)) {
$enableHome = FALSE;
}
/* Check if we are in users home department */
if (!count($deps) || ($this->base == $ui->getBase()) || !in_array_ics($ui->getBase(), $deps)) {
$enableHome = FALSE;
}
if ($this->baseMode) {
$actions = [
[
'id' => 'ROOT',
......@@ -410,6 +410,7 @@ class managementListing
} else {
$actions = [];
}
$actions[] = [
'id' => 'REFRESH',
'desc' => _('Reload list'),
......@@ -418,14 +419,17 @@ class managementListing
'enabled' => TRUE,
'class' => 'optional',
];
$actions[] = [
'id' => 'listing_configure',
'desc' => _('Configure this management list'),
'name' => _('Configure'),
'icon' => 'geticon.php?context=categories&icon=settings&size=16',
'enabled' => TRUE,
'class' => '',
];
if (!$skipConfiguration) {
$actions[] = [
'id' => 'listing_configure',
'desc' => _('Configure this management list'),
'name' => _('Configure'),
'icon' => 'geticon.php?context=categories&icon=settings&size=16',
'enabled' => TRUE,
'class' => '',
];
}
return $actions;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment