mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-18 20:39:13 +02:00
WIP new app.ts method dialogExec(_menuaction) opening a popup into a dialog
ToDo: overwrite Framework actions in etemplate2.handle_load() to eg. close dialog, but not window, or refresh window instead of opener
This commit is contained in:
@@ -938,7 +938,7 @@ export class Et2Dialog extends Et2Widget(SlotMixin(SlDialog))
|
||||
let template_buttons = [
|
||||
...search_in.querySelectorAll('[slot="footer"],[slot="buttons"]'),
|
||||
// Look for a dialog footer, which will contain several buttons and possible other widgets
|
||||
...search_in.querySelectorAll(".dialogFooterToolbar"),
|
||||
...search_in.querySelectorAll(".dialogFooterToolbar et2-button"),
|
||||
// Look for buttons at high level (not everywhere, otherwise we can't have other buttons in the template)
|
||||
...search_in.querySelectorAll(":scope > et2-button, :scope > * > et2-button")
|
||||
];
|
||||
|
@@ -747,6 +747,29 @@ export abstract class EgwApp
|
||||
this.et2_view.close = destroy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens _menuaction in an Et2Dialog
|
||||
*
|
||||
* @param _menuaction
|
||||
* @return Promise<any>
|
||||
*/
|
||||
dialogExec(_menuaction : string)
|
||||
{
|
||||
const ajax = this.egw.json(_menuaction.match(/^([^.:]+)/)[0] + '.jdots_framework.ajax_exec.template.' + _menuaction,
|
||||
['index.php?menuaction=' + _menuaction], _response =>
|
||||
{
|
||||
if (Array.isArray(_response) && typeof _response[0] === 'string')
|
||||
{
|
||||
jQuery(_response[0]).appendTo(document.body);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("Invalid response to dialogExec('"+_menuaction+"')", _response);
|
||||
}
|
||||
});
|
||||
return ajax.sendRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge selected entries into template document
|
||||
*
|
||||
|
Reference in New Issue
Block a user