mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-26 15:59:07 +01:00
if no url-param given, but a selector (id of a selectbox), the active tab is determind by it's value (set via the html-file)
This commit is contained in:
parent
d3b6b5b791
commit
1353159e61
@ -81,7 +81,6 @@ function Tabs(nrTabs,activeCSSclass,inactiveCSSclass,HTMLtabID,HTMLtabcontentID,
|
|||||||
if(document.getElementById(this.HTMLtabcontentID + tabnr))
|
if(document.getElementById(this.HTMLtabcontentID + tabnr))
|
||||||
document.getElementById(this.HTMLtabcontentID + tabnr).className = this.activeCSSclass;
|
document.getElementById(this.HTMLtabcontentID + tabnr).className = this.activeCSSclass;
|
||||||
|
|
||||||
|
|
||||||
if(document.getElementById(this.HTMLtabselectorID))
|
if(document.getElementById(this.HTMLtabselectorID))
|
||||||
document.getElementById(this.HTMLtabselectorID).selectedIndex = tabnr-1;
|
document.getElementById(this.HTMLtabselectorID).selectedIndex = tabnr-1;
|
||||||
if(document.getElementById(this.HTMLtabradioID + tabnr))
|
if(document.getElementById(this.HTMLtabradioID + tabnr))
|
||||||
@ -157,8 +156,13 @@ function Tabs(nrTabs,activeCSSclass,inactiveCSSclass,HTMLtabID,HTMLtabcontentID,
|
|||||||
*/
|
*/
|
||||||
function display(tabnr)
|
function display(tabnr)
|
||||||
{
|
{
|
||||||
this.disableAll(this.nrTabs);
|
for (i = 1; i <= this.nrTabs; ++i)
|
||||||
this.setActive(tabnr);
|
{
|
||||||
|
if (i == tabnr)
|
||||||
|
this.setActive(tabnr);
|
||||||
|
else
|
||||||
|
this.setInactive(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,42 +194,39 @@ function Tabs(nrTabs,activeCSSclass,inactiveCSSclass,HTMLtabID,HTMLtabcontentID,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get url parameter for first tab and display it.
|
* Determine active tab from url parameter or selector and display it.
|
||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
var tab = 0;
|
var tab = 0;
|
||||||
var url = document.URL;
|
var regexp = new RegExp('(^|&)' + this.tabPageKey + '=[0-9]{1,2}');
|
||||||
var pos = url.indexOf("?");
|
var urlparams = window.location.search;
|
||||||
if (pos > -1)
|
var urlparamstart = urlparams.search(regexp);
|
||||||
|
|
||||||
|
// getting the active tab from the tabPageKey (url/get-var) if set
|
||||||
|
if (this.tabPageKey && urlparamstart > -1)
|
||||||
{
|
{
|
||||||
var urlparams = url.substr(pos + 1,url.length - (pos + 1));
|
urlparamstart = urlparamstart + ((urlparams[urlparamstart] == '&') ? 1 : 0);
|
||||||
var regexp = new RegExp('(^|&)' + this.tabPageKey + '=[0-9]{1,2}');
|
var urlparam = urlparams.substr(urlparamstart,urlparams.length - urlparamstart);
|
||||||
var urlparamstart = urlparams.search(regexp);
|
var pos = urlparam.indexOf("&");
|
||||||
if (urlparamstart > -1)
|
if (pos > -1)
|
||||||
{
|
{
|
||||||
urlparamstart = urlparamstart + ((urlparams[urlparamstart] == '&') ? 1 : 0);
|
urlparam = urlparam.substr(0,pos);
|
||||||
var urlparam = urlparams.substr(urlparamstart,urlparams.length - urlparamstart);
|
}
|
||||||
pos = urlparam.indexOf("&");
|
pos = urlparam.indexOf("=");
|
||||||
if (pos > -1)
|
if (pos > -1)
|
||||||
{
|
{
|
||||||
urlparam = urlparam.substr(0,pos);
|
var urlparamvalue = urlparam.substr(pos + 1,urlparam.length - (pos + 1));
|
||||||
}
|
tab = urlparamvalue;
|
||||||
pos = urlparam.indexOf("=");
|
}
|
||||||
if (pos > -1)
|
|
||||||
{
|
|
||||||
var urlparamvalue = urlparam.substr(pos + 1,urlparam.length - (pos + 1));
|
|
||||||
tab = urlparamvalue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tab = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tab = 1;
|
// getting the active tab from the selector if set
|
||||||
|
if(document.getElementById(this.HTMLtabselectorID))
|
||||||
|
tab = document.getElementById(this.HTMLtabselectorID).selectedIndex+1;
|
||||||
|
else
|
||||||
|
tab = 1;
|
||||||
}
|
}
|
||||||
if ((tab <= 0) || (tab > this.nrTabs))
|
if ((tab <= 0) || (tab > this.nrTabs))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user