mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
Fix extra tabs opened not keeping their orders after reload
This commit is contained in:
parent
70b96c4ebc
commit
96c0f54581
@ -41,7 +41,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
|
|
||||||
this.apps = null;
|
this.apps = null;
|
||||||
|
|
||||||
this.tabApps = JSON.parse(egw.getSessionItem('api', 'fw_tab_apps')||null) || [];
|
this.tabApps = JSON.parse(egw.getSessionItem('api', 'fw_tab_apps')||null) || {};
|
||||||
|
|
||||||
//Register the resize handler
|
//Register the resize handler
|
||||||
jQuery(window).resize(function(){window.framework.resizeHandler();});
|
jQuery(window).resize(function(){window.framework.resizeHandler();});
|
||||||
@ -86,7 +86,12 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
//Close all open tabs, remove all applications from the application list
|
//Close all open tabs, remove all applications from the application list
|
||||||
this.sidemenuUi.clean();
|
this.sidemenuUi.clean();
|
||||||
this.tabsUi.clean();
|
this.tabsUi.clean();
|
||||||
this.apps = apps = (this.tabApps.length > 0) ? apps.concat(this.tabApps) : apps;
|
if (Object.keys(this.tabApps).length > 0)
|
||||||
|
{
|
||||||
|
apps = apps.concat(Object.values(this.tabApps));
|
||||||
|
}
|
||||||
|
this.apps = apps;
|
||||||
|
|
||||||
var defaultApp = null;
|
var defaultApp = null;
|
||||||
var restore = new Object;
|
var restore = new Object;
|
||||||
var restore_count = 0;
|
var restore_count = 0;
|
||||||
@ -451,7 +456,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
if (serialized != this.serializedTabState)
|
if (serialized != this.serializedTabState)
|
||||||
{
|
{
|
||||||
this.serializedTabState = serialized;
|
this.serializedTabState = serialized;
|
||||||
|
if (this.tabApps) this._setTabAppsSession(this.tabApps);
|
||||||
egw.jsonq('EGroupware\\Api\\Framework\\Ajax::ajax_tab_changed_state', [data]);
|
egw.jsonq('EGroupware\\Api\\Framework\\Ajax::ajax_tab_changed_state', [data]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -584,11 +589,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
app.destroy();
|
app.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tag.parentFw.tabApps.forEach((a,i)=>{if (a.name == this.tag.appName)
|
delete(this.tag.parentFw.tabApps[this.tag.appName]);
|
||||||
{
|
|
||||||
this.tag.parentFw.tabApps.splice(i,1);
|
|
||||||
return;
|
|
||||||
}});
|
|
||||||
this.tag.parentFw._setTabAppsSession(this.tag.parentFw.tabApps);
|
this.tag.parentFw._setTabAppsSession(this.tag.parentFw.tabApps);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -738,13 +739,14 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
|
|
||||||
|
|
||||||
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);
|
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);
|
||||||
this.tabApps.push(jQuery.extend(true, this.apps.filter(a=>{if (a.name == app.appName) return a})[0], {
|
this.tabApps[appname] = (jQuery.extend(true, this.apps.filter(a=>{if (a.name == app.appName) return a})[0], {
|
||||||
title: _extra.displayName,
|
title: _extra.displayName,
|
||||||
icon:_extra.icon,
|
icon:_extra.icon,
|
||||||
name: appname,
|
name: appname,
|
||||||
opened: 1,
|
opened: this.tabsUi.tabs.length+1,
|
||||||
url: _link,
|
url: _link,
|
||||||
internalName: app.appName
|
internalName: app.appName,
|
||||||
|
active: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._setTabAppsSession(this.tabApps);
|
this._setTabAppsSession(this.tabApps);
|
||||||
@ -859,7 +861,13 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
|||||||
if (_app.tab)
|
if (_app.tab)
|
||||||
{
|
{
|
||||||
this.tabsUi.showTab(_app.tab);
|
this.tabsUi.showTab(_app.tab);
|
||||||
|
if (this.tabApps && this.tabApps[_app.appName])
|
||||||
|
{
|
||||||
|
for (let t in this.tabApps)
|
||||||
|
{
|
||||||
|
this.tabApps[t]['active'] = t == _app.appName;
|
||||||
|
}
|
||||||
|
}
|
||||||
//Going to a new tab changes the tab state
|
//Going to a new tab changes the tab state
|
||||||
this.notifyTabChange();
|
this.notifyTabChange();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user