forked from extern/egroupware
Fix extra tabs opened not keeping their orders after reload
This commit is contained in:
parent
276b1cab44
commit
1a3aee6fdd
@ -39,6 +39,10 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
this.applications = new Object();
|
||||
this.activeApp = null;
|
||||
|
||||
this.apps = null;
|
||||
|
||||
this.tabApps = JSON.parse(egw.getSessionItem('api', 'fw_tab_apps')||null) || {};
|
||||
|
||||
//Register the resize handler
|
||||
jQuery(window).resize(function(){window.framework.resizeHandler();});
|
||||
|
||||
@ -70,6 +74,11 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
//Close all open tabs, remove all applications from the application list
|
||||
this.sidemenuUi.clean();
|
||||
this.tabsUi.clean();
|
||||
if (Object.keys(this.tabApps).length > 0)
|
||||
{
|
||||
apps = apps.concat(Object.values(this.tabApps));
|
||||
}
|
||||
this.apps = apps;
|
||||
|
||||
var defaultApp = null;
|
||||
var restore = new Object;
|
||||
@ -435,7 +444,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
if (serialized != this.serializedTabState)
|
||||
{
|
||||
this.serializedTabState = serialized;
|
||||
|
||||
if (this.tabApps) this._setTabAppsSession(this.tabApps);
|
||||
egw.jsonq('EGroupware\\Api\\Framework\\Ajax::ajax_tab_changed_state', [data]);
|
||||
}
|
||||
},
|
||||
@ -567,6 +576,9 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
{
|
||||
app.destroy();
|
||||
}
|
||||
|
||||
delete(this.tag.parentFw.tabApps[this.tag.appName]);
|
||||
this.tag.parentFw._setTabAppsSession(this.tag.parentFw.tabApps);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -675,6 +687,14 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
}
|
||||
},
|
||||
|
||||
_setTabAppsSession: function(_tabApps)
|
||||
{
|
||||
if (_tabApps)
|
||||
{
|
||||
egw.setSessionItem('api', 'fw_tab_apps', JSON.stringify(_tabApps));
|
||||
}
|
||||
},
|
||||
|
||||
tabLinkHandler: function(_link, _extra)
|
||||
{
|
||||
var app = this.parseAppFromUrl(_link);
|
||||
@ -707,6 +727,17 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
|
||||
|
||||
this.applicationTabNavigate(this.applications[appname], _link, false, -1, null);
|
||||
this.tabApps[appname] = (jQuery.extend(true, this.apps.filter(a=>{if (a.name == app.appName) return a})[0], {
|
||||
title: _extra.displayName,
|
||||
icon:_extra.icon,
|
||||
name: appname,
|
||||
opened: this.tabsUi.tabs.length+1,
|
||||
url: _link,
|
||||
internalName: app.appName,
|
||||
active: true
|
||||
}));
|
||||
|
||||
this._setTabAppsSession(this.tabApps);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -818,7 +849,13 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
if (_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
|
||||
this.notifyTabChange();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user