WIP Mail REST API: fix reported problems with calendar quick add

This commit is contained in:
ralf 2023-07-13 18:41:07 +02:00
parent 15cf0ca1ff
commit efaa3ae386
5 changed files with 47 additions and 4 deletions

View File

@ -1022,7 +1022,7 @@ export class Et2Dialog extends Et2Widget(SlotMixin(SlDialog))
get _contentNode() : HTMLElement get _contentNode() : HTMLElement
{ {
return this.querySelector('.dialog_content') ?? this.querySelector("*"); return this.querySelector('.dialog_content');
} }
_setupMoveResize() _setupMoveResize()

View File

@ -1516,7 +1516,13 @@ export class etemplate2
// Check the parameters // Check the parameters
const data = _response.data; const data = _response.data;
// window-close does NOT send data.DOMNodeID! // window-close does NOT send data.DOMNodeID!
const dialog = <any>document.querySelector('et2-dialog > form'+(data.DOMNodeID?'#'+data.DOMNodeID:''))?.parentNode; const dialog = <any>document.querySelector('et2-dialog > form'+(data.DOMNodeID?'#'+data.DOMNodeID:'.dialog_content'))?.parentNode;
if (dialog)
{
// stop dialogs from being closed on button click
dialog.callback = () => false;
}
// handle Api\Framework::refresh_opener() // handle Api\Framework::refresh_opener()
if(Array.isArray(data['refresh-opener'])) if(Array.isArray(data['refresh-opener']))

View File

@ -1121,6 +1121,19 @@ declare interface IegwWndLocal extends IegwGlobal
*/ */
open_link(_link : string, _target? : string, _popup? : string, _target_app? : string, open_link(_link : string, _target? : string, _popup? : string, _target_app? : string,
_check_popup_blocker? : boolean, _mime_type? : string) : Window|void; _check_popup_blocker? : boolean, _mime_type? : string) : Window|void;
/**
* Opens a menuaction in an Et2Dialog instead of a popup
*
* Please note:
* This method does NOT (yet) work in popups, only in the main EGroupware window!
* For popups you have to use the app.ts method openDialog(), which creates the dialog in the correct window / popup.
*
* @param string _menuaction
* @return Promise<any>
*/
openDialog(_menuaction : string) : Promise<any>;
/** /**
* Open a (centered) popup window with given size and url * Open a (centered) popup window with given size and url
* *

View File

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

View File

@ -2062,7 +2062,31 @@ export class CalendarApp extends EgwApp
{ {
menuaction += '&'+name+'='+encodeURIComponent(options[name]); menuaction += '&'+name+'='+encodeURIComponent(options[name]);
} }
return this.egw.openDialog(menuaction); return this.egw.openDialog(menuaction).then(_dialog =>
{
// it would be much nicer if openDialog returns Promise<ET2Dialog>, so we can use it, without searching the dialog
// in a window.setTimeout in the DOM ...
window.setTimeout(() =>
{
const dialog = document.querySelector('et2-dialog > form.dialog_content')?.parentNode;
if (dialog)
{
dialog.callback = _button =>
{
if (event)
{
event.destroy();
}
// a little quicker than waiting for the server to close it
if (_button === "calendar-add_button[cancel]")
{
dialog.hide();
}
return false;
}
}
}, 500);
});
} }
/** /**