From d3adf5c2540d865fa9a7e36a82fc148e4d16a308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 20 Dec 2017 10:13:39 +0100 Subject: [PATCH] :sparkles: feat(templates): Add dialog support to creation by template This allows to use properly DialogAttributes like group members issue #5626 --- include/class_template.inc | 14 ++++++++++++++ include/simpleplugin/class_simpleManagement.inc | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/class_template.inc b/include/class_template.inc index c91d1592e..46037cdb0 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -171,6 +171,11 @@ class template } } + public function dialogOpened () + { + return $this->tabObject->dialogOpened(); + } + function execute() { $smarty = get_smarty(); @@ -181,6 +186,15 @@ class template if (!isset($this->attributes[$class])) { continue; } + if ($plugin->is_modal_dialog()) { + $dialogResult = $plugin->dialog->execute(); + if ($dialogResult === FALSE) { + $plugin->closeDialog(); + } else { + $this->tabObject->current = $class; + return $dialogResult; + } + } $attributes = array(); foreach ($this->attributes[$class] as $attr) { if ($plugin->attributesAccess[$attr]->getAclInfo() !== FALSE) { diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index 8afc320cc..9670bf57d 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -92,7 +92,12 @@ class templateDialog { $smarty = get_smarty(); if (is_object($this->template)) { - $smarty->assign('template_dialog', $this->template->execute()); + $templateOutput = $this->template->execute(); + if ($this->template->dialogOpened()) { + return $templateOutput; + } else { + $smarty->assign('template_dialog', $templateOutput); + } } else { $smarty->assign('templates', $this->templates); } -- GitLab