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 f50b405555
commit 1f4cb50e74
4 changed files with 6 additions and 2 deletions

View File

@ -1441,7 +1441,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);
return et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']);
}
else

View File

@ -371,7 +371,7 @@ window.app = {classes: {}};
// Resize popup when et2 load is done
jQuery(node).on('load', () => window.setTimeout(resize_popup, 50));
}
const et2 = new etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content");
const et2 = new etemplate2(node, data.data.menuaction);
et2.load(data.name, data.url, data.data);
if (typeof data.response !== 'undefined') {
const json_request = egw(window).json("");

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