mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
new method to refresh an egroupware applications view, with the possibility for the application to overwrite the default handing of reloading everything
This commit is contained in:
parent
3851389fdc
commit
ccfa98ff9f
@ -114,6 +114,41 @@ function egw_appWindow(_app)
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh given application _app display of entry _id, incl. outputting _msg
|
||||
*
|
||||
* Default implementation here only reloads window with it's current url with an added msg=_msg attached
|
||||
*
|
||||
* @param string _msg message (already translated) to show, eg. 'Entry deleted'
|
||||
* @param string _app application name
|
||||
* @param string|int _id=null id of entry to refresh
|
||||
* @param _type=null either 'edit', 'delete', 'add' or null
|
||||
*/
|
||||
function egw_refresh(_msg, _app, _id, _type)
|
||||
{
|
||||
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
|
||||
var win = egw_appWindow(_app);
|
||||
|
||||
// if window defines an app_refresh method, just call it
|
||||
if (typeof win.app_refresh != 'undefined')
|
||||
{
|
||||
win.app_refresh(_msg, _app, _id, _type);
|
||||
return;
|
||||
}
|
||||
var href = win.location.href;
|
||||
|
||||
if (href.indexOf('msg=') != -1)
|
||||
{
|
||||
href.replace(/msg=[^&]*/,'msg='+encodeURIComponent(_msg));
|
||||
}
|
||||
else if (_msg)
|
||||
{
|
||||
href += (href.indexOf('?') != -1 ? '&' : '?') + 'msg=' + encodeURIComponent(_msg);
|
||||
}
|
||||
//alert('egw_refresh() about to call '+href);
|
||||
win.location.href = href;
|
||||
}
|
||||
|
||||
window.egw_getFramework = function()
|
||||
{
|
||||
if (typeof window.framework != 'undefined')
|
||||
|
Loading…
Reference in New Issue
Block a user