mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
Fix action bugs where actions were not properly linking
This commit is contained in:
parent
251f09d28b
commit
0f898acbb2
@ -31,7 +31,7 @@ var et2_core_inheritance_1 = require("./et2_core_inheritance");
|
||||
require("./et2_core_interfaces");
|
||||
require("./et2_core_common");
|
||||
var et2_core_widget_1 = require("./et2_core_widget");
|
||||
var egw_action_js_1 = require("../egw_action/egw_action.js");
|
||||
require("../egw_action/egw_action.js");
|
||||
require("./et2_types");
|
||||
/**
|
||||
* Abstract widget class which can be inserted into the DOM. All widget classes
|
||||
@ -70,7 +70,7 @@ var et2_DOMWidget = /** @class */ (function (_super) {
|
||||
this.parentNode = null;
|
||||
this._attachSet = {};
|
||||
if (this._actionManager) {
|
||||
var app_om = egw_action_js_1.egw_getObjectManager(this.egw().getAppName(), false, 1);
|
||||
var app_om = egw_getObjectManager(this.egw().getAppName(), false, 1);
|
||||
if (app_om) {
|
||||
var om = app_om.getObjectById(this.id);
|
||||
if (om)
|
||||
@ -448,12 +448,12 @@ var et2_DOMWidget = /** @class */ (function (_super) {
|
||||
*/
|
||||
et2_DOMWidget.prototype._link_actions = function (actions) {
|
||||
// Get the top level element for the tree
|
||||
var objectManager = egw_action_js_1.egw_getAppObjectManager(true);
|
||||
var objectManager = egw_getAppObjectManager(true);
|
||||
var widget_object = objectManager.getObjectById(this.id);
|
||||
if (widget_object == null) {
|
||||
// Add a new container to the object manager which will hold the widget
|
||||
// objects
|
||||
widget_object = objectManager.insertObject(false, new egw_action_js_1.egwActionObject(this.id, objectManager, (new et2_action_object_impl(this)).getAOI(), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(this.id, objectManager, (new et2_action_object_impl(this)).getAOI(), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
}
|
||||
else {
|
||||
widget_object.setAOI((new et2_action_object_impl(this, this.getDOMNode())).getAOI());
|
||||
@ -717,7 +717,7 @@ var et2_action_object_impl = /** @class */ (function () {
|
||||
function et2_action_object_impl(_widget, _node) {
|
||||
var widget = _widget;
|
||||
var objectNode = _node;
|
||||
this.aoi = new egw_action_js_1.egwActionObjectInterface();
|
||||
this.aoi = new egwActionObjectInterface();
|
||||
this.aoi.getWidget = function () {
|
||||
return widget;
|
||||
};
|
||||
@ -734,10 +734,10 @@ var et2_action_object_impl = /** @class */ (function () {
|
||||
// or EGW_AI_DRAG_OUT
|
||||
this.aoi.doTriggerEvent = function (_event, _data) {
|
||||
switch (_event) {
|
||||
case egw_action_js_1.EGW_AI_DRAG_OVER:
|
||||
case EGW_AI_DRAG_OVER:
|
||||
jQuery(this.node).addClass("ui-state-active");
|
||||
break;
|
||||
case egw_action_js_1.EGW_AI_DRAG_OUT:
|
||||
case EGW_AI_DRAG_OUT:
|
||||
jQuery(this.node).removeClass("ui-state-active");
|
||||
break;
|
||||
}
|
||||
|
@ -18,15 +18,7 @@ import {ClassWithAttributes} from './et2_core_inheritance';
|
||||
import './et2_core_interfaces';
|
||||
import './et2_core_common';
|
||||
import {et2_widget, WidgetConfig} from "./et2_core_widget";
|
||||
import {
|
||||
EGW_AI_DRAG_OUT,
|
||||
EGW_AI_DRAG_OVER,
|
||||
egw_getActionManager,
|
||||
egw_getAppObjectManager,
|
||||
egw_getObjectManager,
|
||||
egwActionObject,
|
||||
egwActionObjectInterface
|
||||
} from '../egw_action/egw_action.js';
|
||||
import '../egw_action/egw_action.js';
|
||||
import './et2_types';
|
||||
|
||||
/**
|
||||
|
16
api/js/etemplate/et2_types.d.ts
vendored
16
api/js/etemplate/et2_types.d.ts
vendored
@ -5,6 +5,7 @@ declare module eT2
|
||||
declare var etemplate2 : any;
|
||||
declare class et2_widget{
|
||||
destroy()
|
||||
getWidgetById(string) : et2_widget;
|
||||
}
|
||||
declare class et2_DOMWidget extends et2_widget{}
|
||||
declare class et2_baseWidget extends et2_DOMWidget{}
|
||||
@ -19,8 +20,9 @@ declare class et2_tabbox extends et2_valueWidget {
|
||||
activateTab(et2_widget);
|
||||
}
|
||||
declare class et2_button extends et2_DOMWidget {
|
||||
click() : boolean
|
||||
onclick: Function
|
||||
click() : boolean;
|
||||
onclick: Function;
|
||||
set_disabled(b: boolean) : void;
|
||||
}
|
||||
declare var et2_surroundingsMgr : any;
|
||||
declare var et2_arrayMgr : any;
|
||||
@ -62,7 +64,9 @@ declare class et2_customfields_list extends et2_valueWidget {
|
||||
public customfields : any;
|
||||
set_visible(visible : boolean);
|
||||
}
|
||||
declare var et2_nextmatch : any;
|
||||
declare class et2_nextmatch extends et2_DOMWidget {
|
||||
|
||||
}
|
||||
declare var et2_nextmatch_header_bar : any;
|
||||
declare var et2_nextmatch_header : any;
|
||||
declare var et2_nextmatch_customfields : any;
|
||||
@ -105,7 +109,9 @@ declare var et2_historylog : any;
|
||||
declare var et2_hrule : any;
|
||||
declare var et2_html : any;
|
||||
declare var et2_htmlarea : any;
|
||||
declare var et2_iframe : any;
|
||||
declare class et2_iframe extends et2_valueWidget {
|
||||
public set_src(string);
|
||||
}
|
||||
declare var et2_image : any;
|
||||
declare var et2_appicon : any;
|
||||
declare var et2_avatar : any;
|
||||
@ -177,7 +183,7 @@ declare class et2_nextmatch_taglistheader extends et2_nextmatch_header {}
|
||||
declare class et2_nextmatch_entryheader extends et2_nextmatch_header {}
|
||||
declare class et2_nextmatch_customfilter extends et2_nextmatch_filterheader {}
|
||||
declare function et2_createWidget(type : string, params? : {}, parent? : any) : any;
|
||||
declare function nm_action(_action : {}, _senders : [], _target : any, _ids? : any) : void;
|
||||
declare function nm_action(_action : {}, _senders : [], _target? : any, _ids? : any) : void;
|
||||
declare function et2_compileLegacyJS(_code : string, _widget : et2_widget, _context? : HTMLElement) : Function;
|
||||
// et2_core_xml.js
|
||||
declare function et2_loadXMLFromURL(_url : string, _callback : Function, _context? : object, _fail_callback? : Function) : void;
|
||||
|
@ -34,7 +34,7 @@ require("./et2_core_interfaces");
|
||||
var et2_core_widget_1 = require("./et2_core_widget");
|
||||
var et2_core_inheritance_1 = require("./et2_core_inheritance");
|
||||
var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
|
||||
var egw_action_js_1 = require("../egw_action/egw_action.js");
|
||||
require("../egw_action/egw_action.js");
|
||||
/**
|
||||
* Class which implements the "grid" XET-Tag
|
||||
*
|
||||
@ -733,8 +733,6 @@ var et2_grid = /** @class */ (function (_super) {
|
||||
* @param {array} actions [ {ID: attributes..}+] as for set_actions
|
||||
*/
|
||||
et2_grid.prototype._link_actions = function (actions) {
|
||||
// TODO
|
||||
return;
|
||||
// Get the top level element for the tree
|
||||
// @ts-ignore
|
||||
var objectManager = window.egw_getAppObjectManager(true);
|
||||
@ -743,7 +741,7 @@ var et2_grid = /** @class */ (function (_super) {
|
||||
if (widget_object == null) {
|
||||
// Add a new container to the object manager which will hold the widget
|
||||
// objects
|
||||
widget_object = objectManager.insertObject(false, new egw_action_js_1.egwActionObject(this.id, objectManager, new et2_core_DOMWidget_1.et2_action_object_impl(this), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(this.id, objectManager, new et2_core_DOMWidget_1.et2_action_object_impl(this).getAOI(), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
}
|
||||
// Delete all old objects
|
||||
widget_object.clear();
|
||||
@ -759,7 +757,7 @@ var et2_grid = /** @class */ (function (_super) {
|
||||
if (content) {
|
||||
// Add a new action object to the object manager
|
||||
var row = jQuery('tr', this.tbody)[r];
|
||||
var aoi = new et2_core_DOMWidget_1.et2_action_object_impl(this, row);
|
||||
var aoi = new et2_core_DOMWidget_1.et2_action_object_impl(this, row).getAOI();
|
||||
var obj = widget_object.addObject(content.id || "row_" + r, aoi);
|
||||
// Set the data to the content so it's available for the action
|
||||
obj.data = content;
|
||||
|
@ -18,13 +18,10 @@
|
||||
|
||||
import './et2_core_common';
|
||||
import './et2_core_interfaces';
|
||||
import {et2_register_widget, WidgetConfig, et2_widget} from "./et2_core_widget";
|
||||
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
|
||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||
import {et2_DOMWidget, et2_action_object_impl} from "./et2_core_DOMWidget";
|
||||
import {
|
||||
egw_getAppObjectManager,
|
||||
egwActionObject
|
||||
} from '../egw_action/egw_action.js';
|
||||
import {et2_action_object_impl, et2_DOMWidget} from "./et2_core_DOMWidget";
|
||||
import '../egw_action/egw_action.js';
|
||||
|
||||
|
||||
/**
|
||||
@ -1000,8 +997,6 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
||||
*/
|
||||
_link_actions(actions : object[])
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
// Get the top level element for the tree
|
||||
// @ts-ignore
|
||||
let objectManager = window.egw_getAppObjectManager(true);
|
||||
@ -1011,7 +1006,7 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
||||
// Add a new container to the object manager which will hold the widget
|
||||
// objects
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(
|
||||
this.id, objectManager, new et2_action_object_impl(this),
|
||||
this.id, objectManager, new et2_action_object_impl(this).getAOI(),
|
||||
this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager
|
||||
));
|
||||
}
|
||||
@ -1033,7 +1028,7 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
||||
{
|
||||
// Add a new action object to the object manager
|
||||
const row = jQuery('tr', this.tbody)[r];
|
||||
const aoi = new et2_action_object_impl(this, row);
|
||||
const aoi = new et2_action_object_impl(this, row).getAOI();
|
||||
const obj = widget_object.addObject(content.id || "row_" + r, aoi);
|
||||
|
||||
// Set the data to the content so it's available for the action
|
||||
|
@ -164,7 +164,7 @@ var et2_portlet = /** @class */ (function (_super) {
|
||||
if (widget_object == null) {
|
||||
// Add a new container to the object manager which will hold the widget
|
||||
// objects
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(this.id, objectManager, new et2_core_DOMWidget_1.et2_action_object_impl(this), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(this.id, objectManager, new et2_core_DOMWidget_1.et2_action_object_impl(this).getAOI(), this._actionManager || objectManager.manager.getActionById(this.id) || objectManager.manager));
|
||||
}
|
||||
// Delete all old objects
|
||||
widget_object.clear();
|
||||
|
@ -226,7 +226,7 @@ class et2_portlet extends et2_valueWidget
|
||||
// Add a new container to the object manager which will hold the widget
|
||||
// objects
|
||||
widget_object = objectManager.insertObject(false, new egwActionObject(
|
||||
this.id, objectManager, <egwActionObjectInterface><unknown>new et2_action_object_impl(<et2_DOMWidget><unknown>this),
|
||||
this.id, objectManager, <egwActionObjectInterface><unknown>new et2_action_object_impl(<et2_DOMWidget><unknown>this).getAOI(),
|
||||
this._actionManager || (<egwAction><unknown>objectManager.manager).getActionById(this.id) || objectManager.manager
|
||||
));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var et2_core_DOMWidget_1 = require("./et2_core_DOMWidget");
|
||||
var et2_core_widget_1 = require("./et2_core_widget");
|
||||
var et2_core_inheritance_1 = require("./et2_core_inheritance");
|
||||
var egw_action_js_1 = require("../egw_action/egw_action.js");
|
||||
require("../egw_action/egw_action.js");
|
||||
require("./et2_types");
|
||||
/**
|
||||
* This toolbar gets its contents from its actions
|
||||
@ -79,7 +79,7 @@ var et2_toolbar = /** @class */ (function (_super) {
|
||||
_this._build_menu(et2_toolbar.default_toolbar, true);
|
||||
return _this;
|
||||
}
|
||||
;
|
||||
|
||||
et2_toolbar.prototype.destroy = function () {
|
||||
// Destroy widget
|
||||
if (this.div && this.div.data('ui-menu'))
|
||||
@ -498,9 +498,9 @@ var et2_toolbar = /** @class */ (function (_super) {
|
||||
et2_toolbar.prototype._link_actions = function (actions) {
|
||||
this._build_menu(actions);
|
||||
var self = this;
|
||||
var gom = egw_action_js_1.egw_getObjectManager(this.egw().appName, true, 1);
|
||||
var gom = egw_getObjectManager(this.egw().appName, true, 1);
|
||||
if (this._objectManager == null) {
|
||||
this._objectManager = gom.addObject(new egw_action_js_1.egwActionObjectManager(this.id, this._actionManager));
|
||||
this._objectManager = gom.addObject(new egwActionObjectManager(this.id, this._actionManager));
|
||||
this._objectManager.handleKeyPress = function (_keyCode, _shift, _ctrl, _alt) {
|
||||
for (var i = 0; i < self._actionManager.children.length; i++) {
|
||||
var action = self._actionManager.children[i];
|
||||
@ -515,7 +515,7 @@ var et2_toolbar = /** @class */ (function (_super) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return egw_action_js_1.egwActionObject.prototype.handleKeyPress.call(this, _keyCode, _shift, _ctrl, _alt);
|
||||
return egwActionObject.prototype.handleKeyPress.call(this, _keyCode, _shift, _ctrl, _alt);
|
||||
};
|
||||
this._objectManager.parent.updateFocusedChild(this._objectManager, true);
|
||||
}
|
||||
|
@ -19,11 +19,7 @@
|
||||
import {et2_DOMWidget} from "./et2_core_DOMWidget";
|
||||
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||
import {
|
||||
egw_getObjectManager,
|
||||
egwActionObject,
|
||||
egwActionObjectManager
|
||||
} from '../egw_action/egw_action.js';
|
||||
import '../egw_action/egw_action.js';
|
||||
import './et2_types';
|
||||
|
||||
/**
|
||||
@ -631,7 +627,7 @@ class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
||||
}
|
||||
}
|
||||
return egwActionObject.prototype.handleKeyPress.call(this, _keyCode,_shift,_ctrl,_alt);
|
||||
}
|
||||
};
|
||||
this._objectManager.parent.updateFocusedChild(this._objectManager, true);
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
_menuaction = "EGroupware\\Api\\Etemplate::ajax_process_content";
|
||||
}
|
||||
// Copy the given parameters
|
||||
this.DOMContainer = _container;
|
||||
this._DOMContainer = _container;
|
||||
this.menuaction = _menuaction;
|
||||
// Unique ID to prevent DOM collisions across multiple templates
|
||||
this.uniqueId = _container.getAttribute("id") ? _container.getAttribute("id").replace('.', '-') : '';
|
||||
@ -95,7 +95,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
* Preset the object variable
|
||||
* @type {et2_container}
|
||||
*/
|
||||
this.widgetContainer = null;
|
||||
this._widgetContainer = null;
|
||||
// List of templates (XML) that are known, not always used. Indexed by id.
|
||||
// We share list of templates with iframes and popups
|
||||
try {
|
||||
@ -136,30 +136,30 @@ var etemplate2 = /** @class */ (function () {
|
||||
}
|
||||
this.resize_timeout = setTimeout(function () {
|
||||
self.resize_timeout = false;
|
||||
if (self.widgetContainer) {
|
||||
if (self._widgetContainer) {
|
||||
var appHeader = jQuery('#divAppboxHeader');
|
||||
//Calculate the excess height
|
||||
excess_height = egw(window).is_popup() ? jQuery(window).height() - jQuery(self.DOMContainer).height() - appHeader.outerHeight() + 11 : 0;
|
||||
excess_height = egw(window).is_popup() ? jQuery(window).height() - jQuery(self._DOMContainer).height() - appHeader.outerHeight() + 11 : 0;
|
||||
// Recalculate excess height if the appheader is shown
|
||||
if (appHeader.length > 0 && appHeader.is(':visible'))
|
||||
excess_height -= appHeader.outerHeight() - 9;
|
||||
// Do not resize if the template height is bigger than screen available height
|
||||
// For templates which have sub templates and they are bigger than screenHeight
|
||||
if (screen.availHeight < jQuery(self.DOMContainer).height())
|
||||
if (screen.availHeight < jQuery(self._DOMContainer).height())
|
||||
excess_height = 0;
|
||||
// Call the "resize" event of all functions which implement the
|
||||
// "IResizeable" interface
|
||||
self.widgetContainer.iterateOver(function (_widget) {
|
||||
self._widgetContainer.iterateOver(function (_widget) {
|
||||
_widget.resize(excess_height);
|
||||
}, self, et2_IResizeable);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
// Initial resize needs to be resized immediately (for instance for nextmatch resize)
|
||||
else if (this.widgetContainer) {
|
||||
else if (this._widgetContainer) {
|
||||
// Call the "resize" event of all functions which implement the
|
||||
// "IResizeable" interface
|
||||
this.widgetContainer.iterateOver(function (_widget) {
|
||||
this._widgetContainer.iterateOver(function (_widget) {
|
||||
_widget.resize(excess_height);
|
||||
}, this, et2_IResizeable);
|
||||
}
|
||||
@ -169,7 +169,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
* Clears the current instance.
|
||||
*/
|
||||
etemplate2.prototype.clear = function () {
|
||||
jQuery(this.DOMContainer).trigger('clear');
|
||||
jQuery(this._DOMContainer).trigger('clear');
|
||||
// Remove any handlers on window (resize)
|
||||
if (this.uniqueId) {
|
||||
jQuery(window).off("." + this.uniqueId);
|
||||
@ -179,13 +179,13 @@ var etemplate2 = /** @class */ (function () {
|
||||
this.destroy_session();
|
||||
this.unbind_unload();
|
||||
}
|
||||
if (this.widgetContainer != null) {
|
||||
if (this._widgetContainer != null) {
|
||||
// Un-register handler
|
||||
this.widgetContainer.egw().unregisterJSONPlugin(this.handle_assign, this, 'assign');
|
||||
this.widgetContainer.destroy();
|
||||
this.widgetContainer = null;
|
||||
this._widgetContainer.egw().unregisterJSONPlugin(this.handle_assign, this, 'assign');
|
||||
this._widgetContainer.destroy();
|
||||
this._widgetContainer = null;
|
||||
}
|
||||
jQuery(this.DOMContainer).empty();
|
||||
jQuery(this._DOMContainer).empty();
|
||||
// Remove self from the index
|
||||
for (var name_1 in etemplate2.templates) {
|
||||
if (typeof etemplate2._byTemplate[name_1] == "undefined")
|
||||
@ -197,6 +197,27 @@ var etemplate2 = /** @class */ (function () {
|
||||
}
|
||||
}
|
||||
};
|
||||
Object.defineProperty(etemplate2.prototype, "widgetContainer", {
|
||||
get: function () {
|
||||
return this._widgetContainer;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(etemplate2.prototype, "DOMContainer", {
|
||||
get: function () {
|
||||
return this._DOMContainer;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(etemplate2.prototype, "etemplate_exec_id", {
|
||||
get: function () {
|
||||
return this._etemplate_exec_id;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
/**
|
||||
* Creates an associative array containing the data array managers for each part
|
||||
* of the associative data array. A part is something like "content", "readonlys"
|
||||
@ -227,11 +248,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
break;
|
||||
case "readonlys":
|
||||
result[key] = new et2_readonlysArrayMgr(_data[key]);
|
||||
result[key].perspectiveData.owner = this.widgetContainer;
|
||||
result[key].perspectiveData.owner = this._widgetContainer;
|
||||
break;
|
||||
default:
|
||||
result[key] = new et2_arrayMgr(_data[key]);
|
||||
result[key].perspectiveData.owner = this.widgetContainer;
|
||||
result[key].perspectiveData.owner = this._widgetContainer;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -243,9 +264,9 @@ var etemplate2 = /** @class */ (function () {
|
||||
* calls, eg. via et2_dialog.
|
||||
*/
|
||||
etemplate2.prototype.bind_unload = function () {
|
||||
if (this.etemplate_exec_id) {
|
||||
if (this._etemplate_exec_id) {
|
||||
this.destroy_session = jQuery.proxy(function (ev) {
|
||||
var request = egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session", [this.etemplate_exec_id], null, null, false);
|
||||
var request = egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session", [this._etemplate_exec_id], null, null, false);
|
||||
request.sendRequest();
|
||||
}, this);
|
||||
if (!window.onbeforeunload) {
|
||||
@ -325,7 +346,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
egw(currentapp, window).registerJSONPlugin(this.handle_assign, this, 'assign');
|
||||
if (egw.debug_level() >= 3) {
|
||||
if (console.groupCollapsed) {
|
||||
egw.window.console.groupCollapsed("Loading %s into ", _name, '#' + this.DOMContainer.id);
|
||||
egw.window.console.groupCollapsed("Loading %s into ", _name, '#' + this._DOMContainer.id);
|
||||
}
|
||||
}
|
||||
// Timing & profiling on debug level 'log' (4)
|
||||
@ -365,13 +386,13 @@ var etemplate2 = /** @class */ (function () {
|
||||
// Clear any existing instance
|
||||
this.clear();
|
||||
// Create the basic widget container and attach it to the DOM
|
||||
this.widgetContainer = new et2_core_baseWidget_1.et2_container(null);
|
||||
this.widgetContainer.setApiInstance(egw(currentapp, egw.elemWindow(this.DOMContainer)));
|
||||
this.widgetContainer.setInstanceManager(this);
|
||||
this.widgetContainer.setParentDOMNode(this.DOMContainer);
|
||||
this._widgetContainer = new et2_core_baseWidget_1.et2_container(null);
|
||||
this._widgetContainer.setApiInstance(egw(currentapp, egw.elemWindow(this._DOMContainer)));
|
||||
this._widgetContainer.setInstanceManager(this);
|
||||
this._widgetContainer.setParentDOMNode(this._DOMContainer);
|
||||
// store the id to submit it back to server
|
||||
if (_data) {
|
||||
this.etemplate_exec_id = _data.etemplate_exec_id;
|
||||
this._etemplate_exec_id = _data.etemplate_exec_id;
|
||||
// set app_header
|
||||
if (typeof _data.app_header == 'string') {
|
||||
// @ts-ignore
|
||||
@ -392,11 +413,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
}
|
||||
etemplate2._byTemplate[_name].push(this);
|
||||
// Read the XML structure of the requested template
|
||||
this.widgetContainer.loadFromXML(etemplate2.templates[this.name]);
|
||||
this._widgetContainer.loadFromXML(etemplate2.templates[this.name]);
|
||||
// List of Promises from widgets that are not quite fully loaded
|
||||
var deferred = [];
|
||||
// Inform the widget tree that it has been successfully loaded.
|
||||
this.widgetContainer.loadingFinished(deferred);
|
||||
this._widgetContainer.loadingFinished(deferred);
|
||||
// Connect to the window resize event
|
||||
jQuery(window).on("resize." + this.uniqueId, this, function (e) {
|
||||
e.data.resize(e);
|
||||
@ -424,8 +445,8 @@ var etemplate2 = /** @class */ (function () {
|
||||
// Trigger the "resize" event
|
||||
this.resize();
|
||||
// Automatically set focus to first visible input for popups
|
||||
if (this.widgetContainer._egw.is_popup() && jQuery('[autofocus]', this.DOMContainer).focus().length == 0) {
|
||||
var $input = jQuery('input:visible', this.DOMContainer)
|
||||
if (this._widgetContainer._egw.is_popup() && jQuery('[autofocus]', this._DOMContainer).focus().length == 0) {
|
||||
var $input = jQuery('input:visible', this._DOMContainer)
|
||||
// Date fields open the calendar popup on focus
|
||||
.not('.et2_date')
|
||||
.filter(function () {
|
||||
@ -450,13 +471,13 @@ var etemplate2 = /** @class */ (function () {
|
||||
// Let the application that loaded it know too
|
||||
app[this.app].et2_ready(this, this.name);
|
||||
}
|
||||
jQuery(this.DOMContainer).trigger('load', this);
|
||||
jQuery(this._DOMContainer).trigger('load', this);
|
||||
if (etemplate2.templates[this.name].attributes.onload) {
|
||||
var onload_1 = et2_checkType(etemplate2.templates[this.name].attributes.onload.value, 'js', 'onload', {});
|
||||
if (typeof onload_1 === 'string') {
|
||||
onload_1 = et2_compileLegacyJS(onload_1, this, this.widgetContainer);
|
||||
onload_1 = et2_compileLegacyJS(onload_1, this, this._widgetContainer);
|
||||
}
|
||||
onload_1.call(this.widgetContainer);
|
||||
onload_1.call(this._widgetContainer);
|
||||
}
|
||||
// Profiling
|
||||
if (egw.debug_level() >= 4) {
|
||||
@ -479,7 +500,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
try {
|
||||
if (etemplate2.templates[_name]) {
|
||||
// Set array managers first, or errors will happen
|
||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
this._widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
// Already have it
|
||||
_load.apply(this, []);
|
||||
return;
|
||||
@ -510,7 +531,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
}, this);
|
||||
// Split the given data into array manager objects and pass those to the
|
||||
// widget container - do this here because file is loaded async
|
||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
this._widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
}, this);
|
||||
};
|
||||
/**
|
||||
@ -520,7 +541,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
*/
|
||||
etemplate2.prototype.isDirty = function () {
|
||||
var dirty = false;
|
||||
this.widgetContainer.iterateOver(function (_widget) {
|
||||
this._widgetContainer.iterateOver(function (_widget) {
|
||||
if (_widget.isDirty && _widget.isDirty()) {
|
||||
dirty = true;
|
||||
}
|
||||
@ -532,7 +553,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
*/
|
||||
etemplate2.prototype.autocomplete_fixer = function () {
|
||||
var self = this;
|
||||
var form = self.DOMContainer;
|
||||
var form = self._DOMContainer;
|
||||
// Safari always do the autofill for password field regardless of autocomplete = off
|
||||
// and since there's no other way to switch the autocomplete of, we should switch the
|
||||
// form autocomplete off (e.g. compose dialog, attachment password field)
|
||||
@ -558,7 +579,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
};
|
||||
etemplate2.prototype._set_button = function (button, values) {
|
||||
if (typeof button == 'string') {
|
||||
button = this.widgetContainer.getWidgetById(button);
|
||||
button = this._widgetContainer.getWidgetById(button);
|
||||
}
|
||||
// Button parameter used for submit buttons in datagrid
|
||||
// TODO: This should probably go in nextmatch's getValues(), along with selected rows somehow.
|
||||
@ -608,11 +629,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
* @return {boolean} true if submit was send, false if eg. validation stoped submit
|
||||
*/
|
||||
etemplate2.prototype.submit = function (button, async, no_validation, _container) {
|
||||
var api = this.widgetContainer.egw();
|
||||
var api = this._widgetContainer.egw();
|
||||
if (typeof no_validation == 'undefined') {
|
||||
no_validation = false;
|
||||
}
|
||||
var container = _container || this.widgetContainer;
|
||||
var container = _container || this._widgetContainer;
|
||||
// Get the form values
|
||||
var values = this.getValues(container);
|
||||
// Trigger the submit event
|
||||
@ -637,13 +658,13 @@ var etemplate2 = /** @class */ (function () {
|
||||
this.autocomplete_fixer();
|
||||
// unbind our session-destroy handler, as we are submitting
|
||||
this.unbind_unload();
|
||||
var request = api.json(this.menuaction, [this.etemplate_exec_id, values, no_validation], function () {
|
||||
var request = api.json(this.menuaction, [this._etemplate_exec_id, values, no_validation], function () {
|
||||
api.loading_prompt('et2_submit_spinner', false);
|
||||
}, this, async);
|
||||
request.sendRequest();
|
||||
}
|
||||
else {
|
||||
this.widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||
}
|
||||
}
|
||||
return canSubmit;
|
||||
@ -658,10 +679,10 @@ var etemplate2 = /** @class */ (function () {
|
||||
*/
|
||||
etemplate2.prototype.postSubmit = function (button) {
|
||||
// Get the form values
|
||||
var values = this.getValues(this.widgetContainer);
|
||||
var values = this.getValues(this._widgetContainer);
|
||||
// Trigger the submit event
|
||||
var canSubmit = true;
|
||||
this.widgetContainer.iterateOver(function (_widget) {
|
||||
this._widgetContainer.iterateOver(function (_widget) {
|
||||
if (_widget.submit(values) === false) {
|
||||
canSubmit = false;
|
||||
}
|
||||
@ -672,11 +693,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
// unbind our session-destroy handler, as we are submitting
|
||||
this.unbind_unload();
|
||||
var form = jQuery("<form id='form' action='" + egw().webserverUrl +
|
||||
"/index.php?menuaction=" + this.widgetContainer.egw().getAppName() + ".EGroupware\\Api\\Etemplate.process_exec&ajax=true' method='POST'>");
|
||||
"/index.php?menuaction=" + this._widgetContainer.egw().getAppName() + ".EGroupware\\Api\\Etemplate.process_exec&ajax=true' method='POST'>");
|
||||
var etemplate_id = jQuery(document.createElement("input"))
|
||||
.attr("name", 'etemplate_exec_id')
|
||||
.attr("type", 'hidden')
|
||||
.val(this.etemplate_exec_id)
|
||||
.val(this._etemplate_exec_id)
|
||||
.appendTo(form);
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
@ -790,7 +811,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
// msg, app; // unused but required by function signature
|
||||
var refresh_done = false;
|
||||
// Refresh nextmatches
|
||||
this.widgetContainer.iterateOver(function (_widget) {
|
||||
this._widgetContainer.iterateOver(function (_widget) {
|
||||
// Trigger refresh
|
||||
_widget.refresh(id, type);
|
||||
refresh_done = true;
|
||||
@ -829,11 +850,11 @@ var etemplate2 = /** @class */ (function () {
|
||||
// Sometimes changes take time
|
||||
var deferred = [];
|
||||
// Skip hidden etemplates
|
||||
if (jQuery(this.DOMContainer).filter(':visible').length === 0) {
|
||||
if (jQuery(this._DOMContainer).filter(':visible').length === 0) {
|
||||
return [];
|
||||
}
|
||||
// Allow any widget to change for printing
|
||||
this.widgetContainer.iterateOver(function (_widget) {
|
||||
this._widgetContainer.iterateOver(function (_widget) {
|
||||
// Skip widgets from a different etemplate (home)
|
||||
if (_widget.getInstanceManager() != this)
|
||||
return;
|
||||
@ -891,7 +912,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
for (var name_3 in etemplate2._byTemplate) {
|
||||
for (var i = 0; i < etemplate2._byTemplate[name_3].length; i++) {
|
||||
var et = etemplate2._byTemplate[name_3][i];
|
||||
if (et.DOMContainer.getAttribute("id") == id) {
|
||||
if (et._DOMContainer.getAttribute("id") == id) {
|
||||
return et;
|
||||
}
|
||||
}
|
||||
@ -945,7 +966,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
// regular et2 re-load
|
||||
if (typeof data.url == "string" && typeof data.data === 'object') {
|
||||
// @ts-ignore
|
||||
if (typeof this.load == 'function') {
|
||||
if (this && typeof this.load == 'function') {
|
||||
// Called from etemplate
|
||||
// @ts-ignore
|
||||
this.load(data.name, data.url, data.data);
|
||||
@ -983,7 +1004,7 @@ var etemplate2 = /** @class */ (function () {
|
||||
// Display validation errors
|
||||
for (var id in _response.data) {
|
||||
// @ts-ignore
|
||||
var widget = this.widgetContainer.getWidgetById(id);
|
||||
var widget = this._widgetContainer.getWidgetById(id);
|
||||
if (widget && widget.instanceOf(et2_core_baseWidget_1.et2_baseWidget)) {
|
||||
widget.showMessage(_response.data[id], 'validation_error');
|
||||
// Handle validation_error (messages coming back from server as a response) if widget is children of a tabbox
|
||||
@ -1018,20 +1039,20 @@ var etemplate2 = /** @class */ (function () {
|
||||
(typeof res.data.key != 'undefined') &&
|
||||
(typeof res.data.value != 'undefined')) {
|
||||
if (typeof res.data.etemplate_exec_id == 'undefined' ||
|
||||
res.data.etemplate_exec_id != this.etemplate_exec_id) {
|
||||
res.data.etemplate_exec_id != this._etemplate_exec_id) {
|
||||
// Not for this etemplate, but not an error
|
||||
return false;
|
||||
}
|
||||
if (res.data.key == 'etemplate_exec_id') {
|
||||
this.etemplate_exec_id = res.data.value;
|
||||
this._etemplate_exec_id = res.data.value;
|
||||
return true;
|
||||
}
|
||||
if (this.widgetContainer == null) {
|
||||
if (this._widgetContainer == null) {
|
||||
// Right etemplate, but it's already been cleared.
|
||||
egw.debug('warn', "Tried to call assign on an un-loaded etemplate", res.data);
|
||||
return false;
|
||||
}
|
||||
var widget = this.widgetContainer.getWidgetById(res.data.id);
|
||||
var widget = this._widgetContainer.getWidgetById(res.data.id);
|
||||
if (widget) {
|
||||
if (typeof widget['set_' + res.data.key] != 'function') {
|
||||
egw.debug('warn', "Cannot set %s attribute %s via JSON assign, no set_%s()", res.data.id, res.data.key, res.data.key);
|
||||
|
@ -95,14 +95,14 @@ export class etemplate2
|
||||
private static _byTemplate = {};
|
||||
|
||||
|
||||
private etemplate_exec_id: string;
|
||||
private _etemplate_exec_id: string;
|
||||
private readonly menuaction: string;
|
||||
name: string;
|
||||
private uniqueId: void | string;
|
||||
private template_base_url: string;
|
||||
|
||||
private widgetContainer: et2_container;
|
||||
private DOMContainer: HTMLElement;
|
||||
private _widgetContainer: et2_container;
|
||||
private _DOMContainer: HTMLElement;
|
||||
|
||||
private resize_timeout: number | boolean;
|
||||
private destroy_session: any;
|
||||
@ -117,7 +117,7 @@ export class etemplate2
|
||||
}
|
||||
|
||||
// Copy the given parameters
|
||||
this.DOMContainer = _container;
|
||||
this._DOMContainer = _container;
|
||||
this.menuaction = _menuaction;
|
||||
|
||||
// Unique ID to prevent DOM collisions across multiple templates
|
||||
@ -127,7 +127,7 @@ export class etemplate2
|
||||
* Preset the object variable
|
||||
* @type {et2_container}
|
||||
*/
|
||||
this.widgetContainer = null;
|
||||
this._widgetContainer = null;
|
||||
|
||||
|
||||
// List of templates (XML) that are known, not always used. Indexed by id.
|
||||
@ -181,22 +181,22 @@ export class etemplate2
|
||||
this.resize_timeout = setTimeout(function ()
|
||||
{
|
||||
self.resize_timeout = false;
|
||||
if (self.widgetContainer)
|
||||
if (self._widgetContainer)
|
||||
{
|
||||
const appHeader = jQuery('#divAppboxHeader');
|
||||
|
||||
//Calculate the excess height
|
||||
excess_height = egw(window).is_popup() ? jQuery(window).height() - jQuery(self.DOMContainer).height() - appHeader.outerHeight() + 11 : 0;
|
||||
excess_height = egw(window).is_popup() ? jQuery(window).height() - jQuery(self._DOMContainer).height() - appHeader.outerHeight() + 11 : 0;
|
||||
// Recalculate excess height if the appheader is shown
|
||||
if (appHeader.length > 0 && appHeader.is(':visible')) excess_height -= appHeader.outerHeight() - 9;
|
||||
|
||||
// Do not resize if the template height is bigger than screen available height
|
||||
// For templates which have sub templates and they are bigger than screenHeight
|
||||
if (screen.availHeight < jQuery(self.DOMContainer).height()) excess_height = 0;
|
||||
if (screen.availHeight < jQuery(self._DOMContainer).height()) excess_height = 0;
|
||||
|
||||
// Call the "resize" event of all functions which implement the
|
||||
// "IResizeable" interface
|
||||
self.widgetContainer.iterateOver(function (_widget)
|
||||
self._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
_widget.resize(excess_height);
|
||||
}, self, et2_IResizeable);
|
||||
@ -204,11 +204,11 @@ export class etemplate2
|
||||
}, 100);
|
||||
}
|
||||
// Initial resize needs to be resized immediately (for instance for nextmatch resize)
|
||||
else if (this.widgetContainer)
|
||||
else if (this._widgetContainer)
|
||||
{
|
||||
// Call the "resize" event of all functions which implement the
|
||||
// "IResizeable" interface
|
||||
this.widgetContainer.iterateOver(function (_widget)
|
||||
this._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
_widget.resize(excess_height);
|
||||
}, this, et2_IResizeable);
|
||||
@ -220,7 +220,7 @@ export class etemplate2
|
||||
*/
|
||||
public clear()
|
||||
{
|
||||
jQuery(this.DOMContainer).trigger('clear');
|
||||
jQuery(this._DOMContainer).trigger('clear');
|
||||
|
||||
// Remove any handlers on window (resize)
|
||||
if (this.uniqueId)
|
||||
@ -234,15 +234,15 @@ export class etemplate2
|
||||
this.destroy_session();
|
||||
this.unbind_unload();
|
||||
}
|
||||
if (this.widgetContainer != null)
|
||||
if (this._widgetContainer != null)
|
||||
{
|
||||
// Un-register handler
|
||||
this.widgetContainer.egw().unregisterJSONPlugin(this.handle_assign, this, 'assign');
|
||||
this._widgetContainer.egw().unregisterJSONPlugin(this.handle_assign, this, 'assign');
|
||||
|
||||
this.widgetContainer.destroy();
|
||||
this.widgetContainer = null;
|
||||
this._widgetContainer.destroy();
|
||||
this._widgetContainer = null;
|
||||
}
|
||||
jQuery(this.DOMContainer).empty();
|
||||
jQuery(this._DOMContainer).empty();
|
||||
|
||||
// Remove self from the index
|
||||
for (const name in etemplate2.templates)
|
||||
@ -258,6 +258,21 @@ export class etemplate2
|
||||
}
|
||||
}
|
||||
|
||||
get widgetContainer(): et2_container
|
||||
{
|
||||
return this._widgetContainer;
|
||||
}
|
||||
|
||||
get DOMContainer(): HTMLElement
|
||||
{
|
||||
return this._DOMContainer;
|
||||
}
|
||||
|
||||
get etemplate_exec_id(): string
|
||||
{
|
||||
return this._etemplate_exec_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an associative array containing the data array managers for each part
|
||||
* of the associative data array. A part is something like "content", "readonlys"
|
||||
@ -297,11 +312,11 @@ export class etemplate2
|
||||
break;
|
||||
case "readonlys":
|
||||
result[key] = new et2_readonlysArrayMgr(_data[key]);
|
||||
result[key].perspectiveData.owner = this.widgetContainer;
|
||||
result[key].perspectiveData.owner = this._widgetContainer;
|
||||
break;
|
||||
default:
|
||||
result[key] = new et2_arrayMgr(_data[key]);
|
||||
result[key].perspectiveData.owner = this.widgetContainer;
|
||||
result[key].perspectiveData.owner = this._widgetContainer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,12 +331,12 @@ export class etemplate2
|
||||
*/
|
||||
bind_unload()
|
||||
{
|
||||
if (this.etemplate_exec_id)
|
||||
if (this._etemplate_exec_id)
|
||||
{
|
||||
this.destroy_session = jQuery.proxy(function (ev)
|
||||
{
|
||||
const request = egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session",
|
||||
[this.etemplate_exec_id], null, null, false);
|
||||
[this._etemplate_exec_id], null, null, false);
|
||||
request.sendRequest();
|
||||
}, this);
|
||||
|
||||
@ -424,7 +439,7 @@ export class etemplate2
|
||||
{
|
||||
if (console.groupCollapsed)
|
||||
{
|
||||
egw.window.console.groupCollapsed("Loading %s into ", _name, '#' + this.DOMContainer.id);
|
||||
egw.window.console.groupCollapsed("Loading %s into ", _name, '#' + this._DOMContainer.id);
|
||||
}
|
||||
}
|
||||
// Timing & profiling on debug level 'log' (4)
|
||||
@ -475,15 +490,15 @@ export class etemplate2
|
||||
this.clear();
|
||||
|
||||
// Create the basic widget container and attach it to the DOM
|
||||
this.widgetContainer = new et2_container(null);
|
||||
this.widgetContainer.setApiInstance(egw(currentapp, egw.elemWindow(this.DOMContainer)));
|
||||
this.widgetContainer.setInstanceManager(this);
|
||||
this.widgetContainer.setParentDOMNode(this.DOMContainer);
|
||||
this._widgetContainer = new et2_container(null);
|
||||
this._widgetContainer.setApiInstance(egw(currentapp, egw.elemWindow(this._DOMContainer)));
|
||||
this._widgetContainer.setInstanceManager(this);
|
||||
this._widgetContainer.setParentDOMNode(this._DOMContainer);
|
||||
|
||||
// store the id to submit it back to server
|
||||
if (_data)
|
||||
{
|
||||
this.etemplate_exec_id = _data.etemplate_exec_id;
|
||||
this._etemplate_exec_id = _data.etemplate_exec_id;
|
||||
// set app_header
|
||||
if (typeof _data.app_header == 'string')
|
||||
{
|
||||
@ -510,13 +525,13 @@ export class etemplate2
|
||||
etemplate2._byTemplate[_name].push(this);
|
||||
|
||||
// Read the XML structure of the requested template
|
||||
this.widgetContainer.loadFromXML(etemplate2.templates[this.name]);
|
||||
this._widgetContainer.loadFromXML(etemplate2.templates[this.name]);
|
||||
|
||||
// List of Promises from widgets that are not quite fully loaded
|
||||
const deferred = [];
|
||||
|
||||
// Inform the widget tree that it has been successfully loaded.
|
||||
this.widgetContainer.loadingFinished(deferred);
|
||||
this._widgetContainer.loadingFinished(deferred);
|
||||
|
||||
// Connect to the window resize event
|
||||
jQuery(window).on("resize." + this.uniqueId, this, function (e)
|
||||
@ -555,9 +570,9 @@ export class etemplate2
|
||||
this.resize();
|
||||
|
||||
// Automatically set focus to first visible input for popups
|
||||
if (this.widgetContainer._egw.is_popup() && jQuery('[autofocus]', this.DOMContainer).focus().length == 0)
|
||||
if (this._widgetContainer._egw.is_popup() && jQuery('[autofocus]', this._DOMContainer).focus().length == 0)
|
||||
{
|
||||
const $input = jQuery('input:visible', this.DOMContainer)
|
||||
const $input = jQuery('input:visible', this._DOMContainer)
|
||||
// Date fields open the calendar popup on focus
|
||||
.not('.et2_date')
|
||||
.filter(function ()
|
||||
@ -588,16 +603,16 @@ export class etemplate2
|
||||
app[this.app].et2_ready(this, this.name);
|
||||
}
|
||||
|
||||
jQuery(this.DOMContainer).trigger('load', this);
|
||||
jQuery(this._DOMContainer).trigger('load', this);
|
||||
|
||||
if (etemplate2.templates[this.name].attributes.onload)
|
||||
{
|
||||
let onload = et2_checkType(etemplate2.templates[this.name].attributes.onload.value, 'js', 'onload', {});
|
||||
if (typeof onload === 'string')
|
||||
{
|
||||
onload = et2_compileLegacyJS(onload, this, this.widgetContainer);
|
||||
onload = et2_compileLegacyJS(onload, this, this._widgetContainer);
|
||||
}
|
||||
onload.call(this.widgetContainer);
|
||||
onload.call(this._widgetContainer);
|
||||
}
|
||||
|
||||
// Profiling
|
||||
@ -625,7 +640,7 @@ export class etemplate2
|
||||
if (etemplate2.templates[_name])
|
||||
{
|
||||
// Set array managers first, or errors will happen
|
||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
this._widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
|
||||
// Already have it
|
||||
_load.apply(this, []);
|
||||
@ -662,7 +677,7 @@ export class etemplate2
|
||||
|
||||
// Split the given data into array manager objects and pass those to the
|
||||
// widget container - do this here because file is loaded async
|
||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
this._widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||
}, this);
|
||||
}
|
||||
|
||||
@ -674,7 +689,7 @@ export class etemplate2
|
||||
public isDirty()
|
||||
{
|
||||
let dirty = false;
|
||||
this.widgetContainer.iterateOver(function (_widget)
|
||||
this._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
if (_widget.isDirty && _widget.isDirty())
|
||||
{
|
||||
@ -691,7 +706,7 @@ export class etemplate2
|
||||
autocomplete_fixer()
|
||||
{
|
||||
const self = this;
|
||||
const form = self.DOMContainer;
|
||||
const form = self._DOMContainer;
|
||||
|
||||
// Safari always do the autofill for password field regardless of autocomplete = off
|
||||
// and since there's no other way to switch the autocomplete of, we should switch the
|
||||
@ -727,7 +742,7 @@ export class etemplate2
|
||||
{
|
||||
if (typeof button == 'string')
|
||||
{
|
||||
button = this.widgetContainer.getWidgetById(button);
|
||||
button = this._widgetContainer.getWidgetById(button);
|
||||
}
|
||||
// Button parameter used for submit buttons in datagrid
|
||||
// TODO: This should probably go in nextmatch's getValues(), along with selected rows somehow.
|
||||
@ -783,13 +798,13 @@ export class etemplate2
|
||||
*/
|
||||
submit(button, async, no_validation, _container)
|
||||
{
|
||||
const api = this.widgetContainer.egw();
|
||||
const api = this._widgetContainer.egw();
|
||||
|
||||
if (typeof no_validation == 'undefined')
|
||||
{
|
||||
no_validation = false;
|
||||
}
|
||||
const container = _container || this.widgetContainer;
|
||||
const container = _container || this._widgetContainer;
|
||||
|
||||
// Get the form values
|
||||
const values = this.getValues(container);
|
||||
@ -827,7 +842,7 @@ export class etemplate2
|
||||
this.unbind_unload();
|
||||
|
||||
|
||||
const request = api.json(this.menuaction, [this.etemplate_exec_id, values, no_validation], function ()
|
||||
const request = api.json(this.menuaction, [this._etemplate_exec_id, values, no_validation], function ()
|
||||
{
|
||||
api.loading_prompt('et2_submit_spinner', false);
|
||||
}, this, async);
|
||||
@ -835,7 +850,7 @@ export class etemplate2
|
||||
}
|
||||
else
|
||||
{
|
||||
this.widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||
}
|
||||
}
|
||||
return canSubmit;
|
||||
@ -852,11 +867,11 @@ export class etemplate2
|
||||
postSubmit(button)
|
||||
{
|
||||
// Get the form values
|
||||
const values = this.getValues(this.widgetContainer);
|
||||
const values = this.getValues(this._widgetContainer);
|
||||
|
||||
// Trigger the submit event
|
||||
let canSubmit = true;
|
||||
this.widgetContainer.iterateOver(function (_widget)
|
||||
this._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
if (_widget.submit(values) === false)
|
||||
{
|
||||
@ -872,12 +887,12 @@ export class etemplate2
|
||||
this.unbind_unload();
|
||||
|
||||
const form = jQuery("<form id='form' action='" + egw().webserverUrl +
|
||||
"/index.php?menuaction=" + this.widgetContainer.egw().getAppName() + ".EGroupware\\Api\\Etemplate.process_exec&ajax=true' method='POST'>");
|
||||
"/index.php?menuaction=" + this._widgetContainer.egw().getAppName() + ".EGroupware\\Api\\Etemplate.process_exec&ajax=true' method='POST'>");
|
||||
|
||||
const etemplate_id = jQuery(document.createElement("input"))
|
||||
.attr("name", 'etemplate_exec_id')
|
||||
.attr("type", 'hidden')
|
||||
.val(this.etemplate_exec_id)
|
||||
.val(this._etemplate_exec_id)
|
||||
.appendTo(form);
|
||||
|
||||
const input = document.createElement("input");
|
||||
@ -1024,7 +1039,7 @@ export class etemplate2
|
||||
let refresh_done = false;
|
||||
|
||||
// Refresh nextmatches
|
||||
this.widgetContainer.iterateOver(function (_widget)
|
||||
this._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
// Trigger refresh
|
||||
_widget.refresh(id, type);
|
||||
@ -1071,13 +1086,13 @@ export class etemplate2
|
||||
const deferred = [];
|
||||
|
||||
// Skip hidden etemplates
|
||||
if (jQuery(this.DOMContainer).filter(':visible').length === 0)
|
||||
if (jQuery(this._DOMContainer).filter(':visible').length === 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
// Allow any widget to change for printing
|
||||
this.widgetContainer.iterateOver(function (_widget)
|
||||
this._widgetContainer.iterateOver(function (_widget)
|
||||
{
|
||||
// Skip widgets from a different etemplate (home)
|
||||
if (_widget.getInstanceManager() != this) return;
|
||||
@ -1155,7 +1170,7 @@ export class etemplate2
|
||||
{
|
||||
const et = etemplate2._byTemplate[name][i];
|
||||
|
||||
if (et.DOMContainer.getAttribute("id") == id)
|
||||
if (et._DOMContainer.getAttribute("id") == id)
|
||||
{
|
||||
return et;
|
||||
}
|
||||
@ -1227,7 +1242,7 @@ export class etemplate2
|
||||
if (typeof data.url == "string" && typeof data.data === 'object')
|
||||
{
|
||||
// @ts-ignore
|
||||
if (typeof this.load == 'function')
|
||||
if (this && typeof this.load == 'function')
|
||||
{
|
||||
// Called from etemplate
|
||||
// @ts-ignore
|
||||
@ -1273,7 +1288,7 @@ export class etemplate2
|
||||
for (let id in _response.data)
|
||||
{
|
||||
// @ts-ignore
|
||||
const widget = this.widgetContainer.getWidgetById(id);
|
||||
const widget = this._widgetContainer.getWidgetById(id);
|
||||
if (widget && widget.instanceOf(et2_baseWidget))
|
||||
{
|
||||
(<et2_baseWidget>widget).showMessage(_response.data[id], 'validation_error');
|
||||
@ -1314,20 +1329,20 @@ export class etemplate2
|
||||
(typeof res.data.value != 'undefined')
|
||||
) {
|
||||
if (typeof res.data.etemplate_exec_id == 'undefined' ||
|
||||
res.data.etemplate_exec_id != this.etemplate_exec_id) {
|
||||
res.data.etemplate_exec_id != this._etemplate_exec_id) {
|
||||
// Not for this etemplate, but not an error
|
||||
return false;
|
||||
}
|
||||
if (res.data.key == 'etemplate_exec_id') {
|
||||
this.etemplate_exec_id = res.data.value;
|
||||
this._etemplate_exec_id = res.data.value;
|
||||
return true;
|
||||
}
|
||||
if (this.widgetContainer == null) {
|
||||
if (this._widgetContainer == null) {
|
||||
// Right etemplate, but it's already been cleared.
|
||||
egw.debug('warn', "Tried to call assign on an un-loaded etemplate", res.data);
|
||||
return false;
|
||||
}
|
||||
const widget = this.widgetContainer.getWidgetById(res.data.id);
|
||||
const widget = this._widgetContainer.getWidgetById(res.data.id);
|
||||
if (widget) {
|
||||
if (typeof widget['set_' + res.data.key] != 'function') {
|
||||
egw.debug('warn', "Cannot set %s attribute %s via JSON assign, no set_%s()", res.data.id, res.data.key, res.data.key);
|
||||
|
Loading…
Reference in New Issue
Block a user