From 4853f9a622dcd6c89a5099554ce0aa2ca73077a6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 9 Jan 2022 16:38:14 +0200 Subject: [PATCH] use $method parameter of Api\Etemplate::exec() plus new et2_process handler as menuaction GET parameter allows determining the called function on the URL to eg. send it to different FPM pool (before the menuaction of et2 was always "EGroupware\Api\Etemplate::ajax_process_content") --- api/js/etemplate/etemplate2.js | 2 +- api/js/etemplate/etemplate2.ts | 2 +- api/js/jsapi/egw.js | 2 +- api/src/Etemplate.php | 1 + api/src/Json/Request.php | 3 +++ 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/etemplate2.js b/api/js/etemplate/etemplate2.js index fe663ccdd7..590267e8dd 100644 --- a/api/js/etemplate/etemplate2.js +++ b/api/js/etemplate/etemplate2.js @@ -1048,7 +1048,7 @@ var etemplate2 = /** @class */ (function () { if (data['open_target'] && !uniqueId.match(data['open_target'])) { uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target']; } - var et2 = new etemplate2(node, data.menuaction, uniqueId); + var et2 = new etemplate2(node, data.data.menuaction, uniqueId); et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']); return true; } diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index 3efaca2dac..442db2ecfb 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -1343,7 +1343,7 @@ export class etemplate2 { uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target']; } - const et2 = new etemplate2(node, data.menuaction, uniqueId); + const et2 = new etemplate2(node, data.data.menuaction, uniqueId); et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']); return true; } diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 8edf312612..8c3988c53b 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -334,7 +334,7 @@ } }); } - var et2 = new etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content"); + var et2 = new etemplate2(node, data.data.menuaction); et2.load(data.name,data.url,data.data); if (typeof data.response != 'undefined') { diff --git a/api/src/Etemplate.php b/api/src/Etemplate.php index fc95836631..4b6b0cfde2 100644 --- a/api/src/Etemplate.php +++ b/api/src/Etemplate.php @@ -207,6 +207,7 @@ class Etemplate extends Etemplate\Widget\Template 'validation_errors' => self::$validation_errors, 'langRequire' => array_values($langRequire), 'currentapp' => $currentapp, + 'menuaction' => $method.(strpos($method, '::') !== false ? '::' : '.').'et2_process', ); if (!empty($data['content']['nm']['rows']) && is_array($data['content']['nm']['rows'])) diff --git a/api/src/Json/Request.php b/api/src/Json/Request.php index f51ab822ba..ad066ae753 100644 --- a/api/src/Json/Request.php +++ b/api/src/Json/Request.php @@ -159,6 +159,9 @@ class Request case 'etemplate': // eg. ajax code in an eTemplate widget $menuaction = ($appName = 'etemplate').'.'.$className.'.'.$functionName; break; + case 'et2_process': + $menuaction = ($className=Api\Etemplate::class).'::'.($functionName='ajax_process_content'); + break; case 'template': // calling current template / framework object $menuaction = $appName.'.'.$className.'.'.$functionName; $className = get_class($GLOBALS['egw']->framework);