mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
Removes setMessage from framework, as egw_message handles all cases now, and bind click handler to dismiss the message when we create the element
This commit is contained in:
parent
00b22e82bf
commit
af05aa9471
@ -830,35 +830,6 @@ var fw_base = Class.extend({
|
||||
return framework.activeApp.appName;
|
||||
},
|
||||
|
||||
/**
|
||||
* Display an error or regular message
|
||||
*
|
||||
* @param {string} _msg message to show
|
||||
* @param {string} _type 'error', 'warning' or 'success' (default)
|
||||
*/
|
||||
setMessage: function(_msg, _type)
|
||||
{
|
||||
if (typeof _type == 'undefined')
|
||||
_type = _msg.match(/error/i) ? 'error' : 'success';
|
||||
|
||||
if (this.messageTimer)
|
||||
{
|
||||
window.clearTimeout(this.messageTimer);
|
||||
delete this.messageTimer;
|
||||
}
|
||||
|
||||
this.tabsUi.setAppHeader(_msg, _type+'_message');
|
||||
this.resizeHandler();
|
||||
|
||||
if (_type != 'error') // clear message again after some time, if no error
|
||||
{
|
||||
var self = this;
|
||||
this.messageTimer = window.setTimeout(function() {
|
||||
self.refreshAppTitle.call(self);
|
||||
}, 5000);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Change timezone and refresh current app
|
||||
* @param _tz
|
||||
|
@ -27,7 +27,6 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
_app; // not used, but required by function signature
|
||||
var message_timer;
|
||||
var error_reg_exp;
|
||||
var on_click_remove_installed = false;
|
||||
var a_href_reg = /<a href="([^"]+)">([^<]+)<\/a>/img;
|
||||
var new_line_reg = /<\/?(p|br)\s*\/?>\n?/ig;
|
||||
|
||||
@ -63,7 +62,6 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
*/
|
||||
message: function(_msg, _type)
|
||||
{
|
||||
var framework = _wnd.framework;
|
||||
var jQuery = _wnd.jQuery;
|
||||
|
||||
if (_msg && !_type)
|
||||
@ -73,17 +71,6 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
_type = _msg.match(error_reg_exp) ? 'error' : 'success';
|
||||
}
|
||||
|
||||
// if we are NOT in a popup and have a framwork --> let it deal with it
|
||||
if (!this.is_popup() && typeof framework != 'undefined')
|
||||
{
|
||||
// currently not using framework, but top windows message
|
||||
//framework.setMessage.call(framework, _msg, _type);
|
||||
if (_wnd !== _wnd.top)
|
||||
{
|
||||
egw(_wnd.top).message(_msg, _type);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// handle message display for non-framework templates, eg. idots or jerryr
|
||||
if (message_timer)
|
||||
{
|
||||
@ -100,14 +87,6 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
|
||||
if (_msg) // empty _msg just removes pervious message
|
||||
{
|
||||
if (!on_click_remove_installed)
|
||||
{
|
||||
// install handler to remove message on click
|
||||
jQuery('body').on('click', 'div#egw_message', function(e) {
|
||||
jQuery('div#egw_message').remove();
|
||||
});
|
||||
on_click_remove_installed = true;
|
||||
}
|
||||
// replace p and br-tags with newlines
|
||||
_msg = _msg.replace(new_line_reg, "\n");
|
||||
|
||||
@ -115,6 +94,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
.attr('id','egw_message')
|
||||
.text(_msg)
|
||||
.addClass(_type+'_message')
|
||||
.click(function() {this.remove();})
|
||||
.css('position', 'absolute');
|
||||
parent.prepend(msg_div);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user