mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:20 +01:00
Fix namespaces were not processed
This commit is contained in:
parent
ffae3f2e17
commit
b6e87f0887
@ -184,11 +184,6 @@ export class et2_widget extends ClassWithAttributes
|
||||
options: WidgetConfig;
|
||||
readonly: boolean;
|
||||
|
||||
/**
|
||||
* Set this variable to true if this widget can have namespaces
|
||||
*/
|
||||
createNamespace: boolean = false;
|
||||
|
||||
/**
|
||||
* Widget constructor
|
||||
*
|
||||
@ -237,7 +232,7 @@ export class et2_widget extends ClassWithAttributes
|
||||
|
||||
if (_attrs["id"]) {
|
||||
// Create a namespace for this object
|
||||
if (this.createNamespace) {
|
||||
if (this._createNamespace()) {
|
||||
this.checkCreateNamespace();
|
||||
}
|
||||
}
|
||||
@ -621,7 +616,7 @@ Comment this out (for now)
|
||||
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') {
|
||||
@ -1001,6 +996,19 @@ Comment this out (for now)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
protected _createNamespace() : boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used and therefore it we can not (yet) make it private
|
||||
*
|
||||
@ -1043,7 +1051,7 @@ Comment this out (for now)
|
||||
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) path.pop();
|
||||
if (this.id && this._createNamespace() && path[path.length - 1] == this.id) path.pop();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
@ -62,6 +62,14 @@ var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
|
||||
var et2_core_inputWidget_1 = require("./et2_core_inputWidget");
|
||||
var et2_widget_selectbox_1 = require("./et2_widget_selectbox");
|
||||
var et2_core_inheritance_1 = require("./et2_core_inheritance");
|
||||
var et2_INextmatchHeader = "et2_INextmatchHeader";
|
||||
function implements_et2_INextmatchHeader(obj) {
|
||||
return implements_methods(obj, ["setNextmatch"]);
|
||||
}
|
||||
var et2_INextmatchSortable = "et2_INextmatchSortable";
|
||||
function implements_et2_INextmatchSortable(obj) {
|
||||
return implements_methods(obj, ["setSortmode"]);
|
||||
}
|
||||
/**
|
||||
* Class which implements the "nextmatch" XET-Tag
|
||||
*
|
||||
@ -90,7 +98,6 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
*/
|
||||
function et2_nextmatch(_parent, _attrs, _child) {
|
||||
var _this = _super_1.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_nextmatch._attributes, _child || {})) || this;
|
||||
_this.createNamespace = true;
|
||||
_this.activeFilters = { col_filter: {} };
|
||||
_this.columns = [];
|
||||
// keeps sorted columns
|
||||
@ -528,6 +535,13 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
return this.options.onselect.call(this, this.getSelection().ids, this);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Nextmatch needs a namespace
|
||||
* @private
|
||||
*/
|
||||
et2_nextmatch.prototype._createNamespace = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Create the dynamic height so nm fills all available space
|
||||
*
|
||||
@ -895,13 +909,17 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
_colData.splice(remove_action_index, remove_action_index);
|
||||
}
|
||||
// Create the column manager and update the grid container
|
||||
this.dataview.setColumns(columnData);
|
||||
// TODO this.dataview.setColumns(columnData);
|
||||
for (var x = 0; x < _row.length; x++) {
|
||||
// Append the widget to this container
|
||||
this.addChild(_row[x].widget);
|
||||
}
|
||||
// Create the nextmatch row provider
|
||||
this.rowProvider = new et2_nextmatch_rowProvider(this.dataview.rowProvider, this._getSubgrid, this);
|
||||
/* TODO
|
||||
this.rowProvider = new et2_nextmatch_rowProvider(
|
||||
this.dataview.rowProvider, this._getSubgrid, this);
|
||||
|
||||
*/
|
||||
// Register handler to update preferences when column properties are changed
|
||||
var self = this;
|
||||
this.dataview.onUpdateColumns = function () {
|
||||
@ -945,6 +963,8 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
columnWidgets[x].align = _row[x].align;
|
||||
}
|
||||
}
|
||||
return;
|
||||
// TODO
|
||||
this.rowProvider.setDataRowTemplate(columnWidgets, _rowData, this);
|
||||
// Create the grid controller
|
||||
this.controller = new et2_nextmatch_controller(null, this.egw(), this.getInstanceManager().etemplate_exec_id, this, null, this.dataview.grid, this.rowProvider, this.options.settings.action_links, null, this.options.actions);
|
||||
@ -1425,7 +1445,7 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
}
|
||||
// Free the template again, but don't remove it
|
||||
setTimeout(function () {
|
||||
template.free();
|
||||
template.destroy();
|
||||
}, 1);
|
||||
// Call the "setNextmatch" function of all registered
|
||||
// INextmatchHeader widgets. This updates this.activeFilters.col_filters according
|
||||
@ -1434,10 +1454,10 @@ var et2_nextmatch = /** @class */ (function (_super_1) {
|
||||
_node.setNextmatch(this);
|
||||
}, this, et2_INextmatchHeader);
|
||||
// Set filters to current values
|
||||
this.controller.setFilters(this.activeFilters);
|
||||
// TODO this.controller.setFilters(this.activeFilters);
|
||||
// If no data was sent from the server, and num_rows is 0, the nm will be empty.
|
||||
// This triggers a cache check.
|
||||
if (!this.options.settings.num_rows) {
|
||||
if (!this.options.settings.num_rows && this.controller) {
|
||||
this.controller.update();
|
||||
}
|
||||
// Load the default sort order
|
||||
@ -2053,9 +2073,12 @@ var et2_nextmatch_header_bar = /** @class */ (function (_super_1) {
|
||||
this._createHeader();
|
||||
}
|
||||
// Bind row count
|
||||
/* TODO
|
||||
this.nextmatch.dataview.grid.setInvalidateCallback(function () {
|
||||
this.count_total.text(this.nextmatch.dataview.grid.getTotalCount() + "");
|
||||
}, this);
|
||||
|
||||
*/
|
||||
};
|
||||
/**
|
||||
* Actions are handled by the controller, so ignore these
|
||||
@ -2644,7 +2667,8 @@ var et2_nextmatch_customfields = /** @class */ (function (_super_1) {
|
||||
* Build widgets for header - sortable for numeric, text, etc., filterables for selectbox, radio
|
||||
*/
|
||||
et2_nextmatch_customfields.prototype.loadFields = function () {
|
||||
if (this.nextmatch == null) {
|
||||
// TODO if(this.nextmatch == null)
|
||||
{
|
||||
// not ready yet
|
||||
return;
|
||||
}
|
||||
@ -2759,7 +2783,7 @@ var et2_nextmatch_customfields = /** @class */ (function (_super_1) {
|
||||
if (visible.length) {
|
||||
name += "_" + visible.join("_");
|
||||
}
|
||||
else {
|
||||
else if (this.rows) {
|
||||
// None hidden means all visible
|
||||
jQuery(this.rows[field_name]).parent().parent().children().show();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||
/**
|
||||
* Interface all special nextmatch header elements have to implement.
|
||||
*/
|
||||
interface et2_INextmatchHeader {
|
||||
export interface et2_INextmatchHeader {
|
||||
|
||||
/**
|
||||
* The 'setNextmatch' function is called by the parent nextmatch widget
|
||||
@ -65,12 +65,22 @@ interface et2_INextmatchHeader {
|
||||
*/
|
||||
setNextmatch(nextmatch : et2_nextmatch)
|
||||
}
|
||||
var et2_INextmatchHeader = "et2_INextmatchHeader";
|
||||
function implements_et2_INextmatchHeader(obj : et2_widget)
|
||||
{
|
||||
return implements_methods(obj, ["setNextmatch"]);
|
||||
}
|
||||
|
||||
interface et2_INextmatchSortable{
|
||||
export interface et2_INextmatchSortable{
|
||||
|
||||
setSortmode(_sort_mode)
|
||||
|
||||
}
|
||||
var et2_INextmatchSortable = "et2_INextmatchSortable";
|
||||
function implements_et2_INextmatchSortable(obj : et2_widget)
|
||||
{
|
||||
return implements_methods(obj, ["setSortmode"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class which implements the "nextmatch" XET-Tag
|
||||
@ -182,7 +192,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
private selectPopup: any;
|
||||
|
||||
public static legacyOptions = ["template","hide_header","header_left","header_right"];
|
||||
createNamespace : boolean = true;
|
||||
|
||||
private template: any;
|
||||
columns: {widget: et2_widget}[];
|
||||
@ -788,6 +797,15 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Nextmatch needs a namespace
|
||||
* @private
|
||||
*/
|
||||
protected _createNamespace(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dynamic height so nm fills all available space
|
||||
*
|
||||
@ -1251,7 +1269,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
}
|
||||
|
||||
// Create the column manager and update the grid container
|
||||
this.dataview.setColumns(columnData);
|
||||
// TODO this.dataview.setColumns(columnData);
|
||||
|
||||
for (var x = 0; x < _row.length; x++)
|
||||
{
|
||||
@ -1260,9 +1278,12 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
}
|
||||
|
||||
// Create the nextmatch row provider
|
||||
/* TODO
|
||||
this.rowProvider = new et2_nextmatch_rowProvider(
|
||||
this.dataview.rowProvider, this._getSubgrid, this);
|
||||
|
||||
*/
|
||||
|
||||
// Register handler to update preferences when column properties are changed
|
||||
var self = this;
|
||||
this.dataview.onUpdateColumns = function() {
|
||||
@ -1321,6 +1342,8 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
// TODO
|
||||
this.rowProvider.setDataRowTemplate(columnWidgets, _rowData, this);
|
||||
|
||||
|
||||
@ -1946,7 +1969,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
|
||||
// Free the template again, but don't remove it
|
||||
setTimeout(function() {
|
||||
template.free();
|
||||
template.destroy();
|
||||
},1);
|
||||
|
||||
// Call the "setNextmatch" function of all registered
|
||||
@ -1957,11 +1980,11 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
}, this, et2_INextmatchHeader);
|
||||
|
||||
// Set filters to current values
|
||||
this.controller.setFilters(this.activeFilters);
|
||||
// TODO this.controller.setFilters(this.activeFilters);
|
||||
|
||||
// If no data was sent from the server, and num_rows is 0, the nm will be empty.
|
||||
// This triggers a cache check.
|
||||
if(!this.options.settings.num_rows)
|
||||
if(!this.options.settings.num_rows && this.controller)
|
||||
{
|
||||
this.controller.update();
|
||||
}
|
||||
@ -2712,9 +2735,12 @@ class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INextmatchHe
|
||||
}
|
||||
|
||||
// Bind row count
|
||||
/* TODO
|
||||
this.nextmatch.dataview.grid.setInvalidateCallback(function () {
|
||||
this.count_total.text(this.nextmatch.dataview.grid.getTotalCount() + "");
|
||||
}, this);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3433,7 +3459,7 @@ export class et2_nextmatch_customfields extends et2_container implements et2_INe
|
||||
*/
|
||||
loadFields( )
|
||||
{
|
||||
if(this.nextmatch == null)
|
||||
// TODO if(this.nextmatch == null)
|
||||
{
|
||||
// not ready yet
|
||||
return;
|
||||
@ -3581,7 +3607,7 @@ export class et2_nextmatch_customfields extends et2_container implements et2_INe
|
||||
if(visible.length) {
|
||||
name +="_"+ visible.join("_");
|
||||
}
|
||||
else
|
||||
else if (this.rows)
|
||||
{
|
||||
// None hidden means all visible
|
||||
jQuery(this.rows[field_name]).parent().parent().children().show();
|
||||
|
2
api/js/etemplate/et2_types.d.ts
vendored
2
api/js/etemplate/et2_types.d.ts
vendored
@ -58,8 +58,6 @@ declare class et2_customfields_list extends et2_valueWidget {
|
||||
public customfields : any;
|
||||
set_visible(visible : boolean);
|
||||
}
|
||||
declare var et2_INextmatchHeader : any;
|
||||
declare var et2_INextmatchSortable : any;
|
||||
declare var et2_nextmatch : any;
|
||||
declare var et2_nextmatch_header_bar : any;
|
||||
declare var et2_nextmatch_header : any;
|
||||
|
@ -47,13 +47,15 @@ var et2_box = /** @class */ (function (_super) {
|
||||
*/
|
||||
function et2_box(_parent, _attrs, _child) {
|
||||
var _this = _super.call(this, _parent, _attrs, _child) || this;
|
||||
_this.createNamespace = true;
|
||||
_this.div = jQuery(document.createElement("div"))
|
||||
.addClass("et2_" + _this.getType())
|
||||
.addClass("et2_box_widget");
|
||||
_this.setDOMNode(_this.div[0]);
|
||||
return _this;
|
||||
}
|
||||
et2_box.prototype._createNamespace = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Overriden so we can check for autorepeating children. We only check for
|
||||
* $ in the immediate children & grandchildren of this node.
|
||||
|
@ -35,7 +35,6 @@ export class et2_box extends et2_baseWidget implements et2_IDetachedDOM
|
||||
"cols": {"ignore": true}
|
||||
};
|
||||
|
||||
createNamespace: boolean = true;
|
||||
div: JQuery;
|
||||
|
||||
/**
|
||||
@ -54,6 +53,11 @@ export class et2_box extends et2_baseWidget implements et2_IDetachedDOM
|
||||
this.setDOMNode(this.div[0]);
|
||||
}
|
||||
|
||||
_createNamespace() : boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden so we can check for autorepeating children. We only check for
|
||||
* $ in the immediate children & grandchildren of this node.
|
||||
|
@ -54,7 +54,6 @@ var et2_grid = /** @class */ (function (_super) {
|
||||
var _this =
|
||||
// Call the parent constructor
|
||||
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_grid._attributes, _child || {})) || this;
|
||||
_this.createNamespace = true;
|
||||
// Counters for rows and columns
|
||||
_this.rowCount = 0;
|
||||
_this.columnCount = 0;
|
||||
@ -472,6 +471,9 @@ var et2_grid = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
};
|
||||
et2_grid.prototype._createNamespace = function () {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* As the does not fit very well into the default widget structure, we're
|
||||
* overwriting the loadFromXML function and doing a two-pass reading -
|
||||
@ -731,8 +733,11 @@ 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
|
||||
var objectManager = egw_action_js_1.egw_getAppObjectManager(true);
|
||||
// @ts-ignore
|
||||
var objectManager = window.egw_getAppObjectManager(true);
|
||||
objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId, 2) || objectManager;
|
||||
var widget_object = objectManager.getObjectById(this.id);
|
||||
if (widget_object == null) {
|
||||
|
@ -37,8 +37,6 @@ import {
|
||||
*/
|
||||
export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAligned, et2_IResizeable
|
||||
{
|
||||
createNamespace: boolean = true;
|
||||
|
||||
static readonly _attributes : any = {
|
||||
// Better to use CSS, no need to warn about it
|
||||
"border": {
|
||||
@ -653,6 +651,10 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
||||
}
|
||||
}
|
||||
|
||||
_createNamespace() : boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* As the does not fit very well into the default widget structure, we're
|
||||
* overwriting the loadFromXML function and doing a two-pass reading -
|
||||
@ -998,8 +1000,11 @@ 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
|
||||
let objectManager = egw_getAppObjectManager(true);
|
||||
// @ts-ignore
|
||||
let objectManager = window.egw_getAppObjectManager(true);
|
||||
objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId,2) || objectManager;
|
||||
let widget_object = objectManager.getObjectById(this.id);
|
||||
if (widget_object == null) {
|
||||
|
@ -43,7 +43,6 @@ var et2_hbox = /** @class */ (function (_super) {
|
||||
*/
|
||||
function et2_hbox(_parent, _attrs, _child) {
|
||||
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_hbox._attributes, _child || {})) || this;
|
||||
_this.createNamespace = true;
|
||||
_this.alignData = {
|
||||
"hasAlign": false,
|
||||
"hasLeft": false,
|
||||
@ -62,6 +61,9 @@ var et2_hbox = /** @class */ (function (_super) {
|
||||
_super.prototype.setDOMNode.call(_this, _this.div[0]);
|
||||
return _this;
|
||||
}
|
||||
et2_hbox.prototype._createNamespace = function () {
|
||||
return true;
|
||||
};
|
||||
et2_hbox.prototype._buildAlignCells = function () {
|
||||
if (this.alignData.hasAlign) {
|
||||
// Check whether we have more than one type of align
|
||||
|
@ -24,7 +24,6 @@ import {et2_baseWidget} from "./et2_core_baseWidget";
|
||||
*/
|
||||
class et2_hbox extends et2_baseWidget
|
||||
{
|
||||
createNamespace: boolean = true;
|
||||
alignData : any = {
|
||||
"hasAlign": false,
|
||||
"hasLeft": false,
|
||||
@ -55,6 +54,11 @@ class et2_hbox extends et2_baseWidget
|
||||
super.setDOMNode(this.div[0]);
|
||||
}
|
||||
|
||||
_createNamespace() : boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_buildAlignCells() {
|
||||
if (this.alignData.hasAlign)
|
||||
{
|
||||
|
@ -264,7 +264,6 @@ var et2_radioGroup = /** @class */ (function (_super) {
|
||||
var _this =
|
||||
// Call the inherited constructor
|
||||
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_radioGroup._attributes, _child || {})) || this;
|
||||
_this.createNamespace = false;
|
||||
_this.node = null;
|
||||
_this.value = null;
|
||||
_this.node = jQuery(document.createElement("div"))
|
||||
|
@ -314,7 +314,6 @@ class et2_radioGroup extends et2_valueWidget implements et2_IDetachedDOM
|
||||
}
|
||||
};
|
||||
|
||||
createNamespace : boolean = false;
|
||||
node : JQuery = null;
|
||||
value : any = null;
|
||||
/**
|
||||
|
@ -47,7 +47,6 @@ var et2_template = /** @class */ (function (_super) {
|
||||
var _this =
|
||||
// Call the inherited constructor
|
||||
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_template._attributes, _child || {})) || this;
|
||||
_this.createNamespace = true;
|
||||
// Set this early, so it's available for creating namespace
|
||||
if (_attrs.content) {
|
||||
_this.content = _attrs.content;
|
||||
@ -148,6 +147,9 @@ var et2_template = /** @class */ (function (_super) {
|
||||
this.id = old_id;
|
||||
}
|
||||
};
|
||||
et2_template.prototype._createNamespace = function () {
|
||||
return true;
|
||||
};
|
||||
et2_template.prototype.getDOMNode = function () {
|
||||
return this.div;
|
||||
};
|
||||
|
@ -70,7 +70,6 @@ class et2_template extends et2_DOMWidget
|
||||
}
|
||||
};
|
||||
|
||||
createNamespace: boolean = true;
|
||||
content: string;
|
||||
div: HTMLDivElement;
|
||||
loading: JQueryDeferred<unknown>;
|
||||
@ -203,6 +202,11 @@ class et2_template extends et2_DOMWidget
|
||||
}
|
||||
}
|
||||
|
||||
_createNamespace() : boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
getDOMNode()
|
||||
{
|
||||
return this.div;
|
||||
|
Loading…
Reference in New Issue
Block a user