WIP new app.ts method dialogExec(_menuaction) opening a popup into a dialog

This commit is contained in:
ralf 2023-07-11 22:45:33 +02:00
parent f6a15f3c94
commit c63784d7e8
2 changed files with 20 additions and 5 deletions

View File

@ -1515,27 +1515,36 @@ export class etemplate2
{
// Check the parameters
const data = _response.data;
// window-close does NOT send data.DOMNodeID!
const dialog = <any>document.querySelector('et2-dialog > form'+(data.DOMNodeID?'#'+data.DOMNodeID:''))?.parentNode;
// handle Api\Framework::refresh_opener()
if(Array.isArray(data['refresh-opener']))
{
if(window.opener)// && typeof window.opener.egw_refresh == 'function')
{
var egw = window.egw(opener);
const egw = window.egw(dialog ? window : opener);
egw.refresh.apply(egw, data['refresh-opener']);
}
}
var egw = window.egw(window);
const egw = window.egw(window);
// need to set app_header before message, as message temp. replaces app_header
if(typeof data.data == 'object' && typeof data.data.app_header == 'string')
{
egw.app_header(data.data.app_header, data.data.currentapp || null);
if (dialog)
{
dialog.title = data.data.app_header;
}
else
{
egw.app_header(data.data.app_header, data.data.currentapp || null);
}
delete data.data.app_header;
}
// handle Api\Framework::message()
if(jQuery.isArray(data.message))
if(Array.isArray(data.message))
{
egw.message.apply(egw, data.message);
}
@ -1547,6 +1556,12 @@ export class etemplate2
{
alert(data['window-close']);
}
if (dialog)
{
dialog.close();
dialog.parentNode.removeChild(dialog);
return Promise.resolve();
}
egw.close();
return true;
}

View File

@ -260,7 +260,7 @@ class Etemplate extends Etemplate\Widget\Template
{
if ($output_mode == 2)
{
$content = '<et2-dialog><form id="'.$dom_id.'" class="et2_container"></form></et2-dialog>'."\n";
$content = '<et2-dialog><form target="egw_iframe_autocomplete_helper" action="'.$form_action.'" id="'.$dom_id.'" class="et2_container"></form></et2-dialog>'."\n";
}
else
{