Fix legacy options not being read for some widgets

This commit is contained in:
nathangray 2020-03-30 10:28:48 -06:00
parent c937f50193
commit 1da1cb7b99
42 changed files with 320 additions and 323 deletions

View File

@ -123,9 +123,6 @@ var et2_widget = /** @class */ (function (_super) {
*/
function et2_widget(_parent, _attrs, _child) {
var _this = _super.call(this) || this;
// Set the legacyOptions array to the names of the properties the "options"
// attribute defines.
_this.legacyOptions = [];
_this._children = [];
_this._mgrs = {};
/**
@ -900,6 +897,9 @@ var et2_widget = /** @class */ (function (_super) {
"description": "Object of widget attributes"
}
};
// Set the legacyOptions array to the names of the properties the "options"
// attribute defines.
et2_widget.legacyOptions = [];
return et2_widget;
}(et2_core_inheritance_1.ClassWithAttributes));
exports.et2_widget = et2_widget;

View File

@ -16,7 +16,7 @@
et2_core_arrayMgr;
*/
import { ClassWithAttributes } from './et2_core_inheritance';
import {ClassWithAttributes} from './et2_core_inheritance';
/**
* The registry contains all XML tag names and the corresponding widget
@ -176,7 +176,7 @@ export class et2_widget extends ClassWithAttributes
// Set the legacyOptions array to the names of the properties the "options"
// attribute defines.
legacyOptions: string[] = [];
public static readonly legacyOptions: string[] = [];
private _type: string;
id: string;

View File

@ -382,10 +382,10 @@ var et2_dataview = /** @class */ (function () {
// Create the collection of column ids
var colIds = [];
for (var i = 0; i < this.columns.length; i++) {
if (this.columns[i].visible) {
colIds[i] = this.columns[i].id;
}
}
if (this.columns[i].visible) {
colIds[i] = this.columns[i].id;
}
}
// Create the row provider
if (this.rowProvider) {
this.rowProvider.destroy();

View File

@ -85,22 +85,22 @@ var et2_dataview_rowProvider = /** @class */ (function () {
this._prototypes["fullRow"] = tr;
};
et2_dataview_rowProvider.prototype._createDefaultPrototype = function () {
var tr = jQuery(document.createElement("tr"));
// Append a td for each column
for (var _i = 0, _a = this._columnIds; _i < _a.length; _i++) {
var column = _a[_i];
if (!column)
continue;
var td = jQuery(document.createElement("td"))
.addClass(this._outerId + "_td_" + column)
.appendTo(tr);
var div = jQuery(document.createElement("div"))
.addClass(this._outerId + "_div_" + column)
.addClass("innerContainer")
.appendTo(td);
}
this._prototypes["default"] = tr;
};
var tr = jQuery(document.createElement("tr"));
// Append a td for each column
for (var _i = 0, _a = this._columnIds; _i < _a.length; _i++) {
var column = _a[_i];
if (!column)
continue;
var td = jQuery(document.createElement("td"))
.addClass(this._outerId + "_td_" + column)
.appendTo(tr);
var div = jQuery(document.createElement("div"))
.addClass(this._outerId + "_div_" + column)
.addClass("innerContainer")
.appendTo(td);
}
this._prototypes["default"] = tr;
};
et2_dataview_rowProvider.prototype._createEmptyPrototype = function () {
this._prototypes["empty"] = jQuery(document.createElement("tr"));
};

View File

@ -38,7 +38,6 @@ var et2_customfields_list = /** @class */ (function (_super) {
__extends(et2_customfields_list, _super);
function et2_customfields_list(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_customfields_list._attributes, _child || {})) || this;
_this.legacyOptions = ["type_filter", "private", "fields"]; // Field restriction & private done server-side
_this.rows = {};
_this.widgets = {};
_this.detachedNodes = [];
@ -602,6 +601,7 @@ var et2_customfields_list = /** @class */ (function (_super) {
"description": "JS code which is executed when the value changes."
}
};
et2_customfields_list.legacyOptions = ["type_filter", "private", "fields"]; // Field restriction & private done server-side
et2_customfields_list.PREFIX = '#';
et2_customfields_list.DEFAULT_ID = "custom_fields";
return et2_customfields_list;

View File

@ -64,7 +64,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
}
};
legacyOptions = ["type_filter","private", "fields"]; // Field restriction & private done server-side
public static readonly legacyOptions = ["type_filter","private", "fields"]; // Field restriction & private done server-side
public static readonly PREFIX = '#';

View File

@ -3652,7 +3652,7 @@ export class et2_nextmatch_sortheader extends et2_nextmatch_header implements et
"translate": false
}
};
legacyOptions: ['sortmode'];
public static readonly legacyOptions: ['sortmode'];
private sortmode: string;
/**
@ -4022,7 +4022,7 @@ class et2_nextmatch_customfilter extends et2_nextmatch_filterheader
"default": {}
}
};
legacyOptions: ["widget_type","widget_options"];
public static readonly legacyOptions: ["widget_type","widget_options"];
real_node: et2_selectbox;

View File

@ -218,55 +218,55 @@ var et2_nextmatch_rowProvider = /** @class */ (function () {
* @param {et2_widget} _widget
*/
et2_nextmatch_rowProvider.prototype._getVariableAttributeSet = function (_widget) {
var variableAttributes = [];
var process = function (_widget) {
// Create the attribtues
var hasAttr = false;
var widgetData = {
"widget": _widget,
"data": []
};
// Get all attribute values
for (var key in _widget.attributes) {
if (!_widget.attributes[key].ignore &&
typeof _widget.options[key] != "undefined") {
var val = _widget.options[key];
// TODO: Improve detection
if (typeof val == "string" && val.indexOf("$") >= 0) {
hasAttr = true;
widgetData.data.push({
"attribute": key,
"expression": val
});
}
}
}
// Add the entry if there is any data in it
if (hasAttr) {
variableAttributes.push(widgetData);
}
};
// Check each column
var columns = _widget._widgets;
for (var i = 0; i < columns.length; i++) {
// If column is hidden, don't process it
if (typeof columns[i] === 'undefined' || this._context && this._context.columns && this._context.columns[i] && !this._context.columns[i].visible) {
continue;
}
columns[i].iterateOver(process, this);
}
return variableAttributes;
};
et2_nextmatch_rowProvider.prototype._seperateWidgets = function (_varAttrs) {
// The detachable array contains all widgets which implement the
// et2_IDetachedDOM interface for all needed attributes
var detachable = [];
// The remaining array creates all widgets which have to be completely
// cloned when the widget tree is created
var remaining = [];
// Iterate over the widgets
for (var i = 0; i < _varAttrs.length; i++) {
var widget = _varAttrs[i].widget;
var variableAttributes = [];
var process = function (_widget) {
// Create the attribtues
var hasAttr = false;
var widgetData = {
"widget": _widget,
"data": []
};
// Get all attribute values
for (var key in _widget.attributes) {
if (!_widget.attributes[key].ignore &&
typeof _widget.options[key] != "undefined") {
var val = _widget.options[key];
// TODO: Improve detection
if (typeof val == "string" && val.indexOf("$") >= 0) {
hasAttr = true;
widgetData.data.push({
"attribute": key,
"expression": val
});
}
}
}
// Add the entry if there is any data in it
if (hasAttr) {
variableAttributes.push(widgetData);
}
};
// Check each column
var columns = _widget._widgets;
for (var i = 0; i < columns.length; i++) {
// If column is hidden, don't process it
if (typeof columns[i] === 'undefined' || this._context && this._context.columns && this._context.columns[i] && !this._context.columns[i].visible) {
continue;
}
columns[i].iterateOver(process, this);
}
return variableAttributes;
};
et2_nextmatch_rowProvider.prototype._seperateWidgets = function (_varAttrs) {
// The detachable array contains all widgets which implement the
// et2_IDetachedDOM interface for all needed attributes
var detachable = [];
// The remaining array creates all widgets which have to be completely
// cloned when the widget tree is created
var remaining = [];
// Iterate over the widgets
for (var i = 0; i < _varAttrs.length; i++) {
var widget = _varAttrs[i].widget;
// Check whether the widget parents are not allready in the "remaining"
// slot - if this is the case do not include the widget at all.
var insertWidget = true;
@ -476,22 +476,22 @@ var et2_nextmatch_rowWidget = /** @class */ (function (_super) {
* @param {array} _widgets
*/
et2_nextmatch_rowWidget.prototype.createWidgets = function (_widgets) {
// Clone the given the widgets with this element as parent
this._widgets = [];
var row_id = 0;
for (var i = 0; i < _widgets.length; i++) {
// Disabled columns might be missing widget - skip it
if (!_widgets[i])
continue;
this._widgets[i] = _widgets[i].clone(this);
this._widgets[i].loadingFinished();
// Set column alignment from widget
if (this._widgets[i].align) {
this._row.childNodes[row_id].align = this._widgets[i].align;
}
row_id++;
}
};
// Clone the given the widgets with this element as parent
this._widgets = [];
var row_id = 0;
for (var i = 0; i < _widgets.length; i++) {
// Disabled columns might be missing widget - skip it
if (!_widgets[i])
continue;
this._widgets[i] = _widgets[i].clone(this);
this._widgets[i].loadingFinished();
// Set column alignment from widget
if (this._widgets[i].align) {
this._row.childNodes[row_id].align = this._widgets[i].align;
}
row_id++;
}
};
/**
* Returns the column node for the given sender
*
@ -499,16 +499,16 @@ var et2_nextmatch_rowWidget = /** @class */ (function (_super) {
* @return {DOMElement}
*/
et2_nextmatch_rowWidget.prototype.getDOMNode = function (_sender) {
var row_id = 0;
var row_id = 0;
for (var i = 0; i < this._widgets.length; i++) {
// Disabled columns might be missing widget - skip it
if (!this._widgets[i])
continue;
if (this._widgets[i] == _sender) {
return this._row.childNodes[row_id].childNodes[0]; // Return the i-th td tag
}
row_id++;
}
// Disabled columns might be missing widget - skip it
if (!this._widgets[i])
continue;
if (this._widgets[i] == _sender) {
return this._row.childNodes[row_id].childNodes[0]; // Return the i-th td tag
}
row_id++;
}
return null;
};
return et2_nextmatch_rowWidget;

View File

@ -44,7 +44,6 @@ var et2_button = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_button._attributes, _child || {})) || this;
_this.legacyOptions = ["image", "ro_image"];
_this.label = "";
_this.clicked = false;
_this.btn = null;
@ -357,6 +356,7 @@ var et2_button = /** @class */ (function (_super) {
"ignore": true
}
};
et2_button.legacyOptions = ["image", "ro_image"];
/**
* images to be used as background-image, if none is explicitly applied and id matches given regular expression
*/

View File

@ -76,7 +76,7 @@ export class et2_button extends et2_baseWidget implements et2_IInput, et2_IDetac
}
};
legacyOptions: string[] = ["image", "ro_image"];
public static readonly legacyOptions: string[] = ["image", "ro_image"];
/**
* images to be used as background-image, if none is explicitly applied and id matches given regular expression

View File

@ -48,7 +48,6 @@ var et2_checkbox = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_checkbox._attributes, _child || {})) || this;
_this.legacyOptions = ["selected_value", "unselected_value", "ro_true", "ro_false"];
_this.input = null;
_this.toggle = null;
_this.input = null;
@ -189,6 +188,7 @@ var et2_checkbox = /** @class */ (function (_super) {
"translate": true
}
};
et2_checkbox.legacyOptions = ["selected_value", "unselected_value", "ro_true", "ro_false"];
return et2_checkbox;
}(et2_core_inputWidget_1.et2_inputWidget));
et2_core_widget_1.et2_register_widget(et2_checkbox, ["checkbox"]);

View File

@ -72,7 +72,7 @@ class et2_checkbox extends et2_inputWidget
}
};
legacyOptions : string[] = ["selected_value", "unselected_value", "ro_true", "ro_false"];
public static readonly legacyOptions : string[] = ["selected_value", "unselected_value", "ro_true", "ro_false"];
input : JQuery = null;
toggle : JQuery = null;
value : string | boolean;

