Fix namespaces were not processed

This commit is contained in:
nathangray 2020-01-29 14:29:38 -07:00
parent b6e87f0887
commit 926415795a
5 changed files with 30 additions and 13 deletions

View File

@ -399,7 +399,7 @@ var et2_DOMWidget = /** @class */ (function (_super) {
}
// Initialize the action manager and add some actions to it
// Only look 1 level deep
var gam = egw_action_js_1.egw_getActionManager(this.egw().appName, true, 1);
var gam = window.egw_getActionManager(this.egw().appName, true, 1);
if (typeof this._actionManager != "object") {
if (gam.getActionById(this.getInstanceManager().uniqueId, 1) !== null) {
gam = gam.getActionById(this.getInstanceManager().uniqueId, 1);

View File

@ -575,7 +575,7 @@ export abstract class et2_DOMWidget extends et2_widget implements et2_IDOMNode
// Initialize the action manager and add some actions to it
// Only look 1 level deep
var gam = egw_getActionManager(this.egw().appName,true,1);
var gam = window.egw_getActionManager(this.egw().appName,true,1);
if(typeof this._actionManager != "object")
{
if(gam.getActionById(this.getInstanceManager().uniqueId,1) !== null)

View File

@ -7,7 +7,13 @@
* @subpackage api
* @link http://www.egroupware.org
* @author Andreas Stöckel
*/
*
/*egw:uses
et2_core_common;
egw_inheritance;
et2_core_phpExpressionCompiler;
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@ -323,7 +329,9 @@ exports.et2_arrayMgr = et2_arrayMgr;
var et2_readonlysArrayMgr = /** @class */ (function (_super) {
__extends(et2_readonlysArrayMgr, _super);
function et2_readonlysArrayMgr() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.readOnly = true;
return _this;
}
/**
* Find out if the given ID is readonly, according to the array data

View File

@ -6,7 +6,7 @@
* @subpackage api
* @link http://www.egroupware.org
* @author Andreas Stöckel
*/
*
/*egw:uses
et2_core_common;
@ -33,7 +33,7 @@ export class et2_arrayMgr
};
protected static compiledExpressions: object = {};
private readonly _parentMgr: et2_arrayMgr;
private readOnly: boolean = false;
protected readOnly: boolean = false;
/**
* Constructor
@ -358,6 +358,8 @@ export class et2_arrayMgr
*/
export class et2_readonlysArrayMgr extends et2_arrayMgr {
readOnly : boolean = true;
/**
* Find out if the given ID is readonly, according to the array data
*

View File

@ -126,10 +126,6 @@ var et2_widget = /** @class */ (function (_super) {
// Set the legacyOptions array to the names of the properties the "options"
// attribute defines.
_this.legacyOptions = [];
/**
* Set this variable to true if this widget can have namespaces
*/
_this.createNamespace = false;
_this._children = [];
_this._mgrs = {};
/**
@ -164,7 +160,7 @@ var et2_widget = /** @class */ (function (_super) {
_this.supportedWidgetClasses = [et2_widget];
if (_attrs["id"]) {
// Create a namespace for this object
if (_this.createNamespace) {
if (_this._createNamespace()) {
_this.checkCreateNamespace();
}
}
@ -487,7 +483,7 @@ var et2_widget = /** @class */ (function (_super) {
if (this.getArrayMgr("modifications")) {
var data = this.getArrayMgr("modifications").getEntry(this.id);
// Check for already inside namespace
if (this.createNamespace && this.getArrayMgr("modifications").perspectiveData.owner == this) {
if (this._createNamespace() && this.getArrayMgr("modifications").perspectiveData.owner == this) {
data = this.getArrayMgr("modifications").data;
}
if (typeof data === 'object') {
@ -812,6 +808,17 @@ var et2_widget = /** @class */ (function (_super) {
}
}
};
/**
* Widgets that do support a namespace should override and return true.
*
* Since a private attribute doesn't get instanciated properly before it's needed,
* we use a method so we can get what we need while still in the constructor.
*
* @private
*/
et2_widget.prototype._createNamespace = function () {
return false;
};
/**
* Sets the instance manager object (of type etemplate2, see etemplate2.js)
*
@ -841,7 +848,7 @@ var et2_widget = /** @class */ (function (_super) {
et2_widget.prototype.getPath = function () {
var path = this.getArrayMgr("content").getPath();
// Prevent namespaced widgets with value from going an extra layer deep
if (this.id && this.createNamespace && path[path.length - 1] == this.id)
if (this.id && this._createNamespace() && path[path.length - 1] == this.id)
path.pop();
return path;
};