Fully remove "tabs" attribute for tabbox, it overwrites the internal tabs collection.

Even checking for it sets 'tabs' attribute to null.  Use "extraTabs" instead.
This commit is contained in:
nathan 2023-01-11 13:21:01 -07:00
parent 18764aab64
commit f332b7bba5
5 changed files with 10 additions and 14 deletions

View File

@ -2791,7 +2791,7 @@ class addressbook_ui extends addressbook_bo
$preserve['old_owner'] = $content['owner']; $preserve['old_owner'] = $content['owner'];
unset($preserve['jpegphoto'], $content['jpegphoto']); // unused and messes up json encoding (not utf-8) unset($preserve['jpegphoto'], $content['jpegphoto']); // unused and messes up json encoding (not utf-8)
$this->tmpl->setElementAttribute('tabs', 'add_tabs', true); $this->tmpl->setElementAttribute('tabs', 'add_tabs', true);
$tabs =& $this->tmpl->getElementAttribute('tabs', 'tabs'); $tabs =& $this->tmpl->getElementAttribute('tabs', 'extraTabs');
if (($first_call = !isset($tabs))) if (($first_call = !isset($tabs)))
{ {
$tabs = array(); $tabs = array();

View File

@ -47,11 +47,6 @@ class Tabbox extends Etemplate\Widget
$form_name = self::form_name($params[0], $this->id, $params[1]); $form_name = self::form_name($params[0], $this->id, $params[1]);
// Make sure additional tabs are processed for any method // Make sure additional tabs are processed for any method
if($tabs = self::getElementAttribute($form_name, 'tabs'))
{
// tabs is not usable in webComponent, need to use extraTabs
self::setElementAttribute($form_name, 'extraTabs', $tabs);
}
if(!($tabs =& self::getElementAttribute($form_name, 'extraTabs'))) if(!($tabs =& self::getElementAttribute($form_name, 'extraTabs')))
{ {
$tabs = $this->attrs['extraTabs']; $tabs = $this->attrs['extraTabs'];

View File

@ -1600,7 +1600,7 @@ class filemanager_ui
// add to existing tabs in template // add to existing tabs in template
$tpl->setElementAttribute('tabs', 'add_tabs', true); $tpl->setElementAttribute('tabs', 'add_tabs', true);
$tabs =& $tpl->getElementAttribute('tabs','tabs'); $tabs =& $tpl->getElementAttribute('extraTabs', 'tabs');
if (true) $tabs = array(); if (true) $tabs = array();
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)

View File

@ -168,7 +168,7 @@ class preferences_password
]; ];
$tmpl->setElementAttribute('tabs', 'add_tabs', true); $tmpl->setElementAttribute('tabs', 'add_tabs', true);
$tabs =& $tmpl->getElementAttribute('tabs', 'tabs'); $tabs =& $tmpl->getElementAttribute('tabs', 'extraTabs');
if (($first_call = !isset($tabs))) if (($first_call = !isset($tabs)))
{ {
$tabs = array(); $tabs = array();

View File

@ -567,12 +567,13 @@ class preferences_settings
// defining used tabs on run-time // defining used tabs on run-time
if ($tabs) if ($tabs)
{ {
$tpl->setElementAttribute('tabs', 'tabs', $tabs); $tpl->setElementAttribute('tabs', 'extraTabs', $tabs);
} }
else else
{ {
// Modifications are kept in the request, so reset to just one // Modifications are kept in the request, so reset to just one
$tpl->setElementAttribute('tabs', 'tabs', array(array( $tpl->setElementAttribute('tabs', 'extraTabs', array(
array(
'id' => 'tab1', 'id' => 'tab1',
'template' => 'preferences.settings.tab1', 'template' => 'preferences.settings.tab1',
'label' => 'general settings' 'label' => 'general settings'