View File

@ -57,7 +57,6 @@ var et2_date = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_date._attributes, _child || {})) || this;
_this.legacyOptions = ["data_format"];
_this.input_date = null;
_this.is_mobile = false;
_this.date = new Date();
@ -571,6 +570,7 @@ String: A string in the user\'s date format, or a relative date. Relative dates
"description": "Instead of an input field with a popup calendar, the calendar is displayed inline, with no input field"
}
};
et2_date.legacyOptions = ["data_format"];
return et2_date;
}(et2_core_inputWidget_1.et2_inputWidget));
exports.et2_date = et2_date;
@ -587,7 +587,6 @@ var et2_date_duration = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_date_duration._attributes, _child || {})) || this;
_this.legacyOptions = ["data_format", "display_format", "hours_per_day", "empty_not_0", "short_labels"];
_this.format = null;
// Legacy option put percent in with display format
if (_this.options.display_format.indexOf("%") != -1) {
@ -840,6 +839,7 @@ var et2_date_duration = /** @class */ (function (_super) {
"description": "Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set."
}
};
et2_date_duration.legacyOptions = ["data_format", "display_format", "hours_per_day", "empty_not_0", "short_labels"];
return et2_date_duration;
}(et2_date));
exports.et2_date_duration = et2_date_duration;

