mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
fixed app-header show in wrong tab, caused by framework object being created AFTER egw
This commit is contained in:
parent
59edcaf864
commit
d90faa7dcc
@ -233,7 +233,7 @@
|
|||||||
// set app-header
|
// set app-header
|
||||||
if (window.framework && egw_script.getAttribute('data-app-header'))
|
if (window.framework && egw_script.getAttribute('data-app-header'))
|
||||||
{
|
{
|
||||||
egw(window).app_header(egw_script.getAttribute('data-app-header'));
|
egw(window).app_header(egw_script.getAttribute('data-app-header'), appname);
|
||||||
}
|
}
|
||||||
// display a message
|
// display a message
|
||||||
if (egw_script.getAttribute('data-message'))
|
if (egw_script.getAttribute('data-message'))
|
||||||
|
@ -27,8 +27,6 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
_app; // not used, but required by function signature
|
_app; // not used, but required by function signature
|
||||||
var message_timer;
|
var message_timer;
|
||||||
var jQuery = _wnd.jQuery;
|
var jQuery = _wnd.jQuery;
|
||||||
var framework = _wnd.framework;
|
|
||||||
var is_popup = !framework || _wnd.opener;
|
|
||||||
var error_reg_exp;
|
var error_reg_exp;
|
||||||
|
|
||||||
// install handler to remove message on click
|
// install handler to remove message on click
|
||||||
@ -36,6 +34,16 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
jQuery('div#egw_message').remove();
|
jQuery('div#egw_message').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are we running in a popup
|
||||||
|
*
|
||||||
|
* @returns {boolean} true: popup, false: main window
|
||||||
|
*/
|
||||||
|
function is_popup()
|
||||||
|
{
|
||||||
|
return !_wnd.framework || _wnd.opener;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Display an error or regular message
|
* Display an error or regular message
|
||||||
@ -45,6 +53,8 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
*/
|
*/
|
||||||
message: function(_msg, _type)
|
message: function(_msg, _type)
|
||||||
{
|
{
|
||||||
|
var framework = _wnd.framework;
|
||||||
|
|
||||||
if (_msg && typeof _type == 'undefined')
|
if (_msg && typeof _type == 'undefined')
|
||||||
{
|
{
|
||||||
if (typeof error_reg_exp == 'undefined') error_reg_exp = new RegExp('(error|'+egw.lang('error')+')', 'i');
|
if (typeof error_reg_exp == 'undefined') error_reg_exp = new RegExp('(error|'+egw.lang('error')+')', 'i');
|
||||||
@ -53,7 +63,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we are NOT in a popup and have a framwork --> let it deal with it
|
// if we are NOT in a popup and have a framwork --> let it deal with it
|
||||||
if (!is_popup && typeof framework.setMessage != 'undefined')
|
if (!is_popup() && typeof framework.setMessage != 'undefined')
|
||||||
{
|
{
|
||||||
// currently not using framework, but top windows message
|
// currently not using framework, but top windows message
|
||||||
//framework.setMessage.call(framework, _msg, _type);
|
//framework.setMessage.call(framework, _msg, _type);
|
||||||
@ -94,6 +104,16 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active app independent if we are using a framed template-set or not
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
app_name: function()
|
||||||
|
{
|
||||||
|
return !is_popup() && _wnd.framework ? _wnd.framework.activeApp.appName : _wnd.egw_appName;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update app-header and website-title
|
* Update app-header and website-title
|
||||||
*
|
*
|
||||||
@ -102,12 +122,12 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
*/
|
*/
|
||||||
app_header: function(_header,_app)
|
app_header: function(_header,_app)
|
||||||
{
|
{
|
||||||
if (!is_popup) // not for popups
|
if (!is_popup()) // not for popups
|
||||||
{
|
{
|
||||||
var app = _app || egw_getAppName();
|
var app = _app || this.app_name();
|
||||||
var title = _wnd.document.title.replace(/[.*]$/, '['+_header+']');
|
var title = _wnd.document.title.replace(/[.*]$/, '['+_header+']');
|
||||||
|
|
||||||
framework.setWebsiteTitle.call(window.framework, app, title, _header);
|
_wnd.framework.setWebsiteTitle.call(_wnd.framework, app, title, _header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
jQuery('div#divAppboxHeader').text(_header);
|
jQuery('div#divAppboxHeader').text(_header);
|
||||||
|
Loading…
Reference in New Issue
Block a user