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")
This commit is contained in:
Ralf Becker 2022-01-09 16:38:14 +02:00
parent 9f6451193e
commit 5576048f95
5 changed files with 7 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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')
{

View File

@ -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']))

View File

@ -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);