View File

@ -93,7 +93,7 @@ String: A string in the user\'s date format, or a relative date. Relative dates
}
};
legacyOptions: string[] = ["data_format"];
public static readonly legacyOptions: string[] = ["data_format"];
date: Date;
span: JQuery;
input_date: JQuery = null;
@ -703,7 +703,7 @@ export class et2_date_duration extends et2_date
}
};
legacyOptions: string[] = ["data_format","display_format", "hours_per_day", "empty_not_0", "short_labels"];
public static readonly legacyOptions: string[] = ["data_format","display_format", "hours_per_day", "empty_not_0", "short_labels"];
time_formats: {"d":"d","h":"h","m":"m"};
@ -1085,7 +1085,7 @@ export class et2_date_ro extends et2_valueWidget implements et2_IDetachedDOM
year_range: {ignore: true}
};
legacyOptions: ["data_format"];
public static readonly legacyOptions: ["data_format"];
/**
* Internal container for working easily with dates

View File

@ -51,8 +51,6 @@ var et2_description = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_description._attributes, _child || {})) || this;
_this.legacyOptions = ["font_style", "href", "activate_links", "for",
"extra_link_target", "extra_link_popup", "statustext"];
_this._labelContainer = null;
// Create the span/label tag which contains the label text
_this.span = jQuery(document.createElement(_this.options["for"] ? "label" : "span"))
@ -359,6 +357,8 @@ var et2_description = /** @class */ (function (_super) {
"description": "Text to show as tooltip of defined action"
}
},
_a.legacyOptions = ["font_style", "href", "activate_links", "for",
"extra_link_target", "extra_link_popup", "statustext"],
_a))));
exports.et2_description = et2_description;
;

View File

@ -111,7 +111,7 @@ export class et2_description extends expose(class et2_description extends et2_ba
};
legacyOptions: string[] = ["font_style", "href", "activate_links", "for",
public static readonly legacyOptions: string[] = ["font_style", "href", "activate_links", "for",
"extra_link_target", "extra_link_popup", "statustext"];
span: JQuery;

View File

@ -47,7 +47,6 @@ var et2_entry = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_entry._attributes, _child || {})) || this;
_this.legacyOptions = ["field", "compare", "alternate_fields"];
_this.widget = null;
// Often the ID conflicts, so check prefix
if (_attrs.id && _attrs.id.indexOf(et2_entry.prefix) < 0) {
@ -163,6 +162,7 @@ var et2_entry = /** @class */ (function (_super) {
default: true
}
};
et2_entry.legacyOptions = ["field", "compare", "alternate_fields"];
return et2_entry;
}(et2_core_valueWidget_1.et2_valueWidget));
et2_core_widget_1.et2_register_widget(et2_entry, ["entry", 'contact-value', 'contact-account', 'contact-template', 'infolog-value', 'tracker-value', 'records-value']);

