fix skipping timestamps, but preferring .min.js over .js

added more apps to rollup.config.js (ones givening errors are commented out)
This commit is contained in:
Ralf Becker 2021-06-29 15:21:19 +02:00
parent 3add958afa
commit d7cd90ebe7
8 changed files with 2361 additions and 2230 deletions

View File

@ -1,265 +1,13 @@
import { E as EgwApp, e as egw, a as et2_nextmatch, b as etemplate2, c as et2_dialog, n as nm_action, f as fetchAll } from '../../chunks/etemplate2-c2e8c88a.js';
import '../../chunks/egw_dragdrop_dhtmlx_tree-03e0edbb.js';
import '../../chunks/egw-745f42d8.js';
import { E as EgwApp, e as egw, a as etemplate2, b as et2_dialog, n as nm_action, f as fetchAll } from '../../chunks/etemplate2-0eb045cf.js';
import '../../chunks/CRM-49d7b139.js';
import '../../chunks/egw_dragdrop_dhtmlx_tree-31643465.js';
import '../../chunks/egw-5f30b5ae.js';
import '../../vendor/bower-asset/jquery/dist/jquery.min.js';
import '../../vendor/bower-asset/jquery-ui/jquery-ui.js';
import '../../chunks/egw_json-05acc323.js';
import '../../chunks/egw_core-fa745c26.js';
import '../../chunks/egw_json-98998d7e.js';
import '../../chunks/egw_core-0ec5dc11.js';
import '../../vendor/tinymce/tinymce/tinymce.min.js';
/**
* EGroupware - Addressbook - Javascript UI
*
* @link: https://www.egroupware.org
* @package addressbook
* @author Hadi Nategh <hn-AT-stylite.de>
* @author Ralf Becker <rb-AT-egroupware.org>
* @copyright (c) 2008-21 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
/**
* UI for Addressbook CRM view
*
*/
class CRMView extends EgwApp {
// List ID
list_id = ""; // Reference to the list
nm = null; // Which addressbook contact id(s) we are showing entries for
contact_ids = []; // Private js for the list
app_obj = null; // Hold on to the original push handler
// Push data key(s) to check for our contact ID in the entry's ACL data
push_contact_ids = ["contact_id"];
/**
* Constructor
*
* CRM is part of addressbook
*/
constructor() {
// call parent
super('addressbook');
}
/**
* Destructor
*/
destroy(_app) {
this.nm = null;
if (this.app_obj != null) {
this.app_obj.destroy(_app);
} // call parent
super.destroy(_app);
}
/**
* A template from an app is ready, looks like it might be a CRM view.
* Check it, get CRM ready, and bind accordingly
*
* @param et2
* @param appname
*/
static view_ready(et2, app_obj) {
// Check to see if the template is for a CRM view
if (et2.app == app_obj.appname) {
return CRMView.reconnect(app_obj);
} // Make sure object is there, etemplate2 will pick it up and call our et2_ready
let crm = undefined; // @ts-ignore
if (typeof et2.app_obj.crm == "undefined" && app.classes.crm) {
// @ts-ignore
crm = et2.app_obj.crm = new app.classes.crm();
}
if (typeof crm == "undefined") {
egw.debug("error", "CRMView object is missing");
return false;
} // We can set this now
crm.set_view_obj(app_obj);
}
/**
* This function is called when the etemplate2 object is loaded
* and ready. The associated app [is supposed to have] already called its own et2_ready(),
* so any changes done here will override the app.
*
* @param {etemplate2} et2 newly ready object
* @param {string} name Template name
*/
et2_ready(et2, name) {
// call parent
super.et2_ready(et2, name);
}
/**
* Our CRM has become disconnected from its list, probably because something submitted.
* Find it, and get things working again.
*
* @param app_obj
*/
static reconnect(app_obj) {
// Check
let contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || "";
if (!contact_ids) return;
for (let existing_app of EgwApp._instances) {
if (existing_app instanceof CRMView && existing_app.list_id == app_obj.et2.getInstanceManager().uniqueId) {
// List was reloaded. Rebind.
existing_app.app_obj.destroy(existing_app.app_obj.appname);
if (!existing_app.nm?.getParent()) {
try {
// This will probably not die cleanly, we had a reference when it was destroyed
existing_app.nm.destroy();
} catch (e) {}
}
return existing_app.set_view_obj(app_obj);
}
}
}
/**
* Set the associated private app JS
* We try and pull the needed info here
*/
set_view_obj(app_obj) {
this.app_obj = app_obj; // Make sure object is there, etemplate2 will pick it up and call our et2_ready
app_obj.et2.getInstanceManager().app_obj.crm = this; // Make _sure_ we get notified if the list is removed (actions, refresh) - this is not always a full
// destruction
jQuery(app_obj.et2.getDOMNode()).on('clear', function () {
this.nm = null;
}.bind(this)); // For easy reference later
this.list_id = app_obj.et2.getInstanceManager().uniqueId;
this.nm = app_obj.et2.getDOMWidgetById('nm');
let contact_ids = app_obj.et2.getArrayMgr("content").getEntry("action_id") || "";
if (typeof contact_ids == "string") {
contact_ids = contact_ids.split(",");
}
this.set_contact_ids(contact_ids); // Override the push handler
this._override_push(app_obj);
}
/**
* Set or change which contact IDs we are showing entries for
*/
set_contact_ids(ids) {
this.contact_ids = ids;
let filter = {
action_id: this.contact_ids
};
if (this.nm !== null) {
this.nm.applyFilters(filter);
}
}
/**
* Handle a push notification about entry changes from the websocket
*
* @param pushData
* @param {string} pushData.app application name
* @param {(string|number)} pushData.id id of entry to refresh or null
* @param {string} pushData.type either 'update', 'edit', 'delete', 'add' or null
* - update: request just modified data from given rows. Sorting is not considered,
* so if the sort field is changed, the row will not be moved.
* - edit: rows changed, but sorting may be affected. Requires full reload.
* - delete: just delete the given rows clientside (no server interaction neccessary)
* - add: ask server for data, add in intelligently
* @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
*/
push(pushData) {
if (pushData.app !== this.app_obj.appname || !this.nm) return; // If we know about it and it's an update, just update.
// This must be before all ACL checks, as contact might have changed and entry needs to be removed
// (server responds then with null / no entry causing the entry to disappear)
if (pushData.type !== "add" && this.egw.dataHasUID(this.uid(pushData))) {
// Check to see if it's in OUR nextmatch
let uid = this.uid(pushData);
let known = Object.values(this.nm.controller._indexMap).filter(function (row) {
return row.uid == uid;
});
let type = pushData.type;
if (known && known.length > 0) {
if (!this.id_check(pushData.acl)) {
// Was ours, not anymore, and we know this now - no server needed. Just remove from nm.
type = et2_nextmatch.DELETE;
}
return this.nm.refresh(pushData.id, type);
}
}
if (this.id_check(pushData.acl)) {
return this._app_obj_push(pushData);
}
}
/**
* Check to see if the given entry is "ours"
*
* @param entry
*/
id_check(entry) {
// Check if it's for one of our contacts
for (let field of this.push_contact_ids) {
if (entry && entry[field]) {
let val = typeof entry[field] == "string" ? [entry[field]] : entry[field];
if (val.filter(v => this.contact_ids.indexOf(v) >= 0).length > 0) {
return true;
}
}
}
return false;
}
/**
* Override the list's push handler to do nothing, we'll call it if we want it.
*
* @param app_obj
* @private
*/
_override_push(app_obj) {
this._app_obj_push = app_obj.push.bind(app_obj);
app_obj.push = function (pushData) {
return false;
};
}
}
app.classes.crm = CRMView;
/**
* EGroupware - Addressbook - Javascript UI
*

View File

@ -1081,8 +1081,8 @@ abstract class Framework extends Framework\Extra
$extra['app'] = $GLOBALS['egw_info']['flags']['currentapp'];
// Static things we want to make sure are loaded first
$java_script .='<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.44/dist/themes/base.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.44/dist/shoelace.js"></script>';
//$java_script .='<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.44/dist/themes/base.css">
//<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.44/dist/shoelace.js"></script>';
// load our clientside entrypoint egw.js
$java_script .= '<script type="module" src="'.$GLOBALS['egw_info']['server']['webserver_url'].
'/api/js/jsapi/egw.min.js" id="egw_script_id"';

View File

@ -45,6 +45,9 @@ class Bundle
*/
public static function js_includes(array $js_includes, array &$to_include=null)
{
// disable dev-mode for now with rollup
unset($GLOBALS['egw_info']['server']['debug_minify']);
$file2bundle = array();
if ($GLOBALS['egw_info']['server']['debug_minify'] !== 'True')
{
@ -115,7 +118,8 @@ class Bundle
$path = $min_path;
$mod = $min_mod;
}
$to_include[$file] = $path;//.'?'.$mod.($query ? '&'.$query : '');
// skip timestamp $to_include[$file] = $path.'?'.$mod.($query ? '&'.$query : '');
$to_include[$file] = $path.($query ? '?'.$query : '');
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,13 @@
import { E as EgwApp, e as egw, a as etemplate2, B as nm_open_popup } from '../../chunks/etemplate2-0eb045cf.js';
import { C as CRMView } from '../../chunks/CRM-49d7b139.js';
import '../../chunks/egw_dragdrop_dhtmlx_tree-31643465.js';
import '../../chunks/egw-5f30b5ae.js';
import '../../vendor/bower-asset/jquery/dist/jquery.min.js';
import '../../vendor/bower-asset/jquery-ui/jquery-ui.js';
import '../../chunks/egw_json-98998d7e.js';
import '../../chunks/egw_core-0ec5dc11.js';
import '../../vendor/tinymce/tinymce/tinymce.min.js';
/**
* EGroupware - Infolog - Javascript UI
*
@ -7,37 +17,31 @@
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
/*egw:uses
/api/js/jsapi/egw_app.js
*/
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.js";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for Infolog
*
* @augments AppJS
*/
class InfologApp extends EgwApp {
// These fields help with push filtering & access control to see if we care about a push message
push_grant_fields = ["info_owner", "info_responsible"];
push_filter_fields = ["info_owner", "info_responsible"];
/**
* Constructor
*
* @memberOf app.infolog
*/
constructor() {
// call parent
super('infolog');
// These fields help with push filtering & access control to see if we care about a push message
this.push_grant_fields = ["info_owner", "info_responsible"];
this.push_filter_fields = ["info_owner", "info_responsible"];
this._action_ids = [];
this._action_all = false;
}
/**
* Destructor
*/
destroy(_app) {
// call parent
super.destroy(_app);
@ -50,58 +54,74 @@ class InfologApp extends EgwApp {
* @param {etemplate2} _et2 newly ready object
* @param {string} _name template name
*/
et2_ready(_et2, _name) {
var _a;
// call parent
super.et2_ready(_et2, _name);
// CRM View
super.et2_ready(_et2, _name); // CRM View
if (typeof CRMView !== "undefined") {
CRMView.view_ready(_et2, this);
}
switch (_name) {
case 'infolog.index':
this.filter_change();
// Show / hide descriptions according to details filter
this.filter_change(); // Show / hide descriptions according to details filter
var nm = this.et2.getWidgetById('nm');
var filter2 = nm.getWidgetById('filter2');
this.show_details(filter2.get_value() == 'all', nm.getDOMNode(nm));
// Remove the rule added by show_details() if the template is removed
jQuery(_et2.DOMContainer).on('clear', jQuery.proxy(function () { egw.css(this); }, '#' + nm.getDOMNode(nm).id + ' .et2_box.infoDes'));
// Enable decrypt on hover
this.show_details(filter2.get_value() == 'all', nm.getDOMNode(nm)); // Remove the rule added by show_details() if the template is removed
jQuery(_et2.DOMContainer).on('clear', jQuery.proxy(function () {
egw.css(this);
}, '#' + nm.getDOMNode(nm).id + ' .et2_box.infoDes')); // Enable decrypt on hover
if (this.egw.user('apps').stylite) {
this._get_stylite(function () { this.mailvelopeAvailable(function () { var _a; (_a = app.stylite) === null || _a === void 0 ? void 0 : _a.decrypt_hover(nm); }); });
}
// blur count, if limit modified optimization used
if (((_a = nm.getController()) === null || _a === void 0 ? void 0 : _a.getTotalCount()) === 9999) {
this._get_stylite(function () {
this.mailvelopeAvailable(function () {
app.stylite?.decrypt_hover(nm);
});
});
} // blur count, if limit modified optimization used
if (nm.getController()?.getTotalCount() === 9999) {
this.blurCount(true);
}
break;
case 'infolog.edit.print':
if (this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) {
this.mailvelopeAvailable(this.printEncrypt);
}
else {
} else {
// Trigger print command if the infolog oppend for printing purpose
this.infolog_print_preview_onload();
}
break;
case 'infolog.edit':
if (this.et2.getArrayMgr('content').data.info_des &&
this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) {
if (this.et2.getArrayMgr('content').data.info_des && this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1) {
this._get_stylite(jQuery.proxy(function () {
this.mailvelopeAvailable(jQuery.proxy(function () {
this.toggleEncrypt();
// Decrypt history on hover
this.toggleEncrypt(); // Decrypt history on hover
var history = this.et2.getWidgetById('history');
app.stylite.decrypt_hover(history, 'span');
jQuery(history.getDOMNode(history))
.tooltip('option', 'position', { my: 'top left', at: 'top left', of: history.getDOMNode(history) });
jQuery(history.getDOMNode(history)).tooltip('option', 'position', {
my: 'top left',
at: 'top left',
of: history.getDOMNode(history)
});
}, this));
}, this));
// This disables the diff in history
}, this)); // This disables the diff in history
var history = this.et2.getArrayMgr('content').getEntry('history');
history['status-widgets'].De = 'description';
}
break;
}
}
@ -124,19 +144,21 @@ class InfologApp extends EgwApp {
* @param {object|null} _links app => array of ids of linked entries
* or null, if not triggered on server-side, which adds that info
*/
observer(_msg, _app, _id, _type, _msg_type, _links) {
if (typeof _links != 'undefined') {
if (typeof _links.infolog != 'undefined') {
switch (_app) {
case 'timesheet':
var nm = this.et2 ? this.et2.getWidgetById('nm') : null;
if (nm)
nm.applyFilters();
if (nm) nm.applyFilters();
break;
}
}
}
// Refresh handler for Addressbook CRM view
} // Refresh handler for Addressbook CRM view
if (_app == 'infolog' && this.et2.getInstanceManager() && this.et2.getInstanceManager().app == 'addressbook' && this.et2.getInstanceManager().name == 'infolog.index') {
this.et2._inst.refresh(_msg, _app, _id, _type);
}
@ -149,19 +171,23 @@ class InfologApp extends EgwApp {
*
* @return {object} Application specific map representing the current state
*/
getState() {
let state = {
action: null,
action_id: null
};
let nm = {};
// Get index etemplate
let nm = {}; // Get index etemplate
var et2 = etemplate2.getById('infolog-index');
if (et2) {
state = et2.widgetContainer.getWidgetById("nm").getValue();
let content = et2.widgetContainer.getArrayMgr('content');
nm = content && content.data && content.data.nm ? content.data.nm : {};
}
state.action = nm.action || null;
state.action_id = nm.action_id || null;
return state;
@ -176,16 +202,25 @@ class InfologApp extends EgwApp {
*
* @return {boolean} false - Returns false to stop event propagation
*/
setState(state) {
// as we have to set state.state.action, we have to set all other
// for "No filter" favorite to work as expected
var to_set = { col_filter: null, filter: '', filter2: '', cat_id: '', search: '', action: null };
if (typeof state.state == 'undefined')
state.state = {};
var to_set = {
col_filter: null,
filter: '',
filter2: '',
cat_id: '',
search: '',
action: null
};
if (typeof state.state == 'undefined') state.state = {};
for (var name in to_set) {
if (typeof state.state[name] == 'undefined')
state.state[name] = to_set[name];
if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name];
}
return super.setState(state);
}
/**
@ -194,10 +229,13 @@ class InfologApp extends EgwApp {
* If the filter is set to something that needs dates, we enable the
* header_left template. Otherwise, it is disabled.
*/
filter_change() {
var filter = this.et2.getWidgetById('filter');
var nm = this.et2.getWidgetById('nm');
var dates = this.et2.getWidgetById('infolog.index.dates');
if (nm && filter) {
switch (filter.getValue()) {
case 'bydate':
@ -208,11 +246,14 @@ class InfologApp extends EgwApp {
jQuery(dates.getWidgetById('startdate').getDOMNode()).find('input').focus();
}, 0);
}
break;
default:
if (dates) {
dates.set_disabled(true);
}
break;
}
}
@ -224,43 +265,52 @@ class InfologApp extends EgwApp {
* @param {Event} event Change event
* @param {et2_nextmatch} nm The nextmatch widget that owns the filter
*/
filter2_change(event, nm) {
var filter2 = nm.getWidgetById('filter2');
if (nm && filter2) {
// Show / hide descriptions
this.show_details(filter2.get_value() === 'all', nm.getDOMNode(nm));
}
// Only change columns for a real user event, to avoid interfering with
} // Only change columns for a real user event, to avoid interfering with
// favorites
if (nm && filter2 && !nm.update_in_progress) {
// Store selection as implicit preference
egw.set_preference('infolog', nm.options.settings.columnselection_pref.replace('-details', '') + '-details-pref', filter2.get_value());
// Change preference location - widget is nextmatch
nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details', '') + (filter2.get_value() == 'all' ? '-details' : '');
// Load new preferences
egw.set_preference('infolog', nm.options.settings.columnselection_pref.replace('-details', '') + '-details-pref', filter2.get_value()); // Change preference location - widget is nextmatch
nm.options.settings.columnselection_pref = nm.options.settings.columnselection_pref.replace('-details', '') + (filter2.get_value() == 'all' ? '-details' : ''); // Load new preferences
var colData = nm.columns.slice();
for (var i = 0; i < nm.columns.length; i++)
colData[i].visible = false;
for (var i = 0; i < nm.columns.length; i++) colData[i].visible = false;
if (egw.preference(nm.options.settings.columnselection_pref, 'infolog')) {
nm.set_columns(egw.preference(nm.options.settings.columnselection_pref, 'infolog').split(','));
}
nm._applyUserPreferences(nm.columns, colData);
// Now apply them to columns
nm._applyUserPreferences(nm.columns, colData); // Now apply them to columns
for (var i = 0; i < colData.length; i++) {
nm.dataview.getColumnMgr().columns[i].set_width(colData[i].width);
nm.dataview.getColumnMgr().columns[i].set_visibility(colData[i].visible);
}
nm.dataview.getColumnMgr().updated();
// Update page - set update_in_progress to true to avoid triggering
nm.dataview.getColumnMgr().updated(); // Update page - set update_in_progress to true to avoid triggering
// the change handler and looping if the user has a custom field
// column change
var in_progress = nm.update_in_progress;
nm.update_in_progress = true;
// Set the actual filter value here
nm.update_in_progress = true; // Set the actual filter value here
nm.activeFilters.filter2 = filter2.get_value();
nm.dataview.updateColumns();
nm.update_in_progress = in_progress;
}
return false;
}
/**
@ -269,12 +319,19 @@ class InfologApp extends EgwApp {
* @param {boolean} show
* @param {DOMNode} dom_node
*/
show_details(show, dom_node) {
// Show / hide descriptions
egw.css((dom_node && dom_node.id ? "#" + dom_node.id + ' ' : '') + ".et2_box.infoDes", "display:" + (show ? "block;" : "none;"));
if (egwIsMobile()) {
var $select = jQuery('.infoDetails');
(show) ? $select.each(function (i, e) { jQuery(e).hide(); }) : $select.each(function (i, e) { jQuery(e).show(); });
show ? $select.each(function (i, e) {
jQuery(e).hide();
}) : $select.each(function (i, e) {
jQuery(e).show();
});
}
}
/**
@ -284,29 +341,38 @@ class InfologApp extends EgwApp {
*@param _action
*@param _senders
*/
confirm_delete(_action, _senders) {
var _a;
let children = false;
let child_button = jQuery('#delete_sub').get(0) || jQuery('[id*="delete_sub"]').get(0);
this._action_all = (_a = _action.parent.data.nextmatch) === null || _a === void 0 ? void 0 : _a.getSelection().all;
this._action_all = _action.parent.data.nextmatch?.getSelection().all;
this._action_ids = [];
if (child_button) {
for (let i = 0; i < _senders.length; i++) {
this._action_ids.push(_senders[i].id.split("::").pop());
if (jQuery(_senders[i].iface.getDOMNode()).hasClass('infolog_rowHasSubs')) {
children = true;
break;
}
}
child_button.style.display = children ? 'block' : 'none';
}
nm_open_popup(_action, _senders);
}
_action_ids = [];
_action_all = false;
/**
* Callback for action using ids set(!) in this._action_ids and this._action_all
*
* @param _action
*/
actionCallback(_action) {
egw.json("infolog.infolog_ui.ajax_action", [_action, this._action_ids, this._action_all]).sendRequest(true);
}
@ -316,23 +382,27 @@ class InfologApp extends EgwApp {
* @param ab_id
* @param info_cc
*/
add_email_from_ab(ab_id, info_cc) {
var ab = document.getElementById(ab_id);
if (!ab || !ab.value) {
jQuery("tr.hiddenRow").css("display", "table-row");
}
else {
} else {
var cc = document.getElementById(info_cc);
for (var i = 0; i < ab.options.length && ab.options[i].value != ab.value; ++i)
;
for (var i = 0; i < ab.options.length && ab.options[i].value != ab.value; ++i);
if (i < ab.options.length) {
cc.value += (cc.value ? ', ' : '') + ab.options[i].text.replace(/^.* <(.*)>$/, '$1');
ab.value = '';
// @ts-ignore
ab.value = ''; // @ts-ignore
ab.onchange();
jQuery("tr.hiddenRow").css("display", "none");
}
}
return false;
}
/**
@ -343,57 +413,64 @@ class InfologApp extends EgwApp {
* @param {string} percent_id
* @param {string} datecompleted_id
*/
status_changed(changed_id, status_id, percent_id, datecompleted_id) {
// Make sure this doesn't get executed while template is loading
if (this.et2 == null || this.et2.getInstanceManager() == null)
return;
if (this.et2 == null || this.et2.getInstanceManager() == null) return;
var status = document.getElementById(status_id);
var percent = document.getElementById(percent_id);
var datecompleted = document.getElementById(datecompleted_id + '[str]');
if (!datecompleted) {
datecompleted = jQuery('#' + datecompleted_id + ' input').get(0);
}
var completed;
switch (changed_id) {
case status_id:
completed = status.value == 'done' || status.value == 'billed';
if (completed || status.value == 'not-started' ||
(status.value == 'ongoing') != (parseFloat(percent.value) > 0 && parseFloat(percent.value) < 100)) {
if (completed || status.value == 'not-started' || status.value == 'ongoing' != (parseFloat(percent.value) > 0 && parseFloat(percent.value) < 100)) {
if (completed) {
percent.value = '100';
}
else if (status.value == 'not-started') {
} else if (status.value == 'not-started') {
percent.value = '0';
}
else if (!completed && (parseInt(percent.value) == 0 || parseInt(percent.value) == 100)) {
} else if (!completed && (parseInt(percent.value) == 0 || parseInt(percent.value) == 100)) {
percent.value = '10';
}
}
break;
case percent_id:
completed = parseInt(percent.value) == 100;
if (completed != (status.value == 'done' || status.value == 'billed') ||
(status.value == 'not-started') != (parseInt(percent.value) == 0)) {
status.value = parseInt(percent.value) == 0 ? (jQuery('[value="not-started"]', status).length ?
'not-started' : 'ongoing') : (parseInt(percent.value) == 100 ? 'done' : 'ongoing');
if (completed != (status.value == 'done' || status.value == 'billed') || status.value == 'not-started' != (parseInt(percent.value) == 0)) {
status.value = parseInt(percent.value) == 0 ? jQuery('[value="not-started"]', status).length ? 'not-started' : 'ongoing' : parseInt(percent.value) == 100 ? 'done' : 'ongoing';
}
break;
case datecompleted_id + '[str]':
case datecompleted_id:
completed = datecompleted.value != '';
if (completed != (status.value == 'done' || status.value == 'billed')) {
status.value = completed ? 'done' : 'not-started';
}
if (completed != (parseInt(percent.value) == 100)) {
percent.value = completed ? '100' : '0';
}
break;
}
if (!completed && datecompleted && datecompleted.value != '') {
datecompleted.value = '';
}
else if (completed && datecompleted && datecompleted.value == '') {
// todo: set current date in correct format
} else if (completed && datecompleted && datecompleted.value == '') {// todo: set current date in correct format
}
}
/**
@ -401,23 +478,32 @@ class InfologApp extends EgwApp {
* check if the template is dirty then submit the template otherwise just open new window as print.
*
*/
edit_actions() {
var widget = this.et2.getWidgetById('action');
var template = this.et2._inst;
if (template) {
var id = template.widgetContainer.getArrayMgr('content').data['info_id'];
}
if (widget) {
switch (widget.get_value()) {
case 'print':
if (template.isDirty()) {
template.submit();
}
egw.open(id, 'infolog', 'edit', { print: 1 });
egw.open(id, 'infolog', 'edit', {
print: 1
});
break;
case 'ical':
template.postSubmit();
break;
default:
template.submit();
}
@ -429,13 +515,20 @@ class InfologApp extends EgwApp {
* @param {aciton object} _action
* @param {object} _selected
*/
infolog_menu_print(_action, _selected) {
var id = _selected[0].id.replace(/^infolog::/g, '');
egw.open(id, 'infolog', 'edit', { print: 1 });
egw.open(id, 'infolog', 'edit', {
print: 1
});
}
/**
* Trigger print() onload window
*/
infolog_print_preview_onload() {
var that = this;
jQuery('#infolog-edit-print').bind('load', function () {
@ -458,6 +551,8 @@ class InfologApp extends EgwApp {
/**
* Trigger print() function to print the current window
*/
infolog_print_preview() {
this.egw.message(this.egw.lang('Printing...'));
this.egw.window.print();
@ -465,6 +560,8 @@ class InfologApp extends EgwApp {
/**
*
*/
add_link_sidemenu() {
egw.open('', 'infolog', 'add');
}
@ -477,8 +574,11 @@ class InfologApp extends EgwApp {
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
add_action_handler(action, selected) {
var nm = action.getManager().data.nextmatch || false;
if (nm) {
this.add_with_extras(nm, action.id, nm.getArrayMgr('content').getEntry('action'), nm.getArrayMgr('content').getEntry('action_id'));
}
@ -493,20 +593,26 @@ class InfologApp extends EgwApp {
* @param _action string Special action for new infolog entry
* @param _action_id string ID for special action
*/
add_with_extras(widget, _type, _action, _action_id) {
// We use widget.getRoot() instead of this.et2 for the case when the
// addressbook tab is viewing a contact + infolog list, there's 2 infolog
// etemplates
var nm = widget.getRoot().getWidgetById('nm');
var nm_value = nm.getValue() || {};
// It's important that all these keys are here, they override the link
var nm_value = nm.getValue() || {}; // It's important that all these keys are here, they override the link
// registry.
var action_id = nm_value.action_id ? nm_value.action_id : (_action_id != '0' ? _action_id : "") || "";
if (typeof action_id == "object" && typeof action_id.length == "undefined") {
// Need a real array here
action_id = jQuery.map(action_id, function (val) { return val; });
}
// No action? Try the linked filter, in case it's set
action_id = jQuery.map(action_id, function (val) {
return val;
});
} // No action? Try the linked filter, in case it's set
if (!_action && !_action_id) {
if (nm_value.col_filter && nm_value.col_filter.linked) {
var split = nm_value.col_filter.linked.split(':') || '';
@ -514,6 +620,7 @@ class InfologApp extends EgwApp {
action_id = split[1] || '';
}
}
var extras = {
type: _type || nm_value.col_filter.info_type || "task",
cat_id: nm_value.cat_id || "",
@ -527,10 +634,11 @@ class InfologApp extends EgwApp {
* Get title in order to set it as document title
* @returns {string}
*/
getWindowTitle() {
var widget = this.et2.getWidgetById('info_subject');
if (widget)
return widget.options.value;
if (widget) return widget.options.value;
}
/**
* View parent entry with all children
@ -538,8 +646,11 @@ class InfologApp extends EgwApp {
* @param {aciton object} _action
* @param {object} _selected
*/
view_parent(_action, _selected) {
var data = egw.dataGetUIDdata(_selected[0].id);
if (data && data.data && data.data.info_id_parent) {
egw.link_handler(egw.link('/index.php', {
menuaction: "infolog.infolog_ui.index",
@ -556,15 +667,19 @@ class InfologApp extends EgwApp {
* @param {et2_link_entry} widget
* @returns {boolean}
*/
parent_query(request, widget) {
// No ID yet, no need to filter
if (!widget.getRoot().getArrayMgr('content').getEntry('info_id')) {
return true;
}
if (!request.options) {
request.options = {};
}
// Exclude self from results - no app needed since it's just one app
} // Exclude self from results - no app needed since it's just one app
request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')];
return true;
}
@ -576,19 +691,24 @@ class InfologApp extends EgwApp {
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
timesheet_list(_action, _selected) {
var extras = {
link_app: 'infolog',
link_id: false
};
for (var i = 0; i < _selected.length; i++) {
// Remove UID prefix for just contact_id
var ids = _selected[i].id.split('::');
ids.shift();
ids = ids.join('::');
extras.link_id = ids;
break;
}
egw.open("", "timesheet", "list", extras, 'timesheet');
}
/**
@ -597,6 +717,8 @@ class InfologApp extends EgwApp {
* @param {aciton object} _action
* @param {object} _selected
*/
has_parent(_action, _selected) {
var data = egw.dataGetUIDdata(_selected[0].id);
return data && data.data && data.data.info_id_parent > 0;
@ -609,9 +731,10 @@ class InfologApp extends EgwApp {
* @param {DOMNode} _node
* @param {et2_widget} _widget
*/
submit_if_not_empty(_node, _widget) {
if (_widget.get_value())
this.et2._inst.submit();
if (_widget.get_value()) this.et2._inst.submit();
}
/**
* Toggle encryption
@ -620,12 +743,17 @@ class InfologApp extends EgwApp {
* @param {et2_button} _widget
* @param {DOMNode} _node
*/
toggleEncrypt(_event, _widget, _node) {
if (!this.egw.user('apps').stylite) {
this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription') + ': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>');
return;
}
this._get_stylite(function () { app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node); });
this._get_stylite(function () {
app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node);
});
}
/**
* Make sure stylite javascript is loaded, and call the given callback when it is
@ -634,19 +762,22 @@ class InfologApp extends EgwApp {
* @param {object} attrs
*
*/
_get_stylite(callback, attrs) {
// use app object from etemplate2, which might be private and not just window.app
var app = this.et2.getInstanceManager().app_obj;
if (!app.stylite) {
this.egw.includeJS('/stylite/js/app.js', undefined, undefined, egw.webserverUrl).then(() => {
app.stylite = new app.classes.stylite;
app.stylite = new app.classes.stylite();
app.stylite.et2 = this.et2;
if (callback) {
callback.apply(app.stylite, attrs);
}
});
}
else {
} else {
app.stylite.et2 = this.et2;
callback.apply(app.stylite, attrs);
}
@ -657,6 +788,8 @@ class InfologApp extends EgwApp {
* @param {jQuery.Event} _event
* @param {et2_widget} _widget
*/
onchangeResponsible(_event, _widget) {
if (app.stylite && app.stylite.onchangeResponsible) {
app.stylite.onchangeResponsible.call(app.stylite, _event, _widget);
@ -670,9 +803,13 @@ class InfologApp extends EgwApp {
* @param {egwAction} _action
* @param {egwActionObject[]} _selected
*/
change_responsible(_action, _selected) {
var et2 = _selected[0].manager.data.nextmatch.getInstanceManager();
var responsible = et2.widgetContainer.getWidgetById('responsible');
if (responsible) {
responsible.set_value([]);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value('');
@ -681,14 +818,17 @@ class InfologApp extends EgwApp {
et2.widgetContainer.getWidgetById('responsible_action[add]').set_disabled(_selected.length === 1);
et2.widgetContainer.getWidgetById('responsible_action[delete]').set_disabled(_selected.length === 1);
}
if (_selected.length === 1) {
var data = egw.dataGetUIDdata(_selected[0].id);
if (responsible && data && data.data) {
et2.widgetContainer.getWidgetById('responsible_action[title]').set_value(data.data.info_subject);
et2.widgetContainer.getWidgetById('responsible_action[title]').set_class(data.data.sub_class);
responsible.set_value(data.data.info_responsible);
}
}
nm_open_popup(_action, _selected);
}
/**
@ -697,15 +837,17 @@ class InfologApp extends EgwApp {
*
* @param {Keyring} _keyring Mailvelope keyring to use
*/
printEncrypt(_keyring) {
//this.mailvelopeAvailable(this.toggleEncrypt);
var info_desc = this.et2.getWidgetById('info_des');
var self = this;
mailvelope.createDisplayContainer('#infolog-edit-print_info_des', info_desc.value, _keyring).then(function (_container) {
var $info_des_dom = jQuery(self.et2.getWidgetById('info_des').getDOMNode());
// $info_des_dom.children('iframe').height($info_des_dom.height());
$info_des_dom.children('span').hide();
//Trigger print action
var $info_des_dom = jQuery(self.et2.getWidgetById('info_des').getDOMNode()); // $info_des_dom.children('iframe').height($info_des_dom.height());
$info_des_dom.children('span').hide(); //Trigger print action
self.infolog_print_preview();
}, function (_err) {
self.egw.message(_err, 'error');
@ -716,10 +858,13 @@ class InfologApp extends EgwApp {
*
* @param blur
*/
blurCount(blur) {
var _a;
(_a = document.querySelector('div#infolog-index_nm.et2_nextmatch .header_count')) === null || _a === void 0 ? void 0 : _a.classList.toggle('blur_count', blur);
document.querySelector('div#infolog-index_nm.et2_nextmatch .header_count')?.classList.toggle('blur_count', blur);
}
}
app.classes.infolog = InfologApp;
//# sourceMappingURL=app.js.map

View File

@ -49,25 +49,6 @@ class pixelegg_framework extends Api\Framework\Ajax
if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
}
/**
* Render header
*
* Overwritten to load our slider.js
*
* @param array $extra
* @return type
*/
function header(array $extra=array())
{
// load our slider.js, but only if framework requested
if (!self::$header_done && $_GET['cd'] === 'yes' &&
!(Api\Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile'))
{
self::includeJS('/pixelegg/js/slider.js');
}
return parent::header($extra);
}
/**
* Make given color lighter or darker by percentage
*

View File

@ -28,6 +28,7 @@ export default {
// Output : Input
// Note the .ts extension on the input - we build directly from the TypeScript when available
"pixelegg/js/fw_pixelegg.min": "pixelegg/js/fw_pixelegg.js",
"pixelegg/js/fw_mobile.min": "pixelegg/js/fw_mobile.js",
"api/js/etemplate/etemplate2.min":"api/js/etemplate/etemplate2.ts",
"api/js/egw_action/egw_dragdrop_dhtmlx_tree.min":"api/js/egw_action/egw_dragdrop_dhtmlx_tree.js",
"api/js/jsapi/egw.min": "api/js/jsapi/egw_modules.js",
@ -36,11 +37,30 @@ export default {
// Should be just built-in apps, but until rollup supports multi-level we need them all
"addressbook/js/app": "addressbook/js/app.ts",
"admin/js/app": "admin/js/app.ts",
"bookmarks/js/app": "bookmarks/js/app.ts",
"calendar/js/app.min" : "calendar/js/app.ts",
"notifications/js/notificationajaxpopup.min":"notifications/js/notificationajaxpopup.js",
"collabora/js/app": "collabora/js/app.ts",
"filemanager/js/app": "filemanager/js/app.ts",
//"home/js/app": "home/js/app.js",
//"importexport/js/app": "importexport/js/app.ts",
"infolog/js/app": "infolog/js/app.ts",
"mail/js/app.min": "mail/js/app.js",
//"news_admin/js/app.min": "news_admin/js/app.js",
"notifications/js/notificationajaxpopup.min": "notifications/js/notificationajaxpopup.js",
//"preferences/js/app": "preferences/js/app.js",
"projectmanager/js/app.min": "projectmanager/js/app.ts",
"resources/js/app": "resources/js/app.ts",
"rocketchat/js/app.min": "rocketchat/js/app.js",
//"smallpart/js/app.min": "smallpart/js/app.ts",
"status/js/app": "status/js/app.ts",
"kanban/js/app":"kanban/js/app.ts",
"rocketchat/js/app.min":"rocketchat/js/app.js"
"timesheet/js/app": "timesheet/js/app.ts",
"tracker/js/app": "tracker/js/app.ts",
// EPL
"esyncpro/js/app": "esyncpro/js/app.ts",
//"kanban/js/app": "kanban/js/app.ts",
"policy/js/app": "policy/js/app.ts",
"stylite/js/app": "stylite/js/app.ts",
"webauthn/js/app": "webauthn/js/app.ts",
},
external: function(id,parentId,isResolved) {
if(!isResolved)

View File

@ -1,3 +1,12 @@
import { E as EgwApp, e as egw } from '../../chunks/etemplate2-0eb045cf.js';
import '../../chunks/egw_dragdrop_dhtmlx_tree-31643465.js';
import '../../chunks/egw-5f30b5ae.js';
import '../../vendor/bower-asset/jquery/dist/jquery.min.js';
import '../../vendor/bower-asset/jquery-ui/jquery-ui.js';
import '../../chunks/egw_json-98998d7e.js';
import '../../chunks/egw_core-0ec5dc11.js';
import '../../vendor/tinymce/tinymce/tinymce.min.js';
/**
* EGroupware - Timesheet - Javascript UI
*
@ -7,23 +16,19 @@
* @copyright (c) 2008-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
/*egw:uses
/api/js/jsapi/egw_app.js
*/
import '../../api/js/jsapi/egw_global';
import { EgwApp } from '../../api/js/jsapi/egw_app';
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for timesheet
*
* @augments AppJS
*/
class TimesheetApp extends EgwApp {
// These fields help with push filtering & access control to see if we care about a push message
push_grant_fields = ["ts_owner"];
push_filter_fields = ["ts_owner"];
constructor() {
super('timesheet');
// These fields help with push filtering & access control to see if we care about a push message
this.push_grant_fields = ["ts_owner"];
this.push_filter_fields = ["ts_owner"];
}
/**
* This function is called when the etemplate2 object is loaded
@ -33,9 +38,12 @@ class TimesheetApp extends EgwApp {
* @param et2 etemplate2 Newly ready object
* @param string name
*/
et2_ready(et2, name) {
// call parent
super.et2_ready(et2, name);
if (name == 'timesheet.index') {
this.filter_change();
this.filter2_change();
@ -44,18 +52,22 @@ class TimesheetApp extends EgwApp {
/**
*
*/
filter_change() {
var filter = this.et2.getWidgetById('filter');
var dates = this.et2.getWidgetById('timesheet.index.dates');
let nm = this.et2.getDOMWidgetById('nm');
if (filter && dates) {
dates.set_disabled(filter.get_value() !== "custom");
if (filter.get_value() == 0)
nm.activeFilters.startdate = null;
if (filter.get_value() == 0) nm.activeFilters.startdate = null;
if (filter.value == "custom") {
jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
}
}
return true;
}
/**
@ -63,12 +75,15 @@ class TimesheetApp extends EgwApp {
* either 'all' for details or 'no_description' for no details
*
*/
filter2_change() {
var nm = this.et2.getWidgetById('nm');
var filter2 = this.et2.getWidgetById('filter2');
if (nm && filter2) {
egw.css("#timesheet-index span.timesheet_titleDetails", "font-weight:" + (filter2.getValue() == '1' ? "bold;" : "normal;"));
// Show / hide descriptions
egw.css("#timesheet-index span.timesheet_titleDetails", "font-weight:" + (filter2.getValue() == '1' ? "bold;" : "normal;")); // Show / hide descriptions
egw.css(".et2_label.ts_description", "display:" + (filter2.getValue() == '1' ? "block;" : "none;"));
}
}
@ -81,8 +96,11 @@ class TimesheetApp extends EgwApp {
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
add_action_handler(action, selected) {
var nm = action.getManager().data.nextmatch || false;
if (nm) {
this.add_with_extras(nm);
}
@ -93,25 +111,30 @@ class TimesheetApp extends EgwApp {
*
* @param {et2_widget} widget Originating/calling widget
*/
add_with_extras(widget) {
var nm = widget.getRoot().getWidgetById('nm');
var nm_value = nm.getValue() || {};
var extras = {};
if (nm_value.cat_id) {
extras.cat_id = nm_value.cat_id;
}
if (nm_value.col_filter && nm_value.col_filter.linked) {
var split = nm_value.col_filter.linked.split(':') || '';
extras.link_app = split[0] || '';
extras.link_id = split[1] || '';
}
if (nm_value.col_filter && nm_value.col_filter.pm_id) {
extras.link_app = 'projectmanager';
extras.link_id = nm_value.col_filter.pm_id;
}
else if (nm_value.col_filter && nm_value.col_filter.ts_project) {
} else if (nm_value.col_filter && nm_value.col_filter.ts_project) {
extras.ts_project = nm_value.col_filter.ts_project;
}
egw.open('', 'timesheet', 'add', extras);
}
/**
@ -121,13 +144,17 @@ class TimesheetApp extends EgwApp {
* @param {et2_widget_link_entry} _widget
* @returns {undefined}
*/
pm_id_changed(_egw, _widget) {
// Update price list
var ts_pricelist = _widget.getRoot().getWidgetById('pl_id');
egw.json('projectmanager_widget::ajax_get_pricelist', [_widget.getValue()], function (value) {
ts_pricelist.set_select_options(value || {});
}).sendRequest(true);
var ts_project = this.et2.getWidgetById('ts_project');
if (ts_project) {
ts_project.set_blur(_widget.getValue() ? _widget.search.val() : '');
}
@ -135,9 +162,12 @@ class TimesheetApp extends EgwApp {
/**
* Update custom filter timespan, without triggering a change
*/
update_timespan(start, end) {
if (this && this.et2) {
var nm = this.et2.getWidgetById('nm');
if (nm) {
// Toggle update_in_progress to avoid another request
nm.update_in_progress = true;
@ -153,10 +183,11 @@ class TimesheetApp extends EgwApp {
* Get title in order to set it as document title
* @returns {string}
*/
getWindowTitle() {
var widget = this.et2.getWidgetById('ts_title');
if (widget)
return widget.options.value;
if (widget) return widget.options.value;
}
/**
* Run action via ajax
@ -164,15 +195,20 @@ class TimesheetApp extends EgwApp {
* @param _action
* @param _senders
*/
ajax_action(_action, _senders) {
var _a;
let all = (_a = _action.parent.data.nextmatch) === null || _a === void 0 ? void 0 : _a.getSelection().all;
let all = _action.parent.data.nextmatch?.getSelection().all;
let ids = [];
for (let i = 0; i < _senders.length; i++) {
ids.push(_senders[i].id.split("::").pop());
}
egw.json("timesheet.timesheet_ui.ajax_action", [_action.id, ids, all]).sendRequest(true);
}
}
app.classes.timesheet = TimesheetApp;
//# sourceMappingURL=app.js.map