Commit 990c67f0 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚑 fix(management) Fix configuration dialog for select classes

issue #5965
parent 4d951e7b
......@@ -133,6 +133,40 @@ class ManagementConfigurationDialog extends simplePlugin
}
}
function save_object ()
{
parent::save_object();
if (isset($_POST['edit_cancel'])) {
$this->handle_cancel();
} elseif (isset($_POST['edit_finish'])) {
$this->handle_finish();
}
}
protected function handle_finish ()
{
$msgs = $this->check();
if (count($msgs)) {
msg_dialog::displayChecks($msgs);
return;
} else {
$errors = $this->save();
if (count($errors)) {
msg_dialog::displayChecks($errors);
return;
} else {
$this->parent->remove_lock();
$this->parent->closeDialogs();
}
}
}
protected function handle_cancel ()
{
$this->parent->remove_lock();
$this->parent->closeDialogs();
}
function execute (): string
{
global $config, $ui;
......
......@@ -366,7 +366,7 @@ class management
throw new FusionDirectoryException('No valid listing object');
}
$action = ['targets' => [], 'action' => '', 'subaction' => NULL];
if ($this->is_modal_dialog()) {
if ($this->showTabFooter()) {
if (isset($_POST['edit_cancel'])) {
$action['action'] = 'cancel';
} elseif (isset($_POST['edit_finish'])) {
......@@ -374,7 +374,7 @@ class management
} elseif (isset($_POST['edit_apply'])) {
$action['action'] = 'apply';
}
} else {
} elseif (!$this->dialogOpened()) {
if (isset($_POST['delete_confirmed'])) {
$action['action'] = 'removeConfirmed';
} elseif (isset($_POST['delete_cancel'])) {
......@@ -451,7 +451,7 @@ class management
}
if (method_exists($this->dialogObject, 'execute')) {
$display = $this->dialogObject->execute();
$display .= $this->_getTabFooter();
$display .= $this->getTabFooter();
return $this->getHeader().$display;
}
}
......@@ -460,7 +460,7 @@ class management
if ($this->tabObject instanceOf simpleTabs) {
$this->tabObject->save_object();
$display = $this->tabObject->execute();
$display .= $this->_getTabFooter();
$display .= $this->getTabFooter();
return $this->getHeader().$display;
}
......@@ -554,7 +554,7 @@ class management
}
}
function is_modal_dialog (): bool
function dialogOpened (): bool
{
return (is_object($this->tabObject) || is_object($this->dialogObject));
}
......@@ -608,17 +608,30 @@ class management
}
/*!
* \brief Generates the footer which is used whenever a tab object is displayed.
* \brief Whether footer buttons should appear
*/
protected function _getTabFooter (): string
protected function showTabFooter (): bool
{
// Do not display tab footer for non tab objects
if (!($this->tabObject instanceOf simpleTabs)) {
return '';
return FALSE;
}
// Check if there is a dialog opened - We don't need any buttons in this case.
if ($this->tabObject->dialogOpened()) {
return FALSE;
}
return TRUE;
}
/*!
* \brief Generates the footer which is used whenever a tab object is displayed.
*/
protected function getTabFooter (): string
{
// Do not display tab footer for non tab objects
if (!$this->showTabFooter()) {
return '';
}
......@@ -814,7 +827,7 @@ class management
}
/*!
* \brief Editing an object was caneled.
* \brief Editing an object was canceled.
* Close dialogs/tabs and remove locks.
*/
function cancelEdit ()
......@@ -850,23 +863,6 @@ class management
$this->remove_lock();
$this->closeDialogs();
}
} elseif ($this->dialogObject instanceOf simplePlugin) {
$this->dialogObject->save_object();
$msgs = $this->dialogObject->check();
if (count($msgs)) {
msg_dialog::displayChecks($msgs);
return;
} else {
$errors = $this->dialogObject->save();
if (count($errors)) {
msg_dialog::displayChecks($errors);
return;
} else {
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Dialog saved');
$this->remove_lock();
$this->closeDialogs();
}
}
}
}
......
Supports Markdown
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