additional parameters _replace and _with for egw_refresh to modify the url, fixed not working update of existing msg parameter

This commit is contained in:
Ralf Becker
2011-06-24 14:11:37 +00:00
parent e960b79570
commit ea6b823bd4
2 changed files with 13 additions and 5 deletions

View File

@ -214,8 +214,10 @@ function egw_getAppName()
* @param string|int _id=null id of entry to refresh
* @param string _type=null either 'edit', 'delete', 'add' or null
* @param string _targetapp which app's window should be refreshed, default current
* @param string|RegExp _replace regular expression to replace in url
* @param string _with
*/
function egw_refresh(_msg, _app, _id, _type, _target)
function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with)
{
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window;
@ -228,9 +230,14 @@ function egw_refresh(_msg, _app, _id, _type, _target)
}
var href = win.location.href;
if (typeof _replace != 'undefined')
{
href = href.replace(typeof _replace == 'string' ? new RegExp(_replace) : _replace, typeof _with != 'undefined' ? _with : '');
}
if (href.indexOf('msg=') != -1)
{
href.replace(/msg=[^&]*/,'msg='+encodeURIComponent(_msg));
href = href.replace(/msg=[^&]*/,'msg='+encodeURIComponent(_msg));
}
else if (_msg)
{