🚜 feat(simpleTabs) Split tab loading and tab render

issue #6077
parent 07595b4e
......@@ -209,7 +209,7 @@ class simpleTabs
$tabContent = $this->by_object[$this->current]->execute();
/* Build tab line */
$display = $this->gen_tabs($this->dialogOpened());
$display = $this->renderTabList($this->dialogOpened());
/* Show object */
$display .= '<div class="tab-content">'."\n";
......@@ -240,12 +240,19 @@ class simpleTabs
}
}
/*!
* \brief Load tab list if needed
*/
public function loadTabs ()
{
}
/*!
* \brief Generate the tab classes
*
* \param boolean $disabled false
*/
function gen_tabs ($disabled = FALSE)
protected function renderTabList (bool $disabled = FALSE): string
{
$display = "";
if (!$disabled) {
......@@ -527,7 +534,7 @@ class simpleTabs
$this->ignoreAcls = $bool;
}
public function dialogOpened ()
public function dialogOpened (): bool
{
return $this->by_object[$this->current]->is_modal_dialog();
}
......
......@@ -28,12 +28,17 @@ class ogrouptabs extends simpleTabs_noSpecial
{
parent::__construct($type, $dn, $copied_object);
$this->loadtabs($this->getBaseObject()->gosaGroupObjects);
$this->loadTabs($this->getBaseObject()->gosaGroupObjects);
}
function loadtabs ($gosaGroupObjects)
public function loadTabs (string $gosaGroupObjects = NULL)
{
global $config;
if ($gosaGroupObjects === NULL) {
$gosaGroupObjects = $this->getBaseObject()->getGroupObjectTypes();
}
if ($this->groupObjects == $gosaGroupObjects) {
return;
}
......@@ -130,10 +135,10 @@ class ogrouptabs extends simpleTabs_noSpecial
unset($this->plNotify["$class"]);
}
function gen_tabs ($disabled = FALSE)
protected function renderTabList (bool $disabled = FALSE): string
{
$this->loadtabs($this->getBaseObject()->getGroupObjectTypes());
return parent::gen_tabs($disabled);
$this->loadtabs();
return parent::renderTabList($disabled);
}
/*!
......@@ -157,9 +162,9 @@ class ogrouptabs extends simpleTabs_noSpecial
/*!
* \brief Sets the active tabs from this instance to an other one. Used by templates
*/
function setActiveTabs (&$tabObject)
public function setActiveTabs (&$tabObject)
{
$tabObject->loadtabs($this->groupObjects);
$tabObject->loadTabs($this->groupObjects);
foreach ($this->by_object as $class => $plugin) {
if ($plugin->is_account || $plugin->ignore_account) {
$tabObject->by_object[$class]->is_account = $plugin->is_account;
......
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