View File

@ -76,7 +76,7 @@ class et2_entry extends et2_valueWidget
}
};
legacyOptions : string[] = ["field","compare","alternate_fields"];
public static readonly legacyOptions : string[] = ["field","compare","alternate_fields"];
static readonly prefix: '~';
protected widget = null;

View File

@ -49,7 +49,6 @@ var et2_historylog = /** @class */ (function (_super) {
*/
function et2_historylog(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_historylog._attributes, _child || {})) || this;
_this.legacyOptions = ["status_id"];
_this.div = jQuery(document.createElement("div"))
.addClass("et2_historylog");
_this.innerDiv = jQuery(document.createElement("div"))
@ -574,6 +573,7 @@ var et2_historylog = /** @class */ (function (_super) {
"description": "Method to get rows"
}
};
et2_historylog.legacyOptions = ["status_id"];
et2_historylog.columns = [
{ 'id': 'user_ts', caption: 'Date', 'width': '120px', widget_type: 'date-time', widget: null, nodes: null },
{ 'id': 'owner', caption: 'User', 'width': '150px', widget_type: 'select-account', widget: null, nodes: null },

View File

@ -65,7 +65,7 @@ export class et2_historylog extends et2_valueWidget implements et2_IDataProvider
}
};
legacyOptions = ["status_id"];
public static readonly legacyOptions = ["status_id"];
protected static columns = [
{'id': 'user_ts', caption: 'Date', 'width': '120px', widget_type: 'date-time', widget: null, nodes: null},
{'id': 'owner', caption: 'User', 'width': '150px', widget_type: 'select-account', widget: null, nodes: null},

View File

@ -48,7 +48,6 @@ var et2_image = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_image._attributes, _child || {})) || this;
_this.legacyOptions = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
_this.image = null;
// Create the image or a/image tag
_this.image = jQuery(document.createElement("img"));
@ -249,6 +248,7 @@ var et2_image = /** @class */ (function (_super) {
description: "Clicking on an image with href value would popup an expose view, and will show image referenced by href."
}
};
et2_image.legacyOptions = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
return et2_image;
}(et2_core_baseWidget_1.et2_baseWidget));
et2_core_widget_1.et2_register_widget(et2_image, ["image"]);

View File

@ -19,7 +19,7 @@
*/
import {et2_baseWidget} from './et2_core_baseWidget';
import {WidgetConfig, et2_register_widget} from "./et2_core_widget";
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {ClassWithAttributes} from "./et2_core_inheritance";
/**
@ -75,7 +75,7 @@ class et2_image extends et2_baseWidget implements et2_IDetachedDOM
}
};
legacyOptions : string[] = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
public static readonly legacyOptions : string[] = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
image : JQuery = null;

View File

@ -52,7 +52,6 @@ var et2_itempicker = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_itempicker._attributes, _child || {})) || this;
_this.legacyOptions = ["application"];
_this.last_search = ""; // Remember last search value
_this.action = null; // Action function for button
_this.current_app = ""; // Remember currently chosen application
@ -347,6 +346,7 @@ var et2_itempicker = /** @class */ (function (_super) {
"description": "Callback before query to server. Must return true, or false to abort query."
}
};
et2_itempicker.legacyOptions = ["application"];
return et2_itempicker;
}(et2_core_inputWidget_1.et2_inputWidget));
et2_core_widget_1.et2_register_widget(et2_itempicker, ["itempicker"]);

View File

@ -70,7 +70,7 @@ class et2_itempicker extends et2_inputWidget
}
};
legacyOptions : string[] = ["application"];
public static readonly legacyOptions : string[] = ["application"];
private last_search : string = ""; // Remember last search value
private action : egwFnct = null; // Action function for button
private current_app : string = ""; // Remember currently chosen application

View File

@ -1052,7 +1052,6 @@ var et2_link = /** @class */ (function (_super) {
*/
function et2_link(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_link._attributes, _child || {})) || this;
_this.legacyOptions = ["only_app"];
_this.label_span = jQuery(document.createElement("label"))
.addClass("et2_label");
_this.link = jQuery(document.createElement("span"))
@ -1221,6 +1220,7 @@ var et2_link = /** @class */ (function (_super) {
"description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank"
}
};
et2_link.legacyOptions = ["only_app"];
return et2_link;
}(et2_core_valueWidget_1.et2_valueWidget));
exports.et2_link = et2_link;

View File

@ -9,25 +9,25 @@
* @copyright 2011 Nathan Gray
*/
/*egw:uses
/vendor/bower-asset/jquery/dist/jquery.js;
/vendor/bower-asset/jquery-ui/jquery-ui.js;
et2_core_inputWidget;
et2_core_valueWidget;
/*egw:uses
/vendor/bower-asset/jquery/dist/jquery.js;
/vendor/bower-asset/jquery-ui/jquery-ui.js;
et2_core_inputWidget;
et2_core_valueWidget;
// Include menu system for list context menu
egw_action.egw_menu_dhtmlx;
*/
// Include menu system for list context menu
egw_action.egw_menu_dhtmlx;
*/
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_valueWidget} from "./et2_core_valueWidget";
import {et2_inputWidget} from "./et2_core_inputWidget";
import {et2_selectbox} from "./et2_widget_selectbox";
import {et2_button} from "./et2_widget_button";
import {et2_vfs_select} from "./et2_widget_vfs";
import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget";
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_valueWidget} from "./et2_core_valueWidget";
import {et2_inputWidget} from "./et2_core_inputWidget";
import {et2_selectbox} from "./et2_widget_selectbox";
import {et2_button} from "./et2_widget_button";
import {et2_vfs_select} from "./et2_widget_vfs";
/**
/**
* UI widgets for Egroupware linking system
*/
export class et2_link_to extends et2_inputWidget
@ -1317,7 +1317,7 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
"description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank"
}
};
legacyOptions = ["only_app"];
public static readonly legacyOptions = ["only_app"];
private label_span: JQuery;
private link: JQuery;

