mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-09 01:25:22 +01:00
Enhance tab widget's 'tabs' attribute to include hidden, and id to access content array
This commit is contained in:
parent
d3f498f0f4
commit
8a2259ae99
@ -29,7 +29,7 @@ var et2_tabbox = et2_DOMWidget.extend(
|
||||
'tabs': {
|
||||
'name': 'Tabs',
|
||||
'default': et2_no_init,
|
||||
'description': "Array of [extra] tabs. Each tab needs {label:..., template:...}"
|
||||
'description': "Array of [extra] tabs. Each tab needs {label:..., template:...}. Additional optional keys are hidden and id, for access into content array"
|
||||
}
|
||||
},
|
||||
|
||||
@ -166,30 +166,37 @@ var et2_tabbox = et2_DOMWidget.extend(
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Add any extra tabs
|
||||
if(this.options.tabs)
|
||||
if(this.options.tabs.length)
|
||||
{
|
||||
var readonly = this.getArrayMgr("readonlys").getEntry(this.id) || {};
|
||||
for(var i = 0; i < this.options.tabs.length; i++)
|
||||
{
|
||||
var tab = this.options.tabs[i];
|
||||
var tab_id = tab.id || tab.template;
|
||||
var tab_options = {id: tab_id, template:tab.template};
|
||||
if(tab.id)
|
||||
{
|
||||
tab_options.content = tab.id;
|
||||
}
|
||||
tabData.push({
|
||||
"label": this.egw().lang(tab.label),
|
||||
"widget": et2_createWidget('template',{id:tab.template},this),
|
||||
"widget": et2_createWidget('template',tab_options,this),
|
||||
"contentDiv": null,
|
||||
"flagDiv": null,
|
||||
"hidden": false
|
||||
"hidden": typeof tab.hidden != "undefined" ? tab.hidden : readonly[tab_id] || false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Create the tab DOM-Nodes
|
||||
this.createTabs(tabData);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw("Error while parsing tabbox, none or multiple tabs or tabpanels tags!");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user