forked from extern/egroupware
fixed not called beforeSendToClient callbacks for added tabs, if tab has no (optional) namespace
This commit is contained in:
parent
5f49f94ab4
commit
7251895690
@ -13,6 +13,16 @@
|
||||
|
||||
/**
|
||||
* eTemplate Tabs widget stacks multiple sub-templates and lets you switch between them
|
||||
*
|
||||
* Available attributes:
|
||||
* - add_tabs: true: tabs contain addtional tabs, false: tabs replace tabs in template
|
||||
* - tabs: array with (additional) tabs with values for following keys
|
||||
* + label: label of tab
|
||||
* + template: template name with optional '?'.filemtime as cache-buster
|
||||
* optional:
|
||||
* + prepend: true prepend tab to existing ones, false (default) append tabs
|
||||
* + hidden:
|
||||
* + id: optinal namespace (content attribute of template)
|
||||
*/
|
||||
class etemplate_widget_tabbox extends etemplate_widget
|
||||
{
|
||||
@ -23,6 +33,7 @@ class etemplate_widget_tabbox extends etemplate_widget
|
||||
*/
|
||||
public function beforeSendToClient($cname)
|
||||
{
|
||||
unset($cname);
|
||||
if($this->attrs['tabs'])
|
||||
{
|
||||
// add_tabs toggles replacing or adding to existing tabs
|
||||
@ -31,18 +42,11 @@ class etemplate_widget_tabbox extends etemplate_widget
|
||||
$this->children[1]->children = array();
|
||||
}
|
||||
foreach($this->attrs['tabs'] as $tab)
|
||||
{
|
||||
if($tab['id'])
|
||||
{
|
||||
$template= clone etemplate_widget_template::instance($tab['template']);
|
||||
$template->attrs['content'] = $tab['id'];
|
||||
if($tab['id']) $template->attrs['content'] = $tab['id'];
|
||||
$this->children[1]->children[] = $template;
|
||||
unset($template);
|
||||
/* This doesn't work for some reason
|
||||
$tab_valid =& self::get_array($validated, $tab['id'], true);
|
||||
$tab_valid = $content[$tab['id']];
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,7 +68,7 @@ class etemplate_widget_tabbox extends etemplate_widget
|
||||
{
|
||||
$value = self::get_array($content, $form_name);
|
||||
$valid =& self::get_array($validated, $form_name, true);
|
||||
$valid = $value;
|
||||
if (true) $valid = $value;
|
||||
|
||||
if(!$this->attrs['tabs'])
|
||||
{
|
||||
@ -79,27 +83,13 @@ class etemplate_widget_tabbox extends etemplate_widget
|
||||
$this->children[1]->children = array();
|
||||
}
|
||||
foreach($this->attrs['tabs'] as $tab)
|
||||
{
|
||||
if($tab['id'] && $content[$tab['id']])
|
||||
{
|
||||
$template= clone etemplate_widget_template::instance($tab['template']);
|
||||
$template->attrs['content'] = $tab['id'];
|
||||
$this->children[1]->children[] = $template;
|
||||
unset($template);
|
||||
/* This doesn't work for some reason
|
||||
$tab_valid =& self::get_array($validated, $tab['id'], true);
|
||||
$tab_valid = $content[$tab['id']];
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$template= clone etemplate_widget_template::instance($tab['template']);
|
||||
if($tab['id'] && $content[$tab['id']]) $template->attrs['content'] = $tab['id'];
|
||||
$this->children[1]->children[] = $template;
|
||||
unset($template);
|
||||
}
|
||||
}
|
||||
$valid = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
etemplate_widget::registerWidget('etemplate_widget_tabbox', array('tabbox'));
|
||||
|
Loading…
Reference in New Issue
Block a user