View File

@ -46,7 +46,6 @@ var et2_progress = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_progress._attributes, _child || {})) || this;
_this.legacyOptions = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
_this.progress = null;
var outer = document.createElement("div");
outer.className = "et2_progress";
@ -165,6 +164,7 @@ var et2_progress = /** @class */ (function (_super) {
"translate": true
}
};
et2_progress.legacyOptions = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
return et2_progress;
}(et2_core_valueWidget_1.et2_valueWidget));
et2_core_widget_1.et2_register_widget(et2_progress, ["progress"]);

View File

@ -51,7 +51,7 @@ class et2_progress extends et2_valueWidget implements et2_IDetachedDOM
}
};
legacyOptions : string[] = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
public static readonly legacyOptions : string[] = ["href", "extra_link_target", "imagemap", "extra_link_popup", "id"];
private progress : HTMLElement = null;
/**

View File

@ -50,7 +50,6 @@ var et2_radiobox = /** @class */ (function (_super) {
*/
function et2_radiobox(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_radiobox._attributes, _child || {})) || this;
_this.legacyOptions = ["set_value", "ro_true", "ro_false"];
_this.input = null;
_this.id = "";
_this.createInputWidget();
@ -159,6 +158,7 @@ var et2_radiobox = /** @class */ (function (_super) {
"description": "What should be displayed when readonly and not selected"
}
};
et2_radiobox.legacyOptions = ["set_value", "ro_true", "ro_false"];
return et2_radiobox;
}(et2_core_inputWidget_1.et2_inputWidget));
et2_core_widget_1.et2_register_widget(et2_radiobox, ["radio"]);
@ -176,7 +176,6 @@ var et2_radiobox_ro = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_radiobox_ro._attributes, _child || {})) || this;
_this.legacyOptions = ["set_value", "ro_true", "ro_false"];
_this.value = "";
_this.span = null;
_this.span = jQuery(document.createElement("span"))
@ -243,6 +242,7 @@ var et2_radiobox_ro = /** @class */ (function (_super) {
"type": "string"
}
};
et2_radiobox_ro.legacyOptions = ["set_value", "ro_true", "ro_false"];
return et2_radiobox_ro;
}(et2_core_valueWidget_1.et2_valueWidget));
et2_core_widget_1.et2_register_widget(et2_radiobox_ro, ["radio_ro"]);

View File

@ -16,8 +16,9 @@
*/
import {et2_inputWidget} from "./et2_core_inputWidget";
import {ClassWithAttributes} from "./et2_core_inheritance";
import {WidgetConfig, et2_register_widget} from "./et2_core_widget";
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {et2_valueWidget} from './et2_core_valueWidget';
/**
* Class which implements the "radiobox" XET-Tag
*
@ -50,7 +51,7 @@ class et2_radiobox extends et2_inputWidget
}
};
legacyOptions : string[] = ["set_value", "ro_true", "ro_false"];
public static readonly legacyOptions : string[] = ["set_value", "ro_true", "ro_false"];
input : JQuery = null;
id : string = "";
@ -204,7 +205,7 @@ class et2_radiobox_ro extends et2_valueWidget implements et2_IDetachedDOM
}
};
legacyOptions : string[] = ["set_value", "ro_true", "ro_false"];
public static readonly legacyOptions : string[] = ["set_value", "ro_true", "ro_false"];
value : string = "";
span : JQuery = null;

View File

@ -626,7 +626,6 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
*/
function et2_selectAccount_ro(_parent, _attrs, _child) {
var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_selectAccount_ro._attributes, _child || {})) || this;
_this.legacyOptions = ["empty_label"];
/**
Resolve some circular dependency problems here
selectAccount extends link, link is in a file that needs select,
@ -720,6 +719,7 @@ var et2_selectAccount_ro = /** @class */ (function (_super) {
translate: true
}
};
et2_selectAccount_ro.legacyOptions = ["empty_label"];
return et2_selectAccount_ro;
}(et2_widget_link_2.et2_link_string));
exports.et2_selectAccount_ro = et2_selectAccount_ro;

View File

