From 529833688658c6555026c87fd9b78e4243f94df2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 10 Jun 2021 11:38:54 +0200 Subject: [PATCH] include jquery and other legacy js files via script tag --- addressbook/js/app.js | 2 + addressbook/js/app.ts | 3 +- admin/js/app.js | 264 +++++---- api/js/egw_action/egw_action_popup.js | 1 - api/js/etemplate/et2_dataview_view_aoi.js | 1 - api/js/etemplate/et2_dataview_view_aoi.ts | 1 - api/js/etemplate/et2_widget_htmlarea.js | 2 + api/js/etemplate/et2_widget_htmlarea.ts | 2 + api/js/framework/fw_base.js | 1 - api/js/framework/fw_browser.js | 1 - api/js/framework/fw_desktop.js | 1 - api/js/framework/fw_ui.js | 3 - api/js/jquery/chosen/chosen.jquery.js | 2 - .../jquery-tap-and-hold/jquery.tapandhold.js | 1 - api/js/jquery/jquery-ui-timepicker-addon.js | 2 - api/js/jquery/jquery.noconflict.js | 11 +- api/js/jsapi/egw.js | 13 +- api/js/jsapi/egw_app.js | 2 - api/js/jsapi/egw_app.ts | 2 - api/js/jsapi/egw_calendar.js | 2 - api/js/jsapi/egw_files.js | 2 + api/js/jsapi/egw_tail.js | 4 +- api/js/jsapi/jsapi.js | 2 - api/js/login.js | 4 +- api/src/Framework.php | 12 + filemanager/js/app.js | 504 +++++++++--------- filemanager/js/app.ts | 11 +- infolog/js/app.js | 6 +- infolog/js/app.ts | 8 +- pixelegg/js/fw_pixelegg.js | 1 - pixelegg/js/slider.js | 2 - resources/js/app.js | 91 ++-- resources/js/app.ts | 8 +- 33 files changed, 458 insertions(+), 514 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index 87449a49bb..5eb11616b0 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -16,6 +16,8 @@ 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"; +import { fetchAll } from "../../api/js/etemplate/et2_extension_nextmatch_actions.js"; +import "./CRM.js"; /** * UI for Addressbook * diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts index e447e52864..99eb895fd3 100644 --- a/addressbook/js/app.ts +++ b/addressbook/js/app.ts @@ -20,7 +20,8 @@ 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"; +import {fetchAll} from "../../api/js/etemplate/et2_extension_nextmatch_actions.js"; +import "./CRM.js"; /** * Object to call app.addressbook.openCRMview with diff --git a/admin/js/app.js b/admin/js/app.js index 4b8d838e11..a754091529 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -1,4 +1,3 @@ -"use strict"; /** * EGroupware - Admin - Javascript UI * @@ -8,100 +7,83 @@ * @copyright (c) 2013-20 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"); +import 'jquery'; +import 'jqueryui'; +import '../jsapi/egw_global'; +import '../etemplate/et2_types'; +import { EgwApp } from '../../api/js/jsapi/egw_app'; /** * UI for Admin * * @augments AppJS */ -var AdminApp = /** @class */ (function (_super) { - __extends(AdminApp, _super); +class AdminApp extends EgwApp { /** * Constructor * * @memberOf app.classes.admin */ - function AdminApp() { - var _this = + constructor() { // call parent - _super.call(this, 'admin') || this; + super('admin'); /** * reference to iframe * * {et2_iframe} */ - _this.iframe = null; + this.iframe = null; /** * reference to nextmatch * * {et2_extension_nextmatch} */ - _this.nm = null; + this.nm = null; /** * Reference to div to hold AJAX loadable pages * * {et2_box} */ - _this.ajax_target = null; + this.ajax_target = null; /** * Reference to ACL edit dialog (not the list) */ - _this.acl_dialog = null; - _this.tree = null; + this.acl_dialog = null; + this.tree = null; /** * No SSL */ - _this.SSL_NONE = 0; + this.SSL_NONE = 0; /** * STARTTLS on regular tcp connection/port */ - _this.SSL_STARTTLS = 1; + this.SSL_STARTTLS = 1; /** * SSL (inferior to TLS!) */ - _this.SSL_SSL = 3; + this.SSL_SSL = 3; /** * require TLS version 1+, no SSL version 2 or 3 */ - _this.SSL_TLS = 2; + this.SSL_TLS = 2; /** * if set, verify certifcate (currently not implemented in Horde_Imap_Client!) */ - _this.SSL_VERIFY = 8; - return _this; + this.SSL_VERIFY = 8; } /** * Destructor */ - AdminApp.prototype.destroy = function (_app) { + destroy(_app) { this.iframe = null; this.nm = null; this.acl_dialog = null; this.tree = null; // 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, @@ -110,9 +92,9 @@ var AdminApp = /** @class */ (function (_super) { * @param {etemplate2} _et2 * @param {string} _name name of template loaded */ - AdminApp.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); switch (_name) { case 'admin.index': var iframe = this.iframe = this.et2.getWidgetById('iframe'); @@ -154,13 +136,13 @@ var AdminApp = /** @class */ (function (_super) { } break; } - }; + } /** * Show given url in (visible) iframe or nextmatch with accounts (!_url) * * @param {string} [_url=] url to show in iframe or nothing for showing */ - AdminApp.prototype.load = function (_url) { + load(_url) { if (this.iframe && this.iframe.getDOMNode().contentDocument.location.href .match(/menuaction=admin.admin_statistics.submit.+required=true/) && (!_url || !_url.match(/statistics=(postpone|canceled|submitted)/))) { @@ -210,7 +192,7 @@ var AdminApp = /** @class */ (function (_super) { this.nm.set_disabled(!!_url || ajax); this.groups.set_disabled(true); this.ajax_target.set_disabled(!ajax); - }; + } /** * Observer method receives update notifications from all applications * @@ -229,7 +211,7 @@ var AdminApp = /** @class */ (function (_super) { * @param {string} _targetapp which app's window should be refreshed, default current * @return {false|*} false to stop regular refresh, thought all observers are run */ - AdminApp.prototype.observer = function (_msg, _app, _id, _type, _msg_type, _targetapp) { + observer(_msg, _app, _id, _type, _msg_type, _targetapp) { switch (_app) { case 'admin': // if iframe is used --> refresh it @@ -295,7 +277,7 @@ var AdminApp = /** @class */ (function (_super) { return false; // --> no regular refresh needed } } - }; + } /** * Handle a push notification about entry changes from the websocket * @@ -314,7 +296,7 @@ var AdminApp = /** @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 */ - AdminApp.prototype.push = function (pushData) { + push(pushData) { // We'll listen to addressbook, but only if it has an account ID if (pushData.app != this.appname) return; @@ -324,13 +306,13 @@ var AdminApp = /** @class */ (function (_super) { else if (pushData.id < 0) { this.groups.refresh(pushData.id, pushData.type); } - }; + } /** * Hide navbar for idots template * * Just a hack for old idots, not neccesary for jdots */ - AdminApp.prototype._hide_navbar = function () { + _hide_navbar() { var document = this.iframe.getDOMNode().contentDocument; if (!document) return; // nothing we can do ... @@ -343,36 +325,36 @@ var AdminApp = /** @class */ (function (_super) { if (elem) elem.style.display = 'none'; } - }; + } /** * Set location of iframe for given _action and _sender (row) * * @param _action * @param _senders */ - AdminApp.prototype.iframe_location = function (_action, _senders) { + iframe_location(_action, _senders) { var id = _senders[0].id.split('::'); var url = _action.data.url.replace(/(%24|\$)id/, id[1]); this.load(url); - }; + } /** * Callback to load an etemplate * * @param {Object[]} _data */ - AdminApp.prototype._ajax_load_callback = function (_data) { + _ajax_load_callback(_data) { if (!_data || _data.type != undefined) return; // Insert the content, etemplate will load into it jQuery(this.ajax_target.node).append(typeof _data === 'string' ? _data : _data[0]); - }; + } /** * Link hander for jDots template to just reload our iframe, instead of reloading whole admin app * * @param _url * @return boolean true, if linkHandler took care of link, false otherwise */ - AdminApp.prototype.linkHandler = function (_url) { + linkHandler(_url) { var matches = _url.match(/menuaction=admin.admin_ui.index.*&load=([^&]+)/); if (_url != 'about:blank' && (this.iframe != null && !_url.match('menuaction=admin.admin_ui.index') || matches)) { if (matches) { @@ -383,14 +365,14 @@ var AdminApp = /** @class */ (function (_super) { } // can not load our own index page, has to be done by framework return false; - }; + } /** * Run an admin module / onclick callback for tree * * @param {string} _id id of clicked node * @param {et2_tree} _widget reference to tree widget */ - AdminApp.prototype.run = function (_id, _widget) { + run(_id, _widget) { var link = _widget.getUserData(_id, 'link'); this.groups.set_disabled(true); if (_id == '/accounts' || _id.substr(0, 8) == '/groups/') { @@ -410,9 +392,9 @@ var AdminApp = /** @class */ (function (_super) { this.load(link); } else if (link.substr(0, 11) == 'javascript:') { - var href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/; - var matches = link.match(href_regexp); - var args = []; + const href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/; + const matches = link.match(href_regexp); + let args = []; if (matches.length > 1 && matches[2] !== undefined) { try { args = JSON.parse('[' + matches[2] + ']'); @@ -423,21 +405,21 @@ var AdminApp = /** @class */ (function (_super) { } egw.applyFunc(matches[1], args); } - }; + } /** * Show the group list in the main window */ - AdminApp.prototype.group_list = function () { + group_list() { this.nm.set_disabled(true); this.groups.set_disabled(false); - }; + } /** * View, edit or delete a group callback for tree * * @param {object} _action egwAction * @param {array} _senders egwActionObject _senders[0].id holds id */ - AdminApp.prototype.group = function (_action, _senders) { + group(_action, _senders) { // Tree IDs look like /groups/ID, nm uses admin::ID var from_nm = _senders[0].id.indexOf('::') > 0; var account_id = _senders[0].id.split(from_nm ? '::' : '/')[from_nm ? 1 : 2]; @@ -465,14 +447,14 @@ var AdminApp = /** @class */ (function (_super) { } break; } - }; + } /** * Modify an ACL entry * * @param {object} _action egwAction * @param {array} _senders egwActionObject _senders[0].id holds the id "admin::app:account:location" */ - AdminApp.prototype.acl = function (_action, _senders) { + acl(_action, _senders) { var ids = []; for (var i = 0; i < _senders.length; ++i) { ids.push(_senders[i].id.split('::').pop()); // remove "admin::" prefix @@ -492,8 +474,8 @@ var AdminApp = /** @class */ (function (_super) { this._acl_dialog(content); break; } - }; - AdminApp.prototype._acl_delete = function (ids) { + } + _acl_delete(ids) { var app = egw.app_name(); // can be either admin or preferences! if (app != 'admin') app = 'preferences'; @@ -532,7 +514,7 @@ var AdminApp = /** @class */ (function (_super) { } // Create the dialog this.acl_dialog = et2_createWidget("dialog", dialog_options, et2_dialog._create_parent(app)); - }; + } /** * Create the ACL edit dialog, including defaults & fetching what can be found * @@ -542,7 +524,7 @@ var AdminApp = /** @class */ (function (_super) { * @param {string} app Name of app * @param {function} callback */ - AdminApp.prototype._acl_dialog = function (content, sel_options, etemplate, app, callback) { + _acl_dialog(content, sel_options, etemplate, app, callback) { if (typeof content == 'undefined') content = {}; // Determine which application we're running as @@ -585,8 +567,8 @@ var AdminApp = /** @class */ (function (_super) { else { // Restrict application selectbox to only apps that support ACL sel_options.acl_appname = []; - for (var app_1 in acl_rights) { - sel_options.acl_appname.push({ value: app_1, label: this.egw.lang(this.egw.link_get_registry(app_1, 'entries') || app_1) }); + for (let app in acl_rights) { + sel_options.acl_appname.push({ value: app, label: this.egw.lang(this.egw.link_get_registry(app, 'entries') || app) }); } // Sort list sel_options.acl_appname.sort(function (a, b) { @@ -603,7 +585,7 @@ var AdminApp = /** @class */ (function (_super) { content.acl_rights = content.acl_rights ? parseInt(content.acl_rights) : null; jQuery.extend(content, { acl: [], right: [], label: [] }); // Use this to make sure we get correct app translations - var app_egw = egw(content.acl_appname, window); + let app_egw = egw(content.acl_appname, window); for (var right in acl_rights[content.acl_appname]) { // only user himself is allowed to grant private (16) rights if (right == '16' && content['acl_account'] != egw.user('account_id')) { @@ -704,7 +686,7 @@ var AdminApp = /** @class */ (function (_super) { } // Create the dialog this.acl_dialog = et2_createWidget("dialog", dialog_options, et2_dialog._create_parent(app)); - }; + } /** * Change handler for ACL edit dialog application selectbox. * Re-creates the dialog with the current values @@ -712,7 +694,7 @@ var AdminApp = /** @class */ (function (_super) { * @param input * @param widget */ - AdminApp.prototype.acl_reopen_dialog = function (input, widget) { + acl_reopen_dialog(input, widget) { var content = {}; if (this.acl_dialog != null) { content = this.acl_dialog.get_value() || {}; @@ -722,36 +704,36 @@ var AdminApp = /** @class */ (function (_super) { } // Re-open the dialog this._acl_dialog(content); - }; + } /** * Load the new application's lang files when the app filter is changed */ - AdminApp.prototype.acl_app_change = function (event, nm) { - var appname = nm.getWidgetById('filter2').getValue() || ''; + acl_app_change(event, nm) { + let appname = nm.getWidgetById('filter2').getValue() || ''; if (appname) { - var app_egw = egw(appname); + let app_egw = egw(appname); app_egw.langRequireApp(window, appname); nm.getRoot().setApiInstance(app_egw); } - }; + } /** * Callback called on successfull call of serverside ACL handling * * @param {object} _data returned from server */ - AdminApp.prototype._acl_callback = function (_data) { + _acl_callback(_data) { // Avoid the window / framework / app and just refresh the etemplate // Framework will try to refresh the opener // Get by ID, since this.et2 isn't always the ACL list var et2 = etemplate2.getById('admin-acl').widgetContainer; et2.getInstanceManager().refresh(_data.msg, this.appname, _data.ids, _data.type); - }; + } /** * Check to see if admin has taken away access to a category * * @@param {widget} button add/apply pressed button */ - AdminApp.prototype.check_owner = function (button) { + check_owner(button) { var select_owner = this.et2.getWidgetById('owner'); var diff = []; if (typeof select_owner != 'undefined') { @@ -794,25 +776,25 @@ var AdminApp = /** @class */ (function (_super) { } } return true; - }; + } /** * Show icon based on icon-selectbox, hide placeholder (broken image), if no icon selected * * @param {widget} widget select box widget */ - AdminApp.prototype.change_icon = function (widget) { + change_icon(widget) { var img = widget.getRoot().getWidgetById('icon_url'); if (img) { img.set_src(widget.getValue()); } - }; + } /** * Add / edit an account * * @param {object} _action egwAction * @param {array} _senders egwActionObject _senders[0].id holds account_id */ - AdminApp.prototype.account = function (_action, _senders) { + account(_action, _senders) { var params = jQuery.extend({}, this.egw.link_get_registry('addressbook', 'edit')); var popup = this.egw.link_get_registry('addressbook', 'edit_popup'); switch (_action.id) { @@ -828,7 +810,7 @@ var AdminApp = /** @class */ (function (_super) { break; } this.egw.open_link(this.egw.link('/index.php', params), 'admin', popup, 'admin'); - }; + } /** * Submit statistic * @@ -840,7 +822,7 @@ var AdminApp = /** @class */ (function (_super) { * @param {string} submit_url * @return {boolean} */ - AdminApp.prototype.submit_statistic = function (form, submit_url) { + submit_statistic(form, submit_url) { var that = this; var submit = function () { // submit to egroupware.org @@ -872,26 +854,26 @@ var AdminApp = /** @class */ (function (_super) { }, this.egw.lang('Submit displayed information?'), '', {}, et2_dialog.BUTTON_YES_NO, et2_dialog.QUESTION_MESSAGE, undefined, egw); } return false; - }; + } /** * Change handler for when you change the type of a custom field. * It toggles options / attributes as appropriate. * @param {event object} e * @param {widget object} widget */ - AdminApp.prototype.cf_type_change = function (e, widget) { + cf_type_change(e, widget) { var root = widget.getRoot(); var attributes = widget.getArrayMgr('content').getEntry('attributes[' + widget.getValue() + ']') || {}; root.getWidgetById('cf_values').set_statustext(widget.egw().lang(widget.getArrayMgr('content').getEntry('options[' + widget.getValue() + ']') || '')); jQuery(root.getWidgetById('cf_len').getDOMNode()).toggle(attributes.cf_len && true); jQuery(root.getWidgetById('cf_rows').getDOMNode()).toggle(attributes.cf_rows && true); jQuery(root.getWidgetById('cf_values').getParentDOMNode()).toggle(attributes.cf_values && true); - }; + } /** * Change handler for when you delete a custom app type * If Policy app is available, it asks for documentation */ - AdminApp.prototype.cf_type_delete = function (e, widget) { + cf_type_delete(e, widget) { var callback = function (button, value) { if (button === et2_dialog.YES_BUTTON) { var values = jQuery.extend({}, this.getInstanceManager().getValues(this.getRoot()), value, { appname: this.getRoot().getArrayMgr('content').getEntry('content_types[appname]') }); @@ -933,14 +915,14 @@ var AdminApp = /** @class */ (function (_super) { callback(et2_dialog.YES_BUTTON); } return false; - }; + } /** * Activate none standard SMTP mail accounts for selected users * * @param {egw_action} _action * @param {array} _selected selected users */ - AdminApp.prototype.emailadminActiveAccounts = function (_action, _selected) { + emailadminActiveAccounts(_action, _selected) { var menuaction = 'admin.admin_mail.ajax_activeAccounts'; var accounts = []; var msg1 = egw.lang('%1 accounts being activated', "" + Object.keys(_selected).length); @@ -961,13 +943,13 @@ var AdminApp = /** @class */ (function (_super) { }; // confirmation dialog et2_dialog.show_dialog(callbackDialog, egw.lang('Are you sure you want to %1 mail for selected accounts?', egw.lang(_action.id)), egw.lang('Active Mail Accounts'), {}, et2_dialog.BUTTON_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, egw); - }; + } /** * Resize window methode * * @returns {undefined} */ - AdminApp.prototype.wizard_popup_resize = function () { + wizard_popup_resize() { var $main_div = jQuery('#popupMainDiv'); var $et2 = jQuery('.et2_container'); var w = { @@ -981,21 +963,21 @@ var AdminApp = /** @class */ (function (_super) { if (delta_width != 0 || delta_height != 0) { window.resizeTo(egw_getWindowOuterWidth() - delta_width, egw_getWindowOuterHeight() - delta_height); } - }; + } /** * Switch account wizard to manual entry */ - AdminApp.prototype.wizard_manual = function () { + wizard_manual() { jQuery('.emailadmin_manual').fadeToggle(); // not sure how to to this et2-isch this.wizard_popup_resize(); // popup needs to be resized after toggling - }; + } /** * onclick for continue button to show progress animation * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.wizard_detect = function (_event, _widget) { + wizard_detect(_event, _widget) { // we need to do a manual asynchronious submit to show progress animation // default synchronious submit stops animation! if (this.et2._inst.submit('button[continue]', true)) // true = async submit @@ -1007,60 +989,60 @@ var AdminApp = /** @class */ (function (_super) { } } return false; - }; + } /** * Set default port, if imap ssl-type changes * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.wizard_imap_ssl_onchange = function (_event, _widget) { + wizard_imap_ssl_onchange(_event, _widget) { var ssl_type = _widget.get_value(); this.et2.getWidgetById('acc_imap_port').set_value(ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 993 : 143); - }; + } /** * Set default port, if imap ssl-type changes * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.wizard_smtp_ssl_onchange = function (_event, _widget) { + wizard_smtp_ssl_onchange(_event, _widget) { var ssl_type = _widget.get_value(); this.et2.getWidgetById('acc_smtp_port').set_value(ssl_type == 'no' ? 25 : (ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 465 : 587)); - }; + } /** * Set default port, if imap ssl-type changes * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.wizard_sieve_ssl_onchange = function (_event, _widget) { + wizard_sieve_ssl_onchange(_event, _widget) { var ssl_type = _widget.get_value(); this.et2.getWidgetById('acc_sieve_port').set_value(ssl_type == this.SSL_SSL || ssl_type == this.SSL_TLS ? 5190 : 4190); this.wizard_sieve_onchange(_event, _widget); - }; + } /** * Enable sieve, if user changes some setting * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.wizard_sieve_onchange = function (_event, _widget) { + wizard_sieve_onchange(_event, _widget) { this.et2.getWidgetById('acc_sieve_enabled').set_value(1); - }; + } /** * Switch to select multiple accounts * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.edit_multiple = function (_event, _widget) { + edit_multiple(_event, _widget) { // hide multiple button _widget.set_disabled(true); // switch account-selection to multiple var account_id = this.et2.getWidgetById('account_id'); account_id.set_multiple(true); - }; + } /** * Hide not applying fields, used as: * - onchange handler on account_id @@ -1069,7 +1051,7 @@ var AdminApp = /** @class */ (function (_super) { * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.account_hide_not_applying = function (_event, _widget) { + account_hide_not_applying(_event, _widget) { var account_id = this.et2.getWidgetById('account_id'); var ids = account_id && account_id.get_value ? account_id.get_value() : []; if (typeof ids == 'string') @@ -1104,73 +1086,72 @@ var AdminApp = /** @class */ (function (_super) { if (_event && _event.stopPropagation) _event.stopPropagation(); return false; - }; + } /** * Callback if user changed account selction * * @param {object} _event event-object or information about event * @param {et2_baseWidget} _widget widget causing the event */ - AdminApp.prototype.change_account = function (_event, _widget) { + change_account(_event, _widget) { // todo check dirty and query user to a) save changes, b) discard changes, c) cancel selection _widget.getInstanceManager().submit(); - }; + } /** * Callback if user changes notification folders: unset use-default checkbox * * @param {object} _event * @param {et2_widget} _widget */ - AdminApp.prototype.change_folders = function (_event, _widget) { + change_folders(_event, _widget) { var use_default = this.et2.getWidgetById('notify_use_default'); if (use_default) use_default.set_value(false); - }; + } /** * default onExecute for admin actions * * @param {object} _action * @param {object} _senders */ - AdminApp.prototype.account_edit_action = function (_action, _senders) { + account_edit_action(_action, _senders) { if (_action.data.url) { this.egw.open_link(_action.data.url, _action.data.target || '_blank', _action.data.popup); } - }; + } /** * Clear instance cache * * If there is an error on server-side, resend request with an parameter allowing * cache to use different method not requiring eg. so much memory */ - AdminApp.prototype.clear_cache = function () { - var wait = this.egw.message(this.egw.lang('Clear cache and register hooks') + "\n" + this.egw.lang('Please wait...'), 'info'); - var success = function () { + clear_cache() { + let wait = this.egw.message(this.egw.lang('Clear cache and register hooks') + "\n" + this.egw.lang('Please wait...'), 'info'); + let success = function () { wait.close(); egw.message('Done'); }; this.egw.json('admin.admin_hooks.ajax_clear_cache', null, success).sendRequest(true, undefined, jQuery.proxy(function (_xmlhttp, _err) { this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1', null, success).sendRequest(true); }, this)); - }; + } /** * Action handler for clear credentials action * * @param action * @param selected */ - AdminApp.prototype.clear_credentials_handler = function (action, selected) { - var ids = []; - for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { - var row = selected_1[_i]; + clear_credentials_handler(action, selected) { + let ids = []; + for (let row of selected) { ids.push(row.id.split("::").pop()); } this.egw.request("admin.admin_passwordreset.ajax_clear_credentials", [action.id, ids]); - }; + } /** * Export content of given field into relevant file */ - AdminApp.prototype.smime_exportCert = function () { + smime_exportCert() { var $a = jQuery(document.createElement('a')).appendTo('body').hide(); var acc_id = this.et2.getArrayMgr("content").getEntry('acc_id'); var url = window.egw.webserverUrl + '/index.php?'; @@ -1180,14 +1161,14 @@ var AdminApp = /** @class */ (function (_super) { $a.prop('download', ""); $a[0].click(); $a.remove(); - }; + } /** * Create certificate generator dialog */ - AdminApp.prototype.smime_genCertificate = function () { + smime_genCertificate() { var self = this; et2_createWidget("dialog", { - callback: function (_button_id, _value) { + callback(_button_id, _value) { if (_button_id == 'create' && _value) { var isValid = true; var required = ['countryName', 'emailAddress']; @@ -1244,26 +1225,26 @@ var AdminApp = /** @class */ (function (_super) { resizable: false, position: 'left top' }, et2_dialog._create_parent('mail')); - }; + } /** * Triggers upload for background image and updates its taglist * * @param {type} node * @param {type} widget */ - AdminApp.prototype.login_background_update = function (node, widget) { + login_background_update(node, widget) { var taglist = widget._parent._children[0]; egw.json('admin.admin_config.ajax_upload_anon_images', [widget.get_value(), taglist.get_value()], function (_data) { taglist.set_value(_data); }).sendRequest(); - }; + } /** * Set content of selected row * * @param {array} node * @returns */ - AdminApp.prototype.cmds_onselect = function (node) { + cmds_onselect(node) { var splitter = this.et2.getWidgetById('splitter'); var cmds_preview = this.et2.getWidgetById('cmds_preview'); if (node.length != 1) { @@ -1288,12 +1269,7 @@ var AdminApp = /** @class */ (function (_super) { policy_preview.set_disabled(true); cmds_preview.set_value({ content: [data.data] }); } - }; - return AdminApp; -}(egw_app_1.EgwApp -/** - * @lends app.classes.admin - */ -)); + } +} app.classes.admin = AdminApp; //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/api/js/egw_action/egw_action_popup.js b/api/js/egw_action/egw_action_popup.js index 52538fffaa..a6fbcecd88 100644 --- a/api/js/egw_action/egw_action_popup.js +++ b/api/js/egw_action/egw_action_popup.js @@ -18,7 +18,6 @@ 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'; if (typeof window._egwActionClasses == "undefined") window._egwActionClasses = {}; diff --git a/api/js/etemplate/et2_dataview_view_aoi.js b/api/js/etemplate/et2_dataview_view_aoi.js index a3d8472dc2..764fa59520 100644 --- a/api/js/etemplate/et2_dataview_view_aoi.js +++ b/api/js/etemplate/et2_dataview_view_aoi.js @@ -16,7 +16,6 @@ import { EGW_AO_SHIFT_STATE_MULTI, EGW_AO_STATE_FOCUSED, EGW_AO_STATE_SELECTED, egwActionObjectInterface } from "../egw_action/egw_action.js"; import { egwBitIsSet, egwGetShiftState, egwPreventSelect, egwSetBit, egwUnfocus, egwIsMobile } from "../egw_action/egw_action_common.js"; import { _egw_active_menu } from "../egw_action/egw_menu.js"; -import '../../../vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js'; /** * Contains the action object interface implementation for the nextmatch widget * row. diff --git a/api/js/etemplate/et2_dataview_view_aoi.ts b/api/js/etemplate/et2_dataview_view_aoi.ts index 839c3c71c5..803bc09c42 100644 --- a/api/js/etemplate/et2_dataview_view_aoi.ts +++ b/api/js/etemplate/et2_dataview_view_aoi.ts @@ -23,7 +23,6 @@ import { } from "../egw_action/egw_action.js"; import {egwBitIsSet, egwGetShiftState, egwPreventSelect, egwSetBit, egwUnfocus, egwIsMobile} from "../egw_action/egw_action_common.js"; import {_egw_active_menu} from "../egw_action/egw_menu.js"; -import '../../../vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js'; /** * Contains the action object interface implementation for the nextmatch widget diff --git a/api/js/etemplate/et2_widget_htmlarea.js b/api/js/etemplate/et2_widget_htmlarea.js index d29dc3e93d..48d6ac813e 100644 --- a/api/js/etemplate/et2_widget_htmlarea.js +++ b/api/js/etemplate/et2_widget_htmlarea.js @@ -19,6 +19,8 @@ import { ClassWithAttributes } from "./et2_core_inheritance"; import { et2_register_widget, et2_createWidget } from "./et2_core_widget"; import { et2_no_init } from "./et2_core_common"; import { egw } from "../jsapi/egw_global"; +import { tinymce } from "../../../vendor/tinymce/tinymce/tinymce.min.js"; +import { etemplate2 } from "./etemplate2"; /** * @augments et2_inputWidget */ diff --git a/api/js/etemplate/et2_widget_htmlarea.ts b/api/js/etemplate/et2_widget_htmlarea.ts index 42639290d5..48dd58342a 100644 --- a/api/js/etemplate/et2_widget_htmlarea.ts +++ b/api/js/etemplate/et2_widget_htmlarea.ts @@ -23,6 +23,8 @@ import {et2_IResizeable} from "./et2_core_interfaces"; import {et2_no_init} from "./et2_core_common"; import {egw} from "../jsapi/egw_global"; import {et2_vfsSelect} from "./et2_widget_vfs"; +import {tinymce} from "../../../vendor/tinymce/tinymce/tinymce.min.js"; +import {etemplate2} from "./etemplate2"; /** * @augments et2_inputWidget diff --git a/api/js/framework/fw_base.js b/api/js/framework/fw_base.js index b0d329c0ea..47ec96037d 100644 --- a/api/js/framework/fw_base.js +++ b/api/js/framework/fw_base.js @@ -11,7 +11,6 @@ vendor.bower-asset.jquery.dist.jquery; egw_inheritance.js; */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; import '../jsapi/egw_inheritance.js'; window.fw_base = (function(){ "use strict"; return Class.extend( diff --git a/api/js/framework/fw_browser.js b/api/js/framework/fw_browser.js index b24514c8e2..081230fb78 100644 --- a/api/js/framework/fw_browser.js +++ b/api/js/framework/fw_browser.js @@ -12,7 +12,6 @@ egw_inheritance.js; */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; import '../egw_action/egw_action_common.js'; import '../jsapi/egw_inheritance.js'; import '../etemplate/etemplate2.js'; // otherwise et2_load json-response-handler is not (yet) available diff --git a/api/js/framework/fw_desktop.js b/api/js/framework/fw_desktop.js index d842503669..185f23926c 100644 --- a/api/js/framework/fw_desktop.js +++ b/api/js/framework/fw_desktop.js @@ -16,7 +16,6 @@ framework.fw_classes; egw_inheritance.js; */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; import './fw_base.js'; import './fw_browser.js'; import './fw_ui.js'; diff --git a/api/js/framework/fw_ui.js b/api/js/framework/fw_ui.js index 241f4a0018..a48ccdaa43 100644 --- a/api/js/framework/fw_ui.js +++ b/api/js/framework/fw_ui.js @@ -12,9 +12,6 @@ /api/js/jquery/mousewheel/mousewheel.js; egw_inheritance.js; */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; -import '../../../vendor/bower-asset/jquery-ui/jquery-ui.js'; -import '../jquery/mousewheel/mousewheel.js'; import '../jsapi/egw_inheritance.js'; /** diff --git a/api/js/jquery/chosen/chosen.jquery.js b/api/js/jquery/chosen/chosen.jquery.js index e4df06a2bc..3ed19c9b16 100644 --- a/api/js/jquery/chosen/chosen.jquery.js +++ b/api/js/jquery/chosen/chosen.jquery.js @@ -5,8 +5,6 @@ // Full source at https://github.com/harvesthq/chosen // Copyright (c) 2011 Harvest http://getharvest.com -import 'jquery'; - // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md // This file is generated by `grunt build`, do not edit it by hand. (function() { diff --git a/api/js/jquery/jquery-tap-and-hold/jquery.tapandhold.js b/api/js/jquery/jquery-tap-and-hold/jquery.tapandhold.js index a360d1e2ba..b70041d557 100644 --- a/api/js/jquery/jquery-tap-and-hold/jquery.tapandhold.js +++ b/api/js/jquery/jquery-tap-and-hold/jquery.tapandhold.js @@ -17,7 +17,6 @@ * @description Adds a handler for a custom event 'taphold' that handles a * tap and hold on touch interfaces. */ -import '../../../../vendor/bower-asset/jquery/dist/jquery.js'; (function($) { var TAP_AND_HOLD_TRIGGER_TIMER = 600; var MAX_DISTANCE_ALLOWED_IN_TAP_AND_HOLD_EVENT = 40; diff --git a/api/js/jquery/jquery-ui-timepicker-addon.js b/api/js/jquery/jquery-ui-timepicker-addon.js index 80fc1ce325..1f67c320bc 100644 --- a/api/js/jquery/jquery-ui-timepicker-addon.js +++ b/api/js/jquery/jquery-ui-timepicker-addon.js @@ -1,8 +1,6 @@ /*! jQuery Timepicker Addon - v1.6.1 - 2015-11-14 * http://trentrichardson.com/examples/timepicker * Copyright (c) 2015 Trent Richardson; Licensed MIT */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; -import '../../../vendor/bower-asset/jquery-ui/jquery-ui.js'; (function (factory) { if (typeof define === 'function' && define.amd) { define(['jquery', 'jquery-ui'], factory); diff --git a/api/js/jquery/jquery.noconflict.js b/api/js/jquery/jquery.noconflict.js index 97db806a33..5a07e192ed 100644 --- a/api/js/jquery/jquery.noconflict.js +++ b/api/js/jquery/jquery.noconflict.js @@ -5,13 +5,16 @@ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package api * @subpackage ajax - * @author Ralf Becker - * @version $Id$ + * @author Ralf Becker */ /*egw:uses /vendor/bower-asset/jquery/dist/jquery.js; + /vendor/bower-asset/jquery-ui/jquery-ui.js; + /api/js/jquery/chosen/chosen.jquery.js; + /api/js/jquery/jquery-tab-and-hold/jquery.tabandhold.js; + /api/js/jquery/mousewheel/mousewheel.js; + /api/js/jquery/jquery-ui-timepicker-addon.js; + /vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js; */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; - jQuery.noConflict(); \ No newline at end of file diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 2b5d31ef5b..c2753a6d99 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -63,6 +63,9 @@ window.egw_webserverUrl = egw_script.getAttribute('data-url'); window.egw_appName = egw_script.getAttribute('data-app'); + // split includes in legacy js and modules + const legacy_js_regexp = /\/dhtmlx|jquery/; + // check if egw object was injected by window open if (typeof window.egw == 'undefined') { @@ -95,6 +98,7 @@ { window.egw = { prefsOnly: true, + legacy_js_regexp: legacy_js_regexp, webserverUrl: egw_webserverUrl }; if (debug) console.log('creating new egw object'); @@ -146,6 +150,7 @@ console.log('Security exception accessing window specific egw object --> creating new one', e); window.egw = { prefsOnly: true, + legacy_js_regexp: legacy_js_regexp, webserverUrl: egw_webserverUrl }; } @@ -187,12 +192,10 @@ })); } - // split includes in legacy js and modules - const legacy_regexp = /dhtmlx/; // make our promise global, as legacy code calls egw_LAB.wait which we assign to egw_ready.then - window.egw_LAB = window.egw_ready = Promise.all( - [legacy_js_import(include.filter((src) => src.match(legacy_regexp) !== null), window.egw_webserverUrl)] - .concat(include.filter((src) => src.match(legacy_regexp) === null) + window.egw_LAB = window.egw_ready = + legacy_js_import(include.filter((src) => src.match(legacy_js_regexp) !== null), window.egw_webserverUrl) + .then(() => Promise.all(include.filter((src) => src.match(legacy_js_regexp) === null) .map(rel_src => import(window.egw_webserverUrl+'/'+rel_src) .catch((err) => { console.log(rel_src+":\n\n"+err.message)}) ))).then(() => diff --git a/api/js/jsapi/egw_app.js b/api/js/jsapi/egw_app.js index 3a3c11b362..131865b240 100644 --- a/api/js/jsapi/egw_app.js +++ b/api/js/jsapi/egw_app.js @@ -9,8 +9,6 @@ * @author Hadi Nategh * @author Nathan Gray */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; -import '../../../vendor/bower-asset/jquery-ui/jquery-ui.js'; import { etemplate2 } from "../etemplate/etemplate2"; import { et2_nextmatch } from "../etemplate/et2_extension_nextmatch"; import { et2_dialog } from "../etemplate/et2_widget_dialog"; diff --git a/api/js/jsapi/egw_app.ts b/api/js/jsapi/egw_app.ts index 48a0aeb5cd..c65b345531 100644 --- a/api/js/jsapi/egw_app.ts +++ b/api/js/jsapi/egw_app.ts @@ -10,8 +10,6 @@ * @author Nathan Gray */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; -import '../../../vendor/bower-asset/jquery-ui/jquery-ui.js'; import {etemplate2} from "../etemplate/etemplate2"; import type {et2_container} from "../etemplate/et2_core_baseWidget"; import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch"; diff --git a/api/js/jsapi/egw_calendar.js b/api/js/jsapi/egw_calendar.js index 445d0f318b..275cab45e8 100644 --- a/api/js/jsapi/egw_calendar.js +++ b/api/js/jsapi/egw_calendar.js @@ -19,8 +19,6 @@ egw_css; */ import './egw_core.js'; -import 'jqueryui'; -import '../jquery/jquery-ui-timepicker-addon.js'; /** * Date and timepicker diff --git a/api/js/jsapi/egw_files.js b/api/js/jsapi/egw_files.js index ae61dc0d74..0c617125dc 100644 --- a/api/js/jsapi/egw_files.js +++ b/api/js/jsapi/egw_files.js @@ -156,6 +156,8 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd) { _jsFiles = [_jsFiles]; } + // filter out files included by script-tag via egw.js + _jsFiles = _jsFiles.filter((src) => src.match(egw.legacy_js_regexp) === null); let promise; if (_jsFiles.length === 1) // running this in below case fails when loading app.js from etemplate.load() { diff --git a/api/js/jsapi/egw_tail.js b/api/js/jsapi/egw_tail.js index e6c437a18b..fb239373c1 100644 --- a/api/js/jsapi/egw_tail.js +++ b/api/js/jsapi/egw_tail.js @@ -4,13 +4,11 @@ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package api * @subpackage jsapi - * @link http://www.egroupware.org + * @link https://www.egroupware.org * @author Hadi Nategh (as AT stylite.de) * @author Ralf Becker - * @version $Id$ */ -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; import './egw_json.js'; jQuery(function() diff --git a/api/js/jsapi/jsapi.js b/api/js/jsapi/jsapi.js index a0287485dd..00d933ea1f 100644 --- a/api/js/jsapi/jsapi.js +++ b/api/js/jsapi/jsapi.js @@ -13,8 +13,6 @@ 'use strict'; -import '../../../vendor/bower-asset/jquery/dist/jquery.js'; - /** * Check whether the console object is defined - if not, define one */ diff --git a/api/js/login.js b/api/js/login.js index cbad4ff11d..829e7eb6c0 100644 --- a/api/js/login.js +++ b/api/js/login.js @@ -7,12 +7,10 @@ * @link https://www.egroupware.org */ -import '../../vendor/bower-asset/jquery/dist/jquery.js'; // also ensures egw_LAB.wait exists! - /* if login page is not in top window, set top windows location to it */ if (top !== window) top.location = window.location; -egw_LAB.wait(function() +egw_ready.then(function() { jQuery(document).ready(function() { diff --git a/api/src/Framework.php b/api/src/Framework.php index e6bc5843ef..5334abb7d7 100644 --- a/api/src/Framework.php +++ b/api/src/Framework.php @@ -1121,6 +1121,11 @@ abstract class Framework extends Framework\Extra return $java_script; } + /** + * Files imported via script tag in egw.js, because they are no modules + */ + const legacy_js_imports = '/\/dhtmlx|jquery/'; + /** * Add EGroupware URL prefix eg. '/egroupware' to files AND bundles * @@ -1141,6 +1146,13 @@ abstract class Framework extends Framework\Extra // @todo: add all node_modules as bare imports + // map all legacy-js to something "not hurting" + $imports = array_map(static function($url) use ($prefix) + { + return !preg_match(self::legacy_js_imports, $url) ? $url : + $prefix.'/api/js/jquery/jquery.noconflict.js'; + }, $imports); + return ['imports' => $imports]; } diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 15d8f99664..0abf346a35 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -1,76 +1,64 @@ -"use strict"; /** * EGroupware - Filemanager - Javascript UI * - * @link http://www.egroupware.org + * @link https://www.egroupware.org * @package filemanager * @author Ralf Becker - * @copyright (c) 2008-19 by 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.filemanagerAPP = void 0; /*egw:uses /api/js/jsapi/egw_app.js; */ -var egw_app_1 = require("../../api/js/jsapi/egw_app"); +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"; +import { et2_file } from "../../api/js/etemplate/et2_widget_file"; +import { et2_button } from "../../api/js/etemplate/et2_widget_button"; +import { et2_nextmatch_controller } from "../../api/js/etemplate/et2_extension_nextmatch_controller"; +import { egw_get_file_editor_prefered_mimes } from "../../api/js/jsapi/egw_global"; +import { et2_createWidget } from "../../api/js/etemplate/et2_core_widget"; /** * UI for filemanager */ -var filemanagerAPP = /** @class */ (function (_super) { - __extends(filemanagerAPP, _super); +export class filemanagerAPP extends EgwApp { /** * Constructor * * @memberOf app.filemanager */ - function filemanagerAPP() { - var _this = + constructor() { // call parent - _super.call(this, 'filemanager') || this; + super('filemanager'); /** * path widget, by template */ - _this.path_widget = {}; + this.path_widget = {}; /** * Are files cut into clipboard - need to be deleted at source on paste */ - _this.clipboard_is_cut = false; + this.clipboard_is_cut = false; /** * Regexp to convert id to a path, use this.id2path(_id) */ - _this.remove_prefix = /^filemanager::/; + this.remove_prefix = /^filemanager::/; // Loading filemanager in its tab and home causes us problems with // unwanted destruction, so we check for already existing path widgets - var lists = etemplate2.getByApplication('home'); - for (var i = 0; i < lists.length; i++) { + let lists = etemplate2.getByApplication('home'); + for (let i = 0; i < lists.length; i++) { if (lists[i].app == 'filemanager' && lists[i].widgetContainer.getWidgetById('path')) { - _this.path_widget[lists[i].uniqueId] = lists[i].widgetContainer.getWidgetById('path'); + this.path_widget[lists[i].uniqueId] = lists[i].widgetContainer.getWidgetById('path'); } } - return _this; } /** * Destructor */ - filemanagerAPP.prototype.destroy = function (_app) { + destroy(_app) { delete this.et2; // 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, @@ -79,10 +67,10 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param et2 etemplate2 Newly ready object * @param {string} name template name */ - filemanagerAPP.prototype.et2_ready = function (et2, name) { + et2_ready(et2, name) { // call parent - _super.prototype.et2_ready.call(this, et2, name); - var path_widget = this.et2.getWidgetById('path'); + super.et2_ready(et2, name); + let path_widget = this.et2.getWidgetById('path'); if (path_widget) // do NOT set not found path-widgets, as uploads works on first one only! { this.path_widget[et2.DOMContainer.id] = path_widget; @@ -108,17 +96,17 @@ var filemanagerAPP = /** @class */ (function (_super) { delete this.readonly; } if (name == 'filemanager.index') { - var fe = egw.link_get_registry('filemanager-editor'); - var new_widget = this.et2.getWidgetById('new'); + let fe = egw.link_get_registry('filemanager-editor'); + let new_widget = this.et2.getWidgetById('new'); if (fe && fe["edit"]) { - var new_options = this.et2.getArrayMgr('sel_options').getEntry('new'); + let new_options = this.et2.getArrayMgr('sel_options').getEntry('new'); new_widget.set_select_options(new_options); } else if (new_widget) { new_widget.set_disabled(true); } } - }; + } /** * Set the application's state to the given state. * @@ -130,25 +118,25 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @return {boolean} false - Returns false to stop event propagation */ - filemanagerAPP.prototype.setState = function (state) { + setState(state) { // State should be an object, not a string, but we'll parse if (typeof state == "string") { if (state.indexOf('{') != -1 || state == 'null') { state = JSON.parse(state); } } - var result = _super.prototype.setState.call(this, state, 'filemanager.index'); + let result = super.setState(state, 'filemanager.index'); // This has to happen after the parent, changing to tile recreates // nm controller if (typeof state == "object" && state.state && state.state.view) { - var et2 = etemplate2.getById('filemanager-index'); + let et2 = etemplate2.getById('filemanager-index'); if (et2) { this.et2 = et2.widgetContainer; this.change_view(state.state.view); } } return result; - }; + } /** * Retrieve the current state of the application for future restoration * @@ -156,73 +144,73 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @return {object} Application specific map representing the current state */ - filemanagerAPP.prototype.getState = function () { - var state = _super.prototype.getState.call(this); - var et2 = etemplate2.getById('filemanager-index'); + getState() { + let state = super.getState(); + let et2 = etemplate2.getById('filemanager-index'); if (et2) { - var nm = et2.widgetContainer.getWidgetById('nm'); + let nm = et2.widgetContainer.getWidgetById('nm'); state.view = nm.view; } return state; - }; + } /** * Convert id to path (remove "filemanager::" prefix) */ - filemanagerAPP.prototype.id2path = function (_id) { + id2path(_id) { return _id.replace(this.remove_prefix, ''); - }; + } /** * Convert array of elems to array of paths */ - filemanagerAPP.prototype._elems2paths = function (_elems) { - var paths = []; - for (var i = 0; i < _elems.length; i++) { + _elems2paths(_elems) { + let paths = []; + for (let i = 0; i < _elems.length; i++) { // If selected has no id, try parent. This happens for the placeholder row // in empty directories. paths.push(_elems[i].id ? this.id2path(_elems[i].id) : _elems[i]._context._parentId); } return paths; - }; + } /** * Get directory of a path */ - filemanagerAPP.prototype.dirname = function (_path) { - var parts = _path.split('/'); + dirname(_path) { + let parts = _path.split('/'); parts.pop(); return parts.join('/') || '/'; - }; + } /** * Get name of a path */ - filemanagerAPP.prototype.basename = function (_path) { + basename(_path) { return _path.split('/').pop(); - }; + } /** * Get current working directory */ - filemanagerAPP.prototype.get_path = function (etemplate_name) { + get_path(etemplate_name) { if (!etemplate_name || typeof this.path_widget[etemplate_name] == 'undefined') { for (etemplate_name in this.path_widget) break; } - var path_widget = this.path_widget[etemplate_name]; + let path_widget = this.path_widget[etemplate_name]; return path_widget ? path_widget.get_value.apply(path_widget) : null; - }; + } /** * Open compose with already attached files * * @param {(string|string[])} attachments path(s) * @param {object} params */ - filemanagerAPP.prototype.open_mail = function (attachments, params) { + open_mail(attachments, params) { if (typeof attachments == 'undefined') attachments = this.get_clipboard_files(); if (!params || typeof params != 'object') params = {}; if (!(attachments instanceof Array)) attachments = [attachments]; - var content = { data: { files: { file: [] } } }; - for (var i = 0; i < attachments.length; i++) { + let content = { data: { files: { file: [] } } }; + for (let i = 0; i < attachments.length; i++) { params['preset[file][' + i + ']'] = 'vfs://default' + attachments[i]; content.data.files.file.push('vfs://default' + attachments[i]); } @@ -230,18 +218,18 @@ var filemanagerAPP = /** @class */ (function (_super) { // always open compose in html mode, as attachment links look a lot nicer in html params["mimeType"] = 'html'; return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/, true); - }; + } /** * Mail files action: open compose with already attached files * * @param _action * @param _elems */ - filemanagerAPP.prototype.mail = function (_action, _elems) { + mail(_action, _elems) { this.open_mail(this._elems2paths(_elems), { 'preset[filemode]': _action.id.substr(5) }); - }; + } /** * Mail files action: open compose with already linked files * We're only interested in hidden upload shares here, open_mail can handle @@ -250,14 +238,14 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {egwAction} _action * @param {egwActionObject[]} _selected */ - filemanagerAPP.prototype.mail_share_link = function (_action, _selected) { + mail_share_link(_action, _selected) { if (_action.id !== 'mail_shareUploadDir') { return this.mail(_action, _selected); } - var path = this.id2path(_selected[0].id); + let path = this.id2path(_selected[0].id); this.share_link(_action, _selected, null, false, false, this._mail_link_callback); return true; - }; + } /** * Callback with the share link to append to an email * @@ -266,27 +254,27 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {String} _data.title Title for the link * @param {String} [_data.msg] Error message */ - filemanagerAPP.prototype._mail_link_callback = function (_data) { + _mail_link_callback(_data) { debugger; if (_data.msg || !_data.share_link) window.egw_refresh(_data.msg, this.appname); - var params = { + let params = { 'preset[body]': '' + _data.title + '', 'mimeType': 'html' // always open compose in html mode, as attachment links look a lot nicer in html }; - var content = { + let content = { mail_htmltext: ['
' + _data.title + ''], mail_plaintext: ["\n" + _data.share_link] }; return egw.openWithinWindow("mail", "setCompose", content, params, /mail.mail_compose.compose/); - }; + } /** * Trigger Upload after each file is uploaded * @param {type} _event */ - filemanagerAPP.prototype.uploadOnOne = function (_event) { + uploadOnOne(_event) { this.upload(_event, 1); - }; + } /** * Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename * @@ -296,35 +284,33 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {string} _conflict What to do if the file conflicts with one on the server * @param {string} _target Upload processing target. Sharing classes can override this. */ - filemanagerAPP.prototype.upload = function (_event, _file_count, _path, _conflict, _target) { - if (_conflict === void 0) { _conflict = "ask"; } - if (_target === void 0) { _target = 'filemanager_ui::ajax_action'; } + upload(_event, _file_count, _path, _conflict = "ask", _target = 'filemanager_ui::ajax_action') { if (typeof _path == 'undefined') { _path = this.get_path(); } if (_file_count && !jQuery.isEmptyObject(_event.data.getValue())) { - var widget = _event.data; - var value = widget.getValue(); + let widget = _event.data; + let value = widget.getValue(); value.conflict = _conflict; egw.json(_target, ['upload', value, _path, { ui_path: this.egw.window.location.pathname }], this._upload_callback, this, true, this).sendRequest(); widget.set_value(''); } - }; + } /** * Finish callback for file a file dialog, to get the overwrite / rename prompt * * @param {event} _event * @param {number} _file_count */ - filemanagerAPP.prototype.file_a_file_upload = function (_event, _file_count) { - var widget = _event.data; - var path = widget.getRoot().getWidgetById("path").getValue(); - var action = widget.getRoot().getWidgetById("action").getValue(); - var link = widget.getRoot().getWidgetById("entry").getValue(); + file_a_file_upload(_event, _file_count) { + let widget = _event.data; + let path = widget.getRoot().getWidgetById("path").getValue(); + let action = widget.getRoot().getWidgetById("action").getValue(); + let link = widget.getRoot().getWidgetById("entry").getValue(); if (action == 'save_as' && link.app && link.id) { path = "/apps/" + link.app + "/" + link.id; } - var props = widget.getInstanceManager().getValues(widget.getRoot()); + let props = widget.getInstanceManager().getValues(widget.getRoot()); egw.json('filemanager_ui::ajax_action', [action == 'save_as' ? 'upload' : 'link', widget.getValue(), path, props], function (_data) { app.filemanager._upload_callback(_data); // Remove successful after a delay @@ -337,7 +323,7 @@ var filemanagerAPP = /** @class */ (function (_super) { opener.egw_refresh('', 'filemanager', null, null, 'filemanager'); }, app.filemanager, true, this).sendRequest(true); return true; - }; + } /** * Callback for server response to upload request: * - display message and refresh list @@ -345,13 +331,13 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @param {object} _data values for attributes msg, files, ... */ - filemanagerAPP.prototype._upload_callback = function (_data) { + _upload_callback(_data) { if (_data.msg || _data.uploaded) window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type); - var that = this; - for (var file in _data.uploaded) { + let that = this; + for (let file in _data.uploaded) { if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) { - var buttons = [ + let buttons = [ { text: this.egw.lang("Yes"), id: "overwrite", @@ -364,8 +350,8 @@ var filemanagerAPP = /** @class */ (function (_super) { ]; if (_data.uploaded[file].confirm === "is_dir") buttons.shift(); - var dialog = et2_dialog.show_prompt(function (_button_id, _value) { - var uploaded = {}; + let dialog = et2_dialog.show_prompt(function (_button_id, _value) { + let uploaded = {}; uploaded[this.my_data.file] = this.my_data.data; switch (_button_id) { case "overwrite": @@ -396,22 +382,22 @@ var filemanagerAPP = /** @class */ (function (_super) { }; } } - }; + } /** * Get any files that are in the system clipboard * * @return {string[]} Paths */ - filemanagerAPP.prototype.get_clipboard_files = function () { - var clipboard_files = []; + get_clipboard_files() { + let clipboard_files = []; if (typeof window.localStorage != 'undefined' && typeof egw.getSessionItem('phpgwapi', 'egw_clipboard') != 'undefined') { - var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || { + let clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || { type: [], selected: [] }; if (clipboard.type.indexOf('file') >= 0) { - for (var i = 0; i < clipboard.selected.length; i++) { - var split = clipboard.selected[i].id.split('::'); + for (let i = 0; i < clipboard.selected.length; i++) { + let split = clipboard.selected[i].id.split('::'); if (split[0] == 'filemanager') { clipboard_files.push(this.id2path(clipboard.selected[i].id)); } @@ -419,27 +405,27 @@ var filemanagerAPP = /** @class */ (function (_super) { } } return clipboard_files; - }; + } /** * Update clickboard tooltips in buttons */ - filemanagerAPP.prototype.clipboard_tooltips = function () { - var paste_buttons = ['button[paste]', 'button[linkpaste]', 'button[mailpaste]']; - for (var i = 0; i < paste_buttons.length; ++i) { - var button = this.et2.getWidgetById(paste_buttons[i]); + clipboard_tooltips() { + let paste_buttons = ['button[paste]', 'button[linkpaste]', 'button[mailpaste]']; + for (let i = 0; i < paste_buttons.length; ++i) { + let button = this.et2.getWidgetById(paste_buttons[i]); if (button) button.set_statustext(this.get_clipboard_files().join(",\n")); } - }; + } /** * Clip files into clipboard * * @param _action * @param _elems */ - filemanagerAPP.prototype.clipboard = function (_action, _elems) { + clipboard(_action, _elems) { this.clipboard_is_cut = _action.id == "cut"; - var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || { + let clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')) || { type: [], selected: [] }; @@ -450,8 +436,8 @@ var filemanagerAPP = /** @class */ (function (_super) { }; } // When pasting we need to know the type of data - pull from actions - var drag = _elems[0].getSelectedLinks('drag').links; - for (var k in drag) { + let drag = _elems[0].getSelectedLinks('drag').links; + for (let k in drag) { if (drag[k].enabled && drag[k].actionObj.dragType.length > 0) { clipboard.type = clipboard.type.concat(drag[k].actionObj.dragType); } @@ -459,21 +445,21 @@ var filemanagerAPP = /** @class */ (function (_super) { clipboard.type = jQuery.unique(clipboard.type); // egwAction is a circular structure and can't be stringified so just take what we want // Hopefully that's enough for the action handlers - for (var k in _elems) { + for (let k in _elems) { if (_elems[k].id) clipboard.selected.push({ id: _elems[k].id, data: _elems[k].data }); } // Save it in session egw.setSessionItem('phpgwapi', 'egw_clipboard', JSON.stringify(clipboard)); this.clipboard_tooltips(); - }; + } /** * Paste files into current directory or mail them * * @param _type 'paste', 'linkpaste', 'mailpaste' */ - filemanagerAPP.prototype.paste = function (_type) { - var clipboard_files = this.get_clipboard_files(); + paste(_type) { + let clipboard_files = this.get_clipboard_files(); if (clipboard_files.length == 0) { alert(this.egw.lang('Clipboard is empty!')); return; @@ -494,36 +480,36 @@ var filemanagerAPP = /** @class */ (function (_super) { this._do_action('symlink', clipboard_files); break; } - }; + } /** * Pass action to server * * @param _action * @param _elems */ - filemanagerAPP.prototype.action = function (_action, _elems) { - var paths = this._elems2paths(_elems); - var path = this.get_path(_action && _action.parent.data.nextmatch.getInstanceManager().uniqueId || false); + action(_action, _elems) { + let paths = this._elems2paths(_elems); + let path = this.get_path(_action && _action.parent.data.nextmatch.getInstanceManager().uniqueId || false); this._do_action(_action.id, paths, true, path); - }; + } /** * Prompt user for directory to create * * @param {egwAction|undefined} action Action, event or undefined if called directly * @param {egwActionObject[] | undefined} selected Selected row, or undefined if called directly */ - filemanagerAPP.prototype.createdir = function (action, selected) { - var self = this; + createdir(action, selected) { + let self = this; et2_dialog.show_prompt(function (button, dir) { if (button && dir) { - var path = self.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false); + let path = self.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false); if (action && action instanceof egwAction) { - var paths = self._elems2paths(selected); + let paths = self._elems2paths(selected); if (paths[0]) path = paths[0]; // check if target is a file --> use it's directory instead if (selected[0].id || path) { - var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::' + path); + let data = egw.dataGetUIDdata(selected[0].id || 'filemanager::' + path); if (data && data.data.mime != 'httpd/unix-directory') { path = self.dirname(path); } @@ -533,18 +519,18 @@ var filemanagerAPP = /** @class */ (function (_super) { self.change_dir((path == '/' ? '' : path) + '/' + egw.encodePathComponent(dir)); } }, this.egw.lang('New directory'), this.egw.lang('Create directory')); - }; + } /** * Prompt user for directory to create */ - filemanagerAPP.prototype.symlink = function () { - var self = this; + symlink() { + let self = this; et2_dialog.show_prompt(function (button, target) { if (button && target) { self._do_action('symlink', target); } }, this.egw.lang('Link target'), this.egw.lang('Create link')); - }; + } /** * Run a serverside action via an ajax call * @@ -553,50 +539,50 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param _sync send a synchronous ajax request * @param _path defaults to current path */ - filemanagerAPP.prototype._do_action = function (_type, _selected, _sync, _path) { + _do_action(_type, _selected, _sync, _path) { if (typeof _path == 'undefined') _path = this.get_path(); egw.json('filemanager_ui::ajax_action', [_type, _selected, _path], this._do_action_callback, this, !_sync, this).sendRequest(); - }; + } /** * Callback for _do_action ajax call * * @param _data */ - filemanagerAPP.prototype._do_action_callback = function (_data) { + _do_action_callback(_data) { window.egw_refresh(_data.msg, this.appname, undefined, undefined, undefined, undefined, undefined, _data.type); - }; + } /** * Force download of a file by appending '?download' to it's download url * * @param _action * @param _senders */ - filemanagerAPP.prototype.force_download = function (_action, _senders) { - for (var i = 0; i < _senders.length; i++) { - var data = egw.dataGetUIDdata(_senders[i].id); - var url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[i].id); + force_download(_action, _senders) { + for (let i = 0; i < _senders.length; i++) { + let data = egw.dataGetUIDdata(_senders[i].id); + let url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[i].id); if (url[0] == '/') url = egw.link(url); - var a = document.createElement('a'); + let a = document.createElement('a'); if (typeof a.download == "undefined") { window.location = (url + "?download"); return false; } // Multiple file download for those that support it - var $a = jQuery(a) + let $a = jQuery(a) .prop('href', url) .prop('download', data ? data.data.name : "") .appendTo(this.et2.getDOMNode()); window.setTimeout(jQuery.proxy(function () { - var evt = document.createEvent('MouseEvent'); + let evt = document.createEvent('MouseEvent'); evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this[0].dispatchEvent(evt); this.remove(); }, $a), 100 * i); } return false; - }; + } /** * Check to see if the browser supports downloading multiple files * (using a tag download attribute) to enable/disable the context menu @@ -604,19 +590,19 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {egwAction} action * @param {egwActionObject[]} selected */ - filemanagerAPP.prototype.is_multiple_allowed = function (action, selected) { - var allowed = typeof document.createElement('a').download != "undefined"; + is_multiple_allowed(action, selected) { + let allowed = typeof document.createElement('a').download != "undefined"; if (typeof action == "undefined") return allowed; return (allowed || selected.length <= 1) && action.not_disableClass.apply(action, arguments); - }; + } /** * Change directory * * @param {string} _dir directory to change to incl. '..' for one up * @param {et2_widget} widget */ - filemanagerAPP.prototype.change_dir = function (_dir, widget) { + change_dir(_dir, widget) { for (var etemplate_name in this.path_widget) break; if (widget) @@ -635,7 +621,7 @@ var filemanagerAPP = /** @class */ (function (_super) { break; } this.path_widget[etemplate_name].set_value(_dir); - }; + } /** * Toggle view between tiles and rows * @@ -643,9 +629,9 @@ var filemanagerAPP = /** @class */ (function (_super) { * Or, if this is used as a callback view is actually the event, and we need to find the view. * @param {et2_widget} [button_widget] - The widget that's calling */ - filemanagerAPP.prototype.change_view = function (view, button_widget) { - var et2 = etemplate2.getById('filemanager-index'); - var nm; + change_view(view, button_widget) { + let et2 = etemplate2.getById('filemanager-index'); + let nm; if (et2 && et2.widgetContainer.getWidgetById('nm')) { nm = et2.widgetContainer.getWidgetById('nm'); } @@ -670,7 +656,7 @@ var filemanagerAPP = /** @class */ (function (_super) { // Put it into active filters (but don't refresh) nm.activeFilters["view"] = view; // Change template to match - var template = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile'; + let template = view == et2_nextmatch_controller.VIEW_ROW ? 'filemanager.index.rows' : 'filemanager.tile'; nm.set_template(template); // Wait for template to load, then refresh template = nm.getWidgetById(template); @@ -679,21 +665,21 @@ var filemanagerAPP = /** @class */ (function (_super) { nm.applyFilters({ view: view }); }); } - }; + } /** * Open/active an item * * @param _action * @param _senders */ - filemanagerAPP.prototype.open = function (_action, _senders) { - var data = egw.dataGetUIDdata(_senders[0].id); - var path = this.id2path(_senders[0].id); + open(_action, _senders) { + let data = egw.dataGetUIDdata(_senders[0].id); + let path = this.id2path(_senders[0].id); this.et2 = this.et2 ? this.et2 : etemplate2.getById('filemanager-index').widgetContainer; - var mime = this.et2._inst.widgetContainer.getWidgetById('$row'); + let mime = this.et2._inst.widgetContainer.getWidgetById('$row'); // try to get mime widget DOM node out of the row DOM - var mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row"); - var fe = egw_get_file_editor_prefered_mimes(); + let mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row"); + let fe = egw_get_file_editor_prefered_mimes(); // symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir' if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1) { this.change_dir(path, _action.parent.data.nextmatch || this.et2); @@ -708,7 +694,7 @@ var filemanagerAPP = /** @class */ (function (_super) { }), '', fe.edit_popup); } else { - var url = void 0; + let url; // Build ViewerJS url if (data.data.mime.match(/application\/vnd\.oasis\.opendocument/) && egw.preference('document_doubleclick_action', 'filemanager') == 'collabeditor') { @@ -717,20 +703,20 @@ var filemanagerAPP = /** @class */ (function (_super) { egw.open({ path: path, type: data.data.mime, download_url: url }, 'file', 'view', null, '_browser'); } return false; - }; + } /** * Edit prefs of current directory * * @param _action * @param _senders */ - filemanagerAPP.prototype.editprefs = function (_action, _senders) { - var path = typeof _senders != 'undefined' ? this.id2path(_senders[0].id) : this.get_path(_action && _action.parent.data.nextmatch.getInstanceManager().uniqueId || false); + editprefs(_action, _senders) { + let path = typeof _senders != 'undefined' ? this.id2path(_senders[0].id) : this.get_path(_action && _action.parent.data.nextmatch.getInstanceManager().uniqueId || false); egw().open_link(egw.link('/index.php', { menuaction: 'filemanager.filemanager_ui.file', path: path }), 'fileprefs', '510x425'); - }; + } /** * Callback to check if the paste action is enabled. We also update the * clipboard historical targets here as well @@ -741,9 +727,9 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @returns boolean true if enabled, false otherwise */ - filemanagerAPP.prototype.paste_enabled = function (_action, _senders, _target) { + paste_enabled(_action, _senders, _target) { // Need files in the clipboard for this - var clipboard_files = this.get_clipboard_files(); + let clipboard_files = this.get_clipboard_files(); if (clipboard_files.length === 0) { return false; } @@ -754,18 +740,18 @@ var filemanagerAPP = /** @class */ (function (_super) { if (_action.canHaveChildren.indexOf('drop') == -1) { _action.canHaveChildren.push('drop'); } - var actions = []; + let actions = []; // Current directory - var current_dir = this.get_path(); - var dir = egw.dataGetUIDdata('filemanager::' + current_dir); - var path_widget = etemplate2.getById('filemanager-index').widgetContainer.getWidgetById('button[createdir]'); + let current_dir = this.get_path(); + let dir = egw.dataGetUIDdata('filemanager::' + current_dir); + let path_widget = etemplate2.getById('filemanager-index').widgetContainer.getWidgetById('button[createdir]'); actions.push({ id: _action.id + '_current', caption: current_dir, path: current_dir, enabled: dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 || !dir && path_widget && !path_widget.options.readonly }); // Target, if directory - var target_dir = this.id2path(_target.id); + let target_dir = this.id2path(_target.id); dir = egw.dataGetUIDdata(_target.id); actions.push({ id: _action.id + '_target', @@ -775,10 +761,10 @@ var filemanagerAPP = /** @class */ (function (_super) { (dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 || !dir) }); // Last 10 folders - var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname)); - var action_index = 0; - for (var i = 0; i < 10; i++) { - var path = i < previous_dsts.length ? previous_dsts[i] : ''; + let previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname)); + let action_index = 0; + for (let i = 0; i < 10; i++) { + let path = i < previous_dsts.length ? previous_dsts[i] : ''; actions.push({ id: _action.id + '_target_' + action_index++, caption: path, @@ -788,7 +774,7 @@ var filemanagerAPP = /** @class */ (function (_super) { }); } // Common stuff, every action needs these - for (var i = 0; i < actions.length; i++) { + for (let i = 0; i < actions.length; i++) { //actions[i].type = 'drop', actions[i].acceptedTypes = _action.acceptedTypes; actions[i].no_lang = true; @@ -797,9 +783,9 @@ var filemanagerAPP = /** @class */ (function (_super) { _action.updateActions(actions); // Create paste action // This injects the clipboard data and calls the original handler - var paste_exec = function (action, selected) { + let paste_exec = function (action, selected) { // Add in clipboard as a sender - var clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')); + let clipboard = JSON.parse(egw.getSessionItem('phpgwapi', 'egw_clipboard')); // Set a flag so apps can tell the difference, if they need to action.set_onExecute(action.parent.onExecute.fnct); action.execute(clipboard.selected, selected[0]); @@ -811,12 +797,12 @@ var filemanagerAPP = /** @class */ (function (_super) { })); } }; - for (var i = 0; i < actions.length; i++) { + for (let i = 0; i < actions.length; i++) { _action.getActionById(actions[i].id).onExecute = jQuery.extend(true, {}, _action.onExecute); _action.getActionById(actions[i].id).set_onExecute(paste_exec); } return actions.length > 0; - }; + } /** * File(s) droped * @@ -825,19 +811,19 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param _target * @returns */ - filemanagerAPP.prototype.drop = function (_action, _elems, _target) { - var src = this._elems2paths(_elems); + drop(_action, _elems, _target) { + let src = this._elems2paths(_elems); // Target will be missing ID if directory is empty // so start with the current directory - var parent = _action; - var nm = _target ? _target.manager.data.nextmatch : null; + let parent = _action; + let nm = _target ? _target.manager.data.nextmatch : null; while (!nm && parent.parent) { parent = parent.parent; if (parent.data.nextmatch) nm = parent.data.nextmatch; } - var nm_dst = this.get_path(nm.getInstanceManager().uniqueId || false); - var dst; + let nm_dst = this.get_path(nm.getInstanceManager().uniqueId || false); + let dst; // Action specifies a destination, target does not matter if (_action.data && _action.data.path) { dst = _action.data.path; @@ -845,27 +831,27 @@ var filemanagerAPP = /** @class */ (function (_super) { // File(s) were dropped on a row, they want them inside else if (_target) { dst = ''; - var paths = this._elems2paths([_target]); + let paths = this._elems2paths([_target]); if (paths[0]) dst = paths[0]; // check if target is a file --> use it's directory instead if (_target.id) { - var data = egw.dataGetUIDdata(_target.id); + let data = egw.dataGetUIDdata(_target.id); if (!data || data.data.mime != 'httpd/unix-directory') { dst = this.dirname(dst); } } } // Remember the target for next time - var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname)); + let previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname)); previous_dsts.unshift(dst); previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9); egw.set_preference(this.appname, 'drop_history', previous_dsts); // Actual action id will be something like file_drop_{move|copy|link}[_other_id], // but we need to send move, copy or link - var action_id = _action.id.replace("file_drop_", '').split('_', 1)[0]; + let action_id = _action.id.replace("file_drop_", '').split('_', 1)[0]; this._do_action(action_id, src, false, dst || nm_dst); - }; + } /** * Handle a native / HTML5 file drop from system * @@ -874,15 +860,15 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {string} row_uid UID of the row the files were dropped on * @param {Files[]} files */ - filemanagerAPP.prototype.filedrop = function (row_uid, files) { - var self = this; - var data = egw.dataGetUIDdata(row_uid); + filedrop(row_uid, files) { + let self = this; + let data = egw.dataGetUIDdata(row_uid); files = files || window.event.dataTransfer.files; - var path = typeof data != 'undefined' && data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path(); - var widget = this.et2.getWidgetById('upload'); + let path = typeof data != 'undefined' && data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path(); + let widget = this.et2.getWidgetById('upload'); // Override finish to specify a potentially different path - var old_onfinishone = widget.options.onFinishOne; - var old_onfinish = widget.options.onFinish; + let old_onfinishone = widget.options.onFinishOne; + let old_onfinish = widget.options.onFinish; widget.options.onFinishOne = function (_event, _file_count) { self.upload(_event, _file_count, path); }; @@ -894,7 +880,7 @@ var filemanagerAPP = /** @class */ (function (_super) { widget.set_value(files); // Return false to prevent the link return false; - }; + } /** * Change readonly state for given directory * @@ -903,57 +889,57 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {string} _path * @param {boolean} _ro */ - filemanagerAPP.prototype.set_readonly = function (_path, _ro) { + set_readonly(_path, _ro) { //alert('set_readonly("'+_path+'", '+_ro+')'); if (!this.path_widget) // widget not yet ready, try later { this.readonly = [_path, _ro]; return; } - for (var id in this.path_widget) { - var path = this.get_path(id); + for (let id in this.path_widget) { + let path = this.get_path(id); if (_path == path) { - var ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload', 'new']; - for (var i = 0; i < ids.length; ++i) { - var widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]); + let ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload', 'new']; + for (let i = 0; i < ids.length; ++i) { + let widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]); if (widget) { widget.set_readonly(_ro); } } } } - }; + } /** * Row or filename in select-file dialog clicked * * @param {jQuery.event} event * @param {et2_widget} widget */ - filemanagerAPP.prototype.select_clicked = function (event, widget) { + select_clicked(event, widget) { var _a; if ((_a = widget === null || widget === void 0 ? void 0 : widget.value) === null || _a === void 0 ? void 0 : _a.is_dir) { - var path_1 = null; + let path = null; // Cannot do this, there are multiple widgets named path // widget.getRoot().getWidgetById("path"); widget.getRoot().iterateOver(function (widget) { if (widget.id == "path") - path_1 = widget; + path = widget; }, null, et2_textbox); - if (path_1) { - path_1.set_value(widget.value.path); + if (path) { + path.set_value(widget.value.path); } } else if (this.et2 && this.et2.getArrayMgr('content').getEntry('mode') != 'open-multiple') { - var editfield = this.et2.getWidgetById('name'); + let editfield = this.et2.getWidgetById('name'); if (editfield) { editfield.set_value(widget.value.name); } } else { - var file_1 = widget.value.name; + let file = widget.value.name; widget.getParent().iterateOver(function (widget) { - if (widget.options.selected_value == file_1) { - widget.set_value(widget.get_value() == file_1 ? widget.options.unselected_value : file_1); + if (widget.options.selected_value == file) { + widget.set_value(widget.get_value() == file ? widget.options.unselected_value : file); } }, null, et2_checkbox); } @@ -961,15 +947,15 @@ var filemanagerAPP = /** @class */ (function (_super) { event.preventDefault(); event.stopPropagation(); return false; - }; + } /** * Set Sudo button's label and change its onclick handler according to its action * * @param {widget object} _widget sudo buttononly * @param {string} _action string of action type {login|logout} */ - filemanagerAPP.prototype.set_sudoButton = function (_widget, _action) { - var widget = _widget || this.et2.getWidgetById('sudouser'); + set_sudoButton(_widget, _action) { + let widget = _widget || this.et2.getWidgetById('sudouser'); if (widget) { switch (_action) { case 'login': @@ -983,11 +969,11 @@ var filemanagerAPP = /** @class */ (function (_super) { }; } } - }; + } /** * Open file a file dialog from EPL, warn if EPL is not available */ - filemanagerAPP.prototype.fileafile = function () { + fileafile() { if (this.egw.user('apps').stylite) { this.egw.open_link('/index.php?menuaction=stylite.stylite_filemanager.upload&path=' + this.get_path(), '_blank', '670x320'); } @@ -1001,7 +987,7 @@ var filemanagerAPP = /** @class */ (function (_super) { this.egw.lang('You can use regular upload [+] button to upload files.') + "\n\n" + this.egw.lang('Do you want more information about EPL subscription?'), this.egw.lang('File a file'), undefined, et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE); } - }; + } /** * create a share-link for the given entry * Overriden from parent to handle empty directories @@ -1014,35 +1000,35 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {Function} _callback Callback with results * @returns {Boolean} returns false if not successful */ - filemanagerAPP.prototype.share_link = function (_action, _senders, _target, _writable, _files, _callback) { + share_link(_action, _senders, _target, _writable, _files, _callback) { // Check to see if we're in the empty row (No matches found.) and use current path - var path = _senders[0].id; + let path = _senders[0].id; if (!path) { _senders[0] = { id: this.get_path() }; } // Pass along any action data - var _extra = {}; - for (var i in _action.data) { + let _extra = {}; + for (let i in _action.data) { if (i.indexOf('share') == 0) { _extra[i] = _action.data[i]; } } - _super.prototype.share_link.call(this, _action, _senders, _target, _writable, _files, _callback, _extra); - }; + super.share_link(_action, _senders, _target, _writable, _files, _callback, _extra); + } /** * Share-link callback * @param {object} _data */ - filemanagerAPP.prototype._share_link_callback = function (_data) { + _share_link_callback(_data) { if (_data.msg || _data.share_link) window.egw_refresh(_data.msg, this.appname); console.log("_data", _data); - var app = this; - var copy_link_to_clipboard = function (evt) { - var $target = jQuery(evt.target); + let app = this; + let copy_link_to_clipboard = function (evt) { + let $target = jQuery(evt.target); $target.select(); try { - var successful = document.execCommand('copy'); + let successful = document.execCommand('copy'); if (successful) { egw.message(app.egw.lang('Share link copied into clipboard')); return true; @@ -1063,19 +1049,19 @@ var filemanagerAPP = /** @class */ (function (_super) { width: 450, value: { content: { "share_link": _data.share_link } } }); - }; + } /** * Check if a row can have the Hidden Uploads action * Needs to be a directory */ - filemanagerAPP.prototype.hidden_upload_enabled = function (_action, _senders) { + hidden_upload_enabled(_action, _senders) { if (_senders[0].id == 'nm') return false; - var data = egw.dataGetUIDdata(_senders[0].id); - var readonly = ((data === null || data === void 0 ? void 0 : data.data.class) || '').split(/ +/).indexOf('noEdit') >= 0; + let data = egw.dataGetUIDdata(_senders[0].id); + let readonly = ((data === null || data === void 0 ? void 0 : data.data.class) || '').split(/ +/).indexOf('noEdit') >= 0; // symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir' return (!_senders[0].id || data.data.is_dir && !readonly); - }; + } /** * View the link from an existing share * (EPL only) @@ -1083,11 +1069,11 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {egwAction} _action The shareLink action * @param {egwActionObject[]} _senders The row clicked on */ - filemanagerAPP.prototype.view_link = function (_action, _senders) { - var id = egw.dataGetUIDdata(_senders[0].id).data.share_id; + view_link(_action, _senders) { + let id = egw.dataGetUIDdata(_senders[0].id).data.share_id; egw.json('stylite_filemanager::ajax_view_link', [id], this._share_link_callback, this, true, this).sendRequest(); return true; - }; + } /** * This function copies the selected file/folder entry as webdav link into clipboard * @@ -1095,21 +1081,21 @@ var filemanagerAPP = /** @class */ (function (_super) { * @param {object} _senders selected nm row * @returns {Boolean} returns false if not successful */ - filemanagerAPP.prototype.copy_link = function (_action, _senders) { - var data = egw.dataGetUIDdata(_senders[0].id); - var url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[0].id); + copy_link(_action, _senders) { + let data = egw.dataGetUIDdata(_senders[0].id); + let url = data ? data.data.download_url : '/webdav.php' + this.id2path(_senders[0].id); if (url[0] == '/') url = egw.link(url); if (url.substr(0, 4) == 'http' && url.indexOf('://') <= 5) { // it's already a full url } else { - var hostUrl = new URL(window.location.href); + let hostUrl = new URL(window.location.href); url = hostUrl.origin + url; } if (url) { - var elem = jQuery(document.createElement('div')); - var range = void 0; + let elem = jQuery(document.createElement('div')); + let range; elem.text(url); elem.appendTo('body'); if (document.selection) { @@ -1123,7 +1109,7 @@ var filemanagerAPP = /** @class */ (function (_super) { window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } - var successful = false; + let successful = false; try { successful = document.execCommand('copy'); if (successful) { @@ -1137,7 +1123,7 @@ var filemanagerAPP = /** @class */ (function (_super) { elem.remove(); return false; } - }; + } /** * Function to check wheter selected file is editable. ATM only .odt is supported. * @@ -1146,16 +1132,16 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @returns {boolean} returns true if is editable otherwise false */ - filemanagerAPP.prototype.isEditable = function (_egwAction, _senders) { + isEditable(_egwAction, _senders) { if (_senders.length > 1) return false; - var data = egw.dataGetUIDdata(_senders[0].id); - var mime = this.et2.getInstanceManager().widgetContainer.getWidgetById('$row'); - var fe = egw_get_file_editor_prefered_mimes(data.data.mime); + let data = egw.dataGetUIDdata(_senders[0].id); + let mime = this.et2.getInstanceManager().widgetContainer.getWidgetById('$row'); + let fe = egw_get_file_editor_prefered_mimes(data.data.mime); if (fe && fe.mime && !fe.mime[data.data.mime]) return false; return !!data.data.mime.match(mime.mime_odf_regex); - }; + } /** * Method to create a new document * @param {object} _action either action or node @@ -1163,17 +1149,15 @@ var filemanagerAPP = /** @class */ (function (_super) { * * @return {boolean} returns true */ - filemanagerAPP.prototype.create_new = function (_action, _selected) { - var fe = egw.link_get_registry('filemanager-editor'); + create_new(_action, _selected) { + let fe = egw.link_get_registry('filemanager-editor'); if (fe && fe["edit"]) { egw.open_link(egw.link('/index.php', { menuaction: fe["edit"].menuaction }), '', fe["popup_edit"]); } return true; - }; - return filemanagerAPP; -}(egw_app_1.EgwApp)); -exports.filemanagerAPP = filemanagerAPP; + } +} app.classes.filemanager = filemanagerAPP; //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/filemanager/js/app.ts b/filemanager/js/app.ts index b52707f95e..5902eba4da 100644 --- a/filemanager/js/app.ts +++ b/filemanager/js/app.ts @@ -1,10 +1,10 @@ /** * EGroupware - Filemanager - Javascript UI * - * @link http://www.egroupware.org + * @link https://www.egroupware.org * @package filemanager * @author Ralf Becker - * @copyright (c) 2008-19 by Ralf Becker + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ @@ -13,6 +13,13 @@ */ import {EgwApp} from "../../api/js/jsapi/egw_app"; import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch"; +import {etemplate2} from "../../api/js/etemplate/etemplate2"; +import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog"; +import {et2_file} from "../../api/js/etemplate/et2_widget_file"; +import {et2_button} from "../../api/js/etemplate/et2_widget_button"; +import {et2_nextmatch_controller} from "../../api/js/etemplate/et2_extension_nextmatch_controller"; +import {egw_get_file_editor_prefered_mimes} from "../../api/js/jsapi/egw_global"; +import {et2_createWidget} from "../../api/js/etemplate/et2_core_widget"; /** * UI for filemanager diff --git a/infolog/js/app.js b/infolog/js/app.js index b4e05d3ecb..cf9d763a9a 100644 --- a/infolog/js/app.js +++ b/infolog/js/app.js @@ -10,11 +10,10 @@ /*egw:uses /api/js/jsapi/egw_app.js */ -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"; +import { nm_open_popup } from "../../api/js/etemplate/et2_extension_nextmatch_actions"; /** * UI for Infolog * @@ -639,8 +638,7 @@ class InfologApp extends EgwApp { 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 () { + egw.includeJS('/stylite/js/app.js?' + this.et2.getArrayMgr('content').getEntry('encryption_ts'), undefined, undefined, egw.webserverUrl).then(() => { app.stylite = new app.classes.stylite; app.stylite.et2 = self.et2; if (callback) { diff --git a/infolog/js/app.ts b/infolog/js/app.ts index 44de8ef6e7..525fcebeed 100644 --- a/infolog/js/app.ts +++ b/infolog/js/app.ts @@ -12,14 +12,12 @@ /api/js/jsapi/egw_app.js */ -import 'jquery'; -import 'jqueryui'; - import {EgwApp} from '../../api/js/jsapi/egw_app'; import {etemplate2} from "../../api/js/etemplate/etemplate2"; import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch"; import {CRMView} from "../../addressbook/js/CRM"; import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox"; +import {nm_open_popup} from "../../api/js/etemplate/et2_extension_nextmatch_actions"; /** * UI for Infolog @@ -780,8 +778,8 @@ 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() + egw.includeJS('/stylite/js/app.js?'+this.et2.getArrayMgr('content').getEntry('encryption_ts'), + undefined, undefined, egw.webserverUrl).then(() => { app.stylite = new app.classes.stylite; app.stylite.et2 = self.et2; diff --git a/pixelegg/js/fw_pixelegg.js b/pixelegg/js/fw_pixelegg.js index 5f49548384..2f6664ee9e 100644 --- a/pixelegg/js/fw_pixelegg.js +++ b/pixelegg/js/fw_pixelegg.js @@ -13,7 +13,6 @@ framework.fw_desktop; /pixelegg/js/slider.js; */ -import '../../vendor/bower-asset/jquery/dist/jquery.js'; import '../../api/js/framework/fw_desktop.js'; import './slider.js'; diff --git a/pixelegg/js/slider.js b/pixelegg/js/slider.js index 8d27fff153..c2a03a3aab 100644 --- a/pixelegg/js/slider.js +++ b/pixelegg/js/slider.js @@ -7,8 +7,6 @@ * @package pixelegg */ -import '../../api/js/jquery/chosen/chosen.jquery.js'; - egw_ready.then(function() { /** diff --git a/resources/js/app.js b/resources/js/app.js index bc4ef8be94..d6b09991f7 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,55 +1,39 @@ -"use strict"; /** * EGroupware - Resources - Javascript UI * - * @link http://www.egroupware.org + * @link https://www.egroupware.org * @package resources - * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Hadi Nategh + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id: app.js 44390 2013-11-04 20:54:23Z ralfbecker $ */ -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 }); -var egw_app_1 = require("../../api/js/jsapi/egw_app"); +import { EgwApp } from "../../api/js/jsapi/egw_app"; +import { fetchAll } from "../../api/js/etemplate/et2_extension_nextmatch_actions"; /** * UI for resources */ -var resourcesApp = /** @class */ (function (_super) { - __extends(resourcesApp, _super); +class resourcesApp extends EgwApp { /** * Constructor */ - function resourcesApp() { - return _super.call(this, 'resources') || this; + constructor() { + super('resources'); } /** * Destructor */ - resourcesApp.prototype.destroy = function (_app) { + destroy(_app) { delete this.et2; - _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, * make sure to clean it up in destroy(). */ - resourcesApp.prototype.et2_ready = function (et2, name) { - _super.prototype.et2_ready.call(this, et2, name); - }; + et2_ready(et2, name) { + super.et2_ready(et2, name); + } /** * call calendar planner by selected resources * @@ -57,14 +41,14 @@ var resourcesApp = /** @class */ (function (_super) { * @param {action} _senders selected action * */ - resourcesApp.prototype.view_calendar = function (_action, _senders) { - var res_ids = []; - var matches = []; - var nm = _action.parent.data.nextmatch; - var selection = nm.getSelection(); - var show_calendar = function (res_ids) { + view_calendar(_action, _senders) { + let res_ids = []; + let matches = []; + let nm = _action.parent.data.nextmatch; + let selection = nm.getSelection(); + let show_calendar = function (res_ids) { egw(window).message(this.egw.lang('%1 resource(s) View calendar', res_ids.length)); - var current_owners = (app.calendar ? app.calendar.state.owner || [] : []).join(','); + let current_owners = (app.calendar ? app.calendar.state.owner || [] : []).join(','); if (current_owners) { current_owners += ','; } @@ -75,7 +59,7 @@ var resourcesApp = /** @class */ (function (_super) { fetchAll(res_ids, nm, show_calendar); } else { - for (var i = 0; i < _senders.length; i++) { + for (let i = 0; i < _senders.length; i++) { res_ids.push(_senders[i].id); matches = res_ids[i].match(/^(?:resources::)?([0-9]+)(:([0-9]+))?$/); if (matches) { @@ -84,23 +68,23 @@ var resourcesApp = /** @class */ (function (_super) { } show_calendar(res_ids); } - }; + } /** * Calendar sidebox hook change handler * */ - resourcesApp.prototype.sidebox_change = function (ev, widget) { + sidebox_change(ev, widget) { if (ev[0] != 'r') { widget.setSubChecked(ev, widget.getValue()[ev].value || false); } - var owner = jQuery.extend([], app.calendar.state.owner) || []; - for (var i = owner.length - 1; i >= 0; i--) { + let owner = jQuery.extend([], app.calendar.state.owner) || []; + for (let i = owner.length - 1; i >= 0; i--) { if (owner[i][0] == 'r') { owner.splice(i, 1); } } - var value = widget.getValue(); - for (var key in value) { + let value = widget.getValue(); + for (let key in value) { if (key[0] !== 'r') continue; if (value[key].value && owner.indexOf(key) === -1) { @@ -108,16 +92,16 @@ var resourcesApp = /** @class */ (function (_super) { } } app.calendar.update_state({ owner: owner }); - }; + } /** * Book selected resource for calendar * * @param {action} _action actions * @param {action} _senders selected action */ - resourcesApp.prototype.book = function (_action, _senders) { - var res_ids = [], matches = []; - for (var i = 0; i < _senders.length; i++) { + book(_action, _senders) { + let res_ids = [], matches = []; + for (let i = 0; i < _senders.length; i++) { res_ids.push(_senders[i].id); matches = res_ids[i].match(/^(?:resources::)?([0-9]+)(:([0-9]+))?$/); if (matches) { @@ -126,18 +110,17 @@ var resourcesApp = /** @class */ (function (_super) { } egw(window).message(this.egw.lang('%1 resource(s) booked', res_ids.length)); this.egw.open_link('calendar.calendar_uiforms.edit&participants=r' + res_ids.join(',r'), '_blank', '700x700'); - }; + } /** * set the picture_src to own_src by uploding own file * */ - resourcesApp.prototype.select_picture_src = function () { - var rBtn = this.et2.getWidgetById('picture_src'); + select_picture_src() { + let rBtn = this.et2.getWidgetById('picture_src'); if (typeof rBtn != 'undefined') { rBtn.set_value('own_src'); } - }; - return resourcesApp; -}(egw_app_1.EgwApp)); + } +} app.classes.resources = resourcesApp; //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/resources/js/app.ts b/resources/js/app.ts index 26def3489d..5bae870f4c 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -1,15 +1,15 @@ /** * EGroupware - Resources - Javascript UI * - * @link http://www.egroupware.org + * @link https://www.egroupware.org * @package resources - * @author Hadi Nategh - * @copyright (c) 2008-13 by Ralf Becker + * @author Hadi Nategh + * @copyright (c) 2008-21 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id: app.js 44390 2013-11-04 20:54:23Z ralfbecker $ */ import {EgwApp} from "../../api/js/jsapi/egw_app"; +import {fetchAll} from "../../api/js/etemplate/et2_extension_nextmatch_actions"; /** * UI for resources