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

@ -370,7 +370,7 @@ class filemanager_ui
{
$sel_options['action']['mail'] = lang('Mail files');
list($width,$height) = explode('x',egw_link::get_registry('felamimail','add_popup'));
$GLOBALS['egw_info']['flags']['java_script'] .= "<script>
$GLOBALS['egw_info']['flags']['java_script'] .= "<script type=\"text/javascript\">
function open_mail(attachments)
{
var link = '".egw::link('/index.php',array('menuaction' => 'felamimail.uicompose.compose'))."';
@ -402,7 +402,7 @@ class filemanager_ui
selbox.value = '';
}
}
</script>";
</script>\n";
}
else
{
@ -998,7 +998,8 @@ class filemanager_ui
}
}
$js = "opener.egw_refresh('".str_replace("'","\\'",$msg)."','filemanager','".
str_replace("'","\\'",$refresh_path ? $refresh_path : $path)."','edit');";
str_replace("'","\\'",$refresh_path ? $refresh_path : $path)."','edit',null,/&path=[^&]*/);";
if ($button == 'save') $js .= "window.close();";
echo "<html>\n<body>\n<script>\n$js\n</script>\n</body>\n</html>\n";
if ($button == 'save') common::egw_exit();

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)
{