From ef7c175814fc4ea20909be0d19ab93cf23454f38 Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 29 Apr 2022 17:05:43 +0200 Subject: [PATCH] remove jQueryUI DateTime picker and splitter and use them also for eTemplates marked as legacy --- api/etemplate.php | 333 ++- api/js/etemplate/Et2Widget/Et2Widget.ts | 12 +- api/js/etemplate/et2_widget_date.ts | 1503 +----------- api/js/etemplate/et2_widget_split.ts | 463 ---- api/js/etemplate/etemplate2.ts | 1 - api/js/jquery/jquery-ui-timepicker-addon.css | 30 - api/js/jquery/jquery-ui-timepicker-addon.js | 2263 ------------------ api/js/jquery/splitter.js | 338 --- api/src/Header/ContentSecurityPolicy.php | 4 +- 9 files changed, 207 insertions(+), 4740 deletions(-) delete mode 100644 api/js/etemplate/et2_widget_split.ts delete mode 100644 api/js/jquery/jquery-ui-timepicker-addon.css delete mode 100644 api/js/jquery/jquery-ui-timepicker-addon.js delete mode 100644 api/js/jquery/splitter.js diff --git a/api/etemplate.php b/api/etemplate.php index 227ecbe8db..88fd0034d4 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -13,8 +13,8 @@ use EGroupware\Api; // add et2- prefix to following widgets/tags -const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|textbox|textarea|button|colorpicker|description|image|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m'; -const ADD_ET2_PREFIX_LAST_GROUP = 5; +const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|date(-time[^\s]*|-duration)?|textbox|textarea|button|colorpicker|description|image|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m'; +const ADD_ET2_PREFIX_LAST_GROUP = 6; // switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression ini_set('zlib.output_compression', 0); @@ -52,201 +52,198 @@ function send_template() http_response_code(404); exit; } - /* disable caching for now, as you need to delete the cache, once you change ADD_ET2_PREFIX_REGEXP - $cache = $GLOBALS['egw_info']['server']['temp_dir'].'/egw_cache/eT2-Cache-'.$GLOBALS['egw_info']['server']['install_id'].$_SERVER['PATH_INFO']; - if (file_exists($cache) && filemtime($cache) > filemtime($path) && + $cache = $GLOBALS['egw_info']['server']['temp_dir'].'/egw_cache/eT2-Cache-'. + $GLOBALS['egw_info']['server']['install_id'].'-'.str_replace('/', '-', $_SERVER['PATH_INFO']); + if (file_exists($cache) && filemtime($cache) > max(filemtime($path), filemtime(__FILE__)) && ($str = file_get_contents($cache)) !== false) { $cache_read = microtime(true); } - else*/ - if(($str = file_get_contents($path)) !== false && - // eTemplate marked as legacy, return unchanged template without web-components / et2-prefix - !preg_match('/]* legacy="true"/', $str)) + elseif(($str = file_get_contents($path)) !== false) { // fix -->