Api: Switch from et2_dialog to Et2Dialog

Might be some I missed or can't change just yet
This commit is contained in:
nathan 2022-03-17 16:18:39 -06:00
parent 9087ea644b
commit 255add7d98
6 changed files with 122 additions and 113 deletions

View File

@ -669,13 +669,13 @@ egwAction.prototype._check_confirm_mass_selections = function(_senders, _target)
var callback = function(_button) var callback = function(_button)
{ {
// YES = unchecked, NO = checked // YES = unchecked, NO = checked
check.set_checked(_button === et2_dialog.NO_BUTTON); check.set_checked(_button === Et2Dialog.NO_BUTTON);
if(_button !== et2_dialog.CANCEL_BUTTON) if (_button !== Et2Dialog.CANCEL_BUTTON)
{ {
self._check_confirm(_senders, _target); self._check_confirm(_senders, _target);
} }
}; };
et2_dialog.show_dialog(callback, msg, self.data.hint, {}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.QUESTION_MESSAGE); Et2Dialog.show_dialog(callback, msg, self.data.hint, {}, Et2Dialog.BUTTONS_YES_NO_CANCEL, Et2Dialog.QUESTION_MESSAGE);
return true; return true;
} }
return false; return false;
@ -687,18 +687,21 @@ egwAction.prototype._check_confirm_mass_selections = function(_senders, _target)
egwAction.prototype._check_confirm = function(_senders, _target) egwAction.prototype._check_confirm = function(_senders, _target)
{ {
// check if actions needs to be confirmed first // check if actions needs to be confirmed first
if (this.data && (this.data.confirm || this.data.confirm_multiple) && this.onExecute.fcnt != window.nm_action && if (this.data && (this.data.confirm || this.data.confirm_multiple) && this.onExecute.fnct != window.nm_action &&
typeof et2_dialog != 'undefined') // let old eTemplate run it's own confirmation from nextmatch_action.js typeof Et2Dialog != 'undefined') // let old eTemplate run it's own confirmation from nextmatch_action.js
{ {
var msg = this.data.confirm || ''; var msg = this.data.confirm || '';
if (_senders.length > 1) if (_senders.length > 1)
{ {
if (this.data.confirm_multiple) msg = this.data.confirm_multiple; if (this.data.confirm_multiple)
{
msg = this.data.confirm_multiple;
}
// check if we have all rows selected // check if we have all rows selected
var obj_manager = egw_getObjectManager(this.getManager().parent.id, false); var obj_manager = egw_getObjectManager(this.getManager().parent.id, false);
if (obj_manager && obj_manager.getAllSelected()) if (obj_manager && obj_manager.getAllSelected())
{ {
msg += "\n\n"+egw().lang('Attention: action will be applied to all rows, not only visible ones!'); msg += "\n\n" + egw().lang('Attention: action will be applied to all rows, not only visible ones!');
} }
} }
var self = this; var self = this;
@ -715,13 +718,13 @@ egwAction.prototype._check_confirm = function(_senders, _target)
}); });
return; return;
} }
et2_dialog.show_dialog(function(_button) Et2Dialog.show_dialog(function (_button)
{ {
if (_button == et2_dialog.YES_BUTTON) if (_button == Et2Dialog.YES_BUTTON)
{ {
return self.onExecute.exec(self, _senders, _target); return self.onExecute.exec(self, _senders, _target);
} }
}, msg, self.data.hint, {}, et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE); }, msg, self.data.hint, {}, Et2Dialog.BUTTONS_YES_NO, Et2Dialog.QUESTION_MESSAGE);
return; return;
} }
} }

View File