@ -18,11 +18,10 @@
*/
import {et2_selectbox} from "./et2_widget_selectbox";
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_link_entry} from "./et2_widget_link";
import {et2_link_entry, et2_link_string} from "./et2_widget_link";
import {et2_dialog} from "./et2_widget_dialog";
import {et2_link_string} from "./et2_widget_link";
/**
* Account selection widget
@ -767,7 +766,7 @@ export class et2_selectAccount_ro extends et2_link_string
}
};
legacyOptions : string[] = ["empty_label"];
public static readonly legacyOptions : string[] = ["empty_label"];
/**
* Constructor

View File

@ -50,7 +50,6 @@ var et2_selectbox = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_selectbox._attributes, _child || {})) || this;
_this.legacyOptions = ["rows", "other"]; // Other is sub-type specific
_this.input = null;
_this.value = '';
_this.selected_first = true;
@ -1243,6 +1242,7 @@ var et2_selectbox = /** @class */ (function (_super) {
description: "Allow to set a custom css class combined with selected value. (e.g. cat_23)"
}
};
et2_selectbox.legacyOptions = ["rows", "other"]; // Other is sub-type specific
et2_selectbox.type_cache = {};
return et2_selectbox;
}(et2_core_inputWidget_1.et2_inputWidget));

View File

@ -112,7 +112,7 @@ export class et2_selectbox extends et2_inputWidget
}
};
legacyOptions: string[] = ["rows","other"]; // Other is sub-type specific
public static readonly legacyOptions: string[] = ["rows","other"]; // Other is sub-type specific
input: JQuery = null;
value: string | string[] = '';
expand_button: JQuery;

View File

@ -71,7 +71,7 @@ var et2_split = /** @class */ (function (_super) {
this.div.trigger("destroy");
// Destroy dynamic full-height
this.dynheight.destroy();
_super.prototype.destroy.call(this);
_super.prototype.destroy.call(this);
// Remove placeholder children
if (this._children.length == 0) {
this.div.empty();

View File

@ -47,7 +47,6 @@ var et2_textbox = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_textbox._attributes, _child || {})) || this;
_this.legacyOptions = ["size", "maxlength", "validator"];
_this.input = null;
_this.input = null;
_this.createInputWidget();
@ -283,6 +282,7 @@ var et2_textbox = /** @class */ (function (_super) {
description: "JS code or app.$app.$method called when key is pressed, return false cancels it."
}
};
et2_textbox.legacyOptions = ["size", "maxlength", "validator"];
return et2_textbox;
}(et2_core_inputWidget_1.et2_inputWidget));
exports.et2_textbox = et2_textbox;

View File

@ -15,12 +15,11 @@
*/
import './et2_core_common';
import { ClassWithAttributes } from "./et2_core_inheritance";
import { et2_widget, et2_createWidget, et2_register_widget, WidgetConfig } from "./et2_core_widget";
import { et2_DOMWidget } from './et2_core_DOMWidget'
import { et2_valueWidget } from './et2_core_valueWidget'
import { et2_inputWidget } from './et2_core_inputWidget'
import { et2_button } from './et2_widget_button'
import {ClassWithAttributes} from "./et2_core_inheritance";
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
import {et2_valueWidget} from './et2_core_valueWidget'
import {et2_inputWidget} from './et2_core_inputWidget'
import {et2_button} from './et2_widget_button'
import './et2_types';
/**
@ -88,7 +87,7 @@ export class et2_textbox extends et2_inputWidget implements et2_IResizeable
}
};
legacyOptions: string[] = ["size", "maxlength", "validator"];
public static readonly legacyOptions: string[] = ["size", "maxlength", "validator"];
input: JQuery = null;
size: number;
maxLength: number;

View File

@ -450,7 +450,6 @@ var et2_vfsMime = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_vfsMime._attributes, _child || {})) || this;
_this.legacyOptions = ["size"];
_this.iconOverlayContainer = null;
_this.image = null;
_this.iconOverlayContainer = jQuery(document.createElement('span')).addClass('iconOverlayContainer');
@ -618,6 +617,7 @@ var et2_vfsMime = /** @class */ (function (_super) {
description: " Size of thumbnail in pixel for specified mime type with syntax of: mime_type(s),size (eg. image,video,128)"
}
},
_a.legacyOptions = ["size"],
_a))));
;
et2_core_widget_1.et2_register_widget(et2_vfsMime, ["vfs-mime"]);
@ -828,7 +828,6 @@ var et2_vfsUpload = /** @class */ (function (_super) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_vfsUpload._attributes, _child || {})) || this;
_this.legacyOptions = ["mime"];
_this.asyncOptions = {
target: egw.ajaxUrl("EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_upload")
};
@ -989,6 +988,7 @@ var et2_vfsUpload = /** @class */ (function (_super) {
"default": ''
}
};
et2_vfsUpload.legacyOptions = ["mime"];
return et2_vfsUpload;
}(et2_widget_file_1.et2_file));
et2_core_widget_1.et2_register_widget(et2_vfsUpload, ["vfs-upload"]);

View File

