diff --git a/addressbook/js/CRM.js b/addressbook/js/CRM.js index 0f0574088b..2895f35a51 100644 --- a/addressbook/js/CRM.js +++ b/addressbook/js/CRM.js @@ -1,75 +1,55 @@ -"use strict"; /** * EGroupware - Addressbook - Javascript UI * * @link: https://www.egroupware.org * @package addressbook * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Ralf Becker + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CRMView = void 0; /*egw:uses /api/js/jsapi/egw_app.js */ -require("jquery"); -require("jqueryui"); -require("../jsapi/egw_global"); -require("../etemplate/et2_types"); -var egw_app_1 = require("../../api/js/jsapi/egw_app"); -var et2_extension_nextmatch_1 = require("../../api/js/etemplate/et2_extension_nextmatch"); +import 'jquery'; +import 'jqueryui'; +import { EgwApp } from '../../api/js/jsapi/egw_app'; +import { et2_nextmatch } from "../../api/js/etemplate/et2_extension_nextmatch"; /** * UI for Addressbook CRM view * */ -var CRMView = /** @class */ (function (_super) { - __extends(CRMView, _super); +export class CRMView extends EgwApp { /** * Constructor * * CRM is part of addressbook */ - function CRMView() { - var _this = + constructor() { // call parent - _super.call(this, 'addressbook') || this; + super('addressbook'); // List ID - _this.list_id = ""; + this.list_id = ""; // Reference to the list - _this.nm = null; + this.nm = null; // Which addressbook contact id(s) we are showing entries for - _this.contact_ids = []; + this.contact_ids = []; // Private js for the list - _this.app_obj = null; + this.app_obj = null; // Push data key(s) to check for our contact ID in the entry's ACL data - _this.push_contact_ids = ["contact_id"]; - return _this; + this.push_contact_ids = ["contact_id"]; } /** * Destructor */ - CRMView.prototype.destroy = function (_app) { + destroy(_app) { this.nm = null; if (this.app_obj != null) { this.app_obj.destroy(_app); } // call parent - _super.prototype.destroy.call(this, _app); - }; + super.destroy(_app); + } /** * A template from an app is ready, looks like it might be a CRM view. * Check it, get CRM ready, and bind accordingly @@ -77,13 +57,13 @@ var CRMView = /** @class */ (function (_super) { * @param et2 * @param appname */ - CRMView.view_ready = function (et2, app_obj) { + static view_ready(et2, app_obj) { // Check to see if the template is for a CRM view if (et2.app == app_obj.appname) { return CRMView.reconnect(app_obj); } // Make sure object is there, etemplate2 will pick it up and call our et2_ready - var crm = undefined; + let crm = undefined; // @ts-ignore if (typeof et2.app_obj.crm == "undefined" && app.classes.crm) { // @ts-ignore @@ -95,7 +75,7 @@ var CRMView = /** @class */ (function (_super) { } // We can set this now crm.set_view_obj(app_obj); - }; + } /** * This function is called when the etemplate2 object is loaded * and ready. The associated app [is supposed to have] already called its own et2_ready(), @@ -104,25 +84,24 @@ var CRMView = /** @class */ (function (_super) { * @param {etemplate2} et2 newly ready object * @param {string} name Template name */ - CRMView.prototype.et2_ready = function (et2, name) { + et2_ready(et2, name) { // call parent - _super.prototype.et2_ready.call(this, et2, name); - }; + super.et2_ready(et2, name); + } /** * Our CRM has become disconnected from its list, probably because something submitted. * Find it, and get things working again. * * @param app_obj */ - CRMView.reconnect = function (app_obj) { + static reconnect(app_obj) { var _a; // Check - var contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || ""; + let contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || ""; debugger; if (!contact_ids) return; - for (var _i = 0, _b = egw_app_1.EgwApp._instances; _i < _b.length; _i++) { - var existing_app = _b[_i]; + for (let existing_app of EgwApp._instances) { if (existing_app instanceof CRMView && existing_app.list_id == app_obj.et2.getInstanceManager().uniqueId) { // List was reloaded. Rebind. existing_app.app_obj.destroy(existing_app.app_obj.appname); @@ -136,12 +115,12 @@ var CRMView = /** @class */ (function (_super) { return existing_app.set_view_obj(app_obj); } } - }; + } /** * Set the associated private app JS * We try and pull the needed info here */ - CRMView.prototype.set_view_obj = function (app_obj) { + set_view_obj(app_obj) { this.app_obj = app_obj; // Make sure object is there, etemplate2 will pick it up and call our et2_ready app_obj.et2.getInstanceManager().app_obj.crm = this; @@ -153,24 +132,24 @@ var CRMView = /** @class */ (function (_super) { // For easy reference later this.list_id = app_obj.et2.getInstanceManager().uniqueId; this.nm = app_obj.et2.getDOMWidgetById('nm'); - var contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || ""; + let contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || ""; if (typeof contact_ids == "string") { contact_ids = contact_ids.split(","); } this.set_contact_ids(contact_ids); // Override the push handler this._override_push(app_obj); - }; + } /** * Set or change which contact IDs we are showing entries for */ - CRMView.prototype.set_contact_ids = function (ids) { + set_contact_ids(ids) { this.contact_ids = ids; - var filter = { action_id: this.contact_ids }; + let filter = { action_id: this.contact_ids }; if (this.nm !== null) { this.nm.applyFilters(filter); } - }; + } /** * Handle a push notification about entry changes from the websocket * @@ -186,7 +165,7 @@ var CRMView = /** @class */ (function (_super) { * @param {object|null} pushData.acl Extra data for determining relevance. eg: owner or responsible to decide if update is necessary * @param {number} pushData.account_id User that caused the notification */ - CRMView.prototype.push = function (pushData) { + push(pushData) { if (pushData.app !== this.app_obj.appname || !this.nm) return; // If we know about it and it's an update, just update. @@ -194,13 +173,13 @@ var CRMView = /** @class */ (function (_super) { // (server responds then with null / no entry causing the entry to disappear) if (pushData.type !== "add" && this.egw.dataHasUID(this.uid(pushData))) { // Check to see if it's in OUR nextmatch - var uid_1 = this.uid(pushData); - var known = Object.values(this.nm.controller._indexMap).filter(function (row) { return row.uid == uid_1; }); - var type = pushData.type; + let uid = this.uid(pushData); + let known = Object.values(this.nm.controller._indexMap).filter(function (row) { return row.uid == uid; }); + let type = pushData.type; if (known && known.length > 0) { if (!this.id_check(pushData.acl)) { // Was ours, not anymore, and we know this now - no server needed. Just remove from nm. - type = et2_extension_nextmatch_1.et2_nextmatch.DELETE; + type = et2_nextmatch.DELETE; } return this.nm.refresh(pushData.id, type); } @@ -208,38 +187,34 @@ var CRMView = /** @class */ (function (_super) { if (this.id_check(pushData.acl)) { return this._app_obj_push(pushData); } - }; + } /** * Check to see if the given entry is "ours" * * @param entry */ - CRMView.prototype.id_check = function (entry) { - var _this = this; + id_check(entry) { // Check if it's for one of our contacts - for (var _i = 0, _a = this.push_contact_ids; _i < _a.length; _i++) { - var field = _a[_i]; + for (let field of this.push_contact_ids) { if (entry && entry[field]) { - var val = typeof entry[field] == "string" ? [entry[field]] : entry[field]; - if (val.filter(function (v) { return _this.contact_ids.indexOf(v) >= 0; }).length > 0) { + let val = typeof entry[field] == "string" ? [entry[field]] : entry[field]; + if (val.filter(v => this.contact_ids.indexOf(v) >= 0).length > 0) { return true; } } } return false; - }; + } /** * Override the list's push handler to do nothing, we'll call it if we want it. * * @param app_obj * @private */ - CRMView.prototype._override_push = function (app_obj) { + _override_push(app_obj) { this._app_obj_push = app_obj.push.bind(app_obj); app_obj.push = function (pushData) { return false; }; - }; - return CRMView; -}(egw_app_1.EgwApp)); -exports.CRMView = CRMView; + } +} app.classes.crm = CRMView; //# sourceMappingURL=CRM.js.map \ No newline at end of file diff --git a/addressbook/js/CRM.ts b/addressbook/js/CRM.ts index 3db5c1e992..36e136bc46 100644 --- a/addressbook/js/CRM.ts +++ b/addressbook/js/CRM.ts @@ -4,7 +4,8 @@ * @link: https://www.egroupware.org * @package addressbook * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Ralf Becker + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ @@ -14,8 +15,6 @@ import 'jquery'; import 'jqueryui'; -import '../jsapi/egw_global'; -import '../etemplate/et2_types'; import {EgwApp, PushData} from '../../api/js/jsapi/egw_app'; import {etemplate2} from "../../api/js/etemplate/etemplate2"; @@ -278,5 +277,4 @@ export class CRMView extends EgwApp } } - app.classes.crm = CRMView; \ No newline at end of file diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 5116e42650..87449a49bb 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -1,64 +1,46 @@ -"use strict"; /** * EGroupware - Addressbook - Javascript UI * * @link: https://www.egroupware.org * @package addressbook - * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Hadi Nategh + * @author Ralf Becker + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); /*egw:uses /api/js/jsapi/egw_app.js */ -require("jquery"); -require("jqueryui"); -require("../jsapi/egw_global"); -require("../etemplate/et2_types"); -var egw_app_1 = require("../../api/js/jsapi/egw_app"); -var etemplate2_1 = require("../../api/js/etemplate/etemplate2"); +import 'jquery'; +import 'jqueryui'; +import { EgwApp } from '../../api/js/jsapi/egw_app'; +import { etemplate2 } from "../../api/js/etemplate/etemplate2"; +import { et2_dialog } from "../../api/js/etemplate/et2_widget_dialog"; /** * UI for Addressbook * * @augments AppJS */ -var AddressbookApp = /** @class */ (function (_super) { - __extends(AddressbookApp, _super); +class AddressbookApp extends EgwApp { /** * Constructor * * @memberOf app.addressbook */ - function AddressbookApp() { - var _this = + constructor() { // call parent - _super.call(this, 'addressbook') || this; + super('addressbook'); // These fields help with push - _this.push_grant_fields = ["owner", "shared_with"]; - _this.push_filter_fields = ["tid", "owner", "cat_id"]; - return _this; + this.push_grant_fields = ["owner", "shared_with"]; + this.push_filter_fields = ["tid", "owner", "cat_id"]; } /** * Destructor */ - AddressbookApp.prototype.destroy = function (_app) { + destroy(_app) { // call parent - _super.prototype.destroy.call(this, _app); - }; + super.destroy(_app); + } /** * This function is called when the etemplate2 object is loaded * and ready. If you must store a reference to the et2 object, @@ -67,14 +49,14 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {etemplate2} et2 newly ready object * @param {string} name */ - AddressbookApp.prototype.et2_ready = function (et2, name) { + et2_ready(et2, name) { // r49769 let's CRM view run under currentapp == "addressbook", which causes // app.addressbook.et2_ready called before app.infolog.et2_ready and therefore // app.addressbook.et2 would point to infolog template, if we not stop here if (name.match(/^infolog|tracker\./)) return; // call parent - _super.prototype.et2_ready.call(this, et2, name); + super.et2_ready(et2, name); switch (name) { case 'addressbook.edit': var content = this.et2.getArrayMgr('content').data; @@ -102,7 +84,7 @@ var AddressbookApp = /** @class */ (function (_super) { if (app.addressbook) app.addressbook.show_custom_country(this); }); - }; + } /** * Observer method receives update notifications from all applications * @@ -125,13 +107,13 @@ var AddressbookApp = /** @class */ (function (_super) { * or null, if not triggered on server-side, which adds that info * @return {false|*} false to stop regular refresh, thought all observers are run */ - AddressbookApp.prototype.observer = function (_msg, _app, _id, _type, _msg_type, _links) { + observer(_msg, _app, _id, _type, _msg_type, _links) { // Edit to the current entry var state = this.getState(); if (_app === 'addressbook' && state && state.type && state.type === 'view' && state.id === _id) { var content = egw.dataGetUIDdata('addressbook::' + _id); if (content.data) { - var view = etemplate2_1.etemplate2.getById('addressbook-view'); + var view = etemplate2.getById('addressbook-view'); if (view) { view.widgetContainer._children[0].set_value({ content: content.data }); } @@ -152,7 +134,7 @@ var AddressbookApp = /** @class */ (function (_super) { else if (!content) { // No data on the event, we'll have to reload if calendar column is visible // to get the updated information - var nm = etemplate2_1.etemplate2.getById('addressbook-index').widgetContainer.getWidgetById('nm'); + var nm = etemplate2.getById('addressbook-index').widgetContainer.getWidgetById('nm'); var pref = nm ? nm._getPreferences() : false; if (pref && pref.visible.indexOf('calendar_calendar') > -1) { nm.refresh(null, 'update'); @@ -160,7 +142,7 @@ var AddressbookApp = /** @class */ (function (_super) { } } return true; - }; + } /** * Handle a push notification about entry changes from the websocket * @@ -179,10 +161,10 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {object|null} pushData.acl Extra data for determining relevance. eg: owner or responsible to decide if update is necessary * @param {number} pushData.account_id User that caused the notification */ - AddressbookApp.prototype.push = function (pushData) { + push(pushData) { var _a, _b, _c, _d, _e; // show missed calls on their CRM view - var et2_id = (_a = this.et2) === null || _a === void 0 ? void 0 : _a.getInstanceManager().uniqueId; + let et2_id = (_a = this.et2) === null || _a === void 0 ? void 0 : _a.getInstanceManager().uniqueId; if (pushData.app === 'stylite' && pushData.acl.missed && et2_id && et2_id.substr(0, 17) === 'addressbook-view-' && pushData.acl.account_id == this.egw.user('account_id') && @@ -194,14 +176,14 @@ var AddressbookApp = /** @class */ (function (_super) { return; // Update the contact list if (this.et2 && this.et2.getInstanceManager().name == "addressbook.index") { - return _super.prototype.push.call(this, pushData); + return super.push(pushData); } // Update CRM view (sidebox part), if open - var contact_id = ((_e = (_d = this.et2) === null || _d === void 0 ? void 0 : _d.getArrayMgr("content")) === null || _e === void 0 ? void 0 : _e.getEntry("id")) || 0; + let contact_id = ((_e = (_d = this.et2) === null || _d === void 0 ? void 0 : _d.getArrayMgr("content")) === null || _e === void 0 ? void 0 : _e.getEntry("id")) || 0; if (this.et2 && contact_id && contact_id == pushData.id) { this.et2.getInstanceManager().submit(); } - }; + } /** * Change handler for contact / org selectbox * @@ -209,9 +191,9 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {et2_extension_nextmatch} nm * @param {et2_selectbox} widget */ - AddressbookApp.prototype.change_grouped_view = function (node, nm, widget) { - var template = "addressbook.index.rows"; - var value = {}; + change_grouped_view(node, nm, widget) { + let template = "addressbook.index.rows"; + let value = {}; if (nm.activeFilters.sitemgr_display) { template = nm.activeFilters.sitemgr_display + '.rows'; } @@ -225,7 +207,7 @@ var AddressbookApp = /** @class */ (function (_super) { template = widget.getValue().indexOf('duplicate') === 0 ? 'addressbook.index.duplicate_rows' : 'addressbook.index.org_rows'; } - var promise = nm.set_template(template); + let promise = nm.set_template(template); value[widget.id] = widget.getValue(); if (promise) { jQuery.when.apply(null, promise).done(function () { @@ -233,19 +215,19 @@ var AddressbookApp = /** @class */ (function (_super) { }); } return !promise; - }; + } /** * Open CRM view from addressbook index itself * * @param _action * @param _senders */ - AddressbookApp.prototype.view = function (_action, _senders) { - var extras = { + view(_action, _senders) { + let extras = { contact_id: _senders[0].id.split('::').pop(), index: _senders[0]._index }; - var data = egw.dataGetUIDdata(_senders[0].id)['data']; + let data = egw.dataGetUIDdata(_senders[0].id)['data']; // CRM list if (_action.id != 'view') { extras.crm_list = _action.id.replace('view-', ''); @@ -256,37 +238,37 @@ var AddressbookApp = /** @class */ (function (_super) { : data.n_fn + " (" + egw.lang(extras.crm_list) + ")"; extras.icon = data.photo; return this.openCRMview(extras); - }; + } /** * Open a CRM view for a contact: callback for link-registry / egw.open / other apps * * @param {CrmParams} _params object with attribute "contact_id" and optional "title", "crm_list", "icon" * @param {object} _senders use egw.dataGetUIDdata to get contact_id */ - AddressbookApp.prototype.openCRMview = function (_params, _senders) { - var contact_id = typeof _params === 'object' ? _params.contact_id : _params; + openCRMview(_params, _senders) { + let contact_id = typeof _params === 'object' ? _params.contact_id : _params; if (typeof _senders === 'object') { - var data = egw.dataGetUIDdata(_senders[0].id); + let data = egw.dataGetUIDdata(_senders[0].id); contact_id = data.data.contact_id; } if (typeof contact_id !== 'undefined') { - var crm_list_1 = _params.crm_list || egw.preference('crm_list', 'addressbook'); - if (!crm_list_1 || crm_list_1 === '~edit~') - crm_list_1 = 'infolog'; - var url_1 = this.egw.link('/index.php', { + let crm_list = _params.crm_list || egw.preference('crm_list', 'addressbook'); + if (!crm_list || crm_list === '~edit~') + crm_list = 'infolog'; + let url = this.egw.link('/index.php', { menuaction: 'addressbook.addressbook_ui.view', ajax: 'true', contact_id: contact_id, - crm_list: crm_list_1 + crm_list: crm_list }); // no framework, just open the url if (typeof this.egw.window.framework === 'undefined') { - return this.egw.open_link(url_1); + return this.egw.open_link(url); } - var open_1 = function (_title) { - var title = _title || this.egw.link_title('addressbook', contact_id, open_1); + let open = function (_title) { + let title = _title || this.egw.link_title('addressbook', contact_id, open); if (title) { - this.egw.window.framework.tabLinkHandler(url_1, { + this.egw.window.framework.tabLinkHandler(url, { displayName: title, icon: _params.icon || this.egw.link('/api/avatar.php', { contact_id: contact_id, @@ -294,36 +276,36 @@ var AddressbookApp = /** @class */ (function (_super) { }), refreshCallback: function () { var _a; - (_a = etemplate2_1.etemplate2.getById("addressbook-view-" + this.appName)) === null || _a === void 0 ? void 0 : _a.app_obj.addressbook.view_set_list(); + (_a = etemplate2.getById("addressbook-view-" + this.appName)) === null || _a === void 0 ? void 0 : _a.app_obj.addressbook.view_set_list(); }, - id: contact_id + '-' + crm_list_1 + id: contact_id + '-' + crm_list }); } }.bind(this); - open_1(_params.title); + open(_params.title); } - }; + } /** * Set link filter for the already open & rendered list * * @param {Object} filter Object with key / value pairs of filters to set */ - AddressbookApp.prototype.view_set_list = function (filter) { + view_set_list(filter) { // Find the infolog list - var list = etemplate2_1.etemplate2.getById(jQuery(this.et2.getInstanceManager().DOMContainer).nextAll('.et2_container').attr('id')); + var list = etemplate2.getById(jQuery(this.et2.getInstanceManager().DOMContainer).nextAll('.et2_container').attr('id')); var nm = list ? list.widgetContainer.getWidgetById('nm') : null; if (nm) { nm.applyFilters(filter); } - }; + } /** * Run an action from CRM view toolbar * * @param {object} _action */ - AddressbookApp.prototype.view_actions = function (_action, _widget) { + view_actions(_action, _widget) { var app_id = _widget.dom_id.split('_'); - var et2 = etemplate2_1.etemplate2.getById(app_id[0]); + var et2 = etemplate2.getById(app_id[0]); var id = et2.widgetContainer.getArrayMgr('content').data.id; switch (_widget.id) { case 'button[edit]': @@ -342,13 +324,13 @@ var AddressbookApp = /** @class */ (function (_super) { et2.widgetContainer._inst.submit(); break; } - }; + } /** * Open the calender to view the selected contacts * @param {egwAction} _action * @param {egwActionObject[]} _senders */ - AddressbookApp.prototype.view_calendar = function (_action, _senders) { + view_calendar(_action, _senders) { var extras = { filter: 'all', cat_id: '', @@ -390,14 +372,14 @@ var AddressbookApp = /** @class */ (function (_super) { extras.owner = extras.owner.join(','); egw.open('', 'calendar', 'list', extras, 'calendar'); } - }; + } /** * Add appointment or show calendar for selected contacts, call default nm_action after some checks * * @param _action * @param _senders */ - AddressbookApp.prototype.add_cal = function (_action, _senders) { + add_cal(_action, _senders) { if (!_senders[0].id.match(/^(?:addressbook::)?[0-9]+$/)) { // send org-view requests to server _action.data.nm_action = "submit"; @@ -417,13 +399,13 @@ var AddressbookApp = /** @class */ (function (_super) { // Use framework to add calendar entry egw.open('', 'calendar', 'add', extra); } - }; + } /** * View infolog entries linked to selected contact * @param {egwAction} _action Select action * @param {egwActionObject[]} _senders Selected contact(s) */ - AddressbookApp.prototype.view_infolog = function (_action, _senders) { + view_infolog(_action, _senders) { var extras = { action: 'addressbook', action_id: [], @@ -453,14 +435,14 @@ var AddressbookApp = /** @class */ (function (_super) { else { egw.open('', 'infolog', 'list', extras, 'infolog'); } - }; + } /** * Add task for selected contacts, call default nm_action after some checks * * @param _action * @param _senders */ - AddressbookApp.prototype.add_task = function (_action, _senders) { + add_task(_action, _senders) { if (!_senders[0].id.match(/^(addressbook::)?[0-9]+$/)) { // send org-view requests to server _action.data.nm_action = "submit"; @@ -470,18 +452,18 @@ var AddressbookApp = /** @class */ (function (_super) { _action.data.nm_action = "popup"; } nm_action(_action, _senders); - }; + } /** * Actions via ajax * * @param {egwAction} _action * @param {egwActionObject[]} _selected */ - AddressbookApp.prototype.action = function (_action, _selected) { + action(_action, _selected) { var _a, _b; - var all = (_a = _action.parent.data.nextmatch) === null || _a === void 0 ? void 0 : _a.getSelection().all; - var no_notifications = ((_b = _action.parent.getActionById("no_notifications")) === null || _b === void 0 ? void 0 : _b.checked) || false; - var ids = []; + let all = (_a = _action.parent.data.nextmatch) === null || _a === void 0 ? void 0 : _a.getSelection().all; + let no_notifications = ((_b = _action.parent.getActionById("no_notifications")) === null || _b === void 0 ? void 0 : _b.checked) || false; + let ids = []; // Loop so we get just the app's ID for (var i = 0; i < _selected.length; i++) { var id = _selected[i].id; @@ -492,14 +474,14 @@ var AddressbookApp = /** @class */ (function (_super) { egw.json("addressbook.addressbook_ui.ajax_action", [_action.id, ids, all, no_notifications]).sendRequest(true); break; } - }; + } /** * [More...] in phones clicked: copy allways shown phone numbers to phone popup * * @param {jQuery.event} _event * @param {et2_widget} _widget */ - AddressbookApp.prototype.showphones = function (_event, _widget) { + showphones(_event, _widget) { this._copyvalues({ tel_home: 'tel_home2', tel_work: 'tel_work2', @@ -509,14 +491,14 @@ var AddressbookApp = /** @class */ (function (_super) { jQuery('table.editphones').css('display', 'inline'); _event.stopPropagation(); return false; - }; + } /** * [OK] in phone popup clicked: copy phone numbers back to always shown ones * * @param {jQuery.event} _event * @param {et2_widget} _widget */ - AddressbookApp.prototype.hidephones = function (_event, _widget) { + hidephones(_event, _widget) { this._copyvalues({ tel_home2: 'tel_home', tel_work2: 'tel_work', @@ -526,13 +508,13 @@ var AddressbookApp = /** @class */ (function (_super) { jQuery('table.editphones').css('display', 'none'); _event.stopPropagation(); return false; - }; + } /** * Copy content of multiple fields * * @param {object} what object with src: dst pairs */ - AddressbookApp.prototype._copyvalues = function (what) { + _copyvalues(what) { for (var name in what) { var src = this.et2.getWidgetById(name); var dst = this.et2.getWidgetById(what[name]); @@ -546,17 +528,17 @@ var AddressbookApp = /** @class */ (function (_super) { if (typeof what[val] != 'undefined') tel_prefer.set_value(what[val]); } - }; + } /** * Callback function to create confirm dialog for duplicates contacts * * @param {object} _data includes duplicates contacts information * */ - AddressbookApp.prototype._confirmdialog_callback = function (_data) { + _confirmdialog_callback(_data) { var confirmdialog = function (_title, _value, _buttons, _egw_or_appname) { return et2_createWidget("dialog", { - callback: function (_buttons, _value) { + callback(_buttons, _value) { if (_buttons == et2_dialog.OK_BUTTON) { var id = ''; var content = this.template.widgetContainer.getArrayMgr('content').data; @@ -583,7 +565,7 @@ var AddressbookApp = /** @class */ (function (_super) { for (var id in _data.doublicates) { content.push({ "confirm": id, "name": _data.doublicates[id] }); } - confirmdialog(this.egw.lang('Duplicate warning'), content, et2_dialog.BUTTONs_OK_CANCEL); + confirmdialog(this.egw.lang('Duplicate warning'), content, et2_dialog.BUTTONS_OK_CANCEL); } if (typeof _data.fileas_options == 'object' && this.et2) { var selbox = this.et2.getWidgetById('fileas_type'); @@ -591,14 +573,14 @@ var AddressbookApp = /** @class */ (function (_super) { selbox.set_select_options(_data.fileas_sel_options); } } - }; + } /** * Callback if certain fields get changed * * @param {widget} widget widget * @param {string} own_id Current AB id */ - AddressbookApp.prototype.check_value = function (widget, own_id) { + check_value(widget, own_id) { // if we edit an account, call account_change to let it do it's stuff too if (this.et2.getWidgetById('account_lid')) { this.account_change(null, widget); @@ -621,8 +603,8 @@ var AddressbookApp = /** @class */ (function (_super) { name.set_value(value); } egw.json('addressbook.addressbook_ui.ajax_check_values', [values, widget.id, own_id], this._confirmdialog_callback, this, true, this).sendRequest(); - }; - AddressbookApp.prototype.show_custom_country = function (selectbox) { + } + show_custom_country(selectbox) { if (!selectbox) return; var custom_field_name = selectbox.id.replace("countrycode", "countryname"); @@ -645,14 +627,14 @@ var AddressbookApp = /** @class */ (function (_super) { if (region) { region.set_country_code(selectbox.value); } - }; + } /** * Add a new mailing list. If any contacts are selected, they will be added. * * @param {egwAction} owner * @param {egwActionObject[]} selected */ - AddressbookApp.prototype.add_new_list = function (owner, selected) { + add_new_list(owner, selected) { if (!owner || typeof owner == 'object') { var filter = this.et2.getWidgetById('filter'); owner = filter.getValue() || egw.preference('add_default', 'addressbook'); @@ -676,7 +658,7 @@ var AddressbookApp = /** @class */ (function (_super) { } } this._add_new_list_prompt(owner, contacts); - }; + } /** * Ask the user for a name, then create a new list with the provided contacts * in it. @@ -684,10 +666,10 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {int} owner * @param {String[]} contacts */ - AddressbookApp.prototype._add_new_list_prompt = function (owner, contacts) { + _add_new_list_prompt(owner, contacts) { var lists = this.et2.getWidgetById('filter2'); - var owner_options = this.et2.getArrayMgr('sel_options').getEntry('filter') || {}; - var callback = function (button, values) { + let owner_options = this.et2.getArrayMgr('sel_options').getEntry('filter') || {}; + let callback = function (button, values) { if (button == et2_dialog.OK_BUTTON) { egw.json('addressbook.addressbook_ui.ajax_set_list', [0, values.name, values.owner, contacts], function (result) { if (typeof result == 'object') @@ -714,7 +696,7 @@ var AddressbookApp = /** @class */ (function (_super) { }).sendRequest(true); } }; - var dialog = et2_createWidget("dialog", { + let dialog = et2_createWidget("dialog", { callback: callback, title: this.egw.lang('Add a new list'), buttons: et2_dialog.BUTTONS_OK_CANCEL, @@ -730,7 +712,7 @@ var AddressbookApp = /** @class */ (function (_super) { class: "et2_prompt", minWidth: 400 }, this.et2); - }; + } /** * Rename the current distribution list selected in the nextmatch filter2 * @@ -740,7 +722,7 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {egwAction} action Action selected in context menu (rename) * @param {egwActionObject[]} selected The selected row(s). Not used for this. */ - AddressbookApp.prototype.rename_list = function (action, selected) { + rename_list(action, selected) { var lists = this.et2.getWidgetById('filter2'); var list = lists.getValue() || 0; var value = null; @@ -762,11 +744,11 @@ var AddressbookApp = /** @class */ (function (_super) { }).sendRequest(true); } }, this.egw.lang('Name for the distribution list'), this.egw.lang('Rename list'), value.label); - }; + } /** * OnChange for distribution list selectbox */ - AddressbookApp.prototype.filter2_onchange = function () { + filter2_onchange() { var filter = this.et2.getWidgetById('filter'); var filter2 = this.et2.getWidgetById('filter2'); var widget = this.et2.getWidgetById('nm'); @@ -786,11 +768,11 @@ var AddressbookApp = /** @class */ (function (_super) { return false; } return true; - }; + } /** * Method to enable actions by comparing a field with given value */ - AddressbookApp.prototype.nm_compare_field = function () { + nm_compare_field() { var field = this.et2.getWidgetById('filter2'); if (field) var val = field.get_value(); @@ -800,13 +782,13 @@ var AddressbookApp = /** @class */ (function (_super) { else { return false; } - }; + } /** * Apply advanced search filters to index nextmatch * * @param {object} filters */ - AddressbookApp.prototype.adv_search = function (filters) { + adv_search(filters) { var index = window.opener.etemplate2.getById('addressbook-index'); if (!index) { alert('Could not find index'); @@ -823,14 +805,14 @@ var AddressbookApp = /** @class */ (function (_super) { nm.activeFilters = {}; nm.applyFilters(filters); return false; - }; + } /** * Mail vCard * * @param {object} _action * @param {array} _elems */ - AddressbookApp.prototype.adb_mail_vcard = function (_action, _elems) { + adb_mail_vcard(_action, _elems) { var link = { 'preset[type]': [], 'preset[file]': [] }; var content = { data: { files: { file: [], type: [] } } }; var nm = this.et2.getWidgetById('nm'); @@ -855,19 +837,19 @@ var AddressbookApp = /** @class */ (function (_super) { return; } } - }; + } /** * Action function to set business or private mail checkboxes to user preferences * * @param {egwAction} action Action user selected. */ - AddressbookApp.prototype.mailCheckbox = function (action) { + mailCheckbox(action) { var preferences = { business: action.getManager().getActionById('email_business').checked ? true : false, private: action.getManager().getActionById('email_home').checked ? true : false }; this.egw.set_preference('addressbook', 'preferredMail', preferences); - }; + } /** * Action function to add the email address (business or home) of the selected * contacts to a compose email popup window. @@ -878,7 +860,7 @@ var AddressbookApp = /** @class */ (function (_super) { * 'email_business' or 'email_home', from server side definition of actions. * @param {egwActionObject[]} selected Selected rows */ - AddressbookApp.prototype.addEmail = function (action, selected) { + addEmail(action, selected) { // Check for all selected. var nm = this.et2.getWidgetById('nm'); if (fetchAll(selected, nm, jQuery.proxy(function (ids) { @@ -921,7 +903,7 @@ var AddressbookApp = /** @class */ (function (_super) { break; } return false; - }; + } /** * Merge the selected contacts into the target document. * @@ -931,7 +913,7 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {egwAction} action - The document they clicked * @param {egwActionObject[]} selected - Rows selected */ - AddressbookApp.prototype.merge_mail = function (action, selected, target) { + merge_mail(action, selected, target) { // Special processing for email documents - ask about infolog if (action && action.data && selected.length > 1) { var callback = function (button, value) { @@ -956,7 +938,7 @@ var AddressbookApp = /** @class */ (function (_super) { // Normal processing for only one contact selected return nm_action(action, selected, target); } - }; + } /** * Retrieve the current state of the application for future restoration * @@ -965,12 +947,12 @@ var AddressbookApp = /** @class */ (function (_super) { * * @return {object} Application specific map representing the current state */ - AddressbookApp.prototype.getState = function () { + getState() { // Most likely we're in the list view - var state = _super.prototype.getState.call(this); + var state = super.getState(); if (jQuery.isEmptyObject(state)) { // Not in a list view. Try to find contact ID - var etemplates = etemplate2_1.etemplate2.getByApplication('addressbook'); + var etemplates = etemplate2.getByApplication('addressbook'); for (var i = 0; i < etemplates.length; i++) { var content = etemplates[i].widgetContainer.getArrayMgr("content"); if (content && content.getEntry('id')) { @@ -980,7 +962,7 @@ var AddressbookApp = /** @class */ (function (_super) { } } return state; - }; + } /** * Set the application's state to the given state. * @@ -992,7 +974,7 @@ var AddressbookApp = /** @class */ (function (_super) { * * @return {boolean} false - Returns false to stop event propagation */ - AddressbookApp.prototype.setState = function (state, template) { + setState(state, template) { var current_state = this.getState(); // State should be an object, not a string, but we'll parse if (typeof state == "string") { @@ -1010,11 +992,11 @@ var AddressbookApp = /** @class */ (function (_super) { } else if (jQuery.isEmptyObject(state)) { // Regular handling first to clear everything but advanced search - _super.prototype.setState.call(this, state); + super.setState(state); // Clear advanced search, which is in session and etemplate egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search', [], function () { framework.setWebsiteTitle('addressbook', ''); - var index = etemplate2_1.etemplate2.getById('addressbook-index'); + var index = etemplate2.getById('addressbook-index'); if (index && index.widgetContainer) { var nm = index.widgetContainer.getWidgetById('nm'); if (nm) { @@ -1029,7 +1011,7 @@ var AddressbookApp = /** @class */ (function (_super) { else if (state.state.grouped_view) { // Deal with grouped views that are not valid (not in list of options) // by faking viewing that organisation - var index = etemplate2_1.etemplate2.getById('addressbook-index'); + var index = etemplate2.getById('addressbook-index'); if (index && index.widgetContainer) { var grouped = index.widgetContainer.getWidgetById('grouped_view'); var options; @@ -1055,15 +1037,15 @@ var AddressbookApp = /** @class */ (function (_super) { if (typeof state.state.advanced_search === 'undefined') { state.state.advanced_search = false; } - return _super.prototype.setState.call(this, state); - }; + return super.setState(state); + } /** * Field changed, call server validation * * @param {jQuery.Event} _ev * @param {et2_button} _widget */ - AddressbookApp.prototype.account_change = function (_ev, _widget) { + account_change(_ev, _widget) { switch (_widget.id) { case 'account_passwd': case 'account_lid': @@ -1089,16 +1071,16 @@ var AddressbookApp = /** @class */ (function (_super) { }, this).sendRequest(); break; } - }; + } /** * Get title in order to set it as document title * @returns {string} */ - AddressbookApp.prototype.getWindowTitle = function () { + getWindowTitle() { var widget = this.et2.getWidgetById('n_fn'); if (widget) return widget.options.value; - }; + } /** * Enable/Disable geolocation action items in contextmenu base on address availabilty * @@ -1106,7 +1088,7 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {egwActionObject[]} _selected selected rows * @returns {boolean} return false if no address found */ - AddressbookApp.prototype.geoLocation_enabled = function (_action, _selected) { + geoLocation_enabled(_action, _selected) { // multiple selection is not supported if (_selected.length > 1) return false; @@ -1132,7 +1114,7 @@ var AddressbookApp = /** @class */ (function (_super) { fields += addrs[i] ? addrs[i] : ''; } return (url !== '' && fields !== '') ? true : false; - }; + } /** * Generate a geo location URL based on geolocation_url in * site configuration @@ -1143,7 +1125,7 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {string} _src_type type of source address ('browser'|'one'|'two') * @returns {Boolean|string} return url and return false if no address */ - AddressbookApp.prototype.geoLocationUrl = function (_dest_data, _dest_type, _src_data, _src_type) { + geoLocationUrl(_dest_data, _dest_type, _src_data, _src_type) { var dest_type = _dest_type || 'one'; var url = this.getGeolocationConfig(); // exit if no url or invalide url given @@ -1185,14 +1167,14 @@ var AddressbookApp = /** @class */ (function (_super) { } } return url !== '' ? url : false; - }; + } /** * Open a popup base on selected address in provided map * * @param {object} _action * @param {object} _selected */ - AddressbookApp.prototype.geoLocationExec = function (_action, _selected) { + geoLocationExec(_action, _selected) { var content = egw.dataGetUIDdata(_selected[0].id); var geolocation_src = egw.preference('geolocation_src', 'addressbook'); var self = this; @@ -1210,13 +1192,13 @@ var AddressbookApp = /** @class */ (function (_super) { window.open(url, '_blank'); }).sendRequest(); } - }; + } /** * Get geolocation_url stored in config|default url * * @returns {String} */ - AddressbookApp.prototype.getGeolocationConfig = function () { + getGeolocationConfig() { // This default url should be identical to the first value of geolocation_url array // defined in addressbook_hooks::config var default_url = 'https://maps.here.com/directions/drive{{%rs=/%rs}}%r0,%t0,%z0,%c0{{%d=/%d}}%r1,%t1,%z1+%c1'; @@ -1224,19 +1206,19 @@ var AddressbookApp = /** @class */ (function (_super) { if (geo_url) geo_url = geo_url[0]; return geo_url || default_url; - }; + } /** * Check to see if the selection contains at most one account * * @param {egwAction} action * @param {egwActionObject[]} selected Selected rows */ - AddressbookApp.prototype.can_merge = function (action, selected) { + can_merge(action, selected) { return selected.filter(function (row) { var data = egw.dataGetUIDdata(row.id); return data && data.data.account_id; }).length <= 1; - }; + } /** * Check if the share action is enabled for this entry * This only works for single contacts @@ -1246,29 +1228,29 @@ var AddressbookApp = /** @class */ (function (_super) { * @param {egwActionObject} _target * @returns {boolean} if action is enabled */ - AddressbookApp.prototype.is_share_enabled = function (_action, _entries, _target) { + is_share_enabled(_action, _entries, _target) { var enabled = true; for (var i = 0; i < _entries.length; i++) { - var id = _entries[i].id.split('::'); + let id = _entries[i].id.split('::'); if (isNaN(id[1])) { return false; } } return enabled; - }; + } /** * Check if selected user(s) is online then enable action * @param _action * @param _selected */ - AddressbookApp.prototype.videoconference_isUserOnline = function (_action, _selected) { - var list = app.status ? app.status.getEntireList() : {}; - for (var sel in _selected) { + videoconference_isUserOnline(_action, _selected) { + let list = app.status ? app.status.getEntireList() : {}; + for (let sel in _selected) { if (sel == '0' && _selected[sel]['id'] == 'nm') continue; - var row = egw.dataGetUIDdata(_selected[sel]['id']); - var enabled = false; - for (var entry in list) { + let row = egw.dataGetUIDdata(_selected[sel]['id']); + let enabled = false; + for (let entry in list) { if (row.data && row.data.account_id && row.data.account_id == list[entry]['account_id']) { enabled = list[entry]['data']['status']['active']; } @@ -1277,19 +1259,19 @@ var AddressbookApp = /** @class */ (function (_super) { return false; } return true; - }; - AddressbookApp.prototype.videoconference_isThereAnyCall = function (_action, _selected) { + } + videoconference_isThereAnyCall(_action, _selected) { return this.videoconference_isUserOnline(_action, _selected) && egw.getSessionItem('status', 'videoconference-session'); - }; + } /** * Call action * @param _action * @param _selected */ - AddressbookApp.prototype.videoconference_actionCall = function (_action, _selected) { - var data = []; - for (var sel in _selected) { - var row = egw.dataGetUIDdata(_selected[sel]['id']); + videoconference_actionCall(_action, _selected) { + let data = []; + for (let sel in _selected) { + let row = egw.dataGetUIDdata(_selected[sel]['id']); data.push({ id: row.data.account_id, name: row.data.n_fn, @@ -1303,29 +1285,28 @@ var AddressbookApp = /** @class */ (function (_super) { else { app.status.makeCall(data); } - }; + } /** * Check if new shared_with value is allowed / user has rights to share into that AB * * Remove the entry again, if user is not allowed */ - AddressbookApp.prototype.shared_changed = function () { - var shared = this.et2.getInputWidgetById('shared_values'); - var value = shared === null || shared === void 0 ? void 0 : shared.get_value(); + shared_changed() { + let shared = this.et2.getInputWidgetById('shared_values'); + let value = shared === null || shared === void 0 ? void 0 : shared.get_value(); if (value) { this.egw.json('addressbook.addressbook_ui.ajax_check_shared', [{ contact: this.et2.getInstanceManager().getValues(this.et2), shared_values: value, shared_writable: this.et2.getInputWidgetById('shared_writable').get_value() - }], function (_data) { + }], _data => { if (Array.isArray(_data) && _data.length) { // remove not allowed entries - shared.set_value(value.filter(function (val) { return _data.indexOf(val) === -1; })); + shared.set_value(value.filter(val => _data.indexOf(val) === -1)); } }).sendRequest(); } - }; - return AddressbookApp; -}(egw_app_1.EgwApp)); + } +} app.classes.addressbook = AddressbookApp; //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts index 9533d0cf6f..e447e52864 100644 --- a/addressbook/js/app.ts +++ b/addressbook/js/app.ts @@ -3,8 +3,9 @@ * * @link: https://www.egroupware.org * @package addressbook - * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Hadi Nategh + * @author Ralf Becker + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ @@ -14,11 +15,12 @@ import 'jquery'; import 'jqueryui'; -import '../jsapi/egw_global'; -import '../etemplate/et2_types'; import {EgwApp, PushData} from '../../api/js/jsapi/egw_app'; import {etemplate2} from "../../api/js/etemplate/etemplate2"; +import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog"; +import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox"; +import {fetchALL} from "../../api/js/etemplate/et2_extension_nextmatch_actions.js"; /** * Object to call app.addressbook.openCRMview with @@ -695,11 +697,11 @@ class AddressbookApp extends EgwApp { content.push({"confirm":id,"name":_data.doublicates[id]}); } - confirmdialog(this.egw.lang('Duplicate warning'),content,et2_dialog.BUTTONs_OK_CANCEL); + confirmdialog(this.egw.lang('Duplicate warning'),content,et2_dialog.BUTTONS_OK_CANCEL); } if (typeof _data.fileas_options == 'object' && this.et2) { - var selbox = this.et2.getWidgetById('fileas_type'); + var selbox = this.et2.getWidgetById('fileas_type'); if (selbox) { selbox.set_select_options(_data.fileas_sel_options); diff --git a/api/js/egw_action/egw_action_common.js b/api/js/egw_action/egw_action_common.js index a4e62dbdb3..ba886f1e95 100644 --- a/api/js/egw_action/egw_action_common.js +++ b/api/js/egw_action/egw_action_common.js @@ -6,9 +6,10 @@ * @copyright 2011 by Andreas Stöckel * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package egw_action - * @version $Id$ */ +import {EGW_AO_SHIFT_STATE_BLOCK, EGW_AO_SHIFT_STATE_MULTI, EGW_AO_SHIFT_STATE_NONE} from "./egw_action.js"; + /** * Sets properties given in _data in _obj. Checks whether the property keys * exists and if corresponding setter functions are available. Properties starting diff --git a/api/js/egw_action/egw_action_popup.js b/api/js/egw_action/egw_action_popup.js index 401be94624..52538fffaa 100644 --- a/api/js/egw_action/egw_action_popup.js +++ b/api/js/egw_action/egw_action_popup.js @@ -15,7 +15,8 @@ /api/js/jquery/jquery-tap-and-hold/jquery.tapandhold.js; */ -import {egwAction, egwActionImplementation} from './egw_action.js'; +import {egwAction, egwActionImplementation, egwActionObject} from './egw_action.js'; +import {egwFnct} from './egw_action_common.js'; import {egwMenu, _egw_active_menu} from "./egw_menu.js"; import '../jquery/jquery-tap-and-hold/jquery.tapandhold.js'; diff --git a/api/js/etemplate/et2_dataview_view_grid.js b/api/js/etemplate/et2_dataview_view_grid.js index cf408a60e0..e4db6c56ab 100644 --- a/api/js/etemplate/et2_dataview_view_grid.js +++ b/api/js/etemplate/et2_dataview_view_grid.js @@ -16,6 +16,7 @@ et2_dataview_view_container; et2_dataview_view_spacer; */ +import { et2_implements_registry } from "./et2_core_interfaces"; import { et2_dataview_IViewRange } from "./et2_dataview_interfaces"; import { et2_dataview_container } from "./et2_dataview_view_container"; import { et2_dataview_spacer } from "./et2_dataview_view_spacer"; @@ -551,7 +552,7 @@ export class et2_dataview_grid extends et2_dataview_container { const container = this._map[i]; // Check which type the container object has const isSpacer = container instanceof et2_dataview_spacer; - const hasIViewRange = !isSpacer && container.implements(et2_dataview_IViewRange); + const hasIViewRange = !isSpacer && et2_implements_registry.et2_dataview_IViewRange(container, et2_dataview_IViewRange); // If the container has one of those special types, calculate the // view range and use that to update the view range of the element // or to request new elements for the spacer diff --git a/api/js/etemplate/et2_dataview_view_grid.ts b/api/js/etemplate/et2_dataview_view_grid.ts index ab1b81abd0..4bdb04c2a1 100644 --- a/api/js/etemplate/et2_dataview_view_grid.ts +++ b/api/js/etemplate/et2_dataview_view_grid.ts @@ -18,6 +18,7 @@ et2_dataview_view_spacer; */ +import {et2_implements_registry} from "./et2_core_interfaces"; import {et2_dataview_IViewRange} from "./et2_dataview_interfaces"; import {et2_dataview_container} from "./et2_dataview_view_container"; import {et2_dataview_spacer} from "./et2_dataview_view_spacer"; @@ -795,7 +796,7 @@ export class et2_dataview_grid extends et2_dataview_container implements et2_dat // Check which type the container object has const isSpacer = container instanceof et2_dataview_spacer; - const hasIViewRange = !isSpacer && container.implements(et2_dataview_IViewRange); + const hasIViewRange = !isSpacer && et2_implements_registry.et2_dataview_IViewRange(container, et2_dataview_IViewRange); // If the container has one of those special types, calculate the // view range and use that to update the view range of the element diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 03684ea68b..0d9e72967e 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -269,7 +269,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 // Sub-objects used for actual work private readonly header: et2_nextmatch_header_bar; dataview: any; - private controller: any; + controller: any; private rowProvider: any; diff --git a/api/js/etemplate/et2_extension_nextmatch_controller.js b/api/js/etemplate/et2_extension_nextmatch_controller.js index 1e617e61c1..6016e740f6 100644 --- a/api/js/etemplate/et2_extension_nextmatch_controller.js +++ b/api/js/etemplate/et2_extension_nextmatch_controller.js @@ -14,6 +14,8 @@ import { et2_dataview_controller } from "./et2_dataview_controller"; import { et2_dataview_column } from "./et2_dataview_model_columns"; import { framework } from "../jsapi/egw_global"; import { egw_getActionManager, egw_getObjectManager, egwActionObjectManager, egwActionObject, EGW_AO_FLAG_DEFAULT_FOCUS, EGW_AO_EXEC_SELECTED, EGW_AO_FLAG_IS_CONTAINER } from "../egw_action/egw_action.js"; +import { nm_action } from "./et2_extension_nextmatch_actions.js"; +import { egwIsMobile } from "../egw_action/egw_action_common.js"; /** * @augments et2_dataview_controller */ diff --git a/api/js/etemplate/et2_extension_nextmatch_controller.ts b/api/js/etemplate/et2_extension_nextmatch_controller.ts index c79e9e9334..a952749e40 100644 --- a/api/js/etemplate/et2_extension_nextmatch_controller.ts +++ b/api/js/etemplate/et2_extension_nextmatch_controller.ts @@ -38,6 +38,8 @@ import { EGW_AO_FLAG_DEFAULT_FOCUS, EGW_AO_EXEC_SELECTED, EGW_AO_FLAG_IS_CONTAINER } from "../egw_action/egw_action.js"; +import {nm_action} from "./et2_extension_nextmatch_actions.js"; +import {egwIsMobile} from "../egw_action/egw_action_common.js"; /** * @augments et2_dataview_controller diff --git a/api/js/jsapi/egw_files.js b/api/js/jsapi/egw_files.js index d897978464..ae61dc0d74 100644 --- a/api/js/jsapi/egw_files.js +++ b/api/js/jsapi/egw_files.js @@ -160,7 +160,10 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd) if (_jsFiles.length === 1) // running this in below case fails when loading app.js from etemplate.load() { const src = _jsFiles[0]; - promise = import(_prefix ? _prefix+src : src); + promise = import(_prefix ? _prefix+src : src) + .catch((err) => { + console.log(src+":\n\n"+err.message); + }); } else { diff --git a/infolog/js/app.js b/infolog/js/app.js index 0664ec98f5..b4e05d3ecb 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -1,4 +1,3 @@ -"use strict"; /** * EGroupware - Infolog - Javascript UI * @@ -8,60 +7,41 @@ * @copyright (c) 2008-13 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); /*egw:uses /api/js/jsapi/egw_app.js */ -require("jquery"); -require("jqueryui"); -require("../jsapi/egw_global"); -require("../etemplate/et2_types"); -var egw_app_1 = require("../../api/js/jsapi/egw_app"); -var etemplate2_1 = require("../../api/js/etemplate/etemplate2"); -var CRM_1 = require("../../addressbook/js/CRM"); +import 'jquery'; +import 'jqueryui'; +import { EgwApp } from '../../api/js/jsapi/egw_app'; +import { etemplate2 } from "../../api/js/etemplate/etemplate2"; +import { CRMView } from "../../addressbook/js/CRM"; /** * UI for Infolog * * @augments AppJS */ -var InfologApp = /** @class */ (function (_super) { - __extends(InfologApp, _super); +class InfologApp extends EgwApp { /** * Constructor * * @memberOf app.infolog */ - function InfologApp() { - var _this = + constructor() { // call parent - _super.call(this, 'infolog') || this; + super('infolog'); // These fields help with push filtering & access control to see if we care about a push message - _this.push_grant_fields = ["info_owner", "info_responsible"]; - _this.push_filter_fields = ["info_owner", "info_responsible"]; - _this._action_ids = []; - _this._action_all = false; - return _this; + this.push_grant_fields = ["info_owner", "info_responsible"]; + this.push_filter_fields = ["info_owner", "info_responsible"]; + this._action_ids = []; + this._action_all = false; } /** * Destructor */ - InfologApp.prototype.destroy = function (_app) { + destroy(_app) { // call parent - _super.prototype.destroy.call(this, _app); - }; + super.destroy(_app); + } /** * This function is called when the etemplate2 object is loaded * and ready. If you must store a reference to the et2 object, @@ -70,13 +50,13 @@ var InfologApp = /** @class */ (function (_super) { * @param {etemplate2} _et2 newly ready object * @param {string} _name template name */ - InfologApp.prototype.et2_ready = function (_et2, _name) { + et2_ready(_et2, _name) { var _a; // call parent - _super.prototype.et2_ready.call(this, _et2, _name); + super.et2_ready(_et2, _name); // CRM View - if (typeof CRM_1.CRMView !== "undefined") { - CRM_1.CRMView.view_ready(_et2, this); + if (typeof CRMView !== "undefined") { + CRMView.view_ready(_et2, this); } switch (_name) { case 'infolog.index': @@ -124,7 +104,7 @@ var InfologApp = /** @class */ (function (_super) { } break; } - }; + } /** * Observer method receives update notifications from all applications * @@ -144,7 +124,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {object|null} _links app => array of ids of linked entries * or null, if not triggered on server-side, which adds that info */ - InfologApp.prototype.observer = function (_msg, _app, _id, _type, _msg_type, _links) { + observer(_msg, _app, _id, _type, _msg_type, _links) { if (typeof _links != 'undefined') { if (typeof _links.infolog != 'undefined') { switch (_app) { @@ -160,7 +140,7 @@ var InfologApp = /** @class */ (function (_super) { if (_app == 'infolog' && this.et2.getInstanceManager() && this.et2.getInstanceManager().app == 'addressbook' && this.et2.getInstanceManager().name == 'infolog.index') { this.et2._inst.refresh(_msg, _app, _id, _type); } - }; + } /** * Retrieve the current state of the application for future restoration * @@ -169,23 +149,23 @@ var InfologApp = /** @class */ (function (_super) { * * @return {object} Application specific map representing the current state */ - InfologApp.prototype.getState = function () { - var state = { + getState() { + let state = { action: null, action_id: null }; - var nm = {}; + let nm = {}; // Get index etemplate - var et2 = etemplate2_1.etemplate2.getById('infolog-index'); + var et2 = etemplate2.getById('infolog-index'); if (et2) { state = et2.widgetContainer.getWidgetById("nm").getValue(); - var content = et2.widgetContainer.getArrayMgr('content'); + let content = et2.widgetContainer.getArrayMgr('content'); nm = content && content.data && content.data.nm ? content.data.nm : {}; } state.action = nm.action || null; state.action_id = nm.action_id || null; return state; - }; + } /** * Set the application's state to the given state. * @@ -196,7 +176,7 @@ var InfologApp = /** @class */ (function (_super) { * * @return {boolean} false - Returns false to stop event propagation */ - InfologApp.prototype.setState = function (state) { + setState(state) { // as we have to set state.state.action, we have to set all other // for "No filter" favorite to work as expected var to_set = { col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null }; @@ -206,15 +186,15 @@ var InfologApp = /** @class */ (function (_super) { if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name]; } - return _super.prototype.setState.call(this, state); - }; + return super.setState(state); + } /** * Enable or disable the date filter * * If the filter is set to something that needs dates, we enable the * header_left template. Otherwise, it is disabled. */ - InfologApp.prototype.filter_change = function () { + filter_change() { var filter = this.et2.getWidgetById('filter'); var nm = this.et2.getWidgetById('nm'); var dates = this.et2.getWidgetById('infolog.index.dates'); @@ -236,7 +216,7 @@ var InfologApp = /** @class */ (function (_super) { break; } } - }; + } /** * show or hide the details of rows by selecting the filter2 option * either 'all' for details or 'no_description' for no details @@ -244,7 +224,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {Event} event Change event * @param {et2_nextmatch} nm The nextmatch widget that owns the filter */ - InfologApp.prototype.filter2_change = function (event, nm) { + filter2_change(event, nm) { var filter2 = nm.getWidgetById('filter2'); if (nm && filter2) { // Show / hide descriptions @@ -282,21 +262,21 @@ var InfologApp = /** @class */ (function (_super) { nm.update_in_progress = in_progress; } return false; - }; + } /** * Show or hide details by changing the CSS class * * @param {boolean} show * @param {DOMNode} dom_node */ - InfologApp.prototype.show_details = function (show, dom_node) { + show_details(show, dom_node) { // Show / hide descriptions egw.css((dom_node && dom_node.id ? "#" + dom_node.id + ' ' : '') + ".et2_box.infoDes", "display:" + (show ? "block;" : "none;")); if (egwIsMobile()) { var $select = jQuery('.infoDetails'); (show) ? $select.each(function (i, e) { jQuery(e).hide(); }) : $select.each(function (i, e) { jQuery(e).show(); }); } - }; + } /** * Confirm delete * If entry has children, asks if you want to delete children too @@ -304,14 +284,14 @@ var InfologApp = /** @class */ (function (_super) { *@param _action *@param _senders */ - InfologApp.prototype.confirm_delete = function (_action, _senders) { + confirm_delete(_action, _senders) { var _a; - var children = false; - var child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0); + let children = false; + let child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0); this._action_all = (_a = _action.parent.data.nextmatch) === null || _a === void 0 ? void 0 : _a.getSelection().all; this._action_ids = []; if (child_button) { - for (var i = 0; i < _senders.length; i++) { + for (let i = 0; i < _senders.length; i++) { this._action_ids.push(_senders[i].id.split("::").pop()); if (jQuery(_senders[i].iface.getDOMNode()).hasClass('infolog_rowHasSubs')) { children = true; @@ -321,22 +301,22 @@ var InfologApp = /** @class */ (function (_super) { child_button.style.display = children ? 'block' : 'none'; } nm_open_popup(_action, _senders); - }; + } /** * Callback for action using ids set(!) in this._action_ids and this._action_all * * @param _action */ - InfologApp.prototype.actionCallback = function (_action) { + actionCallback(_action) { egw.json("infolog.infolog_ui.ajax_action", [_action, this._action_ids, this._action_all]).sendRequest(true); - }; + } /** * Add email from addressbook * * @param ab_id * @param info_cc */ - InfologApp.prototype.add_email_from_ab = function (ab_id, info_cc) { + add_email_from_ab(ab_id, info_cc) { var ab = document.getElementById(ab_id); if (!ab || !ab.value) { jQuery("tr.hiddenRow").css("display", "table-row"); @@ -354,7 +334,7 @@ var InfologApp = /** @class */ (function (_super) { } } return false; - }; + } /** * If one of info_status, info_percent or info_datecompleted changed --> set others to reasonable values * @@ -363,7 +343,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {string} percent_id * @param {string} datecompleted_id */ - InfologApp.prototype.status_changed = function (changed_id, status_id, percent_id, datecompleted_id) { + status_changed(changed_id, status_id, percent_id, datecompleted_id) { // Make sure this doesn't get executed while template is loading if (this.et2 == null || this.et2.getInstanceManager() == null) return; @@ -415,13 +395,13 @@ var InfologApp = /** @class */ (function (_super) { else if (completed && datecompleted && datecompleted.value == '') { // todo: set current date in correct format } - }; + } /** * handle "print" action from "Actions" selectbox in edit infolog window. * check if the template is dirty then submit the template otherwise just open new window as print. * */ - InfologApp.prototype.edit_actions = function () { + edit_actions() { var widget = this.et2.getWidgetById('action'); var template = this.et2._inst; if (template) { @@ -442,21 +422,21 @@ var InfologApp = /** @class */ (function (_super) { template.submit(); } } - }; + } /** * Open infolog entry for printing * * @param {aciton object} _action * @param {object} _selected */ - InfologApp.prototype.infolog_menu_print = function (_action, _selected) { + infolog_menu_print(_action, _selected) { var id = _selected[0].id.replace(/^infolog::/g, ''); egw.open(id, 'infolog', 'edit', { print: 1 }); - }; + } /** * Trigger print() onload window */ - InfologApp.prototype.infolog_print_preview_onload = function () { + infolog_print_preview_onload() { var that = this; jQuery('#infolog-edit-print').bind('load', function () { var isLoadingCompleted = true; @@ -474,20 +454,20 @@ var InfologApp = /** @class */ (function (_super) { } }, 100); }); - }; + } /** * Trigger print() function to print the current window */ - InfologApp.prototype.infolog_print_preview = function () { + infolog_print_preview() { this.egw.message(this.egw.lang('Printing...')); this.egw.window.print(); - }; + } /** * */ - InfologApp.prototype.add_link_sidemenu = function () { + add_link_sidemenu() { egw.open('', 'infolog', 'add'); - }; + } /** * Wrapper so add -> New actions in the context menu can pass current * filter values into new edit dialog @@ -497,12 +477,12 @@ var InfologApp = /** @class */ (function (_super) { * @param {egwAction} action * @param {egwActionObject[]} selected */ - InfologApp.prototype.add_action_handler = function (action, selected) { + add_action_handler(action, selected) { var nm = action.getManager().data.nextmatch || false; if (nm) { this.add_with_extras(nm, action.id, nm.getArrayMgr('content').getEntry('action'), nm.getArrayMgr('content').getEntry('action_id')); } - }; + } /** * Opens a new edit dialog with some extra url parameters pulled from * standard locations. Done with a function instead of hardcoding so @@ -513,7 +493,7 @@ var InfologApp = /** @class */ (function (_super) { * @param _action string Special action for new infolog entry * @param _action_id string ID for special action */ - InfologApp.prototype.add_with_extras = function (widget, _type, _action, _action_id) { + add_with_extras(widget, _type, _action, _action_id) { // We use widget.getRoot() instead of this.et2 for the case when the // addressbook tab is viewing a contact + infolog list, there's 2 infolog // etemplates @@ -542,23 +522,23 @@ var InfologApp = /** @class */ (function (_super) { action_id: typeof action_id.join != "undefined" ? action_id.join(',') : action_id }; egw.open('', 'infolog', 'add', extras); - }; + } /** * Get title in order to set it as document title * @returns {string} */ - InfologApp.prototype.getWindowTitle = function () { + getWindowTitle() { var widget = this.et2.getWidgetById('info_subject'); if (widget) return widget.options.value; - }; + } /** * View parent entry with all children * * @param {aciton object} _action * @param {object} _selected */ - InfologApp.prototype.view_parent = function (_action, _selected) { + view_parent(_action, _selected) { var data = egw.dataGetUIDdata(_selected[0].id); if (data && data.data && data.data.info_id_parent) { egw.link_handler(egw.link('/index.php', { @@ -568,7 +548,7 @@ var InfologApp = /** @class */ (function (_super) { ajax: "true" }), "infolog"); } - }; + } /** * Mess with the query for parent widget to exclude self * @@ -576,7 +556,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {et2_link_entry} widget * @returns {boolean} */ - InfologApp.prototype.parent_query = function (request, widget) { + parent_query(request, widget) { // No ID yet, no need to filter if (!widget.getRoot().getArrayMgr('content').getEntry('info_id')) { return true; @@ -587,7 +567,7 @@ var InfologApp = /** @class */ (function (_super) { // Exclude self from results - no app needed since it's just one app request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')]; return true; - }; + } /** * View a list of timesheets for the linked infolog entry * @@ -596,7 +576,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {egwAction} _action * @param {egwActionObject[]} _selected */ - InfologApp.prototype.timesheet_list = function (_action, _selected) { + timesheet_list(_action, _selected) { var extras = { link_app: 'infolog', link_id: false @@ -610,17 +590,17 @@ var InfologApp = /** @class */ (function (_super) { break; } egw.open("", "timesheet", "list", extras, 'timesheet'); - }; + } /** * Go to parent entry * * @param {aciton object} _action * @param {object} _selected */ - InfologApp.prototype.has_parent = function (_action, _selected) { + has_parent(_action, _selected) { var data = egw.dataGetUIDdata(_selected[0].id); return data && data.data && data.data.info_id_parent > 0; - }; + } /** * Submit template if widget has a value * @@ -629,10 +609,10 @@ var InfologApp = /** @class */ (function (_super) { * @param {DOMNode} _node * @param {et2_widget} _widget */ - InfologApp.prototype.submit_if_not_empty = function (_node, _widget) { + submit_if_not_empty(_node, _widget) { if (_widget.get_value()) this.et2._inst.submit(); - }; + } /** * Toggle encryption * @@ -640,13 +620,13 @@ var InfologApp = /** @class */ (function (_super) { * @param {et2_button} _widget * @param {DOMNode} _node */ - InfologApp.prototype.toggleEncrypt = function (_event, _widget, _node) { + toggleEncrypt(_event, _widget, _node) { if (!this.egw.user('apps').stylite) { this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription') + ': www.egroupware.org/EPL'); return; } this._get_stylite(function () { app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node); }); - }; + } /** * Make sure stylite javascript is loaded, and call the given callback when it is * @@ -654,11 +634,12 @@ var InfologApp = /** @class */ (function (_super) { * @param {object} attrs * */ - InfologApp.prototype._get_stylite = function (callback, attrs) { + _get_stylite(callback, attrs) { // use app object from etemplate2, which might be private and not just window.app var app = this.et2.getInstanceManager().app_obj; if (!app.stylite) { var self = this; + // @ToDo: @new-js-loader egw_LAB.script('stylite/js/app.js?' + this.et2.getArrayMgr('content').getEntry('encryption_ts')).wait(function () { app.stylite = new app.classes.stylite; app.stylite.et2 = self.et2; @@ -671,18 +652,18 @@ var InfologApp = /** @class */ (function (_super) { app.stylite.et2 = this.et2; callback.apply(app.stylite, attrs); } - }; + } /** * OnChange callback for responsible * * @param {jQuery.Event} _event * @param {et2_widget} _widget */ - InfologApp.prototype.onchangeResponsible = function (_event, _widget) { + onchangeResponsible(_event, _widget) { if (app.stylite && app.stylite.onchangeResponsible) { app.stylite.onchangeResponsible.call(app.stylite, _event, _widget); } - }; + } /** * Action handler for context menu change responsible action * @@ -691,7 +672,7 @@ var InfologApp = /** @class */ (function (_super) { * @param {egwAction} _action * @param {egwActionObject[]} _selected */ - InfologApp.prototype.change_responsible = function (_action, _selected) { + change_responsible(_action, _selected) { var et2 = _selected[0].manager.data.nextmatch.getInstanceManager(); var responsible = et2.widgetContainer.getWidgetById('responsible'); if (responsible) { @@ -711,14 +692,14 @@ var InfologApp = /** @class */ (function (_super) { } } nm_open_popup(_action, _selected); - }; + } /** * Handle encrypted info_desc for print purpose * and triggers print action after decryption * * @param {Keyring} _keyring Mailvelope keyring to use */ - InfologApp.prototype.printEncrypt = function (_keyring) { + printEncrypt(_keyring) { //this.mailvelopeAvailable(this.toggleEncrypt); var info_desc = this.et2.getWidgetById('info_des'); var self = this; @@ -731,17 +712,16 @@ var InfologApp = /** @class */ (function (_super) { }, function (_err) { self.egw.message(_err, 'error'); }); - }; + } /** * Blur NM count (used for limit modified optimization not returning (an exact) count * * @param blur */ - InfologApp.prototype.blurCount = function (blur) { + blurCount(blur) { var _a; (_a = document.querySelector('div#infolog-index_nm.et2_nextmatch .header_count')) === null || _a === void 0 ? void 0 : _a.classList.toggle('blur_count', blur); - }; - return InfologApp; -}(egw_app_1.EgwApp)); + } +} app.classes.infolog = InfologApp; //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/infolog/js/app.ts b/infolog/js/app.ts index 9882ba5821..44de8ef6e7 100644 --- a/infolog/js/app.ts +++ b/infolog/js/app.ts @@ -14,11 +14,8 @@ import 'jquery'; import 'jqueryui'; -import '../jsapi/egw_global'; -import '../etemplate/et2_types'; import {EgwApp} from '../../api/js/jsapi/egw_app'; -import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog"; import {etemplate2} from "../../api/js/etemplate/etemplate2"; import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch"; import {CRMView} from "../../addressbook/js/CRM"; @@ -783,6 +780,7 @@ class InfologApp extends EgwApp if (!app.stylite) { var self = this; + // @ToDo: @new-js-loader egw_LAB.script('stylite/js/app.js?'+this.et2.getArrayMgr('content').getEntry('encryption_ts')).wait(function() { app.stylite = new app.classes.stylite;