Add more missing import statements

This commit is contained in:
Hadi Nategh 2021-06-10 15:40:49 +02:00
parent 77a4aad7d6
commit 54fff9739a
40 changed files with 1073 additions and 2018 deletions

View File

@ -13,6 +13,7 @@
*/
import { EgwApp } from '../../api/js/jsapi/egw_app';
import { et2_nextmatch } from "../../api/js/etemplate/et2_extension_nextmatch";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for Addressbook CRM view
*

View File

@ -16,6 +16,7 @@
import {EgwApp, PushData} from '../../api/js/jsapi/egw_app';
import {etemplate2} from "../../api/js/etemplate/etemplate2";
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
import {egw} from "../../api/js/jsapi/egw_global";
/**
* UI for Addressbook CRM view

View File

@ -16,6 +16,7 @@ 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";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for Addressbook
*

View File

@ -19,6 +19,7 @@ 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 "./CRM.js";
import {egw} from "../../api/js/jsapi/egw_global";
/**
* Object to call app.addressbook.openCRMview with

View File

@ -14,6 +14,7 @@ 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_createWidget } from "../../api/js/etemplate/et2_core_widget";
import { egw, egw_getWindowInnerHeight, egw_getWindowInnerWidth, egw_getWindowOuterWidth } from "../../api/js/jsapi/egw_global";
/**
* UI for Admin
*

View File

@ -16,7 +16,13 @@ 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_createWidget} from "../../api/js/etemplate/et2_core_widget";
import {
egw,
egw_getWindowInnerHeight,
egw_getWindowInnerWidth,
egw_getWindowOuterWidth
} from "../../api/js/jsapi/egw_global";
import {egwActionObject, egwAction} from '../../api/js/egw_action/egw_action.js';
/**
* UI for Admin
*

View File

@ -1,884 +0,0 @@
/**
* EGroupware egw_action framework - TS declarations
*
* Generated with:
* mkdir /tmp/egw_action
* cd api/js/egw_action
* tsc --declaration --allowJS --outDir /tmp/egw_action *.js
* cat /tmp/egw_action/*.d.ts > egw_action.d.ts
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
*/
/**
* Returns the action manager for the given application - each application has its
* own sub-ActionManager in the global action manager object to prevent collisions
* from happening
*
* @param _id is the name of the sub-actionManager which should be returned.
* If the action manager does not exist right now, it is created. If the
* parameter is ommited or null, the global action manager is returned.
* @param {boolean} [_create=true] If an objectManager with the given id is not
* found, it will be created at the top level.
* @param {number} [_search_depth=Infinite] How deep into existing action children
* to search.
*/
declare function egw_getActionManager(_id: any, _create?: boolean, _search_depth?: number): any;
/**
* Returns the object manager for the given application - each application may
* have its own object manager where it can place action objects or containers.
*
* @param _id is the name of the sub-object manager should be returned. If the
* object manager does not exists right now, it is created. If the parameter
* is ommited or null, the global object manager is returned.
* @param {boolean} [_create=true] If an objectManager with the given id is not
* found, it will be created at the top level.
* @param {number} [_search_depth=Infinite] How deep into existing action children
* to search.
*/
declare function egw_getObjectManager(_id: any, _create?: boolean, _search_depth?: number): any;
/**
* Returns the object manager for the current application
*
* @param {boolean} _create
* @param {string} _appName
* @return {egwActionObjectManager}
*/
declare function egw_getAppObjectManager(_create?: boolean, _appName?: string): typeof egwActionObjectManager;
/**
* Returns the action manager for the current application
*
* @param {boolean} _create
* @return {egwActionManager}
*/
declare function egw_getAppActionManager(_create: boolean): typeof egwActionManager;
/** egwActionHandler Interface **/
/**
* Constructor for the egwActionHandler interface which (at least) should have the
* execute function implemented.
*
* @param {function} _executeEvent
* @return {egwActionHandler}
*/
declare function egwActionHandler(_executeEvent: Function): egwActionHandler;
declare class egwActionHandler {
/** egwActionHandler Interface **/
/**
* Constructor for the egwActionHandler interface which (at least) should have the
* execute function implemented.
*
* @param {function} _executeEvent
* @return {egwActionHandler}
*/
constructor(_executeEvent: Function);
execute: Function;
}
/**
* Constructor for egwAction object
*
* @param {egwAction} _parent
* @param {string} _id
* @param {string} _caption
* @param {string} _iconUrl
* @param {(string|function)} _onExecute
* @param {boolean} _allowOnMultiple
* @returns {egwAction}
*/
declare function egwAction(_parent: egwAction, _id: string, _caption: string, _iconUrl: string, _onExecute: TimerHandler, _allowOnMultiple: boolean): egwAction;
declare class egwAction {
/**
* Constructor for egwAction object
*
* @param {egwAction} _parent
* @param {string} _id
* @param {string} _caption
* @param {string} _iconUrl
* @param {(string|function)} _onExecute
* @param {boolean} _allowOnMultiple
* @returns {egwAction}
*/
constructor(_parent: egwAction, _id: string, _caption: string, _iconUrl: string, _onExecute: TimerHandler, _allowOnMultiple: boolean);
id: string;
caption: string;
iconUrl: string;
allowOnMultiple: boolean;
enabled: any;
hideOnDisabled: boolean;
data: {};
type: string;
canHaveChildren: boolean;
parent: egwAction;
children: any[];
onExecute: egwFnct;
hideOnMobile: boolean;
disableIfNoEPL: boolean;
remove(): void;
getActionById(_id: string | number, _search_depth?: number): egwAction;
getActionsByAttr(_attr: string, _val: any): egwAction[];
addAction(_type: string, _id: string, _caption: string, _iconUrl: any, _onExecute: TimerHandler, _allowOnMultiple: boolean): any;
/**
* Default icons for given id
*/
defaultIcons: {
view: string;
edit: string;
open: string;
add: string;
"new": string;
"delete": string;
cat: string;
document: string;
print: string;
copy: string;
move: string;
cut: string;
paste: string;
save: string;
apply: string;
cancel: string;
'continue': string;
next: string;
finish: string;
back: string;
previous: string;
close: string;
};
updateActions(_actions: any, _app?: string): void;
not_disableClass(_action: any, _senders: any, _target: any): boolean;
enableClass(_action: any, _senders: any, _target: any): boolean;
enableId(_action: any, _senders: any, _target: any): any;
setDefaultExecute(_value: TimerHandler): void;
execute(_senders: any[], _target: any): void;
_check_confirm_mass_selections(_senders: any, _target: any): boolean;
_check_confirm(_senders: any, _target: any): any;
set_onExecute(_value: string | boolean | Function): void;
set_caption(_value: any): void;
set_iconUrl(_value: any): void;
set_enabled(_value: any): void;
set_allowOnMultiple(_value: string | number | boolean): void;
set_hideOnDisabled(_value: any): void;
set_hideOnMobile(_value: any): void;
set_disableIfNoEPL(_value: any): void;
set_data(_value: any): void;
updateAction(_data: any): void;
appendToTree(_tree: any[], _addChildren: boolean): {
"action": egwAction;
"children": any[];
};
getManager(): any;
}
declare function _egwActionTreeContains(_tree: any, _elem: any): any;
/** egwActionManager Object **/
/**
* egwActionManager manages a list of actions - it overwrites the egwAction class
* and allows child actions to be added to it.
*
* @param {egwAction} _parent
* @param {string} _id
* @return {egwActionManager}
*/
declare function egwActionManager(_parent: egwAction, _id: string): typeof egwActionManager;
/** egwActionImplementation Interface **/
/**
* Abstract interface for the egwActionImplementation object. The egwActionImplementation
* object is responsible for inserting the actual action representation (context menu,
* drag-drop code) into the DOM Tree by using the egwActionObjectInterface object
* supplied by the object.
* To write a "class" which derives from this object, simply write a own constructor,
* which replaces "this" with a "new egwActionImplementation" and implement your
* code in "doRegisterAction" und "doUnregisterAction".
* Register your own implementation within the _egwActionClasses object.
*
* @return {egwActionImplementation}
*/
declare function egwActionImplementation(): egwActionImplementation;
declare class egwActionImplementation {
doRegisterAction: () => never;
doUnregisterAction: () => never;
doExecuteImplementation: () => never;
type: string;
registerAction(_actionObjectInterface: any, _triggerCallback: Function, _context: any): any;
unregisterAction(_actionObjectInterface: egwActionObjectInterface): any;
executeImplementation(_context: any, _selected: any, _links: any): any;
}
/** egwActionLink Object **/
/**
* The egwActionLink is used to interconnect egwActionObjects and egwActions.
* This gives each action object the possibility to decide, whether the action
* should be active in this context or not.
*
* @param _manager is a reference to the egwActionManager whic contains the action
* the object wants to link to.
*/
declare function egwActionLink(_manager: any): void;
declare class egwActionLink {
/** egwActionLink Object **/
/**
* The egwActionLink is used to interconnect egwActionObjects and egwActions.
* This gives each action object the possibility to decide, whether the action
* should be active in this context or not.
*
* @param _manager is a reference to the egwActionManager whic contains the action
* the object wants to link to.
*/
constructor(_manager: any);
enabled: boolean;
visible: boolean;
actionId: string;
actionObj: any;
manager: any;
updateLink(_data: any): void;
set_enabled(_value: any): void;
set_visible(_value: any): void;
set_actionId(_value: any): void;
}
/**
* The egwActionObject represents an abstract object to which actions may be
* applied. Communication with the DOM tree is established by using the
* egwActionObjectInterface (AOI), which is passed in the constructor.
* egwActionObjects are organized in a tree structure.
*
* @param {string} _id is the identifier of the object which
* @param {egwActionObject} _parent is the parent object in the hirachy. This may be set to NULL
* @param {egwActionObjectInterface} _iface is the egwActionObjectInterface which connects the object
* to the outer world.
* @param {egwActionManager} _manager is the action manager this object is connected to
* this object to the DOM tree. If the _manager isn't supplied, the parent manager
* is taken.
* @param {number} _flags a set of additional flags being applied to the object,
* defaults to 0
*/
declare function egwActionObject(_id: string, _parent: egwActionObject, _iface?: egwActionObjectInterface, _manager?: typeof egwActionManager, _flags?: number): void;
declare class egwActionObject {
/**
* The egwActionObject represents an abstract object to which actions may be
* applied. Communication with the DOM tree is established by using the
* egwActionObjectInterface (AOI), which is passed in the constructor.
* egwActionObjects are organized in a tree structure.
*
* @param {string} _id is the identifier of the object which
* @param {egwActionObject} _parent is the parent object in the hirachy. This may be set to NULL
* @param {egwActionObjectInterface} _iface is the egwActionObjectInterface which connects the object
* to the outer world.
* @param {egwActionManager} _manager is the action manager this object is connected to
* this object to the DOM tree. If the _manager isn't supplied, the parent manager
* is taken.
* @param {number} _flags a set of additional flags being applied to the object,
* defaults to 0
*/
constructor(_id: string, _parent: egwActionObject, _iface?: egwActionObjectInterface, _manager?: typeof egwActionManager, _flags?: number);
id: string;
parent: egwActionObject;
children: any[];
actionLinks: any[];
manager: typeof egwActionManager;
flags: number;
data: any;
setSelectedCallback: any;
registeredImpls: any[];
selectedChildren: any[];
focusedChild: string | egwActionObject;
setAOI(_aoi: egwActionObjectInterface): void;
iface: egwActionObjectInterface;
getObjectById(_id: string, _search_depth?: number): egwActionObject;
addObject(_id: any, _interface: any, _flags?: number): any;
insertObject(_index: number | boolean, _id: any, _iface?: any, _flags?: number): any;
clear(): void;
remove(): void;
getRootObject(): any;
getParentList(): any;
getContainerRoot(): any;
getSelectedObjects(_test: Function, _list: any[]): any;
getAllSelected(): boolean;
toggleAllSelected(_select: any): any;
flatList(_visibleOnly: boolean, _obj: any): any[];
traversePath(_to: any): any[];
getIndex(): number;
getFocusedObject(): string | egwActionObject;
_ifaceCallback(_newState: number, _changedBit: number, _shiftState: number): number;
handleKeyPress(_keyCode: number, _shift: boolean, _ctrl: boolean, _alt: boolean): boolean;
getPrevious(_intval: any): any;
getNext(_intval: any): any;
getSelected(): boolean;
getFocused(): boolean;
getVisible(): boolean;
getState(): number;
setFocused(_focused: boolean): void;
setSelected(_selected: boolean): void;
setAllSelected(_selected: boolean, _informParent: boolean): void;
updateSelectedChildren(_child: string | egwActionObject, _selected: boolean): void;
updateFocusedChild(_child: string | egwActionObject, _focused: boolean): void;
updateActionLinks(_actionLinks: any[], _recursive?: boolean, _doCreate?: boolean): void;
_reconnectCallback(): void;
registerActions(): void;
unregisterActions(): void;
triggerCallback(): any;
makeVisible(): void;
executeActionImplementation(_implContext: any, _implType: string, _execType: number): any;
forceSelection(): void;
getSelectedLinks(_actionType: any): any;
_getLinks(_objs: any[], _actionType: string): any;
getActionLink(_actionId: string): any;
getActionImplementationGroups(_test: Function, _groups: any): any;
isDragOut(_event: Event): boolean;
isSelection(_event: any): boolean;
}
/** egwActionObjectInterface Interface **/
/**
* The egwActionObjectInterface has to be implemented for each actual object in
* the browser. E.g. for the object "DataGridRow", there has to be an
* egwActionObjectInterface which is responsible for returning the outer DOMNode
* of the object to which JS-Events may be attached by the egwActionImplementation
* object, and to do object specific stuff like highlighting the object in the
* correct way and to route state changes (like: "object has been selected")
* to the egwActionObject object the interface is associated to.
*
* @return {egwActionObjectInterface}
*/
declare function egwActionObjectInterface(): egwActionObjectInterface;
declare class egwActionObjectInterface {
doGetDOMNode: () => any;
doSetState: (_state: any, _outerCall: any) => void;
doTriggerEvent: (_event: any, _data: any) => boolean;
doMakeVisible: () => void;
_state: number;
stateChangeCallback: Function;
stateChangeContext: any;
reconnectActionsCallback: Function;
reconnectActionsContext: any;
setStateChangeCallback(_callback: Function, _context: any): void;
setReconnectActionsCallback(_callback: Function, _context: any): void;
reconnectActions(): void;
updateState(_stateBit: number, _set: boolean, _shiftState: boolean): void;
getDOMNode(): any;
setState(_state: any): void;
getState(): number;
triggerEvent(_event: any, _data: any): boolean;
makeVisible(): void;
}
/** egwActionObjectManager Object **/
/**
* The egwActionObjectManager is a dummy class which only contains a dummy
* AOI. It may be used as root object or as object containers.
*
* @param {string} _id
* @param {string} _manager
* @return {egwActionObjectManager}
*/
declare function egwActionObjectManager(_id: egwAction, _manager: string): typeof egwActionObjectManager;
/**
* eGroupWare egw_action framework - egw action framework
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
* Getter functions for the global egwActionManager and egwObjectManager objects
*/
declare var egw_globalActionManager: any;
declare var egw_globalObjectManager: any;
/** egwActionObject Object **/
declare var EGW_AO_STATE_NORMAL: number;
declare var EGW_AO_STATE_SELECTED: number;
declare var EGW_AO_STATE_FOCUSED: number;
declare var EGW_AO_STATE_VISIBLE: number;
declare var EGW_AO_EVENT_DRAG_OVER_ENTER: number;
declare var EGW_AO_EVENT_DRAG_OVER_LEAVE: number;
declare var EGW_AO_SHIFT_STATE_NONE: number;
declare var EGW_AO_SHIFT_STATE_MULTI: number;
declare var EGW_AO_SHIFT_STATE_BLOCK: number;
declare var EGW_AO_FLAG_IS_CONTAINER: number;
declare var EGW_AO_FLAG_DEFAULT_FOCUS: number;
declare var EGW_AO_EXEC_SELECTED: number;
declare var EGW_AO_EXEC_THIS: number;
/** -- egwActionObjectDummyInterface Class -- **/
declare var egwActionObjectDummyInterface: typeof egwActionObjectInterface;
/**
* eGroupWare egw_action framework - egw action framework
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
* Sets properties given in _data in _obj. Checks whether the property keys
* exists and if corresponding setter functions are available. Properties starting
* with "_" are ignored.
*
* @param object _data may be an object with data that will be stored inside the
* given object.
* @param object _obj is the object where the data will be stored.
* @param mixed _setterOnly false: store everything, true: only store when setter exists, "data" store rest in data property
*/
declare function egwActionStoreJSON(_data: any, _obj: any, _setterOnly: any): void;
/**
* Switches the given bit in the set on or off.
*
* @param int _set is the current set
* @param int _bit is the position of the bit which should be switched on/off
* @param boolean _state is whether the bit should be switched on or off
* @returns the new set
*/
declare function egwSetBit(_set: any, _bit: any, _state: any): number;
/**
* Returns whether the given bit is set in the set.
*/
declare function egwBitIsSet(_set: any, _bit: any): boolean;
declare function egwObjectLength(_obj: any): number;
/**
* Isolates the shift state from an event object
*/
declare function egwGetShiftState(e: any): number;
declare function egwPreventSelect(e: any): boolean;
declare class egwPreventSelect {
constructor(e: any);
onselectstart: () => boolean;
}
declare function egwResetPreventSelect(elem: any): void;
declare function egwUnfocus(): void;
declare function egwCallAbstract(_obj: any, _fn: any, _args: any): any;
declare function egwArraysEqual(_ar1: any, _ar2: any): boolean;
declare function egwQueueCallback(_proc: any, _args: any, _context: any, _id: any): void;
/**
* The eventQueue object is used to have control over certain events such as
* ajax responses or timeouts. Sometimes it may happen, that a function attached
* to such an event should no longer be called - with egwEventQueue one has
* a simple possibility to control that.
*/
/**
* Constructor for the egwEventQueue class. Initializes the queue object and the
* internal data structures such as the internal key.
*/
declare function egwEventQueue(): void;
declare class egwEventQueue {
events: {};
key_id: number;
flush(): void;
queue(_proc: any, _context: any, _args: any, _id: any): string;
run(_key: any): void;
queueTimeout(_proc: any, _context: any, _args: any, _id: any, _timeout: any): void;
}
/**
* Class which is used to be able to handle references to JavaScript functions
* from strings.
*
* @param object _context is the context in which the function will be executed.
* @param mixed _default is the default value which should be returned when no
* function (string) has been set. If it is a function this function will be
* called.
* @param array _acceptedTypes is an array of types which contains the "typeof"
* strings of accepted non-functions in setValue
*/
declare function egwFnct(_context: any, _default: any, _acceptedTypes?: any): void;
declare class egwFnct {
/**
* Class which is used to be able to handle references to JavaScript functions
* from strings.
*
* @param object _context is the context in which the function will be executed.
* @param mixed _default is the default value which should be returned when no
* function (string) has been set. If it is a function this function will be
* called.
* @param array _acceptedTypes is an array of types which contains the "typeof"
* strings of accepted non-functions in setValue
*/
constructor(_context: any, _default: any, _acceptedTypes?: any);
context: any;
acceptedTypes: any;
fnct: any;
value: any;
isDefault: boolean;
hasHandler(): boolean;
setValue(_value: any): void;
exec(...args: any[]): any;
}
declare function egwIsMobile(): any;
/**
sprintf() for JavaScript 0.6
Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of sprintf() for JavaScript nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Changelog:
2007.04.03 - 0.1:
- initial release
2007.09.11 - 0.2:
- feature: added argument swapping
2007.09.17 - 0.3:
- bug fix: no longer throws exception on empty paramenters (Hans Pufal)
2007.10.21 - 0.4:
- unit test and patch (David Baird)
2010.05.09 - 0.5:
- bug fix: 0 is now preceeded with a + sign
- bug fix: the sign was not at the right position on padded results (Kamal Abdali)
- switched from GPL to BSD license
2010.05.22 - 0.6:
- reverted to 0.4 and fixed the bug regarding the sign of the number 0
Note:
Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
who warned me about a bug in 0.5, I discovered that the last update was
a regress. I appologize for that.
**/
declare function str_repeat(i: any, m: any): string;
declare function sprintf(...args: any[]): string;
declare var _egwQueuedCallbacks: {};
/**
* Checks whether this is currently run on a mobile browser
*/
declare var _egw_mobileBrowser: any;
/**
* The egwDragAction class overwrites the egwAction class and adds the new
* "dragType" propery. The "onExecute" event of the drag action will be called
* whenever dragging starts. The onExecute JS handler should return the
* drag-drop helper object - otherwise an default helper will be generated.
*
* @param {egwAction} _id
* @param {string} _handler
* @param {string} _caption
* @param {string} _icon
* @param {(string|function)} _onExecute
* @param {bool} _allowOnMultiple
* @returns {egwDragAction}
*/
declare function egwDragAction(_id: egwAction, _handler: string, _caption: string, _icon: string, _onExecute: TimerHandler, _allowOnMultiple: any): typeof egwDragAction;
declare function getDragImplementation(): any;
declare function egwDragActionImplementation(): egwActionImplementation;
/**
* The egwDropAction class overwrites the egwAction class and adds the "acceptedTypes"
* property. This array should contain all "dragTypes" the drop action is allowed to
*
* @param {egwAction} _id
* @param {string} _handler
* @param {string} _caption
* @param {string} _icon
* @param {(string|function)} _onExecute
* @param {bool} _allowOnMultiple
* @returns {egwDropAction}
*/
declare function egwDropAction(_id: egwAction, _handler: string, _caption: string, _icon: string, _onExecute: TimerHandler, _allowOnMultiple: any): typeof egwDropAction;
declare function getDropImplementation(): any;
declare function egwDropActionImplementation(): egwActionImplementation;
declare var _dragActionImpl: any;
declare var _dropActionImpl: any;
declare var EGW_AI_DRAG: number;
declare var EGW_AI_DRAG_OUT: number;
declare var EGW_AI_DRAG_OVER: number;
declare function egwPopupAction(_id: any, _handler: any, _caption: any, _icon: any, _onExecute: any, _allowOnMultiple: any): egwAction;
declare function getPopupImplementation(): any;
declare function egwPopupActionImplementation(): egwActionImplementation;
declare var _popupActionImpl: any;
/**
* eGroupWare egw_dragdrop_dhtmlxmenu - egw action framework
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
* This file contains an egw_actionObjectInterface which allows a dhtmlx tree
* row to be a drag target and contains a function which transforms a complete
* dhtmlx tree into egw_actionObjects
*/
declare function dhtmlxTree_getNode(_tree: any, _itemId: any): JQuery;
declare function dhtmlxtreeItemAOI(_tree: any, _itemId: any): egwActionObjectInterface;
/**
* Checks whether the given keycode is in the list of valid key codes. If not,
* returns -1.
*/
declare function egw_keycode_makeValid(_keyCode: any): any;
declare function _egw_nodeIsInInput(_node: any): any;
/**
* Creates an unique key for the given shortcut
*/
declare function egw_shortcutIdx(_keyCode: any, _shift: any, _ctrl: any, _alt: any): string;
/**
* Registers a global shortcut. If the shortcut already exists, it is overwritten.
* @param int _keyCode is one of the keycode constants
* @param bool _shift whether shift has to be set
* @param bool _ctrl whether ctrl has to be set
* @param bool _alt whether alt has to be set
* @param function _handler the function which will be called when the shortcut
* is evoked. An object containing the shortcut data will be passed as first
* parameter.
* @param object _context is the context in which the function will be executed
*/
declare function egw_registerGlobalShortcut(_keyCode: any, _shift: any, _ctrl: any, _alt: any, _handler: any, _context: any): void;
/**
* Unregisters the given shortcut.
*/
declare function egw_unregisterGlobalShortcut(_keyCode: any, _shift: any, _ctrl: any, _alt: any): void;
/**
* the egw_keyHandler function handles various key presses. The boolean
* _shift, _ctrl, _alt values have been translated into platform independent
* values (for apple devices).
*/
declare function egw_keyHandler(_keyCode: any, _shift: any, _ctrl: any, _alt: any): any;
/**
* eGroupWare egw_action framework - Shortcut/Keyboard input manager
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
* Define the key constants (IE doesn't support "const" keyword)
*/
declare var EGW_KEY_BACKSPACE: number;
declare var EGW_KEY_TAB: number;
declare var EGW_KEY_ENTER: number;
declare var EGW_KEY_ESCAPE: number;
declare var EGW_KEY_DELETE: number;
declare var EGW_KEY_SPACE: number;
declare var EGW_KEY_PAGE_UP: number;
declare var EGW_KEY_PAGE_DOWN: number;
declare var EGW_KEY_ARROW_LEFT: number;
declare var EGW_KEY_ARROW_UP: number;
declare var EGW_KEY_ARROW_RIGHT: number;
declare var EGW_KEY_ARROW_DOWN: number;
declare var EGW_KEY_0: number;
declare var EGW_KEY_1: number;
declare var EGW_KEY_2: number;
declare var EGW_KEY_3: number;
declare var EGW_KEY_4: number;
declare var EGW_KEY_5: number;
declare var EGW_KEY_6: number;
declare var EGW_KEY_7: number;
declare var EGW_KEY_8: number;
declare var EGW_KEY_9: number;
declare var EGW_KEY_A: number;
declare var EGW_KEY_B: number;
declare var EGW_KEY_C: number;
declare var EGW_KEY_D: number;
declare var EGW_KEY_E: number;
declare var EGW_KEY_F: number;
declare var EGW_KEY_G: number;
declare var EGW_KEY_H: number;
declare var EGW_KEY_I: number;
declare var EGW_KEY_J: number;
declare var EGW_KEY_K: number;
declare var EGW_KEY_L: number;
declare var EGW_KEY_M: number;
declare var EGW_KEY_N: number;
declare var EGW_KEY_O: number;
declare var EGW_KEY_P: number;
declare var EGW_KEY_Q: number;
declare var EGW_KEY_R: number;
declare var EGW_KEY_S: number;
declare var EGW_KEY_T: number;
declare var EGW_KEY_U: number;
declare var EGW_KEY_V: number;
declare var EGW_KEY_W: number;
declare var EGW_KEY_X: number;
declare var EGW_KEY_Y: number;
declare var EGW_KEY_Z: number;
declare var EGW_KEY_MENU: number;
declare var EGW_KEY_F1: number;
declare var EGW_KEY_F2: number;
declare var EGW_KEY_F3: number;
declare var EGW_KEY_F4: number;
declare var EGW_KEY_F5: number;
declare var EGW_KEY_F6: number;
declare var EGW_KEY_F7: number;
declare var EGW_KEY_F8: number;
declare var EGW_KEY_F9: number;
declare var EGW_KEY_F10: number;
declare var EGW_KEY_F11: number;
declare var EGW_KEY_F12: number;
declare var EGW_VALID_KEYS: number[];
declare function egw_keycode_translation_function(_nativeKeyCode: any): any;
declare var egw_registeredShortcuts: {};
/**
* Internal function which generates a menu item with the given parameters as used
* in e.g. the egwMenu.addItem function.
*/
declare function _egwGenMenuItem(_parent: any, _id: any, _caption: any, _iconUrl: any, _onClick: any): egwMenuItem;
/**
* Internal function which parses the given menu tree in _elements and adds the
* elements to the given parent.
*/
declare function _egwGenMenuStructure(_elements: any, _parent: any): egwMenuItem[];
/**
* Internal function which searches for the given ID inside an element tree.
*/
declare function _egwSearchMenuItem(_elements: any, _id: any): any;
/**
* Internal function which alows to set the onClick handler of multiple menu items
*/
declare function _egwSetMenuOnClick(_elements: any, _onClick: any): void;
/**
* Constructor for the egwMenu object. The egwMenu object is a abstract representation
* of a context/popup menu. The actual generation of the menu can by done by so
* called menu implementations. Those are activated by simply including the JS file
* of such an implementation.
*
* The currently available implementation is the "egwDhtmlxMenu.js" which is based
* upon the dhtmlxmenu component.
*/
declare function egwMenu(): void;
declare class egwMenu {
children: any[];
instance: egwMenuImpl;
_checkImpl(): boolean;
showAt(_x: any, _y: any, _force: any): boolean;
hide(): void;
addItem(_id: any, _caption: any, _iconUrl: any, _onClick: any): egwMenuItem;
clear(): void;
loadStructure(_elements: any): void;
getItem(_id: any): any;
setGlobalOnClick(_onClick: any): void;
}
/**
* Constructor for the egwMenuItem. Each entry in a menu (including seperators)
* is represented by a menu item.
*/
declare function egwMenuItem(_parent: any, _id: any): void;
declare class egwMenuItem {
/**
* Constructor for the egwMenuItem. Each entry in a menu (including seperators)
* is represented by a menu item.
*/
constructor(_parent: any, _id: any);
id: any;
caption: string;
checkbox: boolean;
checked: boolean;
groupIndex: number;
enabled: boolean;
iconUrl: string;
onClick: any;
default: boolean;
data: any;
shortcutCaption: any;
children: any[];
parent: any;
getItem(_id: any): any;
setGlobalOnClick(_onClick: any): void;
addItem(_id: any, _caption: any, _iconUrl: any, _onClick: any): egwMenuItem;
set_id(_value: any): void;
set_caption(_value: any): void;
set_checkbox(_value: any): void;
set_checked(_value: any): void;
set_groupIndex(_value: any): void;
set_enabled(_value: any): void;
set_onClick(_value: any): void;
set_iconUrl(_value: any): void;
set_default(_value: any): void;
set_data(_value: any): void;
set_hint(_value: any): void;
hint: any;
set_shortcutCaption(_value: any): void;
}
/**
* eGroupWare egw_action framework - JS Menu abstraction
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
declare var _egw_active_menu: any;
/**
* eGroupWare egw_action framework - JS Menu abstraction
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
*
* @param {type} _structure
*/
declare function egwMenuImpl(_structure: any): void;
declare class egwMenuImpl {
/**
* eGroupWare egw_action framework - JS Menu abstraction
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
*
* @param {type} _structure
*/
constructor(_structure: any);
dhtmlxmenu: any;
_translateStructure(_structure: any, _parentId: any, _idCnt: any): number;
showAt(_x: any, _y: any, _onHide: any): void;
hide(): void;
}
/**
* Main egwDynStyleSheet class - all egwDynStyleSheets share the same stylesheet
* which is dynamically inserted into the head section of the DOM-Tree.
* This stylesheet is created with the first egwDynStyleSheet class.
*/
declare function egwDynStyleSheet(): any;
declare class egwDynStyleSheet {
styleSheet: any;
selectors: {};
selectorCount: number;
updateRule(_selector: any, _rule: any): void;
}
/**
* eGroupWare egw_action framework - egw action framework
*
* @link http://www.egroupware.org
* @author Andreas Stöckel <as@stylite.de>
* @copyright 2011 by Andreas Stöckel
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package egw_action
* @version $Id$
*/
/**
* Contains the egwDynStyleSheet class which allows dynamic generation of stylesheet
* rules - updating a single stylesheet rule is way more efficient than updating
* the element style of many objects.
*/
declare var EGW_DYNAMIC_STYLESHEET: any;

