forked from extern/egroupware
Fix issue after closing a tab app next available tab wont get selected properly
This commit is contained in:
parent
81d5574fff
commit
864b896ad6
@ -128,7 +128,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
this.appData = new egw_fw_class_application(this,
|
||||
app.name, app.title, app.icon, app.url, app.sideboxwidth,
|
||||
baseUrl, internalName);
|
||||
|
||||
if (app.isTabApp) this.appData['isTabApp'] = true;
|
||||
//Create a sidebox menu entry for each application
|
||||
if (!app.noNavbar && app.status != 5)
|
||||
{
|
||||
@ -517,7 +517,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
//Set the tab closeable if there's more than one tab
|
||||
this.tabsUi.setCloseable(this.tabsUi._isNotTheLastTab());
|
||||
// Do not show tab header if the app is with status 5, means run in background
|
||||
if (_status == 5 && !this.tabApps[_app.appName]) _app.tab.hideTabHeader(true);
|
||||
if (_status == 5 && !_app.isTabApp) _app.tab.hideTabHeader(true);
|
||||
|
||||
}
|
||||
},
|
||||
@ -746,7 +746,8 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
opened: this.tabsUi.tabs.length+1,
|
||||
url: _link,
|
||||
internalName: app.appName,
|
||||
active: true
|
||||
active: true,
|
||||
isTabApp: true
|
||||
}));
|
||||
|
||||
this._setTabAppsSession(this.tabApps);
|
||||
@ -863,7 +864,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
if (_app.tab)
|
||||
{
|
||||
this.tabsUi.showTab(_app.tab);
|
||||
if (this.tabApps && this.tabApps[_app.appName])
|
||||
if (this.tabApps)
|
||||
{
|
||||
for (let t in this.tabApps)
|
||||
{
|
||||
|
@ -665,7 +665,13 @@ egw_fw_ui_tabs.prototype.removeTab = function(_tab)
|
||||
|
||||
//Delete entries in the histroy which might be double
|
||||
this.cleanHistory();
|
||||
|
||||
// lookup for next available tab
|
||||
var lookUpTheNextTab = function(_tab){
|
||||
for(var t in this.tabs)
|
||||
{
|
||||
if (_tab != this.tabs[t] && (this.tabs[t]['status'] != '5' || this.tabs[t]['tag']['isTabApp'])) return this.tabs[t];
|
||||
}
|
||||
}.bind(this);
|
||||
//Special treatement if the currently active tab gets deleted
|
||||
if (_tab == this.activeTab)
|
||||
{
|
||||
@ -673,8 +679,8 @@ egw_fw_ui_tabs.prototype.removeTab = function(_tab)
|
||||
if (this.tabs.length > 0)
|
||||
{
|
||||
//Check whether there is another tab in the tab history,
|
||||
//if not, simply show the first (or next, if tab is first) tab in the list.
|
||||
var tab = _tab == this.tabs[0] ? this.tabs[1] : this.tabs[0];
|
||||
//if not, look up for the next available tab.
|
||||
var tab = lookUpTheNextTab(_tab);
|
||||
if (typeof this.tabHistory[this.tabHistory.length - 1] != 'undefined')
|
||||
{
|
||||
tab = this.tabHistory[this.tabHistory.length - 1];
|
||||
@ -700,7 +706,7 @@ egw_fw_ui_tabs.prototype.removeTab = function(_tab)
|
||||
*/
|
||||
egw_fw_ui_tabs.prototype.showTab = function(_tab)
|
||||
{
|
||||
if (this.activeTab != _tab)
|
||||
if (this.activeTab != _tab && (_tab.status != '5' || _tab.tag.isTabApp))
|
||||
{
|
||||
for (var i = 0; i < this.tabs.length; i++)
|
||||
{
|
||||
@ -768,7 +774,7 @@ egw_fw_ui_tabs.prototype._isNotTheLastTab = function()
|
||||
for (var i in this.tabs)
|
||||
{
|
||||
//exclude open tabs with status 5, e.g. status app
|
||||
if (this.tabs[i]['status'] != '5') n++;
|
||||
if (this.tabs[i]['status'] != '5' || this.tabs[i]['tag']['isTabApp']) n++;
|
||||
}
|
||||
return n > 1 ? true : false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user