forked from extern/egroupware
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:
parent
3add958afa
commit
d7cd90ebe7
@ -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
|
||||
*
|
||||
|
@ -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"';
|
||||
|
@ -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
1513
infolog/js/app.js
1513
infolog/js/app.js
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
*
|
||||
|
@ -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)
|
||||
|
@ -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,172 +16,199 @@
|
||||
* @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 {
|
||||
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"];
|
||||
// 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');
|
||||
}
|
||||
/**
|
||||
* 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().
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
/**
|
||||
* 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().
|
||||
*
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
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.value == "custom") {
|
||||
jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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.value == "custom") {
|
||||
jQuery(this.et2.getWidgetById('startdate').getDOMNode()).find('input').focus();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* show or hide the details of rows by selecting the filter2 option
|
||||
* 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(".et2_label.ts_description", "display:" + (filter2.getValue() == '1' ? "block;" : "none;"));
|
||||
}
|
||||
/**
|
||||
* show or hide the details of rows by selecting the filter2 option
|
||||
* 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(".et2_label.ts_description", "display:" + (filter2.getValue() == '1' ? "block;" : "none;"));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Wrapper so add action in the context menu can pass current
|
||||
* filter values into new edit dialog
|
||||
*
|
||||
* @see add_with_extras
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
/**
|
||||
* Wrapper so add action in the context menu can pass current
|
||||
* filter values into new edit dialog
|
||||
*
|
||||
* @see add_with_extras
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Opens a new edit dialog with some extra url parameters pulled from
|
||||
* nextmatch filters.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
/**
|
||||
* Opens a new edit dialog with some extra url parameters pulled from
|
||||
* nextmatch filters.
|
||||
*
|
||||
* @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) {
|
||||
extras.ts_project = nm_value.col_filter.ts_project;
|
||||
}
|
||||
egw.open('', 'timesheet', 'add', extras);
|
||||
|
||||
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] || '';
|
||||
}
|
||||
/**
|
||||
* Change handler for project selection to set empty ts_project string, if project get deleted
|
||||
*
|
||||
* @param {type} _egw
|
||||
* @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() : '');
|
||||
}
|
||||
|
||||
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) {
|
||||
extras.ts_project = nm_value.col_filter.ts_project;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
this.et2.getWidgetById('startdate').set_value(start);
|
||||
this.et2.getWidgetById('enddate').set_value(end);
|
||||
nm.activeFilters.startdate = start;
|
||||
nm.activeFilters.enddate = end;
|
||||
nm.update_in_progress = false;
|
||||
}
|
||||
}
|
||||
|
||||
egw.open('', 'timesheet', 'add', extras);
|
||||
}
|
||||
/**
|
||||
* Change handler for project selection to set empty ts_project string, if project get deleted
|
||||
*
|
||||
* @param {type} _egw
|
||||
* @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() : '');
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
this.et2.getWidgetById('startdate').set_value(start);
|
||||
this.et2.getWidgetById('enddate').set_value(end);
|
||||
nm.activeFilters.startdate = start;
|
||||
nm.activeFilters.enddate = end;
|
||||
nm.update_in_progress = false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Run action via ajax
|
||||
*
|
||||
* @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 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);
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
/**
|
||||
* Run action via ajax
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
|
||||
|
||||
ajax_action(_action, _senders) {
|
||||
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
|
Loading…
Reference in New Issue
Block a user