From 9cee681b944c3faaba0683b02c906be2354bdc74 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 2 Sep 2021 10:52:10 -0600 Subject: [PATCH] Bring web-component work into master branch --- api/etemplate.php | 123 + api/js/etemplate/Et2Box/Et2Box.ts | 97 + api/js/etemplate/Et2Box/test/Et2Box.test.ts | 32 + api/js/etemplate/Et2Button/Et2Button.ts | 183 + .../Et2Button/test/Et2Button.test.ts | 69 + .../Et2Colorpicker/Et2Colorpicker.ts | 40 + api/js/etemplate/Et2Date/Et2Date.ts | 187 + .../Et2InputWidget/Et2InputWidget.ts | 146 + .../Et2InputWidget/test/InputBase.test.ts | 39 + api/js/etemplate/Et2Textarea/Et2Textarea.ts | 83 + api/js/etemplate/Et2Textbox/Et2Textbox.ts | 49 + .../Et2Textbox/test/Et2Textbox.test.ts | 32 + .../Et2Textbox/test/Et2TextboxValues.test.ts | 34 + api/js/etemplate/Et2Widget/Et2Widget.ts | 910 +++ api/js/etemplate/et2-button.ts | 21 - api/js/etemplate/et2_core_inheritance.ts | 500 +- api/js/etemplate/et2_core_inputWidget.ts | 72 +- api/js/etemplate/et2_core_widget.ts | 396 +- api/js/etemplate/et2_widget_description.ts | 8 +- api/js/etemplate/et2_widget_grid.ts | 329 +- api/js/etemplate/etemplate2.ts | 114 +- api/js/jsapi/egw_tooltip.js | 5 +- api/src/Etemplate/Widget/Button.php | 2 +- api/src/Etemplate/Widget/Date.php | 95 +- api/src/Etemplate/Widget/Template.php | 22 +- api/src/Etemplate/Widget/Textbox.php | 4 +- infolog/templates/default/edit.xet | 24 +- lit/index.html | 47 - lit/js/app.js | 11 - package-lock.json | 6178 ++++++++++------- package.json | 18 +- rollup.config.js | 27 +- web-test-runner.config.mjs | 73 + 33 files changed, 6740 insertions(+), 3230 deletions(-) create mode 100644 api/etemplate.php create mode 100644 api/js/etemplate/Et2Box/Et2Box.ts create mode 100644 api/js/etemplate/Et2Box/test/Et2Box.test.ts create mode 100644 api/js/etemplate/Et2Button/Et2Button.ts create mode 100644 api/js/etemplate/Et2Button/test/Et2Button.test.ts create mode 100644 api/js/etemplate/Et2Colorpicker/Et2Colorpicker.ts create mode 100644 api/js/etemplate/Et2Date/Et2Date.ts create mode 100644 api/js/etemplate/Et2InputWidget/Et2InputWidget.ts create mode 100644 api/js/etemplate/Et2InputWidget/test/InputBase.test.ts create mode 100644 api/js/etemplate/Et2Textarea/Et2Textarea.ts create mode 100644 api/js/etemplate/Et2Textbox/Et2Textbox.ts create mode 100644 api/js/etemplate/Et2Textbox/test/Et2Textbox.test.ts create mode 100644 api/js/etemplate/Et2Textbox/test/Et2TextboxValues.test.ts create mode 100644 api/js/etemplate/Et2Widget/Et2Widget.ts delete mode 100644 api/js/etemplate/et2-button.ts delete mode 100644 lit/index.html delete mode 100644 lit/js/app.js create mode 100644 web-test-runner.config.mjs diff --git a/api/etemplate.php b/api/etemplate.php new file mode 100644 index 0000000000..c5dd4ac56a --- /dev/null +++ b/api/etemplate.php @@ -0,0 +1,123 @@ +/templates/default/.xet + * + * @link https://www.egroupware.org + * @author Ralf Becker + * @package api + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + */ + +use EGroupware\Api; + +// add et2- prefix to following widgets/tags +const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|textbox|textarea|button))(/?|\s[^>]*)>#m'; + +// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression +ini_set('zlib.output_compression', 0); + +$GLOBALS['egw_info'] = array( + 'flags' => array( + 'currentapp' => 'api', + 'noheader' => true, + // miss-use session creation callback to send the template, in case we have no session + 'autocreate_session_callback' => 'send_template', + 'nocachecontrol' => true, + ) +); + +$start = microtime(true); +include '../header.inc.php'; + +send_template(); + +function send_template() +{ + $header_include = microtime(true); + + // release session, as we don't need it and it blocks parallel requests + $GLOBALS['egw']->session->commit_session(); + + header('Content-Type: application/xml; charset=UTF-8'); + + //$path = EGW_SERVER_ROOT.$_SERVER['PATH_INFO']; + // check for customized template in VFS + list(, $app, , $template, $name) = explode('/', $_SERVER['PATH_INFO']); + $path = Api\Etemplate::rel2path(Api\Etemplate::relPath($app . '.' . basename($name, '.xet'), $template)); + if(empty($path) || !file_exists($path) || !is_readable($path)) + { + 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) && + ($str = file_get_contents($cache)) !== false) + { + $cache_read = microtime(true); + } + else*/ + if(($str = file_get_contents($path)) !== false) + { + // fix -->