View File

@ -261,7 +261,7 @@ function egw_unregisterGlobalShortcut(_keyCode, _shift, _ctrl, _alt) {
* _shift, _ctrl, _alt values have been translated into platform independent
* values (for apple devices).
*/
function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
export function egw_keyHandler(_keyCode, _shift, _ctrl, _alt) {
// Check whether there is a global shortcut waiting for the keypress event
var idx = egw_shortcutIdx(_keyCode, _shift, _ctrl, _alt);

View File

@ -11,6 +11,7 @@ import { et2_DOMWidget } from './et2_core_DOMWidget';
import { ClassWithAttributes } from "./et2_core_inheritance";
import { et2_register_widget } from "./et2_core_widget";
import { et2_no_init } from "./et2_core_common";
import { egwIsMobile } from "../egw_action/egw_action_common.js";
/**
* Class which manages the DOM node itself. The simpleWidget class is derrived
* from et2_DOMWidget and implements the getDOMNode function. A setDOMNode

View File

@ -22,6 +22,7 @@ import {et2_no_init} from "./et2_core_common";
// fixing circular dependencies by only importing type
import type {et2_inputWidget} from "./et2_core_inputWidget";
import type {et2_valueWidget} from "./et2_core_valueWidget";
import {egwIsMobile} from "../egw_action/egw_action_common.js";
/**
* Class which manages the DOM node itself. The simpleWidget class is derrived

View File

@ -21,6 +21,7 @@ import { et2_dataview_column, et2_dataview_columns } from './et2_dataview_model_
import { et2_dataview_view_resizable } from "./et2_dataview_view_resizeable";
import { et2_dataview_grid } from "./et2_dataview_view_grid";
import { et2_dataview_rowProvider } from "./et2_dataview_view_rowProvider";
import { egw } from "../jsapi/egw_global";
/**
* The et2_dataview class is the main class for displaying a dataview. The
* dataview class manages the creation of the outer html nodes (like the table,

View File

@ -23,6 +23,7 @@ import {et2_dataview_column, et2_dataview_columns} from './et2_dataview_model_co
import {et2_dataview_view_resizable} from "./et2_dataview_view_resizeable";
import {et2_dataview_grid} from "./et2_dataview_view_grid";
import {et2_dataview_rowProvider} from "./et2_dataview_view_rowProvider"
import {egw} from "../jsapi/egw_global";
/**
* The et2_dataview class is the main class for displaying a dataview. The

View File

@ -61,6 +61,7 @@ import { et2_dynheight } from "./et2_widget_dynheight";
import { et2_arrayMgr } from "./et2_core_arrayMgr";
import { egw } from "../jsapi/egw_global";
import { et2_compileLegacyJS } from "./et2_core_legacyJSFunctions";
import { egwIsMobile } from "../egw_action/egw_action_common.js";
export const et2_INextmatchHeader = "et2_INextmatchHeader";
et2_implements_registry.et2_INextmatchHeader = function (obj) {
return implements_methods(obj, ["setNextmatch"]);

View File

@ -66,6 +66,7 @@ import {et2_searchbox} from "./et2_widget_textbox";
import {et2_template} from "./et2_widget_template";
import {egw} from "../jsapi/egw_global";
import {et2_compileLegacyJS} from "./et2_core_legacyJSFunctions";
import {egwIsMobile} from "../egw_action/egw_action_common.js";
//import {et2_selectAccount} from "./et2_widget_SelectAccount";

View File

@ -12,7 +12,7 @@ import { et2_dataview_row } from "./et2_dataview_view_row";
import { et2_dataview_tile } from "./et2_dataview_view_tile";
import { et2_dataview_controller } from "./et2_dataview_controller";
import { et2_dataview_column } from "./et2_dataview_model_columns";
import { framework } from "../jsapi/egw_global";
import { framework, egw } from "../jsapi/egw_global";
import { egw_getActionManager, egw_getObjectManager, egwActionObjectManager, egwActionObject, EGW_AO_FLAG_DEFAULT_FOCUS, EGW_AO_EXEC_SELECTED, EGW_AO_FLAG_IS_CONTAINER } from "../egw_action/egw_action.js";
import { nm_action } from "./et2_extension_nextmatch_actions.js";
import { egwIsMobile } from "../egw_action/egw_action_common.js";

View File

@ -29,7 +29,7 @@ import {et2_dataview_tile} from "./et2_dataview_view_tile";
import {et2_nextmatch} from "./et2_extension_nextmatch";
import {et2_dataview_controller} from "./et2_dataview_controller";
import {et2_dataview_column} from "./et2_dataview_model_columns";
import {framework, Iegw} from "../jsapi/egw_global";
import {framework, Iegw, egw} from "../jsapi/egw_global";
import {
egw_getActionManager,
egw_getObjectManager,

View File

@ -23,6 +23,7 @@ import { et2_inputWidget } from './et2_core_inputWidget';
import { et2_DOMWidget } from "./et2_core_DOMWidget";
import { egw } from "../jsapi/egw_global";
import { date } from "./lib/date.js";
import { egwIsMobile } from "../egw_action/egw_action_common.js";
// all calls to jQueryUI.datetimepicker as jQuery.datepicker give errors which are currently suppressed with @ts-ignore
// adding npm package @types/jquery.ui.datetimepicker did NOT help :(
/**

View File

@ -27,6 +27,7 @@ import {et2_DOMWidget} from "./et2_core_DOMWidget";
import {et2_IDetachedDOM} from "./et2_core_interfaces";
import {egw} from "../jsapi/egw_global";
import {date} from "./lib/date.js";
import {egwIsMobile} from "../egw_action/egw_action_common.js";
// all calls to jQueryUI.datetimepicker as jQuery.datepicker give errors which are currently suppressed with @ts-ignore
// adding npm package @types/jquery.ui.datetimepicker did NOT help :(

View File

@ -20,6 +20,7 @@ import { egw } from "../jsapi/egw_global";
import { et2_no_init } from "./et2_core_common";
import { et2_IResizeable } from "./et2_core_interfaces";
import { et2_dialog } from "./et2_widget_dialog";
import { egw_getAppObjectManager, egwActionObject } from "../egw_action/egw_action.js";
/**
* Class which implements the UI of a Portlet
*

View File

@ -22,6 +22,7 @@ import {egw} from "../jsapi/egw_global";
import {et2_no_init} from "./et2_core_common";
import {et2_IResizeable} from "./et2_core_interfaces";
import {et2_dialog} from "./et2_widget_dialog";
import {egw_getAppObjectManager, egwActionObject, egwAction, egwActionObjectInterface} from "../egw_action/egw_action.js";
/**
* Class which implements the UI of a Portlet

View File

@ -23,6 +23,7 @@ import { et2_inputWidget } from './et2_core_inputWidget';
import { et2_DOMWidget } from "./et2_core_DOMWidget";
import { et2_directChildrenByTagName, et2_readAttrWithDefault } from "./et2_core_xml";
import { egw } from "../jsapi/egw_global";
import { sprintf } from "../egw_action/egw_action_common.js";
// all calls to Chosen jQuery plugin as jQuery.(un)chosen() give errors which are currently suppressed with @ts-ignore
// adding npm package @types/chosen-js did NOT help :(
/**

View File

@ -26,6 +26,7 @@ import {et2_DOMWidget} from "./et2_core_DOMWidget";
import {et2_directChildrenByTagName, et2_readAttrWithDefault} from "./et2_core_xml";
import {egw} from "../jsapi/egw_global";
import {et2_IDetachedDOM} from "./et2_core_interfaces";
import {sprintf} from "../egw_action/egw_action_common.js";
// all calls to Chosen jQuery plugin as jQuery.(un)chosen() give errors which are currently suppressed with @ts-ignore
// adding npm package @types/chosen-js did NOT help :(

View File

@ -1,4 +1,3 @@
"use strict";
/*
* Egroupware
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -8,49 +7,35 @@
* @author Nathan Gray
* @version $Id$
*/
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.et2_calendar_daycol = void 0;
/*egw:uses
et2_core_valueWidget;
/calendar/js/et2_widget_event.js;
*/
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
var et2_core_valueWidget_1 = require("../../api/js/etemplate/et2_core_valueWidget");
var et2_widget_timegrid_1 = require("./et2_widget_timegrid");
var et2_widget_view_1 = require("./et2_widget_view");
var et2_widget_event_1 = require("./et2_widget_event");
var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritance");
import { et2_createWidget, et2_register_widget } from "../../api/js/etemplate/et2_core_widget";
import { et2_valueWidget } from "../../api/js/etemplate/et2_core_valueWidget";
import { et2_calendar_timegrid } from "./et2_widget_timegrid";
import { et2_calendar_view } from "./et2_widget_view";
import { et2_calendar_event } from "./et2_widget_event";
import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance";
import { et2_no_init } from "../../api/js/etemplate/et2_core_common";
import { egw } from "../../api/js/jsapi/egw_global";
import { egwIsMobile } from "../../api/js/egw_action/egw_action_common.js";
/**
* Class which implements the "calendar-timegrid" XET-Tag for displaying a single days
*
* This widget is responsible mostly for positioning its events
*
*/
var et2_calendar_daycol = /** @class */ (function (_super) {
__extends(et2_calendar_daycol, _super);
export class et2_calendar_daycol extends et2_valueWidget {
/**
* Constructor
*/
function et2_calendar_daycol(_parent, _attrs, _child) {
var _this =
constructor(_parent, _attrs, _child) {
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_calendar_daycol._attributes, _child || {})) || this;
_this.registeredUID = null;
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_calendar_daycol._attributes, _child || {}));
this.registeredUID = null;
// Init to defaults, just in case - they will be updated from parent
_this.display_settings = {
this.display_settings = {
wd_start: 60 * 9,
wd_end: 60 * 17,
granularity: 30,
@ -60,51 +45,50 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
titleHeight: 2.0
};
// Main container
_this.div = jQuery(document.createElement("div"))
this.div = jQuery(document.createElement("div"))
.addClass("calendar_calDayCol")
.css('width', _this.options.width)
.css('left', _this.options.left);
_this.header = jQuery(document.createElement('div'))
.css('width', this.options.width)
.css('left', this.options.left);
this.header = jQuery(document.createElement('div'))
.addClass("calendar_calDayColHeader")
.css('width', _this.options.width)
.css('left', _this.options.left);
_this.title = jQuery(document.createElement('div'))
.css('width', this.options.width)
.css('left', this.options.left);
this.title = jQuery(document.createElement('div'))
.addClass('et2_clickable et2_link')
.appendTo(_this.header);
_this.user_spacer = jQuery(document.createElement('div'))
.appendTo(this.header);
this.user_spacer = jQuery(document.createElement('div'))
.addClass("calendar_calDayColHeader_spacer")
.appendTo(_this.header);
_this.all_day = jQuery(document.createElement('div'))
.appendTo(this.header);
this.all_day = jQuery(document.createElement('div'))
.addClass("calendar_calDayColAllDay")
.css('max-height', (egw.preference('limit_all_day_lines', 'calendar') || 3) * 1.4 + 'em')
.appendTo(_this.header);
_this.event_wrapper = jQuery(document.createElement('div'))
.appendTo(this.header);
this.event_wrapper = jQuery(document.createElement('div'))
.addClass("event_wrapper")
.appendTo(_this.div);
_this.setDOMNode(_this.div[0]);
.appendTo(this.div);
this.setDOMNode(this.div[0]);
// Used for its date calculations - note this is a datetime, parent
// uses just a date
_this._date_helper = et2_createWidget('date-time', {}, null);
_this._date_helper.loadingFinished();
return _this;
this._date_helper = et2_createWidget('date-time', {}, null);
this._date_helper.loadingFinished();
}
et2_calendar_daycol.prototype.doLoadingFinished = function () {
var result = _super.prototype.doLoadingFinished.call(this);
doLoadingFinished() {
let result = super.doLoadingFinished();
// Parent will have everything we need, just load it from there
if (this.getParent() && this.getParent().options.owner) {
this.set_owner(this.getParent().options.owner);
}
if (this.title.text() === '' && this.options.date &&
this.getParent() && this.getParent().instanceOf(et2_widget_timegrid_1.et2_calendar_timegrid)) {
this.getParent() && this.getParent().instanceOf(et2_calendar_timegrid)) {
// Forces an update
var date = this.options.date;
const date = this.options.date;
this.options.date = '';
this.set_date(date);
}
return result;
};
et2_calendar_daycol.prototype.destroy = function () {
_super.prototype.destroy.call(this);
}
destroy() {
super.destroy();
this.div.off();
this.header.off().remove();
this.title.off();
@ -116,11 +100,11 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
this._date_helper.destroy();
this._date_helper = null;
egw.dataUnregisterUID(this.registeredUID, null, this);
};
et2_calendar_daycol.prototype.getDOMNode = function (sender) {
}
getDOMNode(sender) {
if (!sender || sender === this)
return this.div[0];
if (sender.instanceOf && sender.instanceOf(et2_widget_event_1.et2_calendar_event)) {
if (sender.instanceOf && sender.instanceOf(et2_calendar_event)) {
if (this.display_settings.granularity === 0) {
return this.event_wrapper[0];
}
@ -130,22 +114,22 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
return this.div[0];
}
};
}
/**
* Draw the individual divs for clicking to add an event
*/
et2_calendar_daycol.prototype._draw = function () {
_draw() {
// Remove any existing
jQuery('.calendar_calAddEvent', this.div).remove();
// Grab real values from parent
if (this.getParent() && this.getParent().instanceOf(et2_widget_timegrid_1.et2_calendar_timegrid)) {
if (this.getParent() && this.getParent().instanceOf(et2_calendar_timegrid)) {
this.display_settings.wd_start = 60 * this.getParent().options.day_start;
this.display_settings.wd_end = 60 * this.getParent().options.day_end;
this.display_settings.granularity = this.getParent().options.granularity;
var header = this.getParent().dayHeader.children();
const header = this.getParent().dayHeader.children();
// Figure out insert index
var idx = 0;
var siblings = this.getParent().getDOMNode(this).childNodes;
let idx = 0;
const siblings = this.getParent().getDOMNode(this).childNodes;
while (idx < siblings.length && siblings[idx] != this.getDOMNode()) {
idx++;
}
@ -158,17 +142,13 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
}
this.div.attr('data-date', this.options.date);
};
et2_calendar_daycol.prototype.getDate = function () {
}
getDate() {
return this.date;
};
Object.defineProperty(et2_calendar_daycol.prototype, "date_helper", {
get: function () {
return this._date_helper;
},
enumerable: false,
configurable: true
});
}
get date_helper() {
return this._date_helper;
}
/**
* Set the date
*
@ -178,7 +158,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {boolean} force_redraw =false Redraw even if the date is the same.
* Used for when new data is available.
*/
et2_calendar_daycol.prototype.set_date = function (_date, events, force_redraw) {
set_date(_date, events, force_redraw) {
if (typeof events === 'undefined' || !events) {
events = false;
}
@ -199,13 +179,13 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
this.date = new Date(this.getParent().date_helper.getValue());
// Keep internal option in Ymd format, it gets passed around in this format
var new_date = "" + this.getParent().date_helper.get_year() +
const new_date = "" + this.getParent().date_helper.get_year() +
sprintf("%02d", this.getParent().date_helper.get_month()) +
sprintf("%02d", this.getParent().date_helper.get_date());
// Set label
if (!this.options.label) {
// Add timezone offset back in, or formatDate will lose those hours
var formatDate = new Date(this.date.valueOf() + this.date.getTimezoneOffset() * 60 * 1000);
const formatDate = new Date(this.date.valueOf() + this.date.getTimezoneOffset() * 60 * 1000);
this.title.html('<span class="long_date">' + jQuery.datepicker.formatDate('DD', formatDate) +
'</span><span class="short_date">' + jQuery.datepicker.formatDate('D', formatDate) + '</span>' +
jQuery.datepicker.formatDate('d', formatDate));
@ -222,13 +202,13 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
!force_redraw) {
return;
}
var cache_id = CalendarApp._daywise_cache_id(new_date, this.options.owner);
const cache_id = CalendarApp._daywise_cache_id(new_date, this.options.owner);
if (this.options.date && this.registeredUID &&
cache_id !== this.registeredUID) {
egw.dataUnregisterUID(this.registeredUID, null, this);
// Remove existing events
while (this._children.length > 0) {
var node = this._children[this._children.length - 1];
const node = this._children[this._children.length - 1];
this.removeChild(node);
node.destroy();
}
@ -243,7 +223,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
this.registeredUID = cache_id;
egw.dataRegisterUID(this.registeredUID, this._data_callback, this, this.getInstanceManager().execId, this.id);
}
};
}
/**
* Set the owner of this day
*
@ -252,7 +232,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* necessarily an entry from the resource app), or a list containing a
* combination of both.
*/
et2_calendar_daycol.prototype.set_owner = function (_owner) {
set_owner(_owner) {
this.title
.attr("data-owner", _owner);
this.header.attr('data-owner', _owner);
@ -266,7 +246,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
return;
}
this.options.owner = typeof _owner !== 'object' ? [_owner] : _owner;
var cache_id = CalendarApp._daywise_cache_id(this.options.date, _owner);
const cache_id = CalendarApp._daywise_cache_id(this.options.date, _owner);
if (this.options.date && this.registeredUID &&
cache_id !== this.registeredUID) {
egw.dataUnregisterUID(this.registeredUID, null, this);
@ -275,12 +255,12 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
this.registeredUID = cache_id;
egw.dataRegisterUID(this.registeredUID, this._data_callback, this, this.getInstanceManager().execId, this.id);
}
};
et2_calendar_daycol.prototype.set_class = function (classnames) {
}
set_class(classnames) {
this.header.removeClass(this.class);
_super.prototype.set_class.call(this, classnames);
super.set_class(classnames);
this.header.addClass(classnames);
};
}
/**
* Callback used when the daywise data changes
*
@ -290,20 +270,20 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {String[]} event_ids
* @returns {undefined}
*/
et2_calendar_daycol.prototype._data_callback = function (event_ids) {
var events = [];
_data_callback(event_ids) {
const events = [];
if (event_ids == null || typeof event_ids.length == 'undefined')
event_ids = [];
for (var i = 0; i < event_ids.length; i++) {
var event_1 = egw.dataGetUIDdata('calendar::' + event_ids[i]);
event_1 = event_1 && event_1.data || false;
if (event_1 && event_1.date && et2_widget_event_1.et2_calendar_event.owner_check(event_1, this) && (event_1.date === this.options.date ||
for (let i = 0; i < event_ids.length; i++) {
let event = egw.dataGetUIDdata('calendar::' + event_ids[i]);
event = event && event.data || false;
if (event && event.date && et2_calendar_event.owner_check(event, this) && (event.date === this.options.date ||
// Accept multi-day events
new Date(event_1.start) <= this.date //&& new Date(event.end) >= this.date
new Date(event.start) <= this.date //&& new Date(event.end) >= this.date
)) {
events.push(event_1);
events.push(event);
}
else if (event_1) {
else if (event) {
// Got an ID that doesn't belong
event_ids.splice(i--, 1);
}
@ -320,28 +300,28 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
if (!this.getParent().disabled)
this._update_events(events);
};
et2_calendar_daycol.prototype.set_label = function (label) {
}
set_label(label) {
this.options.label = label;
this.title.text(label);
this.title.toggleClass('et2_clickable et2_link', label === '');
};
et2_calendar_daycol.prototype.set_left = function (left) {
}
set_left(left) {
if (this.div) {
this.div.css('left', left);
}
};
et2_calendar_daycol.prototype.set_width = function (width) {
}
set_width(width) {
this.options.width = width;
if (this.div) {
this.div.outerWidth(this.options.width);
this.header.outerWidth(this.options.width);
}
};
}
/**
* Applies class for today, and any holidays for current day
*/
et2_calendar_daycol.prototype.day_class_holiday = function () {
day_class_holiday() {
this.title
// Remove all special day classes
.removeClass('calendar_calToday calendar_calBirthday calendar_calHoliday')
@ -349,15 +329,15 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
.addClass("et2_clickable et2_link");
this.title.attr('data-holiday', '');
// Set today class - note +1 when dealing with today, as months in JS are 0-11
var today = new Date();
const today = new Date();
today.setUTCMinutes(today.getUTCMinutes() - today.getTimezoneOffset());
this.title.toggleClass("calendar_calToday", this.options.date === '' + today.getUTCFullYear() +
sprintf("%02d", today.getUTCMonth() + 1) +
sprintf("%02d", today.getUTCDate()));
// Holidays and birthdays
var holidays = et2_widget_view_1.et2_calendar_view.get_holidays(this, this.options.date.substring(0, 4));
var holiday_list = [];
var holiday_pref = (egw.preference('birthdays_as_events', 'calendar') || []);
let holidays = et2_calendar_view.get_holidays(this, this.options.date.substring(0, 4));
const holiday_list = [];
let holiday_pref = (egw.preference('birthdays_as_events', 'calendar') || []);
if (typeof holiday_pref === 'string') {
holiday_pref = holiday_pref.split(',');
}
@ -365,12 +345,12 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
holiday_pref = jQuery.extend([], holiday_pref);
}
// Show holidays as events on mobile or by preference
var holidays_as_events = egwIsMobile() || egw.preference('birthdays_as_events', 'calendar') === true ||
const holidays_as_events = egwIsMobile() || egw.preference('birthdays_as_events', 'calendar') === true ||
holiday_pref.indexOf('holiday') >= 0;
var birthdays_as_events = egwIsMobile() || holiday_pref.indexOf('birthday') >= 0;
const birthdays_as_events = egwIsMobile() || holiday_pref.indexOf('birthday') >= 0;
if (holidays && holidays[this.options.date]) {
holidays = holidays[this.options.date];
for (var i = 0; i < holidays.length; i++) {
for (let i = 0; i < holidays.length; i++) {
if (typeof holidays[i]['birthyear'] !== 'undefined') {
// Show birthdays as events on mobile or by preference
if (birthdays_as_events) {
@ -443,7 +423,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
}
this.title.attr('title', holiday_list.join(', '));
};
}
/**
* Load the event data for this day and create event widgets for each.
*
@ -451,19 +431,19 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
*
* @param {Object[]} [_events] Array of event information, one per event.
*/
et2_calendar_daycol.prototype._update_events = function (_events) {
var c;
var events = _events || this.getArrayMgr('content').getEntry(this.options.date) || [];
_update_events(_events) {
let c;
const events = _events || this.getArrayMgr('content').getEntry(this.options.date) || [];
// Remove extra events
while (this._children.length > 0) {
var node = this._children[this._children.length - 1];
const node = this._children[this._children.length - 1];
this.removeChild(node);
node.destroy();
}
// Make sure children are in cronological order, or columns are backwards
events.sort(function (a, b) {
var start = new Date(a.start) - new Date(b.start);
var end = new Date(a.end) - new Date(b.end);
const start = new Date(a.start) - new Date(b.start);
const end = new Date(a.end) - new Date(b.end);
// Whole day events sorted by ID, normal events by start / end time
if (a.whole_day && b.whole_day) {
return (a.app_id - b.app_id);
@ -481,13 +461,13 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}, this);
}
// Seperate loop so column sorting finds all children in the right place
var child_length = this._children.length;
let child_length = this._children.length;
for (c = 0; c < events.length && c < child_length; c++) {
var event_2 = this.getWidgetById('event_' + events[c].id);
if (!event_2)
let event = this.getWidgetById('event_' + events[c].id);
if (!event)
continue;
if (this.isInTree()) {
event_2.doLoadingFinished();
event.doLoadingFinished();
}
}
// Show holidays as events on mobile or by preference
@ -496,7 +476,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
// Apply styles to hidden events
this._out_of_view();
};
}
/**
* Apply styles for out-of-view and partially hidden events
*
@ -517,26 +497,26 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* and on hover shows the category color, title & time. Clicking changes
* the view to the selected day, and opens the event for editing.
*/
et2_calendar_daycol.prototype._out_of_view = function () {
_out_of_view() {
// Reset
this.header.children('.hiddenEventBefore').remove();
this.div.children('.hiddenEventAfter').remove();
this.event_wrapper.css('overflow', 'visible');
this.all_day.removeClass('overflown');
jQuery('.calendar_calEventBody', this.div).css({ 'padding-top': '', 'margin-top': '' });
var timegrid = this.getParent();
const timegrid = this.getParent();
// elem is jquery div of event
function isHidden(elem) {
// Add an extra 5px top and bottom to include events just on the
// edge of visibility
var docViewTop = timegrid.scrolling.scrollTop() + 5, docViewBottom = docViewTop + (this.display_settings.granularity === 0 ?
const docViewTop = timegrid.scrolling.scrollTop() + 5, docViewBottom = docViewTop + (this.display_settings.granularity === 0 ?
this.event_wrapper.height() :
timegrid.scrolling.height() - 10), elemTop = elem.position().top, elemBottom = elemTop + elem.outerHeight(true);
if ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)) {
// Entirely visible
return false;
}
var visible = {
const visible = {
hidden: elemTop > docViewTop ? 'bottom' : 'top',
completely: false
};
@ -561,15 +541,15 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
// Reset
event.title.css({ 'top': '', 'background-color': '' });
event.body.css({ 'padding-top': '', 'margin-top': '' });
var hidden = isHidden.call(this, event.div);
var day = this;
const hidden = isHidden.call(this, event.div);
const day = this;
if (!hidden) {
return;
}
// Only top is hidden, move label
// Bottom hidden is fine
if (hidden.hidden === 'top' && !hidden.completely && !event.div.hasClass('calendar_calEventSmall')) {
var title_height = event.title.outerHeight();
const title_height = event.title.outerHeight();
event.title.css({
'top': timegrid.scrolling.scrollTop() - event.div.position().top,
'background-color': 'transparent'
@ -595,8 +575,8 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
else if (hidden.completely) {
this._hidden_indicator(event, hidden.hidden == 'top', false);
}
}, this, et2_widget_event_1.et2_calendar_event);
};
}, this, et2_calendar_event);
}
/**
* Show an indicator that there are hidden events
*
@ -609,11 +589,11 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {boolean} top Events hidden at the top (true) or bottom (false)
* @param {function} [onclick] Callback for when user clicks on the indicator
*/
et2_calendar_daycol.prototype._hidden_indicator = function (event, top, onclick) {
var indicator = null;
var day = this;
var timegrid = this.getParent();
var fixed_height = timegrid.div.hasClass('calendar_calTimeGridFixed');
_hidden_indicator(event, top, onclick) {
let indicator = null;
const day = this;
const timegrid = this.getParent();
const fixed_height = timegrid.div.hasClass('calendar_calTimeGridFixed');
// Event is before the displayed times
if (top) {
// Create if not already there
@ -671,7 +651,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
});
}
}
var count = parseInt(indicator.attr('data-hidden_count')) + 1;
const count = parseInt(indicator.attr('data-hidden_count')) + 1;
indicator.attr('data-hidden_count', count);
if (this.display_settings.granularity === 0) {
indicator.append(event.div.clone());
@ -694,39 +674,39 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
if (indicator !== null) {
// Avoid white, which is hard to see
// Use border-bottom-color, Firefox doesn't give a value with border-color
var color = jQuery.Color(event.div.css('background-color')).toString() !== jQuery.Color('white').toString() ?
const color = jQuery.Color(event.div.css('background-color')).toString() !== jQuery.Color('white').toString() ?
event.div.css('background-color') : event.div.css('border-bottom-color');
if (color !== 'rgba(0, 0, 0, 0)') {
indicator.css('border-color', color);
}
}
};
}
/**
* Sort a day's events into minimally overlapping columns
*
* @returns {Array[]} Events sorted into columns
*/
et2_calendar_daycol.prototype._spread_events = function () {
_spread_events() {
if (!this.date)
return [];
var day_start = this.date.valueOf() / 1000;
var dst_check = new Date(this.date);
let day_start = this.date.valueOf() / 1000;
const dst_check = new Date(this.date);
dst_check.setUTCHours(12);
// if daylight saving is switched on or off, correct $day_start
// gives correct times after 2am, times between 0am and 2am are wrong
var daylight_diff = day_start + 12 * 60 * 60 - (dst_check.valueOf() / 1000);
const daylight_diff = day_start + 12 * 60 * 60 - (dst_check.valueOf() / 1000);
if (daylight_diff) {
day_start -= daylight_diff;
}
var eventCols = [], col_ends = [];
const eventCols = [], col_ends = [];
// Make sure children are in cronological order, or columns are backwards
this._children.sort(function (a, b) {
var start = new Date(a.options.value.start) - new Date(b.options.value.start);
var end = new Date(a.options.value.end) - new Date(b.options.value.end);
const start = new Date(a.options.value.start) - new Date(b.options.value.start);
const end = new Date(a.options.value.end) - new Date(b.options.value.end);
// Whole day events sorted by ID, normal events by start / end time
if (a.options.value.whole_day && b.options.value.whole_day) {
// Longer duration comes first so we have nicer bars across the top
var duration = (new Date(b.options.value.end) - new Date(b.options.value.start)) -
const duration = (new Date(b.options.value.end) - new Date(b.options.value.start)) -
(new Date(a.options.value.end) - new Date(a.options.value.start));
return duration ? duration : (a.options.value.app_id - b.options.value.app_id);
}
@ -735,43 +715,43 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
}
return start ? start : end;
});
for (var i = 0; i < this._children.length; i++) {
var event_3 = this._children[i].options.value || false;
if (!event_3)
for (let i = 0; i < this._children.length; i++) {
const event = this._children[i].options.value || false;
if (!event)
continue;
if (event_3.date && event_3.date != this.options.date &&
if (event.date && event.date != this.options.date &&
// Multi-day events date may be different
(new Date(event_3.start) >= this.date || new Date(event_3.end) < this.date)) {
(new Date(event.start) >= this.date || new Date(event.end) < this.date)) {
// Still have a child event that has changed date (DnD)
this._children[i].destroy();
this.removeChild(this._children[i]);
continue;
}
var c = 0;
event_3['multiday'] = false;
if (typeof event_3.start !== 'object') {
event_3.start = new Date(event_3.start);
let c = 0;
event['multiday'] = false;
if (typeof event.start !== 'object') {
event.start = new Date(event.start);
}
if (typeof event_3.end !== 'object') {
event_3.end = new Date(event_3.end);
if (typeof event.end !== 'object') {
event.end = new Date(event.end);
}
event_3['start_m'] = parseInt(String((event_3.start.valueOf() / 1000 - day_start) / 60), 10);
if (event_3['start_m'] < 0) {
event_3['start_m'] = 0;
event_3['multiday'] = true;
event['start_m'] = parseInt(String((event.start.valueOf() / 1000 - day_start) / 60), 10);
if (event['start_m'] < 0) {
event['start_m'] = 0;
event['multiday'] = true;
}
event_3['end_m'] = parseInt(String((event_3.end.valueOf() / 1000 - day_start) / 60), 10);
if (event_3['end_m'] >= 24 * 60) {
event_3['end_m'] = 24 * 60 - 1;
event_3['multiday'] = true;
event['end_m'] = parseInt(String((event.end.valueOf() / 1000 - day_start) / 60), 10);
if (event['end_m'] >= 24 * 60) {
event['end_m'] = 24 * 60 - 1;
event['multiday'] = true;
}
if (!event_3.start.getUTCHours() && !event_3.start.getUTCMinutes() && event_3.end.getUTCHours() == 23 && event_3.end.getUTCMinutes() == 59) {
event_3.whole_day_on_top = (event_3.non_blocking && event_3.non_blocking != '0');
if (!event.start.getUTCHours() && !event.start.getUTCMinutes() && event.end.getUTCHours() == 23 && event.end.getUTCMinutes() == 59) {
event.whole_day_on_top = (event.non_blocking && event.non_blocking != '0');
}
if (!event_3['whole_day_on_top']) {
for (c = 0; event_3['start_m'] < col_ends[c]; ++c)
if (!event['whole_day_on_top']) {
for (c = 0; event['start_m'] < col_ends[c]; ++c)
;
col_ends[c] = event_3['end_m'];
col_ends[c] = event['end_m'];
}
if (typeof eventCols[c] === 'undefined') {
eventCols[c] = [];
@ -779,7 +759,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
eventCols[c].push(this._children[i]);
}
return eventCols;
};
}
/**
* Position the event according to its time and how this widget is laid
* out.
@ -787,24 +767,24 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {et2_calendar_event} [event] - Event to be updated
* If a single event is not provided, all events are repositioned.
*/
et2_calendar_daycol.prototype.position_event = function (event) {
position_event(event) {
// If hidden, skip it - it takes too long
if (!this.div.is(':visible'))
return;
// Sort events into minimally-overlapping columns
var columns = this._spread_events();
for (var c = 0; c < columns.length; c++) {
const columns = this._spread_events();
for (let c = 0; c < columns.length; c++) {
// Calculate horizontal positioning
var left = Math.ceil(5 + (1.5 * 100 / (parseFloat(this.options.width) || 100)));
var right = 2;
let left = Math.ceil(5 + (1.5 * 100 / (parseFloat(this.options.width) || 100)));
let right = 2;
if (columns.length !== 1) {
right = !c ? 30 : 2;
left += c * (100.0 - left) / columns.length;
}
for (var i = 0; (columns[c].indexOf(event) >= 0 || !event) && i < columns[c].length; i++) {
for (let i = 0; (columns[c].indexOf(event) >= 0 || !event) && i < columns[c].length; i++) {
// Calculate vertical positioning
var top_1 = 0;
var height = 0;
let top = 0;
let height = 0;
// Position the event
if (this.display_settings.granularity === 0) {
if (this.all_day.has(columns[c][i].div).length) {
@ -836,16 +816,16 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
columns[c][i].div.appendTo(this.event_wrapper);
this.getParent().resizeTimes();
}
top_1 = this._time_to_position(columns[c][i].options.value.start_m);
height = this._time_to_position(columns[c][i].options.value.end_m) - top_1;
top = this._time_to_position(columns[c][i].options.value.start_m);
height = this._time_to_position(columns[c][i].options.value.end_m) - top;
}
// Position the event
if (event && columns[c].indexOf(event) >= 0 || !event) {
columns[c][i].div.css('top', top_1 + '%');
columns[c][i].div.css('top', top + '%');
columns[c][i].div.css('height', height + '%');
// Remove spacing from border, but only if visible or the height will be wrong
if (columns[c][i].div.is(':visible')) {
var border_diff = columns[c][i].div.outerHeight() - columns[c][i].div.height();
const border_diff = columns[c][i].div.outerHeight() - columns[c][i].div.height();
columns[c][i].div.css('height', 'calc(' + height + '% - ' + border_diff + ')');
}
// This gives the wrong height
@ -861,7 +841,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
return;
}
}
};
}
/**
* Calculates the vertical position based on the time
*
@ -870,14 +850,14 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {int} time in minutes from midnight
* @return {float} position in percent
*/
et2_calendar_daycol.prototype._time_to_position = function (time) {
var pos = 0.0;
_time_to_position(time) {
let pos = 0.0;
// 24h
pos = ((time / 60) / 24) * 100;
return pos.toFixed(1);
};
et2_calendar_daycol.prototype.attachToDOM = function () {
var result = _super.prototype.attachToDOM.call(this);
}
attachToDOM() {
let result = super.attachToDOM();
// Remove the binding for the click handler, unless there's something
// custom here.
if (!this.onclick) {
@ -886,7 +866,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
// But we do want to listen to certain clicks, and handle them internally
jQuery(this.node).on('click.et2_daycol', '.calendar_calDayColHeader,.calendar_calAddEvent', jQuery.proxy(this.click, this));
return result;
};
}
/**
* Click handler calling custom handler set via onclick attribute to this.onclick,
* or the default which is to open a new event at that time.
@ -897,7 +877,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* @param {Event} _ev
* @returns {boolean}
*/
et2_calendar_daycol.prototype.click = function (_ev) {
click(_ev) {
if (this.getParent().options.readonly)
return;
// Drag to create in progress
@ -920,14 +900,14 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
else if (this.header.has(_ev.target).length && !jQuery('.hiddenEventBefore', this.header).has(_ev.target).length ||
this.header.is(_ev.target)) {
// Click on the header, but not the title. That's an all-day non-blocking
var end = this.date.getFullYear() + '-' + (this.date.getUTCMonth() + 1) + '-' + this.date.getUTCDate() + 'T23:59';
var options_1 = {
const end = this.date.getFullYear() + '-' + (this.date.getUTCMonth() + 1) + '-' + this.date.getUTCDate() + 'T23:59';
let options = {
start: this.date.toJSON(),
end: end,
non_blocking: true,
owner: this.options.owner
};
app.calendar.add(options_1);
app.calendar.add(options);
return false;
}
}
@ -936,19 +916,19 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
app.calendar.update_state({ view: 'day', date: this.date.toJSON() });
return false;
}
};
}
/**
* Code for implementing et2_IDetachedDOM
*
* @param {array} _attrs array to add further attributes to
*/
et2_calendar_daycol.prototype.getDetachedAttributes = function (_attrs) {
};
et2_calendar_daycol.prototype.getDetachedNodes = function () {
getDetachedAttributes(_attrs) {
}
getDetachedNodes() {
return [this.getDOMNode(this)];
};
et2_calendar_daycol.prototype.setDetachedAttributes = function (_nodes, _values) {
};
}
setDetachedAttributes(_nodes, _values) {
}
// Resizable interface
/**
* Resize
@ -956,7 +936,7 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
* Parent takes care of setting proper width & height for the containing div
* here we just need to adjust the events to fit the new size.
*/
et2_calendar_daycol.prototype.resize = function () {
resize() {
if (this.disabled || !this.div.is(':visible') || this.getParent().disabled) {
return;
}
@ -971,38 +951,36 @@ var et2_calendar_daycol = /** @class */ (function (_super) {
// to reset for _out_of_view()
this.iterateOver(function (widget) {
widget._small_size();
}, this, et2_widget_event_1.et2_calendar_event);
}, this, et2_calendar_event);
}
this._out_of_view();
};
et2_calendar_daycol._attributes = {
date: {
name: "Date",
type: "any",
description: "What date is this daycol for. YYYYMMDD or Date",
default: et2_no_init
},
owner: {
name: "Owner",
type: "any",
default: et2_no_init,
description: "Account ID number of the calendar owner, if not the current user"
},
display_birthday_as_event: {
name: "Birthdays",
type: "boolean",
default: false,
description: "Display birthdays as events"
},
display_holiday_as_event: {
name: "Holidays",
type: "boolean",
default: false,
description: "Display holidays as events"
}
};
return et2_calendar_daycol;
}(et2_core_valueWidget_1.et2_valueWidget));
exports.et2_calendar_daycol = et2_calendar_daycol;
et2_core_widget_1.et2_register_widget(et2_calendar_daycol, ["calendar-daycol"]);
}
}
et2_calendar_daycol._attributes = {
date: {
name: "Date",
type: "any",
description: "What date is this daycol for. YYYYMMDD or Date",
default: et2_no_init
},
owner: {
name: "Owner",
type: "any",
default: et2_no_init,
description: "Account ID number of the calendar owner, if not the current user"
},
display_birthday_as_event: {
name: "Birthdays",
type: "boolean",
default: false,
description: "Display birthdays as events"
},
display_holiday_as_event: {
name: "Holidays",
type: "boolean",
default: false,
description: "Display holidays as events"
}
};
et2_register_widget(et2_calendar_daycol, ["calendar-daycol"]);
//# sourceMappingURL=et2_widget_daycol.js.map

View File

@ -14,13 +14,17 @@
/calendar/js/et2_widget_event.js;
*/
import {et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_createWidget, et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_valueWidget} from "../../api/js/etemplate/et2_core_valueWidget";
import {et2_calendar_timegrid} from "./et2_widget_timegrid";
import {et2_calendar_view} from "./et2_widget_view";
import {et2_calendar_event} from "./et2_widget_event";
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
import {et2_date} from "../../api/js/etemplate/et2_widget_date";
import {et2_IDetachedDOM, et2_IResizeable} from "../../api/js/etemplate/et2_core_interfaces";
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
import {egw} from "../../api/js/jsapi/egw_global";
import {egwIsMobile} from "../../api/js/egw_action/egw_action_common.js";
/**
* Class which implements the "calendar-timegrid" XET-Tag for displaying a single days

View File

@ -1,4 +1,3 @@
"use strict";
/*
* Egroupware Calendar event widget
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -8,30 +7,21 @@
* @author Nathan Gray
* @version $Id$
*/
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.et2_calendar_event = void 0;
/*egw:uses
/etemplate/js/et2_core_valueWidget;
*/
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
var et2_core_valueWidget_1 = require("../../api/js/etemplate/et2_core_valueWidget");
var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritance");
var et2_core_DOMWidget_1 = require("../../api/js/etemplate/et2_core_DOMWidget");
var et2_widget_daycol_1 = require("./et2_widget_daycol");
var et2_widget_planner_row_1 = require("./et2_widget_planner_row");
import { et2_createWidget, et2_register_widget } from "../../api/js/etemplate/et2_core_widget";
import { et2_valueWidget } from "../../api/js/etemplate/et2_core_valueWidget";
import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance";
import { et2_action_object_impl } from "../../api/js/etemplate/et2_core_DOMWidget";
import { et2_calendar_daycol } from "./et2_widget_daycol";
import { et2_calendar_planner_row } from "./et2_widget_planner_row";
import { et2_no_init } from "../../api/js/etemplate/et2_core_common";
import { egw_getAppObjectManager, egwActionObject } from '../../api/js/egw_action/egw_action.js';
import { egw } from "../../api/js/jsapi/egw_global";
import { et2_selectbox } from "../../api/js/etemplate/et2_widget_selectbox";
import { et2_container } from "../../api/js/etemplate/et2_core_baseWidget";
import { et2_dialog } from "../../api/js/etemplate/et2_widget_dialog";
/**
* Class for a single event, displayed in either the timegrid or planner view
*
@ -57,22 +47,20 @@ var et2_widget_planner_row_1 = require("./et2_widget_planner_row");
* et2_calendar_planner directly.
*
*/
var et2_calendar_event = /** @class */ (function (_super) {
__extends(et2_calendar_event, _super);
export class et2_calendar_event extends et2_valueWidget {
/**
* Constructor
*/
function et2_calendar_event(_parent, _attrs, _child) {
var _this =
constructor(_parent, _attrs, _child) {
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_calendar_event._attributes, _child || {})) || this;
_this._need_actions_linked = false;
var event = _this;
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_calendar_event._attributes, _child || {}));
this._need_actions_linked = false;
const event = this;
// Main container
_this.div = jQuery(document.createElement("div"))
this.div = jQuery(document.createElement("div"))
.addClass("calendar_calEvent")
.addClass(_this.options.class)
.css('width', _this.options.width)
.addClass(this.options.class)
.css('width', this.options.width)
.on('mouseenter', function () {
// Bind actions on first mouseover for faster creation
if (event._need_actions_linked) {
@ -105,28 +93,27 @@ var et2_calendar_event = /** @class */ (function (_super) {
});
}, 105);
});
_this.title = jQuery(document.createElement('div'))
this.title = jQuery(document.createElement('div'))
.addClass("calendar_calEventHeader")
.appendTo(_this.div);
_this.body = jQuery(document.createElement('div'))
.appendTo(this.div);
this.body = jQuery(document.createElement('div'))
.addClass("calendar_calEventBody")
.appendTo(_this.div);
_this.icons = jQuery(document.createElement('div'))
.appendTo(this.div);
this.icons = jQuery(document.createElement('div'))
.addClass("calendar_calEventIcons")
.appendTo(_this.title);
_this.setDOMNode(_this.div[0]);
return _this;
.appendTo(this.title);
this.setDOMNode(this.div[0]);
}
et2_calendar_event.prototype.doLoadingFinished = function () {
_super.prototype.doLoadingFinished.call(this);
doLoadingFinished() {
super.doLoadingFinished();
// Already know what is needed to hook to cache
if (this.options.value && this.options.value.row_id) {
egw.dataRegisterUID('calendar::' + this.options.value.row_id, this._UID_callback, this, this.getInstanceManager().execId, this.id);
}
return true;
};
et2_calendar_event.prototype.destroy = function () {
_super.prototype.destroy.call(this);
}
destroy() {
super.destroy();
if (this._actionObject) {
this._actionObject.remove();
this._actionObject = null;
@ -142,11 +129,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
jQuery('body.egw_tooltip').remove();
// Unregister, or we'll continue to be notified...
if (this.options.value) {
var old_app_id = this.options.value.row_id;
const old_app_id = this.options.value.row_id;
egw.dataUnregisterUID('calendar::' + old_app_id, null, this);
}
};
et2_calendar_event.prototype.set_value = function (_value) {
}
set_value(_value) {
// Un-register for updates
if (this.options.value) {
var old_id = this.options.value.row_id;
@ -156,22 +143,22 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
this.options.value = _value;
// Register for updates
var id = this.options.value.row_id;
const id = this.options.value.row_id;
if (!old_id || old_id !== id) {
egw.dataRegisterUID('calendar::' + id, this._UID_callback, this, this.getInstanceManager().execId, this.id);
}
if (_value && !egw.dataHasUID('calendar::' + id)) {
egw.dataStoreUID('calendar::' + id, _value);
}
};
}
/**
* Callback for changes in cached data
*/
et2_calendar_event.prototype._UID_callback = function (event) {
_UID_callback(event) {
// Copy to avoid changes, which may cause nm problems
var value = event === null ? null : jQuery.extend({}, event);
var parent = this.getParent();
var parent_owner = parent.getDOMNode(parent).dataset['owner'] || parent.getParent().options.owner;
const value = event === null ? null : jQuery.extend({}, event);
let parent = this.getParent();
let parent_owner = parent.getDOMNode(parent).dataset['owner'] || parent.getParent().options.owner;
if (parent_owner.indexOf(',') >= 0) {
parent_owner = parent_owner.split(',');
}
@ -180,11 +167,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
this._values_check(value);
}
// Check for changing days in the grid view
var state = this.getInstanceManager().app_obj.calendar.getState() || app.calendar.getState();
let state = this.getInstanceManager().app_obj.calendar.getState() || app.calendar.getState();
if (!this._sameday_check(value) || !this._status_check(value, state.status_filter, parent_owner)) {
// May need to update parent to remove out-of-view events
parent.removeChild(this);
if (event === null && parent && parent.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
if (event === null && parent && parent.instanceOf(et2_calendar_daycol)) {
parent._out_of_view();
}
// This should now cease to exist, as new events have been created
@ -202,15 +189,15 @@ var et2_calendar_event = /** @class */ (function (_super) {
if (this.getParent()) {
this._update();
}
};
}
/**
* Draw the event
*/
et2_calendar_event.prototype._update = function () {
_update() {
// Update to reflect new information
var event = this.options.value;
var id = event.row_id ? event.row_id : event.id + (event.recur_type ? ':' + event.recur_date : '');
var formatted_start = event.start.toJSON();
const event = this.options.value;
const id = event.row_id ? event.row_id : event.id + (event.recur_type ? ':' + event.recur_date : '');
const formatted_start = event.start.toJSON();
this.set_id('event_' + id);
if (this._actionObject) {
this._actionObject.id = 'calendar::' + id;
@ -219,7 +206,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
// Make sure category stuff is there
// Fake it to use the cache / call - if already there, these will return
// immediately.
var im = this.getInstanceManager();
const im = this.getInstanceManager();
et2_selectbox.cat_options({
_type: 'select-cat',
getInstanceManager: function () { return im; }
@ -237,7 +224,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
// Let timegrid always get the drag
.droppable('option', 'greedy', false);
}
var tooltip = jQuery(this._tooltip()).text();
let tooltip = jQuery(this._tooltip()).text();
// DOM nodes
this.div
// Set full day flag
@ -266,11 +253,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
.addClass(event.class)
.toggleClass('calendar_calEventPrivate', typeof event.private !== 'undefined' && event.private);
this.options.class = event.class;
var status_class = this._status_class();
const status_class = this._status_class();
// Add category classes, if real categories are set
if (event.category && event.category != '0') {
var cats = event.category.split(',');
for (var i = 0; i < cats.length; i++) {
const cats = event.category.split(',');
for (let i = 0; i < cats.length; i++) {
this.div.addClass('cat_' + cats[i]);
}
}
@ -278,7 +265,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
this.div.addClass(status_class);
this.body.toggleClass('calendar_calEventBodySmall', event.whole_day_on_top || false);
// Header
var title = !event.is_private ? egw.htmlspecialchars(event['title']) : egw.lang('private');
const title = !event.is_private ? egw.htmlspecialchars(event['title']) : egw.lang('private');
this.title
.html('<span class="calendar_calTimespan">' + this._get_timespan(event) + '<br /></span>')
.append('<span class="calendar_calEventTitle">' + title + '</span>');
@ -296,7 +283,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
else {
// @ts-ignore
var start_time = jQuery.datepicker.formatTime(egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", {
const start_time = jQuery.datepicker.formatTime(egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", {
hour: event.start_m / 60,
minute: event.start_m % 60,
seconds: 0,
@ -317,7 +304,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
if (jQuery(this.getParent().getDOMNode(this)).is(':visible')) {
this._small_size();
}
};
}
/**
* Calculate display variants for when event is too short for full display
*
@ -327,28 +314,28 @@ var et2_calendar_event = /** @class */ (function (_super) {
* 2 - Show timespan and title, with ellipsis
* > 4 - Show description as well, truncated to fit
*/
et2_calendar_event.prototype._small_size = function () {
_small_size() {
if (this.options.value.whole_day_on_top)
return;
// Skip for planner view, it's always small
if (this.getParent() && this.getParent().instanceOf(et2_widget_planner_row_1.et2_calendar_planner_row))
if (this.getParent() && this.getParent().instanceOf(et2_calendar_planner_row))
return;
// Pre-calculation reset
this.div.removeClass('calendar_calEventSmall');
this.body.css('height', 'auto');
var line_height = parseFloat(this.div.css('line-height'));
var visible_lines = Math.floor(this.div.innerHeight() / line_height);
const line_height = parseFloat(this.div.css('line-height'));
let visible_lines = Math.floor(this.div.innerHeight() / line_height);
if (!this.title.height()) {
// Handle sizing while hidden, such as when calendar is not the active tab
visible_lines = Math.floor(egw.getHiddenDimensions(this.div).h / egw.getHiddenDimensions(this.title).h);
}
visible_lines = Math.max(1, visible_lines);
if (this.getParent() && this.getParent().instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
if (this.getParent() && this.getParent().instanceOf(et2_calendar_daycol)) {
this.div.toggleClass('calendar_calEventSmall', visible_lines < 4);
this.div
.attr('data-visible_lines', visible_lines);
}
else if (this.getParent() && this.getParent().instanceOf(et2_widget_planner_row_1.et2_calendar_planner_row)) {
else if (this.getParent() && this.getParent().instanceOf(et2_calendar_planner_row)) {
// Less than 8 hours is small
this.div.toggleClass('calendar_calEventSmall', this.options.value.end.valueOf() - this.options.value.start.valueOf() < 28800000);
}
@ -358,18 +345,18 @@ var et2_calendar_event = /** @class */ (function (_super) {
else {
this.body.css('height', '');
}
};
}
/**
* Examines the participants & returns CSS classname for status
*
* @returns {String}
*/
et2_calendar_event.prototype._status_class = function () {
var status_class = 'calendar_calEventAllAccepted';
for (var id in this.options.value.participants) {
var status_1 = this.options.value.participants[id];
status_1 = et2_calendar_event.split_status(status_1);
switch (status_1) {
_status_class() {
let status_class = 'calendar_calEventAllAccepted';
for (let id in this.options.value.participants) {
let status = this.options.value.participants[id];
status = et2_calendar_event.split_status(status);
switch (status) {
case 'A':
case '': // app without status
break;
@ -382,31 +369,31 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
}
return status_class;
};
}
/**
* Create tooltip shown on hover
*
* @return {String}
*/
et2_calendar_event.prototype._tooltip = function () {
_tooltip() {
if (!this.div || !this.options.value || !this.options.value.app_id)
return '';
var border = this.div.css('borderTopColor');
var bg_color = this.div.css('background-color');
var header_color = this.title.css('color');
var timespan = this._get_timespan(this.options.value);
var parent = this.getParent() instanceof et2_widget_daycol_1.et2_calendar_daycol ? this.getParent() : this.getParent();
const border = this.div.css('borderTopColor');
const bg_color = this.div.css('background-color');
const header_color = this.title.css('color');
const timespan = this._get_timespan(this.options.value);
const parent = this.getParent() instanceof et2_calendar_daycol ? this.getParent() : this.getParent();
parent.date_helper.set_value(this.options.value.start.valueOf ? new Date(this.options.value.start) : this.options.value.start);
var start = parent.date_helper.input_date.val();
const start = parent.date_helper.input_date.val();
parent.date_helper.set_value(this.options.value.end.valueOf ? new Date(this.options.value.end) : this.options.value.end);
var end = parent.date_helper.input_date.val();
var times = !this.options.value.multiday ?
const end = parent.date_helper.input_date.val();
const times = !this.options.value.multiday ?
'<span class="calendar_calEventLabel">' + this.egw().lang('Time') + '</span>:' + timespan :
'<span class="calendar_calEventLabel">' + this.egw().lang('Start') + '</span>:' + start + ' ' +
'<span class="calendar_calEventLabel">' + this.egw().lang('End') + '</span>:' + end;
var cat_label = '';
let cat_label = '';
if (this.options.value.category) {
var cat = et2_createWidget('select-cat', { 'readonly': true }, this);
const cat = et2_createWidget('select-cat', { 'readonly': true }, this);
cat.set_value(this.options.value.category);
cat_label = this.options.value.category.indexOf(',') <= 0 ? cat.span.text() : [];
if (typeof cat_label != 'string') {
@ -418,7 +405,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
cat.destroy();
}
// Location + Videoconference
var location = '';
let location = '';
if (this.options.value.location || this.options.value['##videoconference']) {
location += '<p><span class="calendar_calEventLabel">' + this.egw().lang('Location') + '</span>:' +
egw.htmlspecialchars(this.options.value.location);
@ -435,11 +422,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
location += '</p>';
}
// Participants
var participants = '';
let participants = '';
if (this.options.value.participant_types['']) {
participants += this.options.value.participant_types[''].join("<br />");
}
for (var type_name in this.options.value.participant_types) {
for (let type_name in this.options.value.participant_types) {
if (type_name) {
participants += '</p><p><span class="calendar_calEventLabel">' + type_name + ':</span><br />';
participants += this.options.value.participant_types[type_name].join("<br />");
@ -461,36 +448,36 @@ var et2_calendar_event = /** @class */ (function (_super) {
participants + '</p>' + this._participant_summary(this.options.value.participants) +
'</div>' +
'</div>';
};
}
/**
* Generate participant summary line
*
* @returns {String}
*/
et2_calendar_event.prototype._participant_summary = function (participants) {
_participant_summary(participants) {
if (Object.keys(this.options.value.participants).length < 2) {
return '';
}
var participant_status = { A: 0, R: 0, T: 0, U: 0, D: 0 };
var status_label = { A: 'accepted', R: 'rejected', T: 'tentative', U: 'unknown', D: 'delegated' };
var participant_summary = Object.keys(this.options.value.participants).length + ' ' + this.egw().lang('Participants') + ': ';
var status_totals = [];
for (var id in this.options.value.participants) {
const participant_status = { A: 0, R: 0, T: 0, U: 0, D: 0 };
const status_label = { A: 'accepted', R: 'rejected', T: 'tentative', U: 'unknown', D: 'delegated' };
const participant_summary = Object.keys(this.options.value.participants).length + ' ' + this.egw().lang('Participants') + ': ';
const status_totals = [];
for (let id in this.options.value.participants) {
var status = this.options.value.participants[id].substr(0, 1);
participant_status[status]++;
}
for (var status_2 in participant_status) {
if (participant_status[status_2] > 0) {
status_totals.push(participant_status[status_2] + ' ' + this.egw().lang(status_label[status_2]));
for (let status in participant_status) {
if (participant_status[status] > 0) {
status_totals.push(participant_status[status] + ' ' + this.egw().lang(status_label[status]));
}
}
return participant_summary + status_totals.join(', ');
};
}
/**
* Get actual icons from list
*/
et2_calendar_event.prototype._icons = function () {
var icons = [];
_icons() {
const icons = [];
if (this.options.value.is_private) {
// Hide everything
icons.push('<img src="' + this.egw().image('private', 'calendar') + '" title="' + this.egw().lang('private event') + '"/>');
@ -500,7 +487,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
jQuery.extend(icons, this.options.value.icons);
}
else if (this.options.value.app !== 'calendar') {
var app_icon = "" + (egw.link_get_registry(this.options.value.app, 'icon') || (this.options.value.app + '/navbar'));
let app_icon = "" + (egw.link_get_registry(this.options.value.app, 'icon') || (this.options.value.app + '/navbar'));
icons.push('<img src="' + this.egw().image(app_icon) + '" title="' + this.egw().lang(this.options.value.app) + '"/>');
}
if (this.options.value.priority == 3) {
@ -514,9 +501,9 @@ var et2_calendar_event = /** @class */ (function (_super) {
icons.push('<img src="' + this.egw().image('recur', 'calendar') + '" title="' + this.egw().lang('recurring event') + '"/>');
}
// icons for single user, multiple users or group(s) and resources
var single = '<img src="' + this.egw().image('single', 'calendar') + '" title="' + this.egw().lang("single participant") + '"/>';
var multiple = '<img src="' + this.egw().image('users', 'calendar') + '" title="' + this.egw().lang("multiple participants") + '"/>';
for (var uid in this.options.value['participants']) {
const single = '<img src="' + this.egw().image('single', 'calendar') + '" title="' + this.egw().lang("single participant") + '"/>';
const multiple = '<img src="' + this.egw().image('users', 'calendar') + '" title="' + this.egw().lang("multiple participants") + '"/>';
for (const uid in this.options.value['participants']) {
// @ts-ignore
if (Object.keys(this.options.value.participants).length == 1 && !isNaN(uid)) {
icons.push(single);
@ -552,20 +539,20 @@ var et2_calendar_event = /** @class */ (function (_super) {
icons.push('<img src="' + this.egw().image('nonblocking', 'calendar') + '" title="' + this.egw().lang('non blocking') + '"/>');
}
return icons;
};
}
/**
* Bind the click handler for opening the video conference
*
* Tooltips are placed in the DOM directly in the body, managed by egw.
*/
et2_calendar_event.prototype._bind_videoconference = function () {
var vc_event = 'click.calendar_videoconference';
_bind_videoconference() {
let vc_event = 'click.calendar_videoconference';
jQuery('body').off(vc_event)
.on(vc_event, '[data-videoconference]', function (event) {
var data = egw.dataGetUIDdata("calendar::" + this.dataset.id);
let data = egw.dataGetUIDdata("calendar::" + this.dataset.id);
app.calendar.joinVideoConference(this.dataset.videoconference, data.data || this.dataset);
});
};
}
/**
* Get a text representation of the timespan of the event. Either start
* - end, or 'all day'
@ -576,8 +563,8 @@ var et2_calendar_event = /** @class */ (function (_super) {
*
* @return {string} Timespan
*/
et2_calendar_event.prototype._get_timespan = function (event) {
var timespan = '';
_get_timespan(event) {
let timespan = '';
if (event['start_m'] === 0 && event['end_m'] >= 24 * 60 - 1) {
if (event['end_m'] > 24 * 60) {
// @ts-ignore
@ -600,7 +587,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
}
else {
var duration = event.multiday ?
let duration = event.multiday ?
(event.end - event.start) / 60000 :
(event.end_m - event.start_m);
duration = Math.floor(duration / 60) + this.egw().lang('h') + (duration % 60 ? duration % 60 : '');
@ -621,18 +608,18 @@ var et2_calendar_event = /** @class */ (function (_super) {
timespan += ': ' + duration;
}
return timespan;
};
}
/**
* Make sure event data has all proper values, and format them as expected
* @param {Object} event
*/
et2_calendar_event.prototype._values_check = function (event) {
_values_check(event) {
// Make sure ID is a string
if (event.id) {
event.id = '' + event.id;
}
// Parent might be a daycol or a planner_row
var parent = this.getParent();
let parent = this.getParent();
// Use dates as objects
if (typeof event.start !== 'object') {
parent.date_helper.set_value(event.start);
@ -655,7 +642,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
if (!event.start.getUTCHours() && !event.start.getUTCMinutes() && event.end.getUTCHours() == 23 && event.end.getUTCMinutes() == 59) {
event.whole_day_on_top = (event.non_blocking && event.non_blocking != '0');
}
};
}
/**
* Check to see if the provided event information is for the same date as
* what we're currently expecting, and that it has not been changed.
@ -673,22 +660,22 @@ var et2_calendar_event = /** @class */ (function (_super) {
*
* @return {Boolean} Provided event data is for the same date
*/
et2_calendar_event.prototype._sameday_check = function (event) {
_sameday_check(event) {
// Event somehow got orphaned, or deleted
if (!this.getParent() || event === null) {
return false;
}
// Also check participants against owner
var owner_match = et2_calendar_event.owner_check(event, this.getParent());
const owner_match = et2_calendar_event.owner_check(event, this.getParent());
// Simple, same day
if (owner_match && this.options.value.date && event.date == this.options.value.date) {
return true;
}
// Multi-day non-recurring event spans days - date does not match
var event_start = new Date(event.start);
var event_end = new Date(event.end);
var parent = this.getParent();
if (owner_match && (parent instanceof et2_widget_daycol_1.et2_calendar_daycol) && parent.getDate() >= event_start && parent.getDate() <= event_end) {
const event_start = new Date(event.start);
const event_end = new Date(event.end);
const parent = this.getParent();
if (owner_match && (parent instanceof et2_calendar_daycol) && parent.getDate() >= event_start && parent.getDate() <= event_end) {
return true;
}
// Delete all old actions
@ -698,15 +685,15 @@ var et2_calendar_event = /** @class */ (function (_super) {
this._actionObject = null;
}
// Update daywise caches
var new_cache_id = CalendarApp._daywise_cache_id(event.date, this.getParent().options.owner);
var new_daywise = egw.dataGetUIDdata(new_cache_id);
const new_cache_id = CalendarApp._daywise_cache_id(event.date, this.getParent().options.owner);
let new_daywise = egw.dataGetUIDdata(new_cache_id);
new_daywise = new_daywise && new_daywise.data ? new_daywise.data : [];
var old_cache_id = '';
let old_cache_id = '';
if (this.options.value && this.options.value.date) {
old_cache_id = CalendarApp._daywise_cache_id(this.options.value.date, parent.options.owner);
}
if (new_cache_id != old_cache_id) {
var old_daywise = egw.dataGetUIDdata(old_cache_id);
let old_daywise = egw.dataGetUIDdata(old_cache_id);
old_daywise = old_daywise && old_daywise.data ? old_daywise.data : [];
old_daywise.splice(old_daywise.indexOf(this.options.value.row_id), 1);
egw.dataStoreUID(old_cache_id, old_daywise);
@ -718,7 +705,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
}
return false;
};
}
/**
* Check that the event passes the given status filter.
* Status filter is set in the sidebox and used when fetching several events, but if user changes their status
@ -729,14 +716,14 @@ var et2_calendar_event = /** @class */ (function (_super) {
* @param owner The owner of the target / parent, not the event owner
* @private
*/
et2_calendar_event.prototype._status_check = function (event, filter, owner) {
_status_check(event, filter, owner) {
if (!owner || !event) {
return false;
}
// If we're doing a bunch, just one passing is enough
if (typeof owner !== "string") {
var pass = false;
for (var j = 0; j < owner.length && pass == false; j++) {
let pass = false;
for (let j = 0; j < owner.length && pass == false; j++) {
pass = pass || this._status_check(event, filter, owner[j]);
}
return pass;
@ -747,23 +734,23 @@ var et2_calendar_event = /** @class */ (function (_super) {
return true;
}
// Get the relevant participant
var participant = event.participants[owner];
let participant = event.participants[owner];
// If filter says don't look in groups, skip it all
if (!participant && filter === 'no-enum-groups') {
return false;
}
// Couldn't find the current owner in the participant list, check groups & resources
if (!participant) {
var options = null;
let options = null;
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
}
if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") {
var resource = options.find(function (element) {
let resource = options.find(function (element) {
return element.id == owner;
}) || {};
var matching_participant = typeof resource.resources == "undefined" ?
resource : resource === null || resource === void 0 ? void 0 : resource.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; });
let matching_participant = typeof resource.resources == "undefined" ?
resource : resource === null || resource === void 0 ? void 0 : resource.resources.filter(id => typeof event.participants[id] != "undefined");
if (matching_participant.length > 0) {
return this._status_check(event, filter, matching_participant);
}
@ -773,7 +760,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
}
}
var status = et2_calendar_event.split_status(participant);
let status = et2_calendar_event.split_status(participant);
switch (filter) {
default:
case 'all':
@ -804,16 +791,16 @@ var et2_calendar_event = /** @class */ (function (_super) {
case 'deleted': // Show events that have been deleted
return event.deleted;
}
};
et2_calendar_event.prototype.attachToDOM = function () {
var result = _super.prototype.attachToDOM.call(this);
}
attachToDOM() {
let result = super.attachToDOM();
// Remove the binding for the click handler, unless there's something
// custom here.
if (!this.onclick) {
jQuery(this.node).off("click");
}
return result;
};
}
/**
* Click handler calling custom handler set via onclick attribute to this.onclick.
* All other handling is done by the timegrid widget.
@ -821,17 +808,17 @@ var et2_calendar_event = /** @class */ (function (_super) {
* @param {Event} _ev
* @returns {boolean}
*/
et2_calendar_event.prototype.click = function (_ev) {
var result = true;
click(_ev) {
let result = true;
if (typeof this.onclick == 'function') {
// Make sure function gets a reference to the widget, splice it in as 2. argument if not
var args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(arguments);
if (args.indexOf(this) == -1)
args.splice(1, 0, this);
result = this.onclick.apply(this, args);
}
return result;
};
}
/**
* Show the recur prompt for this event
*
@ -840,9 +827,9 @@ var et2_calendar_event = /** @class */ (function (_super) {
* @param {et2_calendar_event~prompt_callback} callback
* @param {Object} [extra_data]
*/
et2_calendar_event.prototype.recur_prompt = function (callback, extra_data) {
recur_prompt(callback, extra_data) {
et2_calendar_event.recur_prompt(this.options.value, callback, extra_data);
};
}
/**
* Show the series split prompt for this event
*
@ -850,18 +837,18 @@ var et2_calendar_event = /** @class */ (function (_super) {
*
* @param {et2_calendar_event~prompt_callback} callback
*/
et2_calendar_event.prototype.series_split_prompt = function (callback) {
series_split_prompt(callback) {
et2_calendar_event.series_split_prompt(this.options.value, this.options.value.recur_date, callback);
};
}
/**
* Copy the actions set on the parent, apply them to self
*
* This can take a while to do, so we try to do it only when needed - on mouseover
*/
et2_calendar_event.prototype._copy_parent_actions = function () {
_copy_parent_actions() {
// Copy actions set in parent
if (!this.options.readonly && !this.getParent().options.readonly) {
var action_parent = this;
let action_parent = this;
while (action_parent != null && !action_parent.options.actions &&
!(action_parent instanceof et2_container)) {
action_parent = action_parent.getParent();
@ -874,13 +861,13 @@ var et2_calendar_event = /** @class */ (function (_super) {
// something went wrong, but keep quiet about it
}
}
};
}
/**
* Link the actions to the DOM nodes / widget bits.
*
* @param {object} actions {ID: {attributes..}+} map of egw action information
*/
et2_calendar_event.prototype._link_actions = function (actions) {
_link_actions(actions) {
if (!this._actionObject) {
// Get the top level element - timegrid or so
var objectManager = this.getParent()._actionObject || this.getParent().getParent()._actionObject ||
@ -900,26 +887,26 @@ var et2_calendar_event = /** @class */ (function (_super) {
this._actionObject.unregisterActions();
// Go over the widget & add links - this is where we decide which actions are
// 'allowed' for this widget at this time
var action_links = this._get_action_links(actions);
const action_links = this._get_action_links(actions);
action_links.push('egw_link_drag');
action_links.push('egw_link_drop');
if (this._actionObject.parent.getActionLink('invite')) {
action_links.push('invite');
}
this._actionObject.updateActionLinks(action_links);
};
}
/**
* Code for implementing et2_IDetachedDOM
*
* @param {array} _attrs array to add further attributes to
*/
et2_calendar_event.prototype.getDetachedAttributes = function (_attrs) {
};
et2_calendar_event.prototype.getDetachedNodes = function () {
getDetachedAttributes(_attrs) {
}
getDetachedNodes() {
return [this.getDOMNode()];
};
et2_calendar_event.prototype.setDetachedAttributes = function (_nodes, _values) {
};
}
setDetachedAttributes(_nodes, _values) {
}
// Static class stuff
/**
* Check event owner against a parent object
@ -938,14 +925,14 @@ var et2_calendar_event = /** @class */ (function (_super) {
*
* @return {boolean} Should the event be displayed
*/
et2_calendar_event.owner_check = function (event, parent, owner_too) {
static owner_check(event, parent, owner_too) {
var _a, _b;
var owner_match = true;
var state = ((_a = parent.getInstanceManager()) === null || _a === void 0 ? void 0 : _a.app_obj.calendar.state) || ((_b = app.calendar) === null || _b === void 0 ? void 0 : _b.state) || {};
let owner_match = true;
let state = ((_a = parent.getInstanceManager()) === null || _a === void 0 ? void 0 : _a.app_obj.calendar.state) || ((_b = app.calendar) === null || _b === void 0 ? void 0 : _b.state) || {};
if (typeof owner_too === 'undefined' && state.status_filter) {
owner_too = state.status_filter === 'owner';
}
var options = null;
let options = null;
if (app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) {
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
}
@ -957,8 +944,8 @@ var et2_calendar_event = /** @class */ (function (_super) {
[parent.options.owner] :
parent.options.owner);
owner_match = false;
var length_1 = parent_owner.length;
for (var i = 0; i < length_1; i++) {
const length = parent_owner.length;
for (var i = 0; i < length; i++) {
// Handle groups & grouped resources like mailing lists, they won't match so
// we need the list - pull it from sidebox owner
if ((isNaN(parent_owner[i]) || parent_owner[i] < 0) && options && typeof options.find == "function") {
@ -970,33 +957,29 @@ var et2_calendar_event = /** @class */ (function (_super) {
}
}
}
var participants_1 = jQuery.extend([], Object.keys(event.participants));
var _loop_1 = function () {
var id = participants_1[i];
let participants = jQuery.extend([], Object.keys(event.participants));
for (var i = 0; i < participants.length; i++) {
const id = participants[i];
// Expand group invitations
if (parseInt(id) < 0) {
// Add in groups, if we can get them from options, great
var resource;
if (options && options.find && (resource = options.find(function (element) { return element.id === id; })) && resource.resources) {
participants_1 = participants_1.concat(resource.resources);
participants = participants.concat(resource.resources);
}
else {
// Add in groups, if we can get them (this is asynchronous)
egw.accountData(id, 'account_id', true, function (members) {
participants_1 = participants_1.concat(Object.keys(members));
}, this_1);
participants = participants.concat(Object.keys(members));
}, this);
}
}
if (parent.options.owner == id ||
parent_owner.indexOf &&
parent_owner.indexOf(id) >= 0) {
owner_match = true;
return "break";
}
};
var this_1 = this, resource;
for (var i = 0; i < participants_1.length; i++) {
var state_1 = _loop_1();
if (state_1 === "break")
break;
}
}
}
if (owner_too && !owner_match) {
@ -1005,7 +988,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
parent_owner.indexOf(event.owner) >= 0);
}
return owner_match;
};
}
/**
* @callback et2_calendar_event~prompt_callback
* @param {string} button_id - One of ok, exception, series, single or cancel
@ -1036,10 +1019,10 @@ var et2_calendar_event = /** @class */ (function (_super) {
*
* @augments {et2_calendar_event}
*/
et2_calendar_event.recur_prompt = function (event_data, callback, extra_data) {
var egw;
var edit_id = event_data.app_id;
var edit_date = event_data.start;
static recur_prompt(event_data, callback, extra_data) {
let egw;
const edit_id = event_data.app_id;
const edit_date = event_data.start;
// seems window.opener somehow in certain conditions could be from different origin
// we try to catch the exception and in this case retrieve the egw object from current window.
try {
@ -1048,8 +1031,8 @@ var et2_calendar_event = /** @class */ (function (_super) {
catch (e) {
egw = window.egw('calendar');
}
var that = this;
var extra_params = extra_data && typeof extra_data == 'object' ? extra_data : {};
const that = this;
const extra_params = extra_data && typeof extra_data == 'object' ? extra_data : {};
extra_params.date = edit_date.toJSON ? edit_date.toJSON() : edit_date;
if (typeof callback != 'function') {
callback = function (_button_id) {
@ -1069,7 +1052,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
};
}
if (parseInt(event_data.recur_type)) {
var buttons = [
const buttons = [
{ text: egw.lang("Edit exception"), id: "exception", class: "ui-priority-primary", "default": true },
{ text: egw.lang("Edit series"), id: "series" },
{ text: egw.lang("Cancel"), id: "cancel" }
@ -1080,7 +1063,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
else {
callback.call(this, 'single', event_data);
}
};
}
/**
* Split series prompt
*
@ -1098,8 +1081,8 @@ var et2_calendar_event = /** @class */ (function (_super) {
* called with the button (ok or cancel) and the event data.
* @augments {et2_calendar_event}
*/
et2_calendar_event.series_split_prompt = function (event_data, instance_date, callback) {
var egw;
static series_split_prompt(event_data, instance_date, callback) {
let egw;
// seems window.opener somehow in certian conditions could be from different origin
// we try to catch the exception and in this case retrieve the egw object from current window.
try {
@ -1108,22 +1091,22 @@ var et2_calendar_event = /** @class */ (function (_super) {
catch (e) {
egw = window.egw('calendar');
}
var that = this;
const that = this;
if (typeof instance_date == 'string') {
instance_date = new Date(instance_date);
}
// Check for modifying a series that started before today
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), -tempDate.getTimezoneOffset(), tempDate.getSeconds());
var termination_date = instance_date < today ? egw.lang('today') : date(egw.preference('dateformat'), instance_date);
const tempDate = new Date();
const today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), -tempDate.getTimezoneOffset(), tempDate.getSeconds());
const termination_date = instance_date < today ? egw.lang('today') : date(egw.preference('dateformat'), instance_date);
if (parseInt(event_data.recur_type)) {
et2_dialog.show_dialog(function (button_id) { callback.call(that, button_id, event_data); }, (!event_data.is_private ? event_data['title'] : egw.lang('private')) + "\n" +
egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created.", termination_date), egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL, et2_dialog.WARNING_MESSAGE);
}
};
et2_calendar_event.drag_helper = function (event, ui) {
}
static drag_helper(event, ui) {
ui.helper.width(ui.width());
};
}
/**
* splits the combined status, quantity and role
*
@ -1132,11 +1115,11 @@ var et2_calendar_event = /** @class */ (function (_super) {
* @param {string} [role]
* @return string status U, T, A or R, same as $status parameter on return
*/
et2_calendar_event.split_status = function (status, quantity, role) {
static split_status(status, quantity, role) {
quantity = 1;
role = 'REQ-PARTICIPANT';
//error_log(__METHOD__.__LINE__.array2string($status));
var matches = null;
let matches = null;
if (typeof status === 'string' && status.length > 1) {
matches = status.match(/^.([0-9]*)(.*)$/gi);
}
@ -1151,7 +1134,7 @@ var et2_calendar_event = /** @class */ (function (_super) {
status = 'U';
}
return status;
};
}
/**
* The egw_action system requires an egwActionObjectInterface Interface implementation
* to tie actions to DOM nodes. I'm not sure if we need this.
@ -1162,28 +1145,26 @@ var et2_calendar_event = /** @class */ (function (_super) {
* @param {Object} node
*
*/
et2_calendar_event.et2_event_action_object_impl = function (widget, node) {
var aoi = new et2_core_DOMWidget_1.et2_action_object_impl(widget, node).getAOI();
static et2_event_action_object_impl(widget, node) {
const aoi = new et2_action_object_impl(widget, node).getAOI();
// _outerCall may be used to determine, whether the state change has been
// evoked from the outside and the stateChangeCallback has to be called
// or not.
aoi.doSetState = function (_state, _outerCall) {
};
return aoi;
};
et2_calendar_event._attributes = {
"value": {
type: "any",
default: et2_no_init
},
"onclick": {
"description": "JS code which is executed when the element is clicked. " +
"If no handler is provided, or the handler returns true and the event is not read-only, the " +
"event will be opened according to calendar settings."
}
};
return et2_calendar_event;
}(et2_core_valueWidget_1.et2_valueWidget));
exports.et2_calendar_event = et2_calendar_event;
et2_core_widget_1.et2_register_widget(et2_calendar_event, ["calendar-event"]);
}
}
et2_calendar_event._attributes = {
"value": {
type: "any",
default: et2_no_init
},
"onclick": {
"description": "JS code which is executed when the element is clicked. " +
"If no handler is provided, or the handler returns true and the event is not read-only, the " +
"event will be opened according to calendar settings."
}
};
et2_register_widget(et2_calendar_event, ["calendar-event"]);
//# sourceMappingURL=et2_widget_event.js.map

View File

@ -13,12 +13,19 @@
/etemplate/js/et2_core_valueWidget;
*/
import {et2_register_widget, et2_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_createWidget, et2_register_widget, et2_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_valueWidget} from "../../api/js/etemplate/et2_core_valueWidget";
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
import {et2_action_object_impl, et2_DOMWidget} from "../../api/js/etemplate/et2_core_DOMWidget";
import {et2_calendar_daycol} from "./et2_widget_daycol";
import {et2_calendar_planner_row} from "./et2_widget_planner_row";
import {et2_IDetachedDOM} from "../../api/js/etemplate/et2_core_interfaces";
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
import {egw_getAppObjectManager, egwActionObject} from '../../api/js/egw_action/egw_action.js';
import {egw} from "../../api/js/jsapi/egw_global";
import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
import {et2_container} from "../../api/js/etemplate/et2_core_baseWidget";
import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog";
/**
* Class for a single event, displayed in either the timegrid or planner view

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,10 @@ import {et2_calendar_view} from "./et2_widget_view";
import {et2_action_object_impl} from "../../api/js/etemplate/et2_core_DOMWidget";
import {et2_calendar_event} from "./et2_widget_event";
import {et2_calendar_planner_row} from "./et2_widget_planner_row";
import {egw} from "../../api/js/jsapi/egw_global";
import {EGW_AI_DRAG_OVER, EGW_AO_FLAG_IS_CONTAINER, egw_getObjectManager, egwActionObject} from "../../api/js/egw_action/egw_action.js";
import {et2_IDetachedDOM, et2_IPrint, et2_IResizeable} from "../../api/js/etemplate/et2_core_interfaces";
import {et2_compileLegacyJS} from "../../api/js/etemplate/et2_core_legacyJSFunctions";
/**
* Class which implements the "calendar-planner" XET-Tag for displaying a longer

View File

@ -1,4 +1,3 @@
"use strict";
/*
* Egroupware
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -8,129 +7,113 @@
* @author Nathan Gray
* @version $Id$
*/
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.et2_calendar_planner_row = void 0;
/*egw:uses
/calendar/js/et2_widget_view.js;
/calendar/js/et2_widget_daycol.js;
/calendar/js/et2_widget_event.js;
*/
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
var et2_core_valueWidget_1 = require("../../api/js/etemplate/et2_core_valueWidget");
var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritance");
var et2_core_DOMWidget_1 = require("../../api/js/etemplate/et2_core_DOMWidget");
import { et2_createWidget, et2_register_widget } from "../../api/js/etemplate/et2_core_widget";
import { et2_valueWidget } from "../../api/js/etemplate/et2_core_valueWidget";
import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance";
import { et2_action_object_impl } from "../../api/js/etemplate/et2_core_DOMWidget";
import { EGW_AI_DRAG_OUT, EGW_AI_DRAG_OVER, egw_getObjectManager, egwActionObject } from "../../api/js/egw_action/egw_action.js";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* Class for one row of a planner
*
* This widget is responsible for the label on the side
*
*/
var et2_calendar_planner_row = /** @class */ (function (_super) {
__extends(et2_calendar_planner_row, _super);
export class et2_calendar_planner_row extends et2_valueWidget {
/**
* Constructor
*/
function et2_calendar_planner_row(_parent, _attrs, _child) {
var _this =
constructor(_parent, _attrs, _child) {
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_calendar_planner_row._attributes, _child || {})) || this;
_this._row_height = 20;
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_calendar_planner_row._attributes, _child || {}));
this._row_height = 20;
// Main container
_this.div = jQuery(document.createElement("div"))
this.div = jQuery(document.createElement("div"))
.addClass("calendar_plannerRowWidget")
.css('width', _this.options.width);
_this.title = jQuery(document.createElement('div'))
.css('width', this.options.width);
this.title = jQuery(document.createElement('div'))
.addClass("calendar_plannerRowHeader")
.appendTo(_this.div);
_this.rows = jQuery(document.createElement('div'))
.appendTo(this.div);
this.rows = jQuery(document.createElement('div'))
.addClass("calendar_eventRows")
.appendTo(_this.div);
_this.setDOMNode(_this.div[0]);
.appendTo(this.div);
this.setDOMNode(this.div[0]);
// Used for its date calculations
_this._date_helper = et2_createWidget('date-time', {}, null);
_this._date_helper.loadingFinished();
_this.set_start_date(_this.options.start_date);
_this.set_end_date(_this.options.end_date);
_this._cached_rows = [];
return _this;
this._date_helper = et2_createWidget('date-time', {}, null);
this._date_helper.loadingFinished();
this.set_start_date(this.options.start_date);
this.set_end_date(this.options.end_date);
this._cached_rows = [];
}
et2_calendar_planner_row.prototype.doLoadingFinished = function () {
_super.prototype.doLoadingFinished.call(this);
doLoadingFinished() {
super.doLoadingFinished();
this.set_label(this.options.label);
this._draw();
// Actions are set on the parent, so we need to explicitly get in here
// and get ours
this._link_actions(this.getParent().options.actions || []);
return true;
};
et2_calendar_planner_row.prototype.destroy = function () {
_super.prototype.destroy.call(this);
}
destroy() {
super.destroy();
// date_helper has no parent, so we must explicitly remove it
this._date_helper.destroy();
this._date_helper = null;
};
et2_calendar_planner_row.prototype.getDOMNode = function (_sender) {
}
getDOMNode(_sender) {
if (_sender === this || !_sender) {
return this.div[0];
}
if (_sender._parent === this) {
return this.rows[0];
}
};
}
/**
* Link the actions to the DOM nodes / widget bits.
*
* @param {object} actions {ID: {attributes..}+} map of egw action information
*/
et2_calendar_planner_row.prototype._link_actions = function (actions) {
_link_actions(actions) {
// Get the parent? Might be a grid row, might not. Either way, it is
// just a container with no valid actions
var objectManager = egw_getObjectManager(this.getInstanceManager().app, true, 1);
let objectManager = egw_getObjectManager(this.getInstanceManager().app, true, 1);
objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId, 2) || objectManager;
var parent = objectManager.getObjectById(this.id, 1) || objectManager.getObjectById(this.getParent().id, 1) || objectManager;
let parent = objectManager.getObjectById(this.id, 1) || objectManager.getObjectById(this.getParent().id, 1) || objectManager;
if (!parent) {
egw.debug('error', 'No parent objectManager found');
return;
}
// This binds into the egw action system. Most user interactions (drag to move, resize)
// are handled internally using jQuery directly.
var widget_object = this._actionObject || parent.getObjectById(this.id);
var aoi = new et2_core_DOMWidget_1.et2_action_object_impl(this, this.getDOMNode(this)).getAOI();
var planner = this.getParent();
for (var i = 0; i < parent.children.length; i++) {
var parent_finder = jQuery(parent.children[i].iface.doGetDOMNode()).find(this.div);
let widget_object = this._actionObject || parent.getObjectById(this.id);
const aoi = new et2_action_object_impl(this, this.getDOMNode(this)).getAOI();
const planner = this.getParent();
for (let i = 0; i < parent.children.length; i++) {
const parent_finder = jQuery(parent.children[i].iface.doGetDOMNode()).find(this.div);
if (parent_finder.length > 0) {
parent = parent.children[i];
break;
}
}
// Determine if we allow a dropped event to use the invite/change actions
var _invite_enabled = function (action, event, target) {
const _invite_enabled = function (action, event, target) {
var event = event.iface.getWidget();
var row = target.iface.getWidget() || false;
const row = target.iface.getWidget() || false;
if (event === row || !event || !row ||
!event.options || !event.options.value.participants) {
return false;
}
var owner_match = false;
var own_row = event.getParent() === row;
for (var id in event.options.value.participants) {
let owner_match = false;
const own_row = event.getParent() === row;
for (let id in event.options.value.participants) {
owner_match = owner_match || row.node.dataset.participants === '' + id;
}
var enabled = !owner_match &&
const enabled = !owner_match &&
// Not inside its own timegrid
!own_row;
widget_object.getActionLink('invite').enabled = enabled;
@ -152,7 +135,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
if (event.type === 'drop' && widget_object.getActionLink('egw_link_drop').enabled) {
this.getWidget().getParent()._event_drop.call(jQuery('.calendar_d-n-d_timeCounter', _data.ui.helper)[0], this.getWidget().getParent(), event, _data.ui, this.getWidget());
}
var drag_listener = function (_event, ui) {
const drag_listener = function (_event, ui) {
if (planner.options.group_by === 'month') {
var position = { left: _event.clientX, top: _event.clientY };
}
@ -160,7 +143,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
var position = { top: ui.position.top, left: ui.position.left - jQuery(this).parent().offset().left };
}
aoi.getWidget().getParent()._drag_helper(jQuery('.calendar_d-n-d_timeCounter', ui.helper)[0], position, 0);
var event = _data.ui.draggable.data('selected')[0];
let event = _data.ui.draggable.data('selected')[0];
if (!event || event.id && event.id.indexOf('calendar') !== 0) {
event = false;
}
@ -168,7 +151,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
_invite_enabled(widget_object.getActionLink('invite').actionObj, event, widget_object);
}
};
var time = jQuery('.calendar_d-n-d_timeCounter', _data.ui.helper);
const time = jQuery('.calendar_d-n-d_timeCounter', _data.ui.helper);
switch (_event) {
// Triggered once, when something is dragged into the timegrid's div
case EGW_AI_DRAG_OVER:
@ -223,10 +206,10 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
widget_object.unregisterActions();
// Go over the widget & add links - this is where we decide which actions are
// 'allowed' for this widget at this time
var action_links = this._get_action_links(actions);
const action_links = this._get_action_links(actions);
this.getParent()._init_links_dnd(widget_object.manager, action_links);
widget_object.updateActionLinks(action_links);
};
}
/**
* Get all action-links / id's of 1.-level actions from a given action object
*
@ -235,30 +218,30 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
* @param actions
* @returns {Array}
*/
et2_calendar_planner_row.prototype._get_action_links = function (actions) {
var action_links = [];
_get_action_links(actions) {
const action_links = [];
// Only these actions are allowed without a selection (empty actions)
var empty_actions = ['add'];
for (var i in actions) {
var action = actions[i];
const empty_actions = ['add'];
for (let i in actions) {
const action = actions[i];
if (empty_actions.indexOf(action.id) !== -1 || action.type == 'drop') {
action_links.push(typeof action.id != 'undefined' ? action.id : i);
}
}
return action_links;
};
}
/**
* Draw the individual divs for weekends and events
*/
et2_calendar_planner_row.prototype._draw = function () {
_draw() {
// Remove any existing
this.rows.remove('.calendar_eventRowsMarkedDay,.calendar_eventRowsFiller').nextAll().remove();
var days = 31;
var width = '100';
let days = 31;
let width = '100';
if (this.getParent().options.group_by === 'month') {
days = this.options.end_date.getUTCDate();
if (days < 31) {
var diff = 31 - days;
const diff = 31 - days;
width = 'calc(' + (diff * 3.23) + '% - ' + (diff * 7) + 'px)';
}
}
@ -271,8 +254,8 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
this.rows.after('<div class="calendar_eventRowsFiller"' +
' style="width:' + width + ';" ></div>');
}
};
et2_calendar_planner_row.prototype.set_label = function (label) {
}
set_label(label) {
this.options.label = label;
this.title.text(label);
if (this.getParent().options.group_by === 'month') {
@ -284,14 +267,14 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
this.title.attr('data-date', '');
this.title.removeClass('et2_clickable');
}
};
}
/**
* Change the start date
*
* @param {Date} new_date New end date
* @returns {undefined}
*/
et2_calendar_planner_row.prototype.set_start_date = function (new_date) {
set_start_date(new_date) {
if (!new_date || new_date === null) {
throw new TypeError('Invalid end date. ' + new_date.toString());
}
@ -299,14 +282,14 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
this.options.start_date.setUTCHours(0);
this.options.start_date.setUTCMinutes(0);
this.options.start_date.setUTCSeconds(0);
};
}
/**
* Change the end date
*
* @param {string|number|Date} new_date New end date
* @returns {undefined}
*/
et2_calendar_planner_row.prototype.set_end_date = function (new_date) {
set_end_date(new_date) {
if (!new_date || new_date === null) {
throw new TypeError('Invalid end date. ' + new_date.toString());
}
@ -314,21 +297,21 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
this.options.end_date.setUTCHours(23);
this.options.end_date.setUTCMinutes(59);
this.options.end_date.setUTCSeconds(59);
};
}
/**
* Mark special days (birthdays, holidays) on the planner
*
* @param {Date} start Start of the month
* @param {number} days How many days in the month
*/
et2_calendar_planner_row.prototype._yearlyPlannerMarkDays = function (start, days) {
var day_width = 3.23;
var t = new Date(start);
var content = '';
for (var i = 0; i < days; i++) {
var holidays = [];
_yearlyPlannerMarkDays(start, days) {
const day_width = 3.23;
const t = new Date(start);
let content = '';
for (let i = 0; i < days; i++) {
const holidays = [];
// TODO: implement this, pull / copy data from et2_widget_timegrid
var day_class = this.getParent().day_class_holiday(t, holidays);
const day_class = this.getParent().day_class_holiday(t, holidays);
if (day_class) // no regular weekday
{
content += '<div class="calendar_eventRowsMarkedDay ' + day_class +
@ -339,7 +322,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
t.setUTCDate(t.getUTCDate() + 1);
}
return content;
};
}
/**
* Callback used when the daywise data changes
*
@ -349,17 +332,17 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
* @param {String[]} event_ids
* @returns {undefined}
*/
et2_calendar_planner_row.prototype._data_callback = function (event_ids) {
var events = [];
_data_callback(event_ids) {
const events = [];
if (event_ids == null || typeof event_ids.length == 'undefined')
event_ids = [];
for (var i = 0; i < event_ids.length; i++) {
var event_1 = egw.dataGetUIDdata('calendar::' + event_ids[i]);
event_1 = event_1 && event_1.data || false;
if (event_1 && event_1.date) {
events.push(event_1);
for (let i = 0; i < event_ids.length; i++) {
let event = egw.dataGetUIDdata('calendar::' + event_ids[i]);
event = event && event.data || false;
if (event && event.date) {
events.push(event);
}
else if (event_1) {
else if (event) {
// Got an ID that doesn't belong
event_ids.splice(i--, 1);
}
@ -368,14 +351,10 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
this.resize();
this._update_events(events);
}
};
Object.defineProperty(et2_calendar_planner_row.prototype, "date_helper", {
get: function () {
return this._date_helper;
},
enumerable: false,
configurable: true
});
}
get date_helper() {
return this._date_helper;
}
/**
* Load the event data for this day and create event widgets for each.
*
@ -383,10 +362,10 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
*
* @param {Object[]} [events] Array of event information, one per event.
*/
et2_calendar_planner_row.prototype._update_events = function (events) {
_update_events(events) {
// Remove all events
while (this._children.length > 0) {
var node = this._children[this._children.length - 1];
const node = this._children[this._children.length - 1];
this.removeChild(node);
node.destroy();
}
@ -400,38 +379,38 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
}
// Seperate loop so column sorting finds all children in the right place
for (var c = 0; c < events.length; c++) {
var event_2 = this.getWidgetById('event_' + events[c].row_id);
if (!event_2)
let event = this.getWidgetById('event_' + events[c].row_id);
if (!event)
continue;
if (this.isInTree()) {
event_2.doLoadingFinished();
event.doLoadingFinished();
}
}
};
}
/**
* Position the event according to it's time and how this widget is laid
* out.
*
* @param {undefined|Object|et2_calendar_event} event
*/
et2_calendar_planner_row.prototype.position_event = function (event) {
var rows = this._spread_events();
var height = rows.length * this._row_height;
var row_width = this.rows.width();
position_event(event) {
const rows = this._spread_events();
const height = rows.length * this._row_height;
let row_width = this.rows.width();
if (row_width == 0) {
// Not rendered yet or something
row_width = this.getParent().gridHeader.width() - this.title.width();
}
row_width -= 15;
for (var c = 0; c < rows.length; c++) {
for (let c = 0; c < rows.length; c++) {
// Calculate vertical positioning
var top_1 = c * (100.0 / rows.length);
for (var i = 0; (rows[c].indexOf(event) >= 0 || !event) && i < rows[c].length; i++) {
const top = c * (100.0 / rows.length);
for (let i = 0; (rows[c].indexOf(event) >= 0 || !event) && i < rows[c].length; i++) {
// Calculate horizontal positioning
var left = this._time_to_position(rows[c][i].options.value.start);
var width = this._time_to_position(rows[c][i].options.value.end) - left;
const left = this._time_to_position(rows[c][i].options.value.start);
const width = this._time_to_position(rows[c][i].options.value.end) - left;
// Position the event
rows[c][i].div.css('top', top_1 + '%');
rows[c][i].div.css('top', top + '%');
rows[c][i].div.css('height', (100 / rows.length) + '%');
rows[c][i].div.css('left', left.toFixed(1) + '%');
rows[c][i].div.outerWidth((width / 100 * row_width) + 'px');
@ -440,30 +419,30 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
if (height) {
this.div.height(height + 'px');
}
};
}
/**
* Sort a day's events into non-overlapping rows
*
* @returns {Array[]} Events sorted into rows
*/
et2_calendar_planner_row.prototype._spread_events = function () {
_spread_events() {
// Keep it so we don't have to re-do it when the next event asks
var cached_length = 0;
let cached_length = 0;
this._cached_rows.map(function (row) { cached_length += row.length; });
if (cached_length === this._children.length) {
return this._cached_rows;
}
// sorting the events in non-overlapping rows
var rows = [];
var row_end = [0];
const rows = [];
const row_end = [0];
// Sort in chronological order, so earliest ones are at the top
this._children.sort(function (a, b) {
var start = new Date(a.options.value.start) - new Date(b.options.value.start);
var end = new Date(a.options.value.end) - new Date(b.options.value.end);
const start = new Date(a.options.value.start) - new Date(b.options.value.start);
const end = new Date(a.options.value.end) - new Date(b.options.value.end);
// Whole day events sorted by ID, normal events by start / end time
if (a.options.value.whole_day && b.options.value.whole_day) {
// Longer duration comes first so we have nicer bars across the top
var duration = (new Date(b.options.value.end) - new Date(b.options.value.start)) -
const duration = (new Date(b.options.value.end) - new Date(b.options.value.start)) -
(new Date(a.options.value.end) - new Date(a.options.value.start));
return duration ? duration : (a.options.value.app_id - b.options.value.app_id);
}
@ -472,64 +451,64 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
}
return start ? start : end;
});
for (var n = 0; n < this._children.length; n++) {
var event_3 = this._children[n].options.value || false;
if (typeof event_3.start !== 'object') {
this._date_helper.set_value(event_3.start);
event_3.start = new Date(this._date_helper.getValue());
for (let n = 0; n < this._children.length; n++) {
const event = this._children[n].options.value || false;
if (typeof event.start !== 'object') {
this._date_helper.set_value(event.start);
event.start = new Date(this._date_helper.getValue());
}
if (typeof event_3.end !== 'object') {
this._date_helper.set_value(event_3.end);
event_3.end = new Date(this._date_helper.getValue());
if (typeof event.end !== 'object') {
this._date_helper.set_value(event.end);
event.end = new Date(this._date_helper.getValue());
}
if (typeof event_3['start_m'] === 'undefined') {
var day_start = event_3.start.valueOf() / 1000;
var dst_check = new Date(event_3.start);
if (typeof event['start_m'] === 'undefined') {
let day_start = event.start.valueOf() / 1000;
const dst_check = new Date(event.start);
dst_check.setUTCHours(12);
// if daylight saving is switched on or off, correct $day_start
// gives correct times after 2am, times between 0am and 2am are wrong
var daylight_diff = day_start + 12 * 60 * 60 - (dst_check.valueOf() / 1000);
const daylight_diff = day_start + 12 * 60 * 60 - (dst_check.valueOf() / 1000);
if (daylight_diff) {
day_start -= daylight_diff;
}
event_3['start_m'] = event_3.start.getUTCHours() * 60 + event_3.start.getUTCMinutes();
if (event_3['start_m'] < 0) {
event_3['start_m'] = 0;
event_3['multiday'] = true;
event['start_m'] = event.start.getUTCHours() * 60 + event.start.getUTCMinutes();
if (event['start_m'] < 0) {
event['start_m'] = 0;
event['multiday'] = true;
}
event_3['end_m'] = event_3.end.getUTCHours() * 60 + event_3.end.getUTCMinutes();
if (event_3['end_m'] >= 24 * 60) {
event_3['end_m'] = 24 * 60 - 1;
event_3['multiday'] = true;
event['end_m'] = event.end.getUTCHours() * 60 + event.end.getUTCMinutes();
if (event['end_m'] >= 24 * 60) {
event['end_m'] = 24 * 60 - 1;
event['multiday'] = true;
}
if (!event_3.start.getUTCHours() && !event_3.start.getUTCMinutes() && event_3.end.getUTCHours() == 23 && event_3.end.getUTCMinutes() == 59) {
event_3.whole_day_on_top = (event_3.non_blocking && event_3.non_blocking != '0');
if (!event.start.getUTCHours() && !event.start.getUTCMinutes() && event.end.getUTCHours() == 23 && event.end.getUTCMinutes() == 59) {
event.whole_day_on_top = (event.non_blocking && event.non_blocking != '0');
}
}
// Skip events entirely on hidden weekends
if (this._hidden_weekend_event(event_3)) {
var node = this._children[n];
if (this._hidden_weekend_event(event)) {
const node = this._children[n];
this.removeChild(n--);
node.destroy();
continue;
}
var event_start = new Date(event_3.start).valueOf();
const event_start = new Date(event.start).valueOf();
for (var row = 0; row_end[row] > event_start; ++row)
; // find a "free" row (no other event)
if (typeof rows[row] === 'undefined')
rows[row] = [];
rows[row].push(this._children[n]);
row_end[row] = new Date(event_3['end']).valueOf();
row_end[row] = new Date(event['end']).valueOf();
}
this._cached_rows = rows;
return rows;
};
}
/**
* Check to see if the event is entirely on a hidden weekend
*
* @param values Array of event values, not an et2_widget_event
*/
et2_calendar_planner_row.prototype._hidden_weekend_event = function (values) {
_hidden_weekend_event(values) {
if (!this.getParent() || this.getParent().options.group_by == 'month' || this.getParent().options.show_weekend) {
return false;
}
@ -539,7 +518,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
return true;
}
return false;
};
}
/**
* Calculates the horizontal position based on the time given, as a percentage
* between the start and end times
@ -549,8 +528,8 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
* @param {int|Date|string} end Latest possible time (100%)
* @return {float} position in percent
*/
et2_calendar_planner_row.prototype._time_to_position = function (time, start, end) {
var pos = 0.0;
_time_to_position(time, start, end) {
let pos = 0.0;
// Handle the different value types
start = this.options.start_date;
end = this.options.end_date;
@ -558,9 +537,9 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
start = new Date(start);
end = new Date(end);
}
var wd_start = 60 * (parseInt('' + egw.preference('workdaystarts', 'calendar')) || 9);
var wd_end = 60 * (parseInt('' + egw.preference('workdayends', 'calendar')) || 17);
var t = time;
const wd_start = 60 * (parseInt('' + egw.preference('workdaystarts', 'calendar')) || 9);
const wd_end = 60 * (parseInt('' + egw.preference('workdayends', 'calendar')) || 17);
let t = time;
if (typeof time === 'number' && time < 3600) {
t = new Date(start.valueOf() + wd_start * 3600 * 1000);
}
@ -573,11 +552,11 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
if (t >= end)
return 100; // We are right of our scale
// Remove space for weekends, if hidden
var weekend_count = 0;
var weekend_before = 0;
var partial_weekend = 0;
let weekend_count = 0;
let weekend_before = 0;
let partial_weekend = 0;
if (this.getParent().options.group_by !== 'month' && this.getParent() && !this.getParent().options.show_weekend) {
var counter_date = new Date(start);
const counter_date = new Date(start);
do {
if ([0, 6].indexOf(counter_date.getUTCDay()) !== -1) {
if (counter_date.getUTCDate() === t.getUTCDate() && counter_date.getUTCMonth() === t.getUTCMonth()) {
@ -633,7 +612,7 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
}
pos = 100 * pos;
return pos;
};
}
// Resizable interface
/**
* Resize
@ -641,31 +620,29 @@ var et2_calendar_planner_row = /** @class */ (function (_super) {
* Parent takes care of setting proper width & height for the containing div
* here we just need to adjust the events to fit the new size.
*/
et2_calendar_planner_row.prototype.resize = function () {
resize() {
if (this.disabled || !this.div.is(':visible') || this.getParent().disabled) {
return;
}
var row = jQuery('<div class="calendar_plannerEventRowWidget"></div>').appendTo(this.rows);
const row = jQuery('<div class="calendar_plannerEventRowWidget"></div>').appendTo(this.rows);
this._row_height = (parseInt(window.getComputedStyle(row[0]).getPropertyValue("height")) || 20);
row.remove();
// Resize & position all events
this.position_event();
};
et2_calendar_planner_row._attributes = {
start_date: {
name: "Start date",
type: "any"
},
end_date: {
name: "End date",
type: "any"
},
value: {
type: "any"
}
};
return et2_calendar_planner_row;
}(et2_core_valueWidget_1.et2_valueWidget));
exports.et2_calendar_planner_row = et2_calendar_planner_row;
et2_core_widget_1.et2_register_widget(et2_calendar_planner_row, ["calendar-planner_row"]);
}
}
et2_calendar_planner_row._attributes = {
start_date: {
name: "Start date",
type: "any"
},
end_date: {
name: "End date",
type: "any"
},
value: {
type: "any"
}
};
et2_register_widget(et2_calendar_planner_row, ["calendar-planner_row"]);
//# sourceMappingURL=et2_widget_planner_row.js.map

View File

@ -15,12 +15,15 @@
*/
import {et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_createWidget, et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_valueWidget} from "../../api/js/etemplate/et2_core_valueWidget";
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
import {et2_date} from "../../api/js/etemplate/et2_widget_date";
import {et2_action_object_impl} from "../../api/js/etemplate/et2_core_DOMWidget";
import {et2_calendar_planner} from "./et2_widget_planner";
import {EGW_AI_DRAG_OUT, EGW_AI_DRAG_OVER, egw_getObjectManager, egwActionObject} from "../../api/js/egw_action/egw_action.js";
import {et2_IResizeable} from "../../api/js/etemplate/et2_core_interfaces";
import {egw} from "../../api/js/jsapi/egw_global";
/**
* Class for one row of a planner

View File

@ -1,4 +1,3 @@
"use strict";
/*
* Egroupware Calendar timegrid
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
@ -8,30 +7,21 @@
* @author Nathan Gray
* @version $Id$
*/
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.et2_calendar_timegrid = void 0;
/*egw:uses
/calendar/js/et2_widget_view.js;
*/
var et2_core_widget_1 = require("../../api/js/etemplate/et2_core_widget");
var et2_core_inheritance_1 = require("../../api/js/etemplate/et2_core_inheritance");
var et2_widget_view_1 = require("./et2_widget_view");
var et2_core_DOMWidget_1 = require("../../api/js/etemplate/et2_core_DOMWidget");
var et2_dataview_view_grid_1 = require("../../api/js/etemplate/et2_dataview_view_grid");
var et2_widget_daycol_1 = require("./et2_widget_daycol");
import { et2_createWidget, et2_register_widget } from "../../api/js/etemplate/et2_core_widget";
import { ClassWithAttributes } from "../../api/js/etemplate/et2_core_inheritance";
import { et2_calendar_view } from "./et2_widget_view";
import { et2_action_object_impl } from "../../api/js/etemplate/et2_core_DOMWidget";
import { et2_dataview_grid } from "../../api/js/etemplate/et2_dataview_view_grid";
import { et2_calendar_daycol } from "./et2_widget_daycol";
import { egw } from "../../api/js/jsapi/egw_global";
import { et2_no_init } from "../../api/js/etemplate/et2_core_common";
import { et2_IResizeable } from "../../api/js/etemplate/et2_core_interfaces";
import { et2_calendar_event } from "./et2_widget_event";
import { EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT, egwActionObject, egw_getObjectManager } from "../../api/js/egw_action/egw_action.js";
import { et2_compileLegacyJS } from "../../api/js/etemplate/et2_core_legacyJSFunctions";
/**
* Class which implements the "calendar-timegrid" XET-Tag for displaying a span of days
*
@ -46,58 +36,55 @@ var et2_widget_daycol_1 = require("./et2_widget_daycol");
*
* @augments et2_calendar_view
*/
var et2_calendar_timegrid = /** @class */ (function (_super) {
__extends(et2_calendar_timegrid, _super);
export class et2_calendar_timegrid extends et2_calendar_view {
/**
* Constructor
*
* @memberOf et2_calendar_timegrid
*/
function et2_calendar_timegrid(_parent, _attrs, _child) {
var _this =
constructor(_parent, _attrs, _child) {
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_calendar_timegrid._attributes, _child || {})) || this;
_this.daily_owner = false;
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_calendar_timegrid._attributes, _child || {}));
this.daily_owner = false;
// Main container
_this.div = jQuery(document.createElement("div"))
this.div = jQuery(document.createElement("div"))
.addClass("calendar_calTimeGrid")
.addClass("calendar_TimeGridNoLabel");
// Headers
_this.gridHeader = jQuery(document.createElement("div"))
this.gridHeader = jQuery(document.createElement("div"))
.addClass("calendar_calGridHeader")
.appendTo(_this.div);
_this.dayHeader = jQuery(document.createElement("div"))
.appendTo(_this.gridHeader);
.appendTo(this.div);
this.dayHeader = jQuery(document.createElement("div"))
.appendTo(this.gridHeader);
// Contains times / rows
_this.scrolling = jQuery(document.createElement('div'))
this.scrolling = jQuery(document.createElement('div'))
.addClass("calendar_calTimeGridScroll")
.appendTo(_this.div)
.appendTo(this.div)
.append('<div class="calendar_calTimeLabels"></div>');
// Contains days / columns
_this.days = jQuery(document.createElement("div"))
this.days = jQuery(document.createElement("div"))
.addClass("calendar_calDayCols")
.appendTo(_this.scrolling);
.appendTo(this.scrolling);
// Used for owners
_this.owner = et2_createWidget('description', {}, _this);
_this._labelContainer = jQuery(document.createElement("label"))
this.owner = et2_createWidget('description', {}, this);
this._labelContainer = jQuery(document.createElement("label"))
.addClass("et2_label et2_link")
.appendTo(_this.gridHeader);
_this.gridHover = jQuery('<div style="height:5px;" class="calendar_calAddEvent drop-hover">');
.appendTo(this.gridHeader);
this.gridHover = jQuery('<div style="height:5px;" class="calendar_calAddEvent drop-hover">');
// List of dates in Ymd
// The first one should be start_date, last should be end_date
_this.day_list = [];
_this.day_widgets = [];
this.day_list = [];
this.day_widgets = [];
// Timer to re-scale time to fit
_this.resize_timer = null;
_this.setDOMNode(_this.div[0]);
return _this;
this.resize_timer = null;
this.setDOMNode(this.div[0]);
}
et2_calendar_timegrid.prototype.destroy = function () {
destroy() {
// Stop listening to tab changes
if (typeof framework !== 'undefined' && framework.getApplicationByName('calendar').tab) {
jQuery(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id);
}
_super.prototype.destroy.call(this);
super.destroy();
// Delete all old objects
this._actionObject.clear();
this._actionObject.unregisterActions();
@ -114,9 +101,9 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
if (this.resize_timer) {
window.clearTimeout(this.resize_timer);
}
};
et2_calendar_timegrid.prototype.doLoadingFinished = function () {
_super.prototype.doLoadingFinished.call(this);
}
doLoadingFinished() {
super.doLoadingFinished();
// Listen to tab show to make sure we scroll to the day start, not top
if (typeof framework !== 'undefined' && framework.getApplicationByName('calendar').tab) {
jQuery(framework.getApplicationByName('calendar').tab.contentDiv)
@ -260,10 +247,10 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
.on('mousedown', jQuery.proxy(this._mouse_down, this))
.on('mouseup', jQuery.proxy(this._mouse_up, this));
return true;
};
et2_calendar_timegrid.prototype._createNamespace = function () {
}
_createNamespace() {
return true;
};
}
/**
* Show the current time while dragging
* Used for resizing as well as drag & drop
@ -272,7 +259,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param {type} helper
* @param {type} height
*/
et2_calendar_timegrid.prototype._drag_helper = function (element, helper, height) {
_drag_helper(element, helper, height) {
if (!element)
return;
element.dropEnd = this.gridHover;
@ -314,7 +301,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
jQuery(element).width(jQuery(helper).width());
return element.dropEnd;
};
}
/**
* Handler for dropping an event on the timegrid
*
@ -323,7 +310,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param {type} ui
* @param {type} dropEnd
*/
et2_calendar_timegrid.prototype._event_drop = function (timegrid, event, ui, dropEnd) {
_event_drop(timegrid, event, ui, dropEnd) {
var e = new jQuery.Event('change');
e.originalEvent = event;
e.data = { start: 0 };
@ -371,7 +358,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
loading.remove();
return;
}
var duration;
let duration;
//Get infologID if in case if it's an integrated infolog event
if (event_data.app === 'infolog') {
// Duration - infologs are always non-blocking
@ -418,7 +405,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
});
}
}
};
}
/**
* Something changed, and the days need to be re-drawn. We wait a bit to
* avoid re-drawing twice if start and end date both changed, then recreate
@ -430,7 +417,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* Waiting until invalidate completes prevents 2 updates when changing the date range.
* @returns {undefined}
*/
et2_calendar_timegrid.prototype.invalidate = function (trigger) {
invalidate(trigger) {
// Reset the list of days
this.day_list = [];
// Wait a bit to see if anything else changes, then re-draw the days
@ -455,15 +442,15 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.widget._updateNow();
// Hide loader
window.setTimeout(jQuery.proxy(function () { this.loader.hide(); }, this.widget), 200);
}, { widget: this, "trigger": trigger }), et2_dataview_view_grid_1.et2_dataview_grid.ET2_GRID_INVALIDATE_TIMEOUT);
};
et2_calendar_timegrid.prototype.detachFromDOM = function () {
}, { widget: this, "trigger": trigger }), et2_dataview_grid.ET2_GRID_INVALIDATE_TIMEOUT);
}
detachFromDOM() {
// Remove the binding to the change handler
jQuery(this.div).off(".et2_calendar_timegrid");
return _super.prototype.detachFromDOM.call(this);
};
et2_calendar_timegrid.prototype.attachToDOM = function () {
var result = _super.prototype.attachToDOM.call(this);
return super.detachFromDOM();
}
attachToDOM() {
let result = super.attachToDOM();
// Add the binding for the event change handler
jQuery(this.div).on("change.et2_calendar_timegrid", '.calendar_calEvent', this, function (e) {
// Make sure function gets a reference to the widget
@ -482,21 +469,21 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
e.stopPropagation();
});
return result;
};
et2_calendar_timegrid.prototype.getDOMNode = function (_sender) {
}
getDOMNode(_sender) {
if (_sender === this || !_sender) {
return this.div ? this.div[0] : null;
}
else if (_sender.instanceOf(et2_widget_daycol_1.et2_calendar_daycol)) {
else if (_sender.instanceOf(et2_calendar_daycol)) {
return this.days ? this.days[0] : null;
}
else if (_sender) {
return this.gridHeader ? this.gridHeader[0] : null;
}
};
et2_calendar_timegrid.prototype.set_disabled = function (disabled) {
}
set_disabled(disabled) {
var old_value = this.options.disabled;
_super.prototype.set_disabled.call(this, disabled);
super.set_disabled(disabled);
if (disabled) {
this.loader.show();
}
@ -506,35 +493,35 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
// to the top, so add 2px;
this.scrolling.scrollTop(this._top_time + 2);
}
};
}
/**
* Update the 'now' line
* @private
*/
// @ts-ignore
et2_calendar_timegrid.prototype._updateNow = function () {
var now = _super.prototype._updateNow.call(this);
_updateNow() {
let now = super._updateNow();
if (now === false || this.options.granularity == 0 || !this.div.is(':visible')) {
this.now_div.hide();
return false;
}
// Position & show line
var set_line = function (line, now, day) {
let set_line = function (line, now, day) {
line.appendTo(day.getDOMNode()).show();
var pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
let pos = day._time_to_position(now.getUTCHours() * 60 + now.getUTCMinutes());
//this.now_div.position({my: 'left', at: 'left', of: day.getDOMNode()});
line.css('top', pos + '%');
};
// Showing just 1 day, multiple owners - span all
if (this.daily_owner && this.day_list.length == 1) {
var day = this.day_widgets[0];
let day = this.day_widgets[0];
set_line(this.now_div, now, day);
this.now_div.css('width', (this.day_widgets.length * 100) + '%');
return true;
}
// Find the day of the week
for (var i = 0; i < this.day_widgets.length; i++) {
var day = this.day_widgets[i];
let day = this.day_widgets[i];
if (day.getDate() >= now) {
day = this.day_widgets[i - 1];
set_line(this.now_div, now, day);
@ -543,11 +530,11 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
}
return true;
};
}
/**
* Clear everything, and redraw the whole grid
*/
et2_calendar_timegrid.prototype._drawGrid = function () {
_drawGrid() {
this.div.css('height', this.options.height)
.empty();
this.loader.prependTo(this.div).show();
@ -555,12 +542,12 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this._drawTimes();
// Draw in the vertical - the days
this.invalidate();
};
}
/**
* Creates the DOM nodes for the times in the left column, and the horizontal
* lines (mostly via CSS) that span the whole date range.
*/
et2_calendar_timegrid.prototype._drawTimes = function () {
_drawTimes() {
jQuery('.calendar_calTimeRow', this.div).remove();
this.div.toggleClass('calendar_calTimeGridList', this.options.granularity === 0);
this.gridHeader
@ -581,7 +568,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.days.css('height', '100%');
this.iterateOver(function (day) {
day.resize();
}, this, et2_widget_daycol_1.et2_calendar_daycol);
}, this, et2_calendar_daycol);
return;
}
var wd_start = 60 * this.options.day_start;
@ -643,14 +630,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.gridHover.css('height', this.rowHeight);
// Scroll to start of day
this.scrolling.scrollTop(this._top_time);
};
}
/**
* As window size and number of all day non-blocking events change, we need
* to re-scale the time grid to make sure the full working day is shown.
*
* We use a timeout to avoid doing it multiple times if redrawing or resizing.
*/
et2_calendar_timegrid.prototype.resizeTimes = function () {
resizeTimes() {
// Hide resizing from user
this.loader.show();
// Wait a bit to see if anything else changes, then re-draw the times
@ -666,12 +653,12 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this._resizeTimes();
}
}, this), 1);
};
}
/**
* Re-scale the time grid to make sure the full working day is shown.
* This is the timeout callback that does the actual re-size immediately.
*/
et2_calendar_timegrid.prototype._resizeTimes = function () {
_resizeTimes() {
if (!this.div.is(':visible')) {
return;
}
@ -700,13 +687,13 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}, this, et2_IResizeable);
}
this.loader.hide();
};
}
/**
* Set up the needed day widgets to correctly display the selected date
* range. First we calculate the needed dates, then we create any needed
* widgets. Existing widgets are recycled rather than discarded.
*/
et2_calendar_timegrid.prototype._drawDays = function () {
_drawDays() {
this.scrolling.append(this.days);
// If day list is still empty, recalculate it from start & end date
if (this.day_list.length === 0 && this.options.start_date && this.options.end_date) {
@ -822,14 +809,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.day_col.setDetachedAttributes(nodes.clone(),)
}
*/
};
}
/**
* Set header classes
*
*/
et2_calendar_timegrid.prototype.set_header_classes = function () {
set_header_classes() {
var day;
var app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
for (var i = 0; i < this.day_widgets.length; i++) {
day = this.day_widgets[i];
// Classes
@ -841,21 +828,21 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
day.set_class('');
}
}
};
}
/**
* Update UI while scrolling within the selected time
*
* Toggles out of view indicators and adjusts not visible headers
* @param {Event} event Scroll event
*/
et2_calendar_timegrid.prototype._scroll = function (event) {
_scroll(event) {
if (!this.day_widgets)
return;
// Loop through days, let them deal with it
for (var day = 0; day < this.day_widgets.length; day++) {
this.day_widgets[day]._out_of_view();
}
};
}
/**
* Calculate a list of days between start and end date, skipping weekends if
* desired.
@ -867,7 +854,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
*
* @returns {string[]} List of days in Ymd format
*/
et2_calendar_timegrid.prototype._calculate_day_list = function (start_date, end_date, show_weekend) {
_calculate_day_list(start_date, end_date, show_weekend) {
var day_list = [];
this.date_helper.set_value(end_date);
var end = this.date_helper.date.getTime();
@ -883,13 +870,13 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
// though the limit is more based on how wide the screen is
while (end >= this.date_helper.date.getTime() && i++ <= 14);
return day_list;
};
}
/**
* Link the actions to the DOM nodes / widget bits.
*
* @param {object} actions {ID: {attributes..}+} map of egw action information
*/
et2_calendar_timegrid.prototype._link_actions = function (actions) {
_link_actions(actions) {
// Get the parent? Might be a grid row, might not. Either way, it is
// just a container with no valid actions
var objectManager = egw_getObjectManager(this.getInstanceManager().app, true, 1);
@ -903,7 +890,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
// This binds into the egw action system. Most user interactions (drag to move, resize)
// are handled internally using jQuery directly.
var widget_object = this._actionObject || parent.getObjectById(this.id);
var aoi = new et2_core_DOMWidget_1.et2_action_object_impl(this, this.getDOMNode(this)).getAOI();
var aoi = new et2_action_object_impl(this, this.getDOMNode(this)).getAOI();
for (var i = 0; i < parent.children.length; i++) {
var parent_finder = jQuery(parent.children[i].iface.doGetDOMNode()).find(this.div);
if (parent_finder.length > 0) {
@ -912,7 +899,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
}
// Determine if we allow a dropped event to use the invite/change actions
var _invite_enabled = function (action, event, target) {
let _invite_enabled = function (action, event, target) {
var event = event.iface.getWidget();
var timegrid = target.iface.getWidget() || false;
if (event === timegrid || !event || !timegrid ||
@ -936,7 +923,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
owner_match = owner_match || col.options.owner.indexOf(id) !== -1;
own_timegrid = (col === event.getParent());
}
}, this, et2_widget_daycol_1.et2_calendar_daycol);
}, this, et2_calendar_daycol);
}
}
var enabled = !owner_match &&
@ -1035,14 +1022,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
var action_links = this._get_action_links(actions);
this._init_links_dnd(widget_object.manager, action_links);
widget_object.updateActionLinks(action_links);
};
}
/**
* Automatically add dnd support for linking
*
* @param {type} mgr
* @param {type} actionLinks
*/
et2_calendar_timegrid.prototype._init_links_dnd = function (mgr, actionLinks) {
_init_links_dnd(mgr, actionLinks) {
if (this.options.readonly)
return;
var self = this;
@ -1155,7 +1142,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
if (col.div.has(timegrid.gridHover).length || col.header.has(timegrid.gridHover).length) {
add_owner = col.options.owner;
}
}, this, et2_widget_daycol_1.et2_calendar_daycol);
}, this, et2_calendar_daycol);
}
egw().json('calendar.calendar_uiforms.ajax_invite', [
button_id === 'series' ? event_data.id : event_data.app_id,
@ -1199,7 +1186,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
actionLinks.push(drag_action.id);
}
drag_action.set_dragType(['link', 'calendar']);
};
}
/**
* Get all action-links / id's of 1.-level actions from a given action object
*
@ -1208,7 +1195,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param actions
* @returns {Array}
*/
et2_calendar_timegrid.prototype._get_action_links = function (actions) {
_get_action_links(actions) {
var action_links = [];
// TODO: determine which actions are allowed without an action (empty actions)
for (var i in actions) {
@ -1218,7 +1205,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
}
return action_links;
};
}
/**
* Provide specific data to be displayed.
* This is a way to set start and end dates, owner and event data in one call.
@ -1239,7 +1226,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* necessarily an entry from the resource app), or a list containing a
* combination of both.
*/
et2_calendar_timegrid.prototype.set_value = function (events) {
set_value(events) {
if (typeof events !== 'object')
return false;
var use_days_sent = true;
@ -1249,7 +1236,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
if (events.end_date) {
use_days_sent = false;
}
_super.prototype.set_value.call(this, events);
super.set_value(events);
if (use_days_sent) {
var day_list = Object.keys(events);
if (day_list.length) {
@ -1258,18 +1245,18 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
// Sub widgets actually get their own data from egw.data, so we'll
// stick it there
var consolidated = et2_widget_view_1.et2_calendar_view.is_consolidated(this.options.owner, this.day_list.length == 1 ? 'day' : 'week');
var consolidated = et2_calendar_view.is_consolidated(this.options.owner, this.day_list.length == 1 ? 'day' : 'week');
for (var day in events) {
var day_list_1 = [];
let day_list = [];
for (var i = 0; i < events[day].length; i++) {
day_list_1.push(events[day][i].row_id);
day_list.push(events[day][i].row_id);
egw.dataStoreUID('calendar::' + events[day][i].row_id, events[day][i]);
}
// Might be split by user, so we have to check that too
for (var i = 0; i < this.options.owner.length; i++) {
var owner = consolidated ? this.options.owner : this.options.owner[i];
var day_id = CalendarApp._daywise_cache_id(day, owner);
egw.dataStoreUID(day_id, day_list_1);
egw.dataStoreUID(day_id, day_list);
if (consolidated)
break;
}
@ -1281,7 +1268,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
if (!this.update_timer) {
window.setTimeout(jQuery.proxy(function () { this.loader.hide(); }, this), 200);
}
};
}
/**
* Set which user owns this. Owner is passed along to the individual
* days.
@ -1289,9 +1276,9 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param {number|number[]} _owner Account ID
* @returns {undefined}
*/
et2_calendar_timegrid.prototype.set_owner = function (_owner) {
set_owner(_owner) {
var old = this.options.owner || 0;
_super.prototype.set_owner.call(this, _owner);
super.set_owner(_owner);
this.owner.set_label('');
this.div.removeClass('calendar_TimeGridNoLabel');
// Check to see if it's our own calendar, with just us showing
@ -1337,7 +1324,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
typeof old === 'string' && '' + old !== '' + this.options.owner)) {
this.invalidate(true);
}
};
}
/**
* Set a label for this week
*
@ -1345,7 +1332,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
*
* @param {string} label
*/
et2_calendar_timegrid.prototype.set_label = function (label) {
set_label(label) {
this.options.label = label;
this._labelContainer.html(label);
this.gridHeader.prepend(this._labelContainer);
@ -1353,7 +1340,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
// but is empty, but give extra space for a single owner name
this.div.toggleClass('calendar_TimeGridNoLabel', label.trim().length > 0 && label.trim().length <= 6 ||
this.options.owner.length > 1);
};
}
/**
* Set how big the time divisions are
*
@ -1363,7 +1350,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
*
* @param {number} minutes
*/
et2_calendar_timegrid.prototype.set_granularity = function (minutes) {
set_granularity(minutes) {
// Avoid < 0
minutes = Math.max(0, minutes);
if (this.options.granularity !== minutes) {
@ -1380,13 +1367,13 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
else if (!this.update_timer) {
this.resizeTimes();
}
};
}
/**
* Turn on or off the visibility of weekends
*
* @param {boolean} weekends
*/
et2_calendar_timegrid.prototype.set_show_weekend = function (weekends) {
set_show_weekend(weekends) {
weekends = weekends ? true : false;
if (this.options.show_weekend !== weekends) {
this.options.show_weekend = weekends;
@ -1394,11 +1381,11 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.invalidate();
}
}
};
}
/**
* Call change handler, if set
*/
et2_calendar_timegrid.prototype.change = function () {
change() {
if (this.onchange) {
if (typeof this.onchange == 'function') {
// Make sure function gets a reference to the widget
@ -1411,14 +1398,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
return (et2_compileLegacyJS(this.options.onchange, this, _node))();
}
}
};
}
/**
* Call event change handler, if set
*
* @param {type} event
* @param {type} dom_node
*/
et2_calendar_timegrid.prototype.event_change = function (event, dom_node) {
event_change(event, dom_node) {
if (this.onevent_change) {
var event_data = this._get_event_info(dom_node);
var event_widget = this.getWidgetById(event_data.widget_id);
@ -1441,14 +1428,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}, this));
}
return false;
};
et2_calendar_timegrid.prototype.get_granularity = function () {
}
get_granularity() {
// get option, or user's preference
if (typeof this.options.granularity === 'undefined') {
this.options.granularity = egw.preference('interval', 'calendar') || 30;
}
return parseInt(this.options.granularity);
};
}
/**
* Click handler calling custom handler set via onclick attribute to this.onclick
*
@ -1459,7 +1446,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param {Event} _ev
* @returns {boolean} Continue processing event (true) or stop (false)
*/
et2_calendar_timegrid.prototype.click = function (_ev) {
click(_ev) {
var result = true;
if (this.options.readonly)
return;
@ -1524,13 +1511,13 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
app.calendar.add(options);
return false;
}
};
}
/**
* Mousedown handler to support drag to create
*
* @param {jQuery.Event} event
*/
et2_calendar_timegrid.prototype._mouse_down = function (event) {
_mouse_down(event) {
if (event.which !== 1)
return;
if (this.options.readonly)
@ -1591,13 +1578,13 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
});
}
return this._drag_create_start(start);
};
}
/**
* Mouseup handler to support drag to create
*
* @param {jQuery.Event} event
*/
et2_calendar_timegrid.prototype._mouse_up = function (event) {
_mouse_up(event) {
if (this.options.readonly)
return;
var end = jQuery.extend({}, this.gridHover[0].dataset);
@ -1616,7 +1603,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
this.div.off('mousemove.dragcreate');
this.gridHover.css('cursor', '');
return this._drag_create_end(this.drag_create.event ? end : undefined);
};
}
/**
* Get time from position for drag and drop
*
@ -1627,7 +1614,7 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
* @param {number} y
* @returns {DOMNode[]} time node(s) for the given position
*/
et2_calendar_timegrid.prototype._get_time_from_position = function (x, y) {
_get_time_from_position(x, y) {
x = Math.round(x);
y = Math.round(y);
var path = [];
@ -1699,19 +1686,19 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
}
this.gridHover.css('left', '');
return this.gridHover;
};
}
/**
* Code for implementing et2_IDetachedDOM
*
* @param {array} _attrs array to add further attributes to
*/
et2_calendar_timegrid.prototype.getDetachedAttributes = function (_attrs) {
getDetachedAttributes(_attrs) {
_attrs.push('start_date', 'end_date');
};
et2_calendar_timegrid.prototype.getDetachedNodes = function () {
}
getDetachedNodes() {
return [this.getDOMNode(this)];
};
et2_calendar_timegrid.prototype.setDetachedAttributes = function (_nodes, _values) {
}
setDetachedAttributes(_nodes, _values) {
this.div = jQuery(_nodes[0]);
if (_values.start_date) {
this.set_start_date(_values.start_date);
@ -1719,12 +1706,12 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
if (_values.end_date) {
this.set_end_date(_values.end_date);
}
};
}
// Resizable interface
/**
* @param {boolean} [_too_small=null] Force the widget to act as if it was too small
*/
et2_calendar_timegrid.prototype.resize = function (_too_small) {
resize(_too_small) {
if (this.disabled || !this.div.is(':visible')) {
return;
}
@ -1810,14 +1797,14 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
day.set_left((day_width * i) + 'px');
day.set_width(day_width + 'px');
}
};
}
/**
* Set up for printing
*
* @return {undefined|Deferred} Return a jQuery Deferred object if not done setting up
* (waiting for data)
*/
et2_calendar_timegrid.prototype.beforePrint = function () {
beforePrint() {
if (this.disabled || !this.div.is(':visible')) {
return;
}
@ -1856,11 +1843,11 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
});
this.div.css({ 'height': '', 'max-height': '' });
}
};
}
/**
* Reset after printing
*/
et2_calendar_timegrid.prototype.afterPrint = function () {
afterPrint() {
this.div.css('maxHeight', '');
this.scrolling.children().css({ 'transform': '', 'overflow': '' });
this.div.height(this.options.height);
@ -1872,55 +1859,53 @@ var et2_calendar_timegrid = /** @class */ (function (_super) {
// Remove translation
.css({ 'transform': '', 'margin-bottom': '' });
}
};
et2_calendar_timegrid._attributes = {
value: {
type: "any",
description: "An array of events, indexed by date (Ymd format)."
},
day_start: {
name: "Day start time",
type: "string",
default: parseInt('' + egw.preference('workdaystarts', 'calendar')) || 9,
description: "Work day start time. If unset, this will default to the current user's preference"
},
day_end: {
name: "Day end time",
type: "string",
default: parseInt('' + egw.preference('workdayends', 'calendar')) || 17,
description: "Work day end time. If unset, this will default to the current user's preference"
},
show_weekend: {
name: "Weekends",
type: "boolean",
// @ts-ignore
default: egw.preference('days_in_weekview', 'calendar') != 5,
description: "Display weekends. The date range should still include them for proper scrolling, but they just won't be shown."
},
granularity: {
name: "Granularity",
type: "integer",
default: parseInt('' + egw.preference('interval', 'calendar')) || 30,
description: "How many minutes per row, or 0 to display events as a list"
},
"onchange": {
"name": "onchange",
"type": "js",
"default": et2_no_init,
"description": "JS code which is executed when the date range changes."
},
"onevent_change": {
"name": "onevent_change",
"type": "js",
"default": et2_no_init,
"description": "JS code which is executed when an event changes."
},
height: {
"default": '100%'
}
};
return et2_calendar_timegrid;
}(et2_widget_view_1.et2_calendar_view));
exports.et2_calendar_timegrid = et2_calendar_timegrid;
et2_core_widget_1.et2_register_widget(et2_calendar_timegrid, ["calendar-timegrid"]);
}
}
et2_calendar_timegrid._attributes = {
value: {
type: "any",
description: "An array of events, indexed by date (Ymd format)."
},
day_start: {
name: "Day start time",
type: "string",
default: parseInt('' + egw.preference('workdaystarts', 'calendar')) || 9,
description: "Work day start time. If unset, this will default to the current user's preference"
},
day_end: {
name: "Day end time",
type: "string",
default: parseInt('' + egw.preference('workdayends', 'calendar')) || 17,
description: "Work day end time. If unset, this will default to the current user's preference"
},
show_weekend: {
name: "Weekends",
type: "boolean",
// @ts-ignore
default: egw.preference('days_in_weekview', 'calendar') != 5,
description: "Display weekends. The date range should still include them for proper scrolling, but they just won't be shown."
},
granularity: {
name: "Granularity",
type: "integer",
default: parseInt('' + egw.preference('interval', 'calendar')) || 30,
description: "How many minutes per row, or 0 to display events as a list"
},
"onchange": {
"name": "onchange",
"type": "js",
"default": et2_no_init,
"description": "JS code which is executed when the date range changes."
},
"onevent_change": {
"name": "onevent_change",
"type": "js",
"default": et2_no_init,
"description": "JS code which is executed when an event changes."
},
height: {
"default": '100%'
}
};
et2_register_widget(et2_calendar_timegrid, ["calendar-timegrid"]);
//# sourceMappingURL=et2_widget_timegrid.js.map

View File

@ -13,12 +13,18 @@
/calendar/js/et2_widget_view.js;
*/
import {et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {et2_createWidget, et2_register_widget, WidgetConfig} from "../../api/js/etemplate/et2_core_widget";
import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
import {et2_calendar_view} from "./et2_widget_view";
import {et2_action_object_impl} from "../../api/js/etemplate/et2_core_DOMWidget";
import {et2_dataview_grid} from "../../api/js/etemplate/et2_dataview_view_grid";
import {et2_calendar_daycol} from "./et2_widget_daycol";
import {egw} from "../../api/js/jsapi/egw_global";
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
import {et2_IDetachedDOM, et2_IPrint, et2_IResizeable} from "../../api/js/etemplate/et2_core_interfaces";
import {et2_calendar_event} from "./et2_widget_event";
import {EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT, egwActionObject, egw_getObjectManager} from "../../api/js/egw_action/egw_action.js";
import {et2_compileLegacyJS} from "../../api/js/etemplate/et2_core_legacyJSFunctions";
/**
* Class which implements the "calendar-timegrid" XET-Tag for displaying a span of days

View File

@ -16,7 +16,7 @@ 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 { egw, 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

View File

@ -18,7 +18,7 @@ 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 {egw, egw_get_file_editor_prefered_mimes} from "../../api/js/jsapi/egw_global";
import {et2_createWidget} from "../../api/js/etemplate/et2_core_widget";
/**

View File

@ -1,4 +1,3 @@
"use strict";
/**
* EGroupware - Import/Export - Javascript UI
*
@ -9,48 +8,34 @@
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
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 });
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';
import { egw } from "../../api/js/jsapi/egw_global";
/**
* JS for Import/Export
*
* @augments AppJS
*/
var ImportExportApp = /** @class */ (function (_super) {
__extends(ImportExportApp, _super);
class ImportExportApp extends EgwApp {
/**
* Constructor
*
* @memberOf app.infolog
*/
function ImportExportApp() {
constructor() {
// call parent
return _super.call(this, 'importexport') || this;
super('importexport');
}
/**
* Destructor
*/
ImportExportApp.prototype.destroy = function (_app) {
destroy(_app) {
// call parent
_super.prototype.destroy.call(this, _app);
};
super.destroy(_app);
}
/**
* This function is called when the etemplate2 object is loaded
* and ready. If you must store a reference to the et2 object,
@ -59,9 +44,9 @@ var ImportExportApp = /** @class */ (function (_super) {
* @param {etemplate2} _et2 newly ready object
* @param {string} _name template name
*/
ImportExportApp.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);
if (this.et2.getWidgetById('export')) {
if (!this.et2.getArrayMgr("content").getEntry("definition")) {
// et2 doesn't understand a disabled button in the normal sense
@ -76,15 +61,15 @@ var ImportExportApp = /** @class */ (function (_super) {
jQuery('div.filters').hide();
}
}
};
}
/**
* Callback to download the file without destroying the etemplate request
*
* @param data URL to get the export file
*/
ImportExportApp.prototype.download = function (data) {
download(data) {
// Try to get the file to download in the parent window
var app_templates = this.egw.top.etemplate2.getByApplication(framework.activeApp.appName);
let app_templates = this.egw.top.etemplate2.getByApplication(framework.activeApp.appName);
if (app_templates.length > 0) {
app_templates[0].download(data);
}
@ -92,8 +77,8 @@ var ImportExportApp = /** @class */ (function (_super) {
// Couldn't download in opener, download here before popup closes
this.et2.getInstanceManager().download(data);
}
};
ImportExportApp.prototype.export_preview = function (event, widget) {
}
export_preview(event, widget) {
var preview = jQuery(widget.getRoot().getWidgetById('preview_box').getDOMNode());
jQuery('.content', preview).empty()
.append('<div class="loading" style="width:100%;height:100%"></div>');
@ -104,8 +89,8 @@ var ImportExportApp = /** @class */ (function (_super) {
widget.clicked = false;
}, this));
return false;
};
ImportExportApp.prototype.import_preview = function (event, widget) {
}
import_preview(event, widget) {
var test = widget.getRoot().getWidgetById('dry-run');
if (test.getValue() == test.options.unselected_value)
return true;
@ -122,14 +107,14 @@ var ImportExportApp = /** @class */ (function (_super) {
.removeClass('loading');
}, this));
return false;
};
}
/**
* Open a popup to run a given definition
*
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
ImportExportApp.prototype.run_definition = function (action, selected) {
run_definition(action, selected) {
if (!selected || selected.length != 1)
return;
var id = selected[0].id || null;
@ -141,12 +126,12 @@ var ImportExportApp = /** @class */ (function (_super) {
appname: data.application,
definition: data.definition_id
}), "", '850x440', data.application);
};
}
/**
* Allowed users widget has been changed, if 'All users' or 'Just me'
* was selected, turn off any other options.
*/
ImportExportApp.prototype.allowed_users_change = function (node, widget) {
allowed_users_change(node, widget) {
var value = widget.getValue();
// Only 1 selected, no checking needed
if (value == null || value.length <= 1)
@ -174,8 +159,7 @@ var ImportExportApp = /** @class */ (function (_super) {
if (index >= 0) {
widget.set_value(value);
}
};
return ImportExportApp;
}(egw_app_1.EgwApp));
}
}
app.classes.importexport = ImportExportApp;
//# sourceMappingURL=app.js.map

View File

@ -16,6 +16,7 @@ import '../jsapi/egw_global';
import '../etemplate/et2_types';
import {EgwApp} from '../../api/js/jsapi/egw_app';
import {egw} from "../../api/js/jsapi/egw_global";
/**
* JS for Import/Export

View File

@ -14,6 +14,7 @@ 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";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for Infolog
*

View File

@ -18,6 +18,7 @@ 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";
import {egw} from "../../api/js/jsapi/egw_global";
/**
* UI for Infolog

View File

@ -9,6 +9,7 @@
*/
import { EgwApp } from "../../api/js/jsapi/egw_app";
import { fetchAll } from "../../api/js/etemplate/et2_extension_nextmatch_actions";
import { egw } from "../../api/js/jsapi/egw_global";
/**
* UI for resources
*/

View File

@ -10,6 +10,7 @@
import {EgwApp} from "../../api/js/jsapi/egw_app";
import {fetchAll} from "../../api/js/etemplate/et2_extension_nextmatch_actions";
import {egw} from "../../api/js/jsapi/egw_global";
/**
* UI for resources