From f6b32160856a3dca4c3cfba605c555339650e9bc Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Tue, 15 May 2007 06:44:09 +0000 Subject: [PATCH] use egw_openWindowCentered2 instead of plain windows.open to open popup windows centered to the screen --- etemplate/inc/class.uietemplate.inc.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index d04b49b5c3..198b8fee73 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -1655,26 +1655,30 @@ $url = $GLOBALS['egw']->link($matches[1],$matches[2]); $on = str_replace($matches[0],'\''.$url.'\'',$on); } - if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches)) - { - foreach($matches[1] as $n => $matche_name) - { + + if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches)) { + foreach($matches[1] as $n => $matche_name) { $matches[1][$n] = '\''.$this->form_name($cname,$matche_name).'\''; } $on = str_replace($matches[0],$matches[1],$on); } - if (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$on,$matches)) - { + + if (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$on,$matches)) { $question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase $on = str_replace($matches[0],'confirm(\''.addslashes($question).'\')',$on); //$on = preg_replace('/confirm\(["\']{1}(.*)["\']{1}\)/','confirm(\''.addslashes($question).'\')',$on); } + + if (preg_match("/window.open\('(.*)','(.*)','dependent=yes,width=(.*),height=(.*),scrollbars=yes,status=(.*)'\)/",$on,$matches)) { + $on = str_replace($matches[0], "egw_openWindowCentered2('{$matches[1]}', '{$matches[2]}', '{$matches[3]}', '{$matches[4]}', '{$matches[5]}')", $on); + } + // replace xajax calls to code in widgets, with the "etemplate" handler, // this allows to call widgets with the current app, otherwise everyone would need etemplate run rights - if (strpos($on,"xajax_doXMLHTTP('etemplate.")!==false) - { + if (strpos($on,"xajax_doXMLHTTP('etemplate.")!==false) { $on = preg_replace("/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/",'xajax_doXMLHTTP(\''.$GLOBALS['egw_info']['flags']['currentapp'].'.\\1.etemplate\'',$on); } + return $on; }