diff --git a/admin/js/app.ts b/admin/js/app.ts index d004e53b53..a1f5aa2c20 100644 --- a/admin/js/app.ts +++ b/admin/js/app.ts @@ -619,7 +619,7 @@ class AdminApp extends EgwApp dialog.transformAttributes(attrs); this.et2.getInstanceManager().DOMContainer.appendChild(dialog); dialog.updateComplete.then(() => { - dialog.template.widgetContainer.getWidgetById("apps").focus(); + dialog.eTemplate.widgetContainer.getWidgetById("apps").focus(); }); } @@ -1653,14 +1653,14 @@ class AdminApp extends EgwApp { continue; } - widget = this.template.widgetContainer.getWidgetById(required[i]); + widget = this.eTemplate.widgetContainer.getWidgetById(required[i]); widget.set_validation_error('This field is required!'); isValid = false; } // check mismatch passphrase if (_value.passphrase && _value.passphrase !== _value.passphraseConf) { - var passphraseConf = this.template.widgetContainer.getWidgetById('passphrase'); + var passphraseConf = this.eTemplate.widgetContainer.getWidgetById('passphrase'); passphraseConf.set_validation_error('Confirm passphrase is not match!'); isValid = false; } diff --git a/api/js/etemplate/Et2Dialog/Et2Dialog.ts b/api/js/etemplate/Et2Dialog/Et2Dialog.ts index 90987a3309..c1a9bfc1ee 100644 --- a/api/js/etemplate/Et2Dialog/Et2Dialog.ts +++ b/api/js/etemplate/Et2Dialog/Et2Dialog.ts @@ -667,12 +667,33 @@ export class Et2Dialog extends Et2Widget(SlDialog) this.requestUpdate("template", old_template); } + + /** + * Getter for template name. + * + * Historically this returned the etemplate2 widget, but this was incorrect and has been fixed. + * Use `eTemplate` instead of `template` to access the etemplate2 widget. + * + * @returns {string} + */ get template() { // Can't return undefined or requestUpdate() will not notice a change return this.__template || null; } + /** + * The loaded etemplate2 object. + * + * Only available if `template` is set + * + * @returns {etemplate2} + */ + get eTemplate() + { + return this._template_widget; + } + /** * Title for the dialog, goes in the header */ @@ -1454,10 +1475,10 @@ export class Et2Dialog extends Et2Widget(SlDialog) dialog.getUpdateComplete().then(async function() { // Get access to template widgets - log = dialog.template.widgetContainer.getDOMWidgetById('log').getDOMNode(); - progressbar = dialog.template.widgetContainer.getWidgetById('progressbar'); + log = dialog.eTemplate.widgetContainer.getDOMWidgetById('log').getDOMNode(); + progressbar = dialog.eTemplate.widgetContainer.getWidgetById('progressbar'); progressbar.set_label('0 / ' + _list.length); - totals.widget = dialog.template.widgetContainer.getWidgetById('totals'); + totals.widget = dialog.eTemplate.widgetContainer.getWidgetById('totals'); for(let index = 0; index < _list.length && !cancel; index++) { diff --git a/api/js/etemplate/et2_dataview_controller_selection.ts b/api/js/etemplate/et2_dataview_controller_selection.ts index f5356c75bb..c86812e694 100644 --- a/api/js/etemplate/et2_dataview_controller_selection.ts +++ b/api/js/etemplate/et2_dataview_controller_selection.ts @@ -701,10 +701,10 @@ export class et2_dataview_selectionManager (this._context._widget.getDOMNode() || document.body).append(dialog); dialog.updateComplete.then(() => { - dialog.template.DOMContainer.addEventListener('load', () => + dialog.eTemplate.DOMContainer.addEventListener('load', () => { // Get access to template widgets - progressbar = dialog.template.widgetContainer.getWidgetById('progressbar'); + progressbar = dialog.eTemplate.widgetContainer.getWidgetById('progressbar'); let rangePromise = fetchPromise; for(var i = 0; i < queryRanges.length; i++) diff --git a/api/js/etemplate/et2_widget_placeholder.ts b/api/js/etemplate/et2_widget_placeholder.ts index 57b37933d1..ad5492bcbd 100644 --- a/api/js/etemplate/et2_widget_placeholder.ts +++ b/api/js/etemplate/et2_widget_placeholder.ts @@ -209,11 +209,11 @@ export class et2_placeholder_select extends et2_inputWidget */ _on_template_load() { - let app = this.dialog.template.widgetContainer.getDOMWidgetById("app"); - let group = this.dialog.template.widgetContainer.getDOMWidgetById("group"); - let placeholder_list = this.dialog.template.widgetContainer.getDOMWidgetById("placeholder_list"); - let preview = this.dialog.template.widgetContainer.getDOMWidgetById("preview_placeholder"); - let entry = this.dialog.template.widgetContainer.getDOMWidgetById("entry"); + let app = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("app"); + let group = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("group"); + let placeholder_list = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("placeholder_list"); + let preview = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_placeholder"); + let entry = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("entry"); placeholder_list.set_select_options(this._get_placeholders(app.get_value(), group.get_value())); @@ -253,13 +253,13 @@ export class et2_placeholder_select extends et2_inputWidget } placeholder_list.onchange = this._on_placeholder_select.bind(this); entry.onchange = this._on_placeholder_select.bind(this); - (this.dialog.template.widgetContainer.getDOMWidgetById("insert_placeholder")).onclick = () => + (this.dialog.eTemplate.widgetContainer.getDOMWidgetById("insert_placeholder")).onclick = () => { - this.options.insert_callback(this.dialog.template.widgetContainer.getDOMWidgetById("preview_placeholder").getDOMNode().textContent); + this.options.insert_callback(this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_placeholder").getDOMNode().textContent); }; - (this.dialog.template.widgetContainer.getDOMWidgetById("insert_content")).onclick = () => + (this.dialog.eTemplate.widgetContainer.getDOMWidgetById("insert_content")).onclick = () => { - this.options.insert_callback(this.dialog.template.widgetContainer.getDOMWidgetById("preview_content").getDOMNode().textContent); + this.options.insert_callback(this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_content").getDOMNode().textContent); }; app.set_value(app.get_value()); @@ -271,11 +271,11 @@ export class et2_placeholder_select extends et2_inputWidget */ _on_placeholder_select() { - let app = this.dialog.template.widgetContainer.getDOMWidgetById("app"); - let entry = this.dialog.template.widgetContainer.getDOMWidgetById("entry"); - let placeholder_list = this.dialog.template.widgetContainer.getDOMWidgetById("placeholder_list"); - let preview = this.dialog.template.widgetContainer.getDOMWidgetById("preview_placeholder"); - let preview_content = this.dialog.template.widgetContainer.getDOMWidgetById("preview_content"); + let app = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("app"); + let entry = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("entry"); + let placeholder_list = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("placeholder_list"); + let preview = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_placeholder"); + let preview_content = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_content"); // Show the selected placeholder this.set_value(placeholder_list.get_value()); @@ -443,10 +443,10 @@ export class et2_placeholder_snippet_select extends et2_placeholder_select */ _on_template_load() { - let app = this.dialog.template.widgetContainer.getDOMWidgetById("app"); - let placeholder_list = this.dialog.template.widgetContainer.getDOMWidgetById("placeholder_list"); - let preview = this.dialog.template.widgetContainer.getDOMWidgetById("preview_content"); - let entry = this.dialog.template.widgetContainer.getDOMWidgetById("entry"); + let app = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("app"); + let placeholder_list = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("placeholder_list"); + let preview = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_content"); + let entry = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("entry"); placeholder_list.set_select_options(this._get_placeholders("addressbook", "addresses")); @@ -473,10 +473,10 @@ export class et2_placeholder_snippet_select extends et2_placeholder_select */ _on_placeholder_select() { - let app = this.dialog.template.widgetContainer.getDOMWidgetById("app"); - let entry = this.dialog.template.widgetContainer.getDOMWidgetById("entry"); - let placeholder_list = this.dialog.template.widgetContainer.getDOMWidgetById("placeholder_list"); - let preview_content = this.dialog.template.widgetContainer.getDOMWidgetById("preview_content"); + let app = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("app"); + let entry = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("entry"); + let placeholder_list = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("placeholder_list"); + let preview_content = this.dialog.eTemplate.widgetContainer.getDOMWidgetById("preview_content"); let placeholder = ""; if(app && app.value) { diff --git a/filemanager/js/filemanager.ts b/filemanager/js/filemanager.ts index e4c91a9468..8df0b39ec7 100644 --- a/filemanager/js/filemanager.ts +++ b/filemanager/js/filemanager.ts @@ -1447,7 +1447,7 @@ export class filemanagerAPP extends EgwApp document.body.appendChild(dialog); dialog.addEventListener("load", () => { - dialog.template.widgetContainer.getWidgetById("share_link").onclick = copy_link_to_clipboard; + dialog.eTemplate.widgetContainer.getWidgetById("share_link").onclick = copy_link_to_clipboard; }); } diff --git a/timesheet/js/app.ts b/timesheet/js/app.ts index 10a10255ac..e2d58561f4 100644 --- a/timesheet/js/app.ts +++ b/timesheet/js/app.ts @@ -280,7 +280,7 @@ class TimesheetApp extends EgwApp const dialog = new Et2Dialog(this.egw); dialog.getUpdateComplete().then(() => { - const time = dialog.template.widgetContainer.getWidgetById('time'); + const time = dialog.eTemplate.widgetContainer.getWidgetById('time'); // start-time set end-time as max if (0+tse_type & 1) {