@ -10,7 +10,6 @@
import {Et2Widget} from "../Et2Widget/Et2Widget"; import {Et2Widget} from "../Et2Widget/Et2Widget";
import {et2_dialog} from "../et2_widget_dialog";
import {et2_button} from "../et2_widget_button"; import {et2_button} from "../et2_widget_button";
import {LionDialog} from "@lion/dialog"; import {LionDialog} from "@lion/dialog";
import {et2_widget} from "../et2_core_widget"; import {et2_widget} from "../et2_core_widget";
@ -617,8 +616,8 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
callback: function() {}, callback: function() {},
message: _message, message: _message,
title: _title, title: _title,
buttons: et2_dialog.BUTTONS_OK, buttons: Et2Dialog.BUTTONS_OK,
dialog_type: _type || et2_dialog.INFORMATION_MESSAGE dialog_type: _type || Et2Dialog.INFORMATION_MESSAGE
}); });
document.body.appendChild(<LitElement><unknown>dialog); document.body.appendChild(<LitElement><unknown>dialog);
@ -645,7 +644,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
dialog.transformAttributes({ dialog.transformAttributes({
callback: _callback, callback: _callback,
title: _title || 'Input required', title: _title || 'Input required',
buttons: _buttons || et2_dialog.BUTTONS_OK_CANCEL, buttons: _buttons || Et2Dialog.BUTTONS_OK_CANCEL,
value: { value: {
content: { content: {
value: _value, value: _value,
@ -700,7 +699,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
} }
}; };
Et2Dialog.show_dialog(callbackDialog, dialogMsg, titleMsg, {}, Et2Dialog.show_dialog(callbackDialog, dialogMsg, titleMsg, {},
et2_dialog.BUTTONS_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, egw); Et2Dialog.BUTTONS_YES_NO, Et2Dialog.WARNING_MESSAGE, undefined, egw);
}; };
@ -736,13 +735,13 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
// Special action for cancel // Special action for cancel
let buttons = [ let buttons = [
// OK starts disabled // OK starts disabled
{"button_id": et2_dialog.OK_BUTTON, label: 'ok', "default": true, "disabled": true, image: "check"}, {"button_id": Et2Dialog.OK_BUTTON, label: 'ok', "default": true, "disabled": true, image: "check"},
{ {
"button_id": et2_dialog.CANCEL_BUTTON, label: 'cancel', image: "cancel", click: function() "button_id": Et2Dialog.CANCEL_BUTTON, label: 'cancel', image: "cancel", click: function()
{ {
// Cancel run // Cancel run
cancel = true; cancel = true;
jQuery("button[button_id=" + et2_dialog.CANCEL_BUTTON + "]", dialog.div.parent()).button("disable"); jQuery("button[button_id=" + Et2Dialog.CANCEL_BUTTON + "]", dialog.div.parent()).button("disable");
update.call(_list.length, ''); update.call(_list.length, '');
} }
} }
@ -830,7 +829,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
{label: egw.lang("Retry"), id: 'dialog[retry]'}, {label: egw.lang("Retry"), id: 'dialog[retry]'},
{label: egw.lang("Skip"), id: 'dialog[skip]', default: true} {label: egw.lang("Skip"), id: 'dialog[skip]', default: true}
], ],
dialog_type: et2_dialog.ERROR_MESSAGE dialog_type: Et2Dialog.ERROR_MESSAGE
}); });
dialog.egw().window.document.body.appendChild(<LitElement><unknown>retry); dialog.egw().window.document.body.appendChild(<LitElement><unknown>retry);
// Early exit // Early exit

View File

@ -16,7 +16,7 @@ import {EgwApp} from "./egw_app";
import './egw_inheritance.js'; import './egw_inheritance.js';
import {etemplate2} from "../etemplate/etemplate2"; import {etemplate2} from "../etemplate/etemplate2";
import {et2_createWidget} from "../etemplate/et2_core_widget"; import {et2_createWidget} from "../etemplate/et2_core_widget";
import {et2_dialog} from "../etemplate/et2_widget_dialog"; import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch"; import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch";
import {et2_favorites} from "../etemplate/et2_widget_favorites"; import {et2_favorites} from "../etemplate/et2_widget_favorites";
@ -304,13 +304,13 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
{ {
var that = this; var that = this;
var action_id = _action.id; var action_id = _action.id;
et2_dialog.show_dialog(function(button_id,value) Et2Dialog.show_dialog(function (button_id, value)
{ {
if (button_id != et2_dialog.NO_BUTTON) if (button_id != Et2Dialog.NO_BUTTON)
{ {
that._do_action(action_id, _elems); that._do_action(action_id, _elems);
} }
}, confirm_msg, egw.lang('Confirmation required'), et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE); }, confirm_msg, egw.lang('Confirmation required'), Et2Dialog.BUTTONS_YES_NO, Et2Dialog.QUESTION_MESSAGE);
} }
else if (typeof this._do_action == 'function') else if (typeof this._do_action == 'function')
{ {
@ -934,7 +934,7 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
// Make sure first // Make sure first
var do_delete = function(button_id) var do_delete = function(button_id)
{ {
if(button_id != et2_dialog.YES_BUTTON) if (button_id != Et2Dialog.YES_BUTTON)
{ {
line.removeClass('loading'); line.removeClass('loading');
return; return;
@ -969,8 +969,8 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
); );
request.sendRequest(true); request.sendRequest(true);
}; };
et2_dialog.show_dialog(do_delete, (egw.lang("Delete") + " " +name +"?"), Et2Dialog.show_dialog(do_delete, (egw.lang("Delete") + " " + name + "?"),
egw.lang("Delete"), et2_dialog.YES_NO, et2_dialog.QUESTION_MESSAGE); egw.lang("Delete"), Et2Dialog.BUTTONS_YES_NO, Et2Dialog.QUESTION_MESSAGE);
return false; return false;
}, },
@ -1543,20 +1543,22 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
mailvelopeDeleteBackup: function() mailvelopeDeleteBackup: function()
{ {
var self = this; var self = this;
et2_dialog.show_dialog(function (_button_id) Et2Dialog.show_dialog(function (_button_id)
{
if (_button_id == et2_dialog.YES_BUTTON )
{ {
self._mailvelopeBackupFileOperator(undefined, 'DELETE', function(){ if (_button_id == Et2Dialog.YES_BUTTON)
self.egw.message(self.egw.lang('The backup key has been deleted.')); {
}, function(_err){ self._mailvelopeBackupFileOperator(undefined, 'DELETE', function ()
self.egw.message(self.egw.lang('Was not able to delete the backup key because %1',_err)); {
}); self.egw.message(self.egw.lang('The backup key has been deleted.'));
} }, function (_err)
}, {
self.egw.lang('Are you sure, you would like to delete the backup key?'), self.egw.message(self.egw.lang('Was not able to delete the backup key because %1', _err));
self.egw.lang('Delete backup key'), });
{}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.QUESTION_MESSAGE, undefined, self.egw); }
},
self.egw.lang('Are you sure, you would like to delete the backup key?'),
self.egw.lang('Delete backup key'),
{}, Et2Dialog.BUTTONS_YES_NO_CANCEL, Et2Dialog.QUESTION_MESSAGE, undefined, self.egw);
}, },
/** /**
@ -1722,12 +1724,12 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
function(_url, _status){ function(_url, _status){
if (_status == 0) if (_status == 0)
{ {
et2_dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.')); Et2Dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.'));
return; return;
} }
else else
{ {
et2_dialog.alert(egw.lang('Mailvelope addon installation failed! Please try again.')); Et2Dialog.alert(egw.lang('Mailvelope addon installation failed! Please try again.'));
} }
}); });
} }
@ -1823,23 +1825,23 @@ export const AppJS = (function(){ "use strict"; return Class.extend(
}); });
delete buttons[1].default; delete buttons[1].default;
} }
et2_dialog.show_dialog(function (_button_id) Et2Dialog.show_dialog(function (_button_id)
{
if (_button_id != et2_dialog.NO_BUTTON )
{ {
var keys = {}; if (_button_id != Et2Dialog.NO_BUTTON)
keys[self.egw.user('account_id')] = _pubKey;
self.egw.json('addressbook.addressbook_bo.ajax_set_pgp_keys',
[keys, _button_id != et2_dialog.YES_BUTTON ? true : undefined]).sendRequest()
.then(function(_data)
{ {
self.egw.message(_data.response['0'].data); var keys = {};
}); keys[self.egw.user('account_id')] = _pubKey;
} self.egw.json('addressbook.addressbook_bo.ajax_set_pgp_keys',
}, [keys, _button_id != Et2Dialog.YES_BUTTON ? true : undefined]).sendRequest()
self.egw.lang('It is recommended to store your public key in addressbook, so other users can write you encrypted mails.'), .then(function (_data)
self.egw.lang('Store your public key in Addressbook?'), {
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, self.egw); self.egw.message(_data.response['0'].data);
});
}
},
self.egw.lang('It is recommended to store your public key in addressbook, so other users can write you encrypted mails.'),
self.egw.lang('Store your public key in Addressbook?'),
{}, buttons, Et2Dialog.QUESTION_MESSAGE, undefined, self.egw);
}, },
function(_err){ function(_err){
self.egw.message(_err.message+"\n\n"+ self.egw.message(_err.message+"\n\n"+

View File

@ -435,33 +435,33 @@ window.app = {classes: {}};
} }
try { try {
// Open tutorial popup with an introduction video about egroupware // Open tutorial popup with an introduction video about egroupware
if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' && if (window.framework === window.top.framework && typeof Et2Dialog != 'undefined' &&
!egw.preference('egw_tutorial_noautoload', 'common') && !egw.preference('egw_tutorial_noautoload', 'common') &&
!parseInt(egw_script.getAttribute('data-framework-reload')) && !parseInt(egw_script.getAttribute('data-framework-reload')) &&
(!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox')) (!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox'))
{ {
// we need to wait until common translations are loaded // we need to wait until common translations are loaded
egw.langRequireApp(window, 'common', function() egw.langRequireApp(window, 'common', function ()
{ {
var buttons = [ var buttons = [
{text:egw.lang("Show now"), id:"show", image: "check", default:"true"}, {label: egw.lang("Show now"), id: "show", image: "check", default: "true"},
{text:egw.lang("Show next login"), id:"later", image: "right"}, {label: egw.lang("Show next login"), id: "later", image: "right"},
{text:egw.lang("No thanks"), id:"never", image: "cancel"} {label: egw.lang("No thanks"), id: "never", image: "cancel"}
]; ];
et2_dialog.show_dialog(function (_button_id) Et2Dialog.show_dialog(function (_button_id)
{
if (_button_id == "show" )
{ {
egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580'); if (_button_id == "show")
} {
if(_button_id != "later") egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-' + egw.preference('lang') + '-0-a'), '_blank', '960x580');
{ }
egw.set_preference('common', 'egw_tutorial_noautoload',true); if (_button_id != "later")
} {
}, egw.set_preference('common', 'egw_tutorial_noautoload', true);
egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'), }
egw.lang('Introduction'), },
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window)); egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'),
egw.lang('Introduction'),
{}, buttons, Et2Dialog.QUESTION_MESSAGE, undefined, egw(window));
}, this); }, this);
} }

View File

@ -13,12 +13,13 @@
import {etemplate2} from "../etemplate/etemplate2"; import {etemplate2} from "../etemplate/etemplate2";
import type {et2_container} from "../etemplate/et2_core_baseWidget"; import type {et2_container} from "../etemplate/et2_core_baseWidget";
import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch"; import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch";
import {et2_dialog} from "../etemplate/et2_widget_dialog";
import {et2_createWidget} from "../etemplate/et2_core_widget"; import {et2_createWidget} from "../etemplate/et2_core_widget";
import {et2_favorites} from "../etemplate/et2_widget_favorites"; import {et2_favorites} from "../etemplate/et2_widget_favorites";
import type {IegwAppLocal} from "./egw_global"; import type {IegwAppLocal} from "./egw_global";
import Sortable from 'sortablejs/modular/sortable.complete.esm.js'; import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
import {et2_valueWidget} from "../etemplate/et2_core_valueWidget"; import {et2_valueWidget} from "../etemplate/et2_core_valueWidget";
import {nm_action} from "../etemplate/et2_extension_nextmatch_actions";
import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
/** /**
* Type for push-message * Type for push-message
@ -478,13 +479,13 @@ export abstract class EgwApp
{ {
var that = this; var that = this;
var action_id = _action.id; var action_id = _action.id;
et2_dialog.show_dialog(function(button_id, value) Et2Dialog.show_dialog(function(button_id, value)
{ {
if(button_id != et2_dialog.NO_BUTTON) if(button_id != Et2Dialog.NO_BUTTON)
{ {
that._do_action(action_id, _elems); that._do_action(action_id, _elems);
} }
}, confirm_msg, egw.lang('Confirmation required'), null, et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE); }, confirm_msg, 'Confirmation required', null, Et2Dialog.BUTTONS_YES_NO, Et2Dialog.QUESTION_MESSAGE);
} }
else if(typeof this._do_action == 'function') else if(typeof this._do_action == 'function')
{ {
@ -1169,7 +1170,7 @@ export abstract class EgwApp
// Make sure first // Make sure first
var do_delete = function(button_id) var do_delete = function(button_id)
{ {
if(button_id != et2_dialog.YES_BUTTON) if(button_id != Et2Dialog.YES_BUTTON)
{ {
line.removeClass('loading'); line.removeClass('loading');
return; return;
@ -1205,8 +1206,8 @@ export abstract class EgwApp
); );
request.sendRequest(true); request.sendRequest(true);
}; };
et2_dialog.show_dialog(do_delete, (egw.lang("Delete") + " " + name + "?"), Et2Dialog.show_dialog(do_delete, (egw.lang("Delete") + " " + name + "?"),
egw.lang("Delete"), null, et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE); "Delete", null, Et2Dialog.BUTTONS_YES_NO, Et2Dialog.QUESTION_MESSAGE);
return false; return false;
} }
@ -1802,9 +1803,9 @@ export abstract class EgwApp
mailvelopeDeleteBackup() mailvelopeDeleteBackup()
{ {
var self = this; var self = this;
et2_dialog.show_dialog(function(_button_id) Et2Dialog.show_dialog(function(_button_id)
{ {
if(_button_id == et2_dialog.YES_BUTTON) if(_button_id == Et2Dialog.YES_BUTTON)
{ {
self._mailvelopeBackupFileOperator(undefined, 'DELETE', function() self._mailvelopeBackupFileOperator(undefined, 'DELETE', function()
{ {
@ -1815,9 +1816,9 @@ export abstract class EgwApp
}); });
} }
}, },
self.egw.lang('Are you sure, you would like to delete the backup key?'), 'Are you sure, you would like to delete the backup key?',
self.egw.lang('Delete backup key'), 'Delete backup key',
{}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.QUESTION_MESSAGE, undefined, self.egw); {}, Et2Dialog.BUTTONS_YES_NO_CANCEL, Et2Dialog.QUESTION_MESSAGE, undefined, self.egw);
} }
/** /**
@ -2013,12 +2014,12 @@ export abstract class EgwApp
{ {
if(_status == 0) if(_status == 0)
{ {
et2_dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.')); Et2Dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.'));
return; return;
} }
else else
{ {
et2_dialog.alert(egw.lang('Mailvelope addon installation failed! Please try again.')); Et2Dialog.alert(egw.lang('Mailvelope addon installation failed! Please try again.'));
} }
}); });
} }
@ -2111,41 +2112,41 @@ export abstract class EgwApp
var buttons = [ var buttons = [
{ {
button_id: 2, button_id: 2,
text: 'Yes', label: 'Yes',
id: 'dialog[yes]', id: 'dialog[yes]',
image: 'check', image: 'check',
default: true default: true
}, },
{button_id: 3, text: 'No', id: 'dialog[no]', image: 'cancelled'} {button_id: 3, label: 'No', id: 'dialog[no]', image: 'cancelled'}
]; ];
if(egw.user('apps').admin) if(egw.user('apps').admin)
{ {
buttons.unshift({ buttons.unshift({
button_id: 5, button_id: 5,
text: 'Yes and allow non-admin users to do that too (recommended)', label: 'Yes and allow non-admin users to do that too (recommended)',
id: 'dialog[yes_allow]', id: 'dialog[yes_allow]',
image: 'check', image: 'check',
default: true default: true
}); });
delete buttons[1].default; delete buttons[1].default;
} }
et2_dialog.show_dialog(function(_button_id) Et2Dialog.show_dialog(function(_button_id)
{ {
if(_button_id != et2_dialog.NO_BUTTON) if(_button_id != Et2Dialog.NO_BUTTON)
{ {
var keys = {}; var keys = {};
keys[self.egw.user('account_id')] = _pubKey; keys[self.egw.user('account_id')] = _pubKey;
self.egw.json('addressbook.addressbook_bo.ajax_set_pgp_keys', self.egw.json('addressbook.addressbook_bo.ajax_set_pgp_keys',
[keys, _button_id != et2_dialog.YES_BUTTON ? true : undefined]).sendRequest() [keys, _button_id != Et2Dialog.YES_BUTTON ? true : undefined]).sendRequest()
.then(function(_data) .then(function(_data)
{ {
self.egw.message(_data.response['0'].data); self.egw.message(_data.response['0'].data);
}); });
} }
}, },
self.egw.lang('It is recommended to store your public key in addressbook, so other users can write you encrypted mails.'), 'It is recommended to store your public key in addressbook, so other users can write you encrypted mails.',
self.egw.lang('Store your public key in Addressbook?'), 'Store your public key in Addressbook?',
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, self.egw); {}, buttons, Et2Dialog.QUESTION_MESSAGE, undefined, self.egw);
}, },
function(_err) function(_err)
{ {

View File

@ -15,6 +15,7 @@
egw_links; egw_links;
*/ */
import './egw_core.js'; import './egw_core.js';
import {Et2Dialog} from "../etemplate/Et2Dialog/Et2Dialog";
/** /**
* @augments Class * @augments Class
@ -492,10 +493,11 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
if (!popup||popup == 'undefined'||popup == null) if (!popup||popup == 'undefined'||popup == null)
{ {
et2_dialog.show_dialog(function(){ Et2Dialog.show_dialog(function ()
window.egw.open_link(_link, _target, _popup, _target_app); {
},egw.lang("The browser popup blocker is on. Please click on OK button to see the pop-up.\n\nIf you would like to not see this message for the next time, allow your browser pop-up blocker to open popups from %1",window.location.hostname) , window.egw.open_link(_link, _target, _popup, _target_app);
"Popup Blocker Warning",{},et2_dialog.BUTTONS_OK,et2_dialog.WARNING_MESSAGE); }, egw.lang("The browser popup blocker is on. Please click on OK button to see the pop-up.\n\nIf you would like to not see this message for the next time, allow your browser pop-up blocker to open popups from %1", window.location.hostname),
"Popup Blocker Warning", {}, Et2Dialog.BUTTONS_OK, Et2Dialog.WARNING_MESSAGE);
return true; return true;
} }
else else
@ -507,8 +509,8 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
/** /**
* This function helps to append content/ run commands into an already * This function helps to append content/ run commands into an already
* opened popup window. Popup winodws now are getting stored in framework * opened popup window. Popup windows now are getting stored in framework
* object and can be retrived/closed from framework. * object and can be retrieved/closed from framework.
* *
* @param {string} _app name of application to be requested its popups * @param {string} _app name of application to be requested its popups
* @param {string} _method application method implemented in app.js * @param {string} _method application method implemented in app.js
@ -605,17 +607,18 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
else if (popups.length > 1) else if (popups.length > 1)
{ {
var buttons = [ var buttons = [
{text: this.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true}, {label: this.lang("Add"), id: "add", "class": "ui-priority-primary", "default": true},
{text: this.lang("Cancel"), id:"cancel"} {label: this.lang("Cancel"), id: "cancel"}
]; ];
var c = []; var c = [];
for(var i = 0; i < popups.length; i++) for (var i = 0; i < popups.length; i++)
{ {
c.push({label:popups[i].document.title || this.lang(_app), index:i}); c.push({label: popups[i].document.title || this.lang(_app), index: i});
} }
et2_createWidget("dialog", let dialog = new Et2Dialog(this.app_name());
{ dialog.transformAttributes({
callback: function(_button_id, _value) { callback: function (_button_id, _value)
{
if (_value && _value.grid) if (_value && _value.grid)
{ {
switch (_button_id) switch (_button_id)
@ -629,10 +632,11 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
}, },
title: this.lang("Select an opened dialog"), title: this.lang("Select an opened dialog"),
buttons: buttons, buttons: buttons,
value:{content:{grid:c}}, value: {content: {grid: c}},
template: this.webserverUrl+'/api/templates/default/promptOpenedDialog.xet?1', template: this.webserverUrl + '/api/templates/default/promptOpenedDialog.xet?1',
resizable: false resizable: false
}, et2_dialog._create_parent(this.app_name())); });
document.body.appendChild(dialog);
} }
else else
{ {