From f42ee4b026470022a041240bfed7321331b5db23 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 24 Jun 2010 10:51:02 +0000 Subject: [PATCH] - for Ajax: no need to load the "standard" files, they are already loaded, in fact jquery has a problem if loaded twice - add filectime to js and css files loaded via include_css_js_response --- phpgwapi/inc/class.egw_framework.inc.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index d0a2e07459..85ca4e31a7 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -81,6 +81,14 @@ abstract class egw_framework $GLOBALS['egw']->framework = $this; } $this->template_dir = '/phpgwapi/templates/'.$template; + + // for Ajax: no need to load the "standard" files, they are already loaded + // in fact jquery has a problem if loaded twice + if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') + { + self::$js_include_files = array(); + } + error_log(array2string($_SERVER)); } /** @@ -1117,11 +1125,12 @@ abstract class egw_framework $links = "\n"; if(!empty(self::$js_include_files) && is_array(self::$js_include_files)) { - foreach(self::$js_include_files as $file) + foreach(self::$js_include_files as $path) { - list($file,$params) = explode('?',$file,2); - $file .= '?'. filectime(EGW_INCLUDE_ROOT.$file).($params ? '&'.$params : ''); - $links .= '\n"; + $query = ''; + list($path,$query) = explode('?',$path,2); + $path .= '?'. filectime(EGW_SERVER_ROOT.$path).($query ? '&'.$query : ''); + $links .= '\n"; } } return $links."\n"; @@ -1181,6 +1190,9 @@ abstract class egw_framework // add all css files from egw_framework::includeCSS() foreach(self::$css_include_files as $path) { + $query = ''; + list($path,$query) = explode('?',$path,2); + $path .= '?'. filectime(EGW_SERVER_ROOT.$path).($query ? '&'.$query : ''); $response->includeCSS($GLOBALS['egw_info']['server']['webserver_url'].$path); } @@ -1190,6 +1202,9 @@ abstract class egw_framework // add all js files from egw_framework::validate_file() foreach(self::$js_include_files as $path) { + $query = ''; + list($path,$query) = explode('?',$path,2); + $path .= '?'. filectime(EGW_SERVER_ROOT.$path).($query ? '&'.$query : ''); $response->includeScript($GLOBALS['egw_info']['server']['webserver_url'].$path); } }