@ -518,7 +518,7 @@ class et2_vfsMime extends expose(class et2_vfsMime extends et2_valueWidget imple
};
legacyOptions : string[] = ["size"];
public static readonly legacyOptions : string[] = ["size"];
iconOverlayContainer : JQuery = null;
overlayContainer : JQuery;
image : JQuery = null;
@ -932,7 +932,7 @@ class et2_vfsUpload extends et2_file
}
};
legacyOptions : string[] = ["mime"];
public static readonly legacyOptions : string[] = ["mime"];
asyncOptions : {target : any} = {
target: egw.ajaxUrl("EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_upload")

View File

@ -11,7 +11,7 @@
</columns>
<rows>
<row>
<radio id="index" options="$row_cont[index]"/>
<radio id="index" set_value="$row_cont[index]"/>
<description/>
<description id="${row}[label]"/>
</row>

View File

@ -33,16 +33,16 @@
</columns>
<rows>
<row class="row">
<vfs-mime align="center" id="$row" options="16" class="selectIcon"/>
<vfs-mime align="center" id="$row" size="16" class="selectIcon"/>
<vfs id="$row" onclick="app.vfsSelectUI.select_clicked"/>
<checkbox align="right" id="selected[]" options="&quot;$row_cont[name]&quot;"/>
<checkbox align="right" id="selected[]" selected_value="&quot;$row_cont[name]&quot;"/>
</row>
</rows>
</grid>
</hbox>
</row>
<row disabled="!@showmime">
<select id="mime" onchange="app.vfsSelectUI.do_action('mime', widget)" options="All files" class="et2_fullWidth"/>
<select id="mime" onchange="app.vfsSelectUI.do_action('mime', widget)" empty_label="All files" class="et2_fullWidth"/>
</row>
</rows>
</grid>

View File

@ -167,35 +167,35 @@ var et2_calendar_event = /** @class */ (function (_super) {
* Callback for changes in cached data
*/
et2_calendar_event.prototype._UID_callback = function (event) {
// Copy to avoid changes, which may cause nm problems
var value = event === null ? null : jQuery.extend({}, event);
var parent = this.getParent();
var parent_owner = parent.getDOMNode(parent).dataset['owner'] || parent.getParent().options.owner;
// Make sure id is a string, check values
if (value) {
this._values_check(value);
}
// Check for changing days in the grid view
if (!this._sameday_check(value) || !this._status_check(value, app.calendar.getState().status_filter, parent_owner)) {
// May need to update parent to remove out-of-view events
parent.removeChild(this);
if (event === null && parent && parent.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
parent._out_of_view();
}
// This should now cease to exist, as new events have been created
this.destroy();
return;
}
// Copy to avoid changes, which may cause nm problems
this.options.value = jQuery.extend({}, value);
if (this.getParent().options.date) {
this.options.value.date = this.getParent().options.date;
}
// Let parent position - could also be et2_calendar_planner_row
this.getParent().position_event(this);
// Parent may remove this if the date isn't the same
if (this.getParent()) {
this._update();
// Copy to avoid changes, which may cause nm problems
var value = event === null ? null : jQuery.extend({}, event);
var parent = this.getParent();
var parent_owner = parent.getDOMNode(parent).dataset['owner'] || parent.getParent().options.owner;
// Make sure id is a string, check values
if (value) {
this._values_check(value);
}
// Check for changing days in the grid view
if (!this._sameday_check(value) || !this._status_check(value, app.calendar.getState().status_filter, parent_owner)) {
// May need to update parent to remove out-of-view events
parent.removeChild(this);
if (event === null && parent && parent.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
parent._out_of_view();
}
// This should now cease to exist, as new events have been created
this.destroy();
return;
}
// Copy to avoid changes, which may cause nm problems
this.options.value = jQuery.extend({}, value);
if (this.getParent().options.date) {
this.options.value.date = this.getParent().options.date;
}
// Let parent position - could also be et2_calendar_planner_row
this.getParent().position_event(this);
// Parent may remove this if the date isn't the same
if (this.getParent()) {
this._update();
}
};
/**
@ -653,127 +653,125 @@ var et2_calendar_event = /** @class */ (function (_super) {
this._actionObject = null;
}
// Update daywise caches
var new_cache_id = CalendarApp._daywise_cache_id(event.date, this.getParent().options.owner);
var new_daywise = egw.dataGetUIDdata(new_cache_id);
new_daywise = new_daywise && new_daywise.data ? new_daywise.data : [];
var old_cache_id = '';
if (this.options.value && this.options.value.date) {
old_cache_id = CalendarApp._daywise_cache_id(this.options.value.date, parent.options.owner);
}
if (new_cache_id != old_cache_id) {
var old_daywise = egw.dataGetUIDdata(old_cache_id);
old_daywise = old_daywise && old_daywise.data ? old_daywise.data : [];
old_daywise.splice(old_daywise.indexOf(this.options.value.row_id), 1);
egw.dataStoreUID(old_cache_id, old_daywise);
if (new_daywise.indexOf(event.row_id) < 0) {
new_daywise.push(event.row_id);
}
if (egw.dataHasUID(new_cache_id)) {
egw.dataStoreUID(new_cache_id, new_daywise);
}
}
return false;
};
/**
* Check that the event passes the given status filter.
* Status filter is set in the sidebox and used when fetching several events, but if user changes their status
* for an event, it may no longer match and have to be removed.
*
* @param event
* @param filter
* @private
*/
et2_calendar_event.prototype._status_check = function (event, filter, owner) {
if (!owner || !event) {
return false;
}
// If we're doing a bunch, just one passing is enough
if (typeof owner !== "string") {
var pass = false;
for (var j = 0; j < owner.length && pass == false; j++) {
pass = pass || this._status_check(event, filter, owner[j]);
}
return pass;
}
// Show also events just owned by selected user
if (filter == 'owner') {
return owner == event.owner;
}
// Get the relevant participant
var participant = event.participants[owner];
// If filter says don't look in groups, skip it all
if (!participant && filter === 'no-enum-groups') {
return false;
}
// Couldn't find the current owner in the participant list, check groups & resources
if (!participant) {
var options = null;
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
}
if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") {
var resource = options.find(function (element) {
return element.id == owner;
}) || {};
if (resource && resource.resources) {
var matching_participant = resource.resources.filter(function (id) {
return typeof event.participants[id] != "undefined";
});
return this._status_check(event, filter, matching_participant);
}
}
}
var status = et2_calendar_event.split_status(participant);
switch (filter) {
default:
case 'all':
return true;
case 'default': // Show all status, but rejected
return status !== 'R';
case 'accepted': //Show only accepted events
return status === 'A';
case 'unknown': // Show only invitations, not yet accepted or rejected
return status === 'U';
case 'tentative': // Show only tentative accepted events
return status === 'T';
case 'delegated': // Show only delegated events
return status === 'D';
case 'rejected': // Show only rejected events
return status === 'R';
// Handled above
//case 'owner': // Show also events just owned by selected user
case 'hideprivate': // Show all events, as if they were private
// handled server-side
return true;
case 'showonlypublic': // Show only events flagged as public, -not checked as private
return event.public == '1';
// Handled above
// case 'no-enum-groups': // Do not include events of group members
case 'not-unknown': // Show all status, but unknown
return status !== 'U';
case 'deleted': // Show events that have been deleted
return event.deleted;
}
};
et2_calendar_event.prototype.attachToDOM = function () {
var result = _super.prototype.attachToDOM.call(this);
// Remove the binding for the click handler, unless there's something
// custom here.
if (!this.onclick) {
jQuery(this.node).off("click");
}
return result;
};
/**
* Click handler calling custom handler set via onclick attribute to this.onclick.
* All other handling is done by the timegrid widget.
*
* @param {Event} _ev
* @returns {boolean}
*/
et2_calendar_event.prototype.click = function (_ev) {
var result = true;
if (typeof this.onclick == 'function') {
var new_cache_id = CalendarApp._daywise_cache_id(event.date, this.getParent().options.owner);
var new_daywise = egw.dataGetUIDdata(new_cache_id);
new_daywise = new_daywise && new_daywise.data ? new_daywise.data : [];
var old_cache_id = '';
if (this.options.value && this.options.value.date) {
old_cache_id = CalendarApp._daywise_cache_id(this.options.value.date, parent.options.owner);
}
if (new_cache_id != old_cache_id) {
var old_daywise = egw.dataGetUIDdata(old_cache_id);
old_daywise = old_daywise && old_daywise.data ? old_daywise.data : [];
old_daywise.splice(old_daywise.indexOf(this.options.value.row_id), 1);
egw.dataStoreUID(old_cache_id, old_daywise);
if (new_daywise.indexOf(event.row_id) < 0) {
new_daywise.push(event.row_id);
}
if (egw.dataHasUID(new_cache_id)) {
egw.dataStoreUID(new_cache_id, new_daywise);
}
}
return false;
};
/**
* Check that the event passes the given status filter.
* Status filter is set in the sidebox and used when fetching several events, but if user changes their status
* for an event, it may no longer match and have to be removed.
*
* @param event
* @param filter
* @private
*/
et2_calendar_event.prototype._status_check = function (event, filter, owner) {
if (!owner || !event) {
return false;
}
// If we're doing a bunch, just one passing is enough
if (typeof owner !== "string") {
var pass = false;
for (var j = 0; j < owner.length && pass == false; j++) {
pass = pass || this._status_check(event, filter, owner[j]);
}
return pass;
}
// Show also events just owned by selected user
if (filter == 'owner') {
return owner == event.owner;
}
// Get the relevant participant
var participant = event.participants[owner];
// If filter says don't look in groups, skip it all
if (!participant && filter === 'no-enum-groups') {
return false;
}
// Couldn't find the current owner in the participant list, check groups & resources
if (!participant) {
var options = null;
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
}
if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") {
var resource = options.find(function (element) {
return element.id == owner;
}) || {};
if (resource && resource.resources) {
var matching_participant = resource.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; });
return this._status_check(event, filter, matching_participant);
}
}
}
var status = et2_calendar_event.split_status(participant);
switch (filter) {
default:
case 'all':
return true;
case 'default': // Show all status, but rejected
return status !== 'R';
case 'accepted': //Show only accepted events
return status === 'A';
case 'unknown': // Show only invitations, not yet accepted or rejected
return status === 'U';
case 'tentative': // Show only tentative accepted events
return status === 'T';
case 'delegated': // Show only delegated events
return status === 'D';
case 'rejected': // Show only rejected events
return status === 'R';
// Handled above
//case 'owner': // Show also events just owned by selected user
case 'hideprivate': // Show all events, as if they were private
// handled server-side
return true;
case 'showonlypublic': // Show only events flagged as public, -not checked as private
return event.public == '1';
// Handled above
// case 'no-enum-groups': // Do not include events of group members
case 'not-unknown': // Show all status, but unknown
return status !== 'U';
case 'deleted': // Show events that have been deleted
return event.deleted;
}
};
et2_calendar_event.prototype.attachToDOM = function () {
var result = _super.prototype.attachToDOM.call(this);
// Remove the binding for the click handler, unless there's something
// custom here.
if (!this.onclick) {
jQuery(this.node).off("click");
}
return result;
};
/**
* Click handler calling custom handler set via onclick attribute to this.onclick.
* All other handling is done by the timegrid widget.
*
* @param {Event} _ev
* @returns {boolean}
*/
et2_calendar_event.prototype.click = function (_ev) {
var result = true;
if (typeof this.onclick == 'function') {
// Make sure function gets a reference to the widget, splice it in as 2. argument if not
var args = Array.prototype.slice.call(arguments);
if (args.indexOf(this) == -1)