forked from extern/egroupware
allow to (optionally) add tabs to existing tabs in template instead of replacing them
This commit is contained in:
parent
f9ee897544
commit
c39273ac51
@ -30,6 +30,11 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
|
||||
'name': 'Tabs',
|
||||
'default': et2_no_init,
|
||||
'description': "Array of [extra] tabs. Each tab needs {label:..., template:...}. Additional optional keys are hidden and id, for access into content array"
|
||||
},
|
||||
'add_tabs': {
|
||||
'name': 'Add tabs',
|
||||
'default': false,
|
||||
'description': 'Set to true if tabs should be added to tabs from read from template, default false if not'
|
||||
}
|
||||
},
|
||||
|
||||
@ -155,8 +160,26 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
|
||||
this.tabContainer.css("height", height);
|
||||
}
|
||||
|
||||
// either use tabs defined via modification or xml (not both)
|
||||
if(this.options.tabs)
|
||||
// if no tabs set or they should be added to tabs from xml
|
||||
if (!this.options.tabs || this.options.add_tabs)
|
||||
{
|
||||
if (tabsElems.length == 1 && tabpanelsElems.length == 1)
|
||||
{
|
||||
var tabs = tabsElems[0];
|
||||
var tabpanels = tabpanelsElems[0];
|
||||
|
||||
// Parse the "tabs" tag
|
||||
this._readTabs(tabData, tabs);
|
||||
|
||||
// Read and create the widgets defined in the "tabpanels"
|
||||
this._readTabPanels(tabData, tabpanels);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.egw().debug("error","Error while parsing tabbox, none or multiple tabs or tabpanels tags!",this);
|
||||
}
|
||||
}
|
||||
if (this.options.tabs)
|
||||
{
|
||||
var readonly = this.getArrayMgr("readonlys").getEntry(this.id) || {};
|
||||
for(var i = 0; i < this.options.tabs.length; i++)
|
||||
@ -178,21 +201,6 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput],
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (tabsElems.length == 1 && tabpanelsElems.length == 1)
|
||||
{
|
||||
var tabs = tabsElems[0];
|
||||
var tabpanels = tabpanelsElems[0];
|
||||
|
||||
// Parse the "tabs" tag
|
||||
this._readTabs(tabData, tabs);
|
||||
|
||||
// Read and create the widgets defined in the "tabpanels"
|
||||
this._readTabPanels(tabData, tabpanels);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.egw().debug("error","Error while parsing tabbox, none or multiple tabs or tabpanels tags!",this);
|
||||
}
|
||||
|
||||
// Create the tab DOM-Nodes
|
||||
this.createTabs(tabData);
|
||||
|
@ -1173,9 +1173,14 @@ class filemanager_ui
|
||||
if(method_exists($tpl,'get_widget_by_name'))
|
||||
{
|
||||
$tabs =& $tpl->get_widget_by_name('tabs=general|perms|eacl|preview|custom');
|
||||
} else {
|
||||
// et2
|
||||
}
|
||||
else // et2
|
||||
{
|
||||
// add to existing tabs in template
|
||||
$tpl->setElementAttribute('tabs', 'add_tabs', true);
|
||||
|
||||
$tabs =& $tpl->getElementAttribute('tabs','tabs');
|
||||
$tabs = array();
|
||||
}
|
||||
|
||||
foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab)
|
||||
|
@ -252,7 +252,7 @@
|
||||
<description id="msg" span="all" class="redItalic"/>
|
||||
</row>
|
||||
<row>
|
||||
<tabbox id="filemanager.file.general|filemanager.file.perms|filemanager.file.eacl|filemanager.file.preview|filemanager.file.custom" span="all">
|
||||
<tabbox id="tabs" span="all">
|
||||
<tabs>
|
||||
<tab id="filemanager.file.general" label="General"/>
|
||||
<tab id="filemanager.file.perms" label="Permissions"/>
|
||||
|
Loading…
Reference in New Issue
Block a user