|
1
|
|
|
/** |
|
2
|
|
|
* EGroupware clientside API TypeScript interface |
|
3
|
|
|
* |
|
4
|
|
|
* Manually compiled from various JavaScript files in api/js/jsapi. |
|
5
|
|
|
* |
|
6
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
|
7
|
|
|
* @package api |
|
8
|
|
|
* @subpackage api |
|
9
|
|
|
* @link https://www.egroupware.org |
|
10
|
|
|
* @author Ralf Becker <[email protected]> |
|
11
|
|
|
* @author Hadi Natheg <[email protected]> |
|
12
|
|
|
* @author Nathan Gray <[email protected]> |
|
13
|
|
|
* @author Andreas Stöckel |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Global egw object (for now created by the diverse JavaScript files) with a TypeScript interface |
|
18
|
|
|
*/ |
|
19
|
|
|
declare var egw : Iegw; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Interface for global egw with window global or local methods or as function returning an object allowing also application local methods |
|
23
|
|
|
*/ |
|
24
|
|
|
declare interface Iegw extends IegwWndLocal { (_app? : string|Window, _wnd? : Window) : IegwAppLocal } |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Return type for egw.app() call |
|
28
|
|
|
*/ |
|
29
|
|
|
declare interface Iapplication |
|
30
|
|
|
{ |
|
31
|
|
|
title : string; // application title untranslated, better use egw.lang(app.name) |
|
32
|
|
|
name : string; // app-name |
|
33
|
|
|
enabled : number; |
|
34
|
|
|
status : number; |
|
35
|
|
|
id : number; |
|
36
|
|
|
order : number; |
|
37
|
|
|
version : string; |
|
38
|
|
|
index? : string; |
|
39
|
|
|
icon? : string; |
|
40
|
|
|
icon_app? : string; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Data stored by egw_data |
|
45
|
|
|
*/ |
|
46
|
|
|
declare interface IegwData |
|
47
|
|
|
{ |
|
48
|
|
|
timestamp?: number; |
|
49
|
|
|
data: {[key:string]: any}; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Interface for all window global methods (existing only in top window) |
|
54
|
|
|
*/ |
|
55
|
|
|
declare interface IegwGlobal |
|
56
|
|
|
{ |
|
57
|
|
|
/** |
|
58
|
|
|
* Base URL of EGroupware install "/egroupware" or full URL incl. schema and domain |
|
59
|
|
|
*/ |
|
60
|
|
|
webserverUrl : string; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* implemented in egw_config.js |
|
64
|
|
|
*/ |
|
65
|
|
|
/** |
|
66
|
|
|
* Query clientside config |
|
67
|
|
|
* |
|
68
|
|
|
* @param {string} _name name of config variable |
|
69
|
|
|
* @param {string} _app default "phpgwapi" |
|
70
|
|
|
* @return mixed |
|
71
|
|
|
*/ |
|
72
|
|
|
config(_name: string, _app?: string) : any; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Set clientside configuration for all apps |
|
76
|
|
|
* |
|
77
|
|
|
* @param {object} _configs |
|
78
|
|
|
* @param {boolean} _need_clone _configs need to be cloned, as it is from different window context |
|
79
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
80
|
|
|
*/ |
|
81
|
|
|
set_configs(_configs: object, _need_clone?: boolean) : void; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* implemeneted in egw_data.js |
|
85
|
|
|
*/ |
|
86
|
|
|
/** |
|
87
|
|
|
* Registers the intrest in a certain uid for a callback function. If |
|
88
|
|
|
* the data for that uid changes or gets loaded, the given callback |
|
89
|
|
|
* function is called. If the data for the given uid is available at the |
|
90
|
|
|
* time of registering the callback, the callback is called immediately. |
|
91
|
|
|
* |
|
92
|
|
|
* @param _uid is the uid for which the callback should be registered. |
|
93
|
|
|
* @param _callback is the callback which should get called. |
|
94
|
|
|
* @param _context is the optional context in which the callback will be |
|
95
|
|
|
* executed |
|
96
|
|
|
* @param _execId is the exec id which will be used in case the data is |
|
97
|
|
|
* not available |
|
98
|
|
|
* @param _widgetId is the widget id which will be used in case the uid |
|
99
|
|
|
* has to be fetched. |
|
100
|
|
|
*/ |
|
101
|
|
|
dataRegisterUID(_uid : string, _callback : Function, _context, _execId : string, _widgetId : string) : void; |
|
102
|
|
|
/** |
|
103
|
|
|
* Unregisters the intrest of updates for a certain data uid. |
|
104
|
|
|
* |
|
105
|
|
|
* @param _uid is the data uid for which the callbacks should be |
|
106
|
|
|
* unregistered. |
|
107
|
|
|
* @param _callback specifies the specific callback that should be |
|
108
|
|
|
* unregistered. If it evaluates to false, all callbacks (or those |
|
109
|
|
|
* matching the optionally given context) are removed. |
|
110
|
|
|
* @param _context specifies the callback context that should be |
|
111
|
|
|
* unregistered. If it evaluates to false, all callbacks (or those |
|
112
|
|
|
* matching the optionally given callback function) are removed. |
|
113
|
|
|
*/ |
|
114
|
|
|
dataUnregisterUID(_uid : string, _callback : Function, _context) : void; |
|
115
|
|
|
/** |
|
116
|
|
|
* Returns whether data is available for the given uid. |
|
117
|
|
|
* |
|
118
|
|
|
* @param _uid is the uid for which should be checked whether it has some |
|
119
|
|
|
* data. |
|
120
|
|
|
*/ |
|
121
|
|
|
dataHasUID(_uid : string) : boolean; |
|
122
|
|
|
/** |
|
123
|
|
|
* Returns data of a given uid. |
|
124
|
|
|
* |
|
125
|
|
|
* @param _uid is the uid for which should be checked whether it has some |
|
126
|
|
|
* data. |
|
127
|
|
|
*/ |
|
128
|
|
|
dataGetUIDdata(_uid : string) : IegwData; |
|
129
|
|
|
/** |
|
130
|
|
|
* Returns all uids that have the given prefix |
|
131
|
|
|
* |
|
132
|
|
|
* @param {string} _prefix |
|
133
|
|
|
* @return {array} of uids |
|
134
|
|
|
* TODO: Improve this |
|
135
|
|
|
*/ |
|
136
|
|
|
dataKnownUIDs(_prefix : string) : string[]; |
|
137
|
|
|
/** |
|
138
|
|
|
* Stores data for the uid and calls all callback functions registered |
|
139
|
|
|
* for that uid. |
|
140
|
|
|
* |
|
141
|
|
|
* @param _uid is the uid for which the data should be saved. |
|
142
|
|
|
* @param _data is the data which should be saved. |
|
143
|
|
|
*/ |
|
144
|
|
|
dataStoreUID(_uid : string, _data : object) : void; |
|
145
|
|
|
/** |
|
146
|
|
|
* Deletes the data for a certain uid from the local storage and |
|
147
|
|
|
* unregisters all callback functions associated to it. |
|
148
|
|
|
* |
|
149
|
|
|
* This does NOT update nextmatch! |
|
150
|
|
|
* Application code should use: egw(window).refresh(msg, app, id, "delete"); |
|
151
|
|
|
* |
|
152
|
|
|
* @param _uid is the uid which should be deleted. |
|
153
|
|
|
*/ |
|
154
|
|
|
dataDeleteUID(_uid : string) : void; |
|
155
|
|
|
/** |
|
156
|
|
|
* Force a refreash of the given uid from the server if known, and |
|
157
|
|
|
* calls all associated callbacks. |
|
158
|
|
|
* |
|
159
|
|
|
* If the UID does not have any registered callbacks, it cannot be refreshed because the required |
|
160
|
|
|
* execID and context are missing. |
|
161
|
|
|
* |
|
162
|
|
|
* @param {string} _uid is the uid which should be refreshed. |
|
163
|
|
|
* @return {boolean} True if the uid is known and can be refreshed, false if unknown and will not be refreshed |
|
164
|
|
|
*/ |
|
165
|
|
|
dataRefreshUID(_uid : string) : boolean; |
|
166
|
|
|
/** |
|
167
|
|
|
* Search for exact UID string or regular expression and return widgets using it |
|
168
|
|
|
* |
|
169
|
|
|
* @param {string|RegExp} _uid is the uid which should be refreshed. |
|
170
|
|
|
* @return {object} UID: array of (nextmatch-)wigetIds |
|
171
|
|
|
*/ |
|
172
|
|
|
dataSearchUIDs(_uid : string|RegExp) : /*et2_nextmatch*/any[]; |
|
173
|
|
|
/** |
|
174
|
|
|
* Search for exact UID string or regular expression and call registered (nextmatch-)widgets refresh function with given _type |
|
175
|
|
|
* |
|
176
|
|
|
* This method is preferable over dataRefreshUID for app code, as it takes care of things like counters too. |
|
177
|
|
|
* |
|
178
|
|
|
* It does not do anything for _type="add"! |
|
179
|
|
|
* |
|
180
|
|
|
* @param {string|RegExp} _uid is the uid which should be refreshed. |
|
181
|
|
|
* @param {string} _type "delete", "edit", "update", not useful for "add"! |
|
182
|
|
|
* @return {array} (nextmatch-)wigets refreshed |
|
183
|
|
|
*/ |
|
184
|
|
|
dataRefreshUIDs(_uid : string|RegExp, _type : "delete"|"edit"|"update") : /*et2_nextmatch*/any[]; |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* implemented in egw_debug.js |
|
188
|
|
|
*/ |
|
189
|
|
|
/** |
|
190
|
|
|
* Return current log-level |
|
191
|
|
|
*/ |
|
192
|
|
|
debug_level() : number; |
|
193
|
|
|
/** |
|
194
|
|
|
* The debug function can be used to send a debug message to the |
|
195
|
|
|
* java script console. The first parameter specifies the debug |
|
196
|
|
|
* level, all other parameters are passed to the corresponding |
|
197
|
|
|
* console function. |
|
198
|
|
|
* |
|
199
|
|
|
* @param {String} _level "navigation", "log", "info", "warn", "error" |
|
200
|
|
|
* @param args arguments to egw.debug |
|
201
|
|
|
*/ |
|
202
|
|
|
debug(_level : "navigation"|"log"|"info"|"warn"|"error", ...args : any[]) : void; |
|
203
|
|
|
/** |
|
204
|
|
|
* Display log to user because he clicked on icon showed by raise_error |
|
205
|
|
|
* |
|
206
|
|
|
* @returns {undefined} |
|
207
|
|
|
*/ |
|
208
|
|
|
show_log() : void; |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* implemented in egw_images.js |
|
212
|
|
|
*/ |
|
213
|
|
|
/** |
|
214
|
|
|
* Set imagemap, called from /api/images.php |
|
215
|
|
|
* |
|
216
|
|
|
* @param {array|object} _images |
|
217
|
|
|
* @param {boolean} _need_clone _images need to be cloned, as it is from different window context |
|
218
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
219
|
|
|
*/ |
|
220
|
|
|
set_images(_images: object, _need_clone? : boolean); |
|
221
|
|
|
/** |
|
222
|
|
|
* Get image URL for a given image-name and application |
|
223
|
|
|
* |
|
224
|
|
|
* @param {string} _name image-name without extension |
|
225
|
|
|
* @param {string} _app application name, default current app of window |
|
226
|
|
|
* @return string with URL of image |
|
227
|
|
|
*/ |
|
228
|
|
|
image(_name : string, _app? : string) : string; |
|
229
|
|
|
/** |
|
230
|
|
|
* Get image url for a given mime-type and option file |
|
231
|
|
|
* |
|
232
|
|
|
* @param {string} _mime |
|
233
|
|
|
* @param {string} _path vfs path to generate thumbnails for images |
|
234
|
|
|
* @param {number} _size defaults to 128 (only supported size currently) |
|
235
|
|
|
* @param {number} _mtime current modification time of file to allow infinit caching as url changes |
|
236
|
|
|
* @returns url of image |
|
237
|
|
|
*/ |
|
238
|
|
|
mime_icon(_mime : string, _path? : string, _size? : number, _mtime? : number) : string; |
|
239
|
|
|
/** |
|
240
|
|
|
* Create DOM img or svn element depending on url |
|
241
|
|
|
* |
|
242
|
|
|
* @param {string} _url source url |
|
243
|
|
|
* @param {string} _alt alt attribute for img tag |
|
244
|
|
|
* @returns DOM node |
|
245
|
|
|
*/ |
|
246
|
|
|
image_element(_url : string, _alt? : string) : HTMLImageElement; |
|
247
|
|
|
|
|
248
|
|
|
/** |
|
249
|
|
|
* implemented in egw_lang.js |
|
250
|
|
|
*/ |
|
251
|
|
|
/** |
|
252
|
|
|
* Set translation for a given application |
|
253
|
|
|
* |
|
254
|
|
|
* @param {string} _app |
|
255
|
|
|
* @param {object} _messages message => translation pairs |
|
256
|
|
|
* @param {boolean} _need_clone _messages need to be cloned, as it is from different window context |
|
257
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
258
|
|
|
*/ |
|
259
|
|
|
set_lang_arr(_app : string, _messages : object, _need_clone? : true) : void; |
|
260
|
|
|
/** |
|
261
|
|
|
* Translate a given phrase replacing optional placeholders |
|
262
|
|
|
* |
|
263
|
|
|
* @param {string} _msg message to translate |
|
264
|
|
|
* @param _args optional parameters (%{number} replacements) |
|
265
|
|
|
* @return {string} |
|
266
|
|
|
*/ |
|
267
|
|
|
lang(_msg : string, ..._args : string[]) : string; |
|
268
|
|
|
/** |
|
269
|
|
|
* Load default langfiles for an application: common, _appname, custom |
|
270
|
|
|
* |
|
271
|
|
|
* @param {Window} _window |
|
272
|
|
|
* @param {string} _appname name of application to load translations for |
|
273
|
|
|
* @param {function} _callback |
|
274
|
|
|
* @param {object} _context |
|
275
|
|
|
*/ |
|
276
|
|
|
langRequireApp(_window : Window, _appname : string, _callback? : Function, _context? : object) : void; |
|
277
|
|
|
/** |
|
278
|
|
|
* Includes the language files for the given applications -- if those |
|
279
|
|
|
* do not already exist, include them. |
|
280
|
|
|
* |
|
281
|
|
|
* @param {Window} _window is the window which needs the language -- this is |
|
282
|
|
|
* needed as the "ready" event has to be postponed in that window until |
|
283
|
|
|
* all lang files are included. |
|
284
|
|
|
* @param {array} _apps is an array containing the applications for which the |
|
285
|
|
|
* data is needed as objects of the following form: |
|
286
|
|
|
* { |
|
287
|
|
|
* app: <APPLICATION NAME>, |
|
288
|
|
|
* lang: <LANGUAGE CODE> |
|
289
|
|
|
* } |
|
290
|
|
|
* @param {function} _callback called after loading, if not given ready event will be postponed instead |
|
291
|
|
|
* @param {object} _context for callback |
|
292
|
|
|
*/ |
|
293
|
|
|
langRequire(_window : Window, _apps : {app: string, lang: string}[], _callback? : Function, _context? : object) : void; |
|
294
|
|
|
/** |
|
295
|
|
|
* Check if $app is in the registry and has an entry for $name |
|
296
|
|
|
* |
|
297
|
|
|
* @param {string} _app app-name |
|
298
|
|
|
* @param {string} _name name / key in the registry, eg. 'view' |
|
299
|
|
|
* @return {string|object|boolean} false if $app is not registered, otherwise string with the value for $name |
|
300
|
|
|
*/ |
|
301
|
|
|
link_get_registry(_app : string, _name : string) : string|object|boolean; |
|
302
|
|
|
/** |
|
303
|
|
|
* Get mime-type information from app-registry |
|
304
|
|
|
* |
|
305
|
|
|
* We prefer a full match over a wildcard like 'text/*' (written as regualr expr. "/^text\\//" |
|
306
|
|
|
* |
|
307
|
|
|
* @param {string} _type |
|
308
|
|
|
* @return {object} with values for keys 'menuaction', 'mime_id' (path) or 'mime_url' and options 'mime_popup' and other values to pass one |
|
309
|
|
|
*/ |
|
310
|
|
|
get_mime_info(_type : string) : {menuaction : string, mime_id? : string, mime_url? : string, mime_popup? : string}|null; |
|
311
|
|
|
/** |
|
312
|
|
|
* Get handler (link-data) for given path and mime-type |
|
313
|
|
|
* |
|
314
|
|
|
* @param {string|object} _path vfs path, egw_link::set_data() id or |
|
315
|
|
|
* object with attr path, optinal download_url or id, app2 and id2 (path=/apps/app2/id2/id) |
|
316
|
|
|
* @param {string} _type mime-type, if not given in _path object |
|
317
|
|
|
* @return {string|object} string with EGw relative link, array with get-parameters for '/index.php' or null (directory and not filemanager access) |
|
318
|
|
|
*/ |
|
319
|
|
|
mime_open(_path : string|object, _type : string) : string|object; |
|
320
|
|
|
/** |
|
321
|
|
|
* Get list of link-aware apps the user has rights to use |
|
322
|
|
|
* |
|
323
|
|
|
* @param {string} _must_support capability the apps need to support, eg. 'add', default ''=list all apps |
|
324
|
|
|
* @return {object} with app => title pairs |
|
325
|
|
|
*/ |
|
326
|
|
|
link_app_list(_must_support? : string) : object; |
|
327
|
|
|
/** |
|
328
|
|
|
* Set link registry |
|
329
|
|
|
* |
|
330
|
|
|
* @param {object} _registry whole registry or entries for just one app |
|
331
|
|
|
* @param {string} _app |
|
332
|
|
|
* @param {boolean} _need_clone _images need to be cloned, as it is from different window context |
|
333
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
334
|
|
|
*/ |
|
335
|
|
|
set_link_registry(_registry : object, _app? : string, _need_clone? : boolean) : void; |
|
336
|
|
|
/** |
|
337
|
|
|
* Generate a url with get parameters |
|
338
|
|
|
* |
|
339
|
|
|
* Please note, the values of the query get url encoded! |
|
340
|
|
|
* |
|
341
|
|
|
* @param {string} _url a url relative to the egroupware install root, it can contain a query too or |
|
342
|
|
|
* full url containing a schema and "://" |
|
343
|
|
|
* @param {object|string} _extravars query string arguements as string or array (prefered) |
|
344
|
|
|
* if string is used ambersands in vars have to be already urlencoded as '%26', function ensures they get NOT double encoded |
|
345
|
|
|
* @return {string} generated url |
|
346
|
|
|
*/ |
|
347
|
|
|
link(_url : string, _extravars? : string|object) : string; |
|
348
|
|
|
/** |
|
349
|
|
|
* Query a title of _app/_id |
|
350
|
|
|
* |
|
351
|
|
|
* @param {string} _app |
|
352
|
|
|
* @param {string|number} _id |
|
353
|
|
|
* @param {function} _callback optinal callback, required if for responses from the server |
|
354
|
|
|
* @param {object} _context context for the callback |
|
355
|
|
|
* @param {boolean} _force_reload true load again from server, even if already cached |
|
356
|
|
|
* @return {string|null} string with title if it exist in local cache or null if not |
|
357
|
|
|
*/ |
|
358
|
|
|
link_title(_app : string, _id : string|number, _callback? : Function, _context? : object, _force_reload? : boolean) : string|null; |
|
359
|
|
|
/** |
|
360
|
|
|
* Callback to add all current title requests |
|
361
|
|
|
* |
|
362
|
|
|
* @param {object} _params of parameters, only first parameter is used |
|
363
|
|
|
*/ |
|
364
|
|
|
// internal: link_title_before_send(_params : string[]) : void; |
|
365
|
|
|
/** |
|
366
|
|
|
* Callback for server response |
|
367
|
|
|
* |
|
368
|
|
|
* @param {object} _response _app => _id => title |
|
369
|
|
|
*/ |
|
370
|
|
|
// internal: link_title_callback(_response : object) |
|
371
|
|
|
/** |
|
372
|
|
|
* Create quick add selectbox |
|
373
|
|
|
* |
|
374
|
|
|
* @param {HTMLElement|string} _parent parent or selector of it to create selectbox in |
|
375
|
|
|
*/ |
|
376
|
|
|
link_quick_add(_parent : HTMLElement|string) : void; |
|
377
|
|
|
|
|
378
|
|
|
/** |
|
379
|
|
|
* implemented in egw_preferences.js |
|
380
|
|
|
*/ |
|
381
|
|
|
/** |
|
382
|
|
|
* Setting prefs for an app or 'common' |
|
383
|
|
|
* |
|
384
|
|
|
* @param {object} _data object with name: value pairs to set |
|
385
|
|
|
* @param {string} _app application name, 'common' or undefined to prefes of all apps at once |
|
386
|
|
|
* @param {boolean} _need_clone _data need to be cloned, as it is from different window context |
|
387
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
388
|
|
|
*/ |
|
389
|
|
|
set_preferences(_data : object, _app? : string, _need_clone? : boolean) : void; |
|
390
|
|
|
/** |
|
391
|
|
|
* Query an EGroupware user preference |
|
392
|
|
|
* |
|
393
|
|
|
* If a prefernce is not already loaded (only done for "common" by default), it is synchroniosly queryed from the server! |
|
394
|
|
|
* |
|
395
|
|
|
* @param {string} _name name of the preference, eg. 'dateformat', or '*' to get all the application's preferences |
|
396
|
|
|
* @param {string} _app default 'common' |
|
397
|
|
|
* @param {function|undefined} _callback optional callback, if preference needs loading first |
|
398
|
|
|
* if false given and preference is not loaded, undefined is return and no (synchronious) request is send to server |
|
399
|
|
|
* @param {object} _context context for callback |
|
400
|
|
|
* @return string|object|bool preference value or false, if callback given and preference not yet loaded |
|
401
|
|
|
* of object with all prefs for _name="*" |
|
402
|
|
|
*/ |
|
403
|
|
|
preference(_name : string, _app? : string, _callback? : Function, _context? : object) : string|object|boolean; |
|
404
|
|
|
/** |
|
405
|
|
|
* Set a preference and sends it to the server |
|
406
|
|
|
* |
|
407
|
|
|
* Server will silently ignore setting preferences, if user has no right to do so! |
|
408
|
|
|
* |
|
409
|
|
|
* Preferences are only send to server, if they are changed! |
|
410
|
|
|
* |
|
411
|
|
|
* @param {string} _app application name or "common" |
|
412
|
|
|
* @param {string} _name name of the pref |
|
413
|
|
|
* @param _val value of the pref, null, undefined or "" to unset it |
|
414
|
|
|
* @param {function} _callback Function passed along to the queue, called after preference is set server-side, |
|
415
|
|
|
* IF the preference is changed / has a value different from the current one |
|
416
|
|
|
*/ |
|
417
|
|
|
set_preference(_app : string, _name : string, _val : any, _callback? : Function) : void; |
|
418
|
|
|
/** |
|
419
|
|
|
* Call context / open app specific preferences function |
|
420
|
|
|
* |
|
421
|
|
|
* @param {string} name type 'acl', 'prefs', or 'cats' |
|
422
|
|
|
* @param {(array|object)} apps array with apps allowing to call that type, or object/hash with app and boolean or hash with url-params |
|
423
|
|
|
*/ |
|
424
|
|
|
show_preferences(name : "acl"|"prefs"|"cats", apps : object|string[]) : void; |
|
425
|
|
|
/** |
|
426
|
|
|
* Setting prefs for an app or 'common' |
|
427
|
|
|
* |
|
428
|
|
|
* @param {object} _data |
|
429
|
|
|
* @param {string} _app application name or undefined to set grants of all apps at once |
|
430
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
431
|
|
|
*/ |
|
432
|
|
|
set_grants(_data : object, _app? : string) : void; |
|
433
|
|
|
/** |
|
434
|
|
|
* Query an EGroupware user preference |
|
435
|
|
|
* |
|
436
|
|
|
* We currently load grants from all apps in egw.js, so no need for a callback or promise. |
|
437
|
|
|
* |
|
438
|
|
|
* @param {string} _app app-name |
|
439
|
|
|
* @ param {function|false|undefined} _callback optional callback, if preference needs loading first |
|
440
|
|
|
* if false given and preference is not loaded, undefined is return and no (synchronious) request is send to server |
|
441
|
|
|
* @ param {object} _context context for callback |
|
442
|
|
|
* @return grant object, false if not (yet) loaded and no callback or undefined |
|
443
|
|
|
*/ |
|
444
|
|
|
grants(_app : string) /*, _callback, _context)*/ : any; |
|
445
|
|
|
|
|
446
|
|
|
/** |
|
447
|
|
|
* implemented in egw_store.js |
|
448
|
|
|
*/ |
|
449
|
|
|
/** |
|
450
|
|
|
* Retrieve a value from session storage |
|
451
|
|
|
* |
|
452
|
|
|
* @param {string} application Name of application, or common |
|
453
|
|
|
* @param {string} key |
|
454
|
|
|
* @returns {string|null} |
|
455
|
|
|
*/ |
|
456
|
|
|
getSessionItem(application : string, key : string) : string; |
|
457
|
|
|
/** |
|
458
|
|
|
* Set a value in session storage |
|
459
|
|
|
* |
|
460
|
|
|
* @param {string} application Name of application, or common |
|
461
|
|
|
* @param {string} key |
|
462
|
|
|
* @param {string} value |
|
463
|
|
|
*/ |
|
464
|
|
|
setSessionItem(application : string, key : string, value : string) : void; |
|
465
|
|
|
/** |
|
466
|
|
|
* Remove a value from session storage |
|
467
|
|
|
* @param {string} application |
|
468
|
|
|
* @param {string} key |
|
469
|
|
|
*/ |
|
470
|
|
|
removeSessionItem(application : string, key : string) : void; |
|
471
|
|
|
/** |
|
472
|
|
|
* Set an item to localStorage |
|
473
|
|
|
* |
|
474
|
|
|
* @param {string} application an application name or a prefix |
|
475
|
|
|
* @param {string} item |
|
476
|
|
|
* @param {string} value |
|
477
|
|
|
* @returns {undefined} returns undefined |
|
478
|
|
|
*/ |
|
479
|
|
|
setLocalStorageItem(application : string, item : string, value : string); |
|
480
|
|
|
/** |
|
481
|
|
|
* Get an item from localStorage |
|
482
|
|
|
* |
|
483
|
|
|
* @param {string} application an application name or prefix |
|
484
|
|
|
* @param {string} item an item name stored in localStorage |
|
485
|
|
|
* @return {string|null} reutrns requested item value otherwise null |
|
486
|
|
|
*/ |
|
487
|
|
|
getLocalStorageItem(application : string, item : string) : string|null; |
|
488
|
|
|
/** |
|
489
|
|
|
* Remove an item from localStorage |
|
490
|
|
|
* |
|
491
|
|
|
* @param {string} application application name or prefix |
|
492
|
|
|
* @param {string} item an item name to remove |
|
493
|
|
|
*/ |
|
494
|
|
|
removeLocalStorageItem(application : string, item : string) : void; |
|
495
|
|
|
|
|
496
|
|
|
/** |
|
497
|
|
|
* implemented in egw_user.js |
|
498
|
|
|
*/ |
|
499
|
|
|
/** |
|
500
|
|
|
* Set data of current user |
|
501
|
|
|
* |
|
502
|
|
|
* @param {object} _data |
|
503
|
|
|
* @param {boolean} _need_clone _data need to be cloned, as it is from different window context |
|
504
|
|
|
* and therefore will be inaccessible in IE, after that window is closed |
|
505
|
|
|
*/ |
|
506
|
|
|
set_user(_data : object, _need_clone? : boolean) : void; |
|
507
|
|
|
/** |
|
508
|
|
|
* Get data about current user |
|
509
|
|
|
* |
|
510
|
|
|
* @param {string} _field |
|
511
|
|
|
* - 'account_id','account_lid','person_id','account_status', |
|
512
|
|
|
* - 'account_firstname','account_lastname','account_email','account_fullname','account_phone' |
|
513
|
|
|
* - 'apps': object with app => data pairs the user has run-rights for |
|
514
|
|
|
* @return {string|array|null} |
|
515
|
|
|
*/ |
|
516
|
|
|
user(_field : string) : any; |
|
517
|
|
|
/** |
|
518
|
|
|
* Return data of apps the user has rights to run |
|
519
|
|
|
* |
|
520
|
|
|
* Can be used the check of run rights like: if (egw.app('addressbook')) { do something if user has addressbook rights } |
|
521
|
|
|
* |
|
522
|
|
|
* @param {string} _app |
|
523
|
|
|
* @param {string} _name attribute to return, default return whole app-data-object |
|
524
|
|
|
* @return Iapplication|string|undefined undefined if not found |
|
525
|
|
|
*/ |
|
526
|
|
|
app(_app : string, _name : string) : string|undefined; |
|
527
|
|
|
app(_app : string) : Iapplication|undefined; |
|
528
|
|
|
/** |
|
529
|
|
|
* Get a list of accounts the user has access to |
|
530
|
|
|
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups' |
|
531
|
|
|
* |
|
532
|
|
|
* @param {string} type |
|
533
|
|
|
* @returns {array} |
|
534
|
|
|
*/ |
|
535
|
|
|
accounts(type : "accounts"|"groups"|"both"|"owngroups") : object[]; |
|
536
|
|
|
/** |
|
537
|
|
|
* Get account-infos for given numerical _account_ids |
|
538
|
|
|
* |
|
539
|
|
|
* @param {int|array} _account_ids |
|
540
|
|
|
* @param {string} _field default 'account_email' |
|
541
|
|
|
* @param {boolean} _resolve_groups true: return attribute for all members, false: return attribute of group |
|
542
|
|
|
* @param {function} _callback |
|
543
|
|
|
* @param {object} _context |
|
544
|
|
|
*/ |
|
545
|
|
|
accountData(_account_ids : number|number[], _field : string, _resolve_groups : boolean, |
|
546
|
|
|
_callback : Function, _context : object) : void; |
|
547
|
|
|
/** |
|
548
|
|
|
* Set account data. This one can be called from the server to pre-fill the cache. |
|
549
|
|
|
* |
|
550
|
|
|
* @param {object} _data account_id => value pairs |
|
551
|
|
|
* @param {String} _field |
|
552
|
|
|
*/ |
|
553
|
|
|
set_account_cache(_data : object, _field : string) : void; |
|
554
|
|
|
/** |
|
555
|
|
|
* Set specified account-data of selected user in an other widget |
|
556
|
|
|
* |
|
557
|
|
|
* Used eg. in template as: onchange="egw.set_account_data(widget, 'target', 'account_email')" |
|
558
|
|
|
* |
|
559
|
|
|
* @param {et2_widget} _src_widget widget to select the user |
|
560
|
|
|
* @param {string} _target_name name of widget to set the data |
|
561
|
|
|
* @param {string} _field name of data to set eg. "account_email" or "{account_fullname} <{account_email}>" |
|
562
|
|
|
*/ |
|
563
|
|
|
set_account_data(_src_widget : /*et2_widget*/object, _target_name : string, _field : string) : void; |
|
564
|
|
|
/** |
|
565
|
|
|
* Invalidate client-side account cache |
|
566
|
|
|
* |
|
567
|
|
|
* For _type == "add" we invalidate the whole cache currently. |
|
568
|
|
|
* |
|
569
|
|
|
* @param {number} _id nummeric account_id, !_id will invalidate whole cache |
|
570
|
|
|
* @param {string} _type "add", "delete", "update" or "edit" |
|
571
|
|
|
*/ |
|
572
|
|
|
invalidate_account(_id? : number, _type? : "add"|"delete"|"update"|"edit") : void; |
|
573
|
|
|
|
|
574
|
|
|
/** |
|
575
|
|
|
* implemented in egw_utils.js |
|
576
|
|
|
*/ |
|
577
|
|
|
/** |
|
578
|
|
|
* Get url for ajax request |
|
579
|
|
|
* |
|
580
|
|
|
* @param _menuaction |
|
581
|
|
|
* @return full url incl. webserver_url |
|
582
|
|
|
*/ |
|
583
|
|
|
ajaxUrl(_menuaction : string) : string; |
|
584
|
|
|
/** |
|
585
|
|
|
* Get window of element |
|
586
|
|
|
* |
|
587
|
|
|
* @param _elem |
|
588
|
|
|
*/ |
|
589
|
|
|
elemWindow(_elem : HTMLElement) : Window; |
|
590
|
|
|
/** |
|
591
|
|
|
* Get unique identifier |
|
592
|
|
|
* |
|
593
|
|
|
* @return {string} hex encoded, per call incremented counter |
|
594
|
|
|
*/ |
|
595
|
|
|
uid() : string; |
|
596
|
|
|
/** |
|
597
|
|
|
* Decode encoded vfs special chars |
|
598
|
|
|
* |
|
599
|
|
|
* @param {string} _path path to decode |
|
600
|
|
|
* @return {string} |
|
601
|
|
|
*/ |
|
602
|
|
|
decodePath(_path : string) : string; |
|
603
|
|
|
/** |
|
604
|
|
|
* Encode vfs special chars excluding / |
|
605
|
|
|
* |
|
606
|
|
|
* @param {string} _path path to decode |
|
607
|
|
|
* @return {string} |
|
608
|
|
|
*/ |
|
609
|
|
|
encodePath(_path : string) : string; |
|
610
|
|
|
/** |
|
611
|
|
|
* Encode vfs special chars removing / |
|
612
|
|
|
* |
|
613
|
|
|
* '%' => '%25', |
|
614
|
|
|
* '#' => '%23', |
|
615
|
|
|
* '?' => '%3F', |
|
616
|
|
|
* '/' => '', // better remove it completly |
|
617
|
|
|
* |
|
618
|
|
|
* @param {string} _comp path to decode |
|
619
|
|
|
* @return {string} |
|
620
|
|
|
*/ |
|
621
|
|
|
encodePathComponent(_comp : string) : string; |
|
622
|
|
|
/** |
|
623
|
|
|
* Escape HTML special chars, just like PHP |
|
624
|
|
|
* |
|
625
|
|
|
* @param {string} s String to encode |
|
626
|
|
|
* |
|
627
|
|
|
* @return {string} |
|
628
|
|
|
*/ |
|
629
|
|
|
htmlspecialchars(s : string) : string; |
|
630
|
|
|
/** |
|
631
|
|
|
* If an element has display: none (or a parent like that), it has no size. |
|
632
|
|
|
* Use this to get its dimensions anyway. |
|
633
|
|
|
* |
|
634
|
|
|
* @param element HTML element |
|
635
|
|
|
* @param boolOuter Pass true to get outerWidth() / outerHeight() instead of width() / height() |
|
636
|
|
|
* |
|
637
|
|
|
* @return Object [w: width, h: height] |
|
638
|
|
|
* |
|
639
|
|
|
* @author Ryan Wheale |
|
640
|
|
|
* @see http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/ |
|
641
|
|
|
*/ |
|
642
|
|
|
getHiddenDimensions(element : HTMLElement, boolOuter? : boolean) : {h: number, w: number, top: number, left: number}; |
|
643
|
|
|
/** |
|
644
|
|
|
* Store a window's name in egw.store so we can have a list of open windows |
|
645
|
|
|
* |
|
646
|
|
|
* @param {string} appname |
|
647
|
|
|
* @param {Window} popup |
|
648
|
|
|
*/ |
|
649
|
|
|
storeWindow(appname: boolean, popup : Window) : void; |
|
650
|
|
|
/** |
|
651
|
|
|
* Get a list of the names of open popups |
|
652
|
|
|
* |
|
653
|
|
|
* Using the name, you can get a reference to the popup using: |
|
654
|
|
|
* window.open('', name); |
|
655
|
|
|
* Popups that were not given a name when they were opened are not tracked. |
|
656
|
|
|
* |
|
657
|
|
|
* @param {string} appname Application that owns/opened the popup |
|
658
|
|
|
* @param {string} regex Optionally filter names by the given regular expression |
|
659
|
|
|
* |
|
660
|
|
|
* @returns {string[]} List of window names |
|
661
|
|
|
*/ |
|
662
|
|
|
getOpenWindows(appname : string, regex? : string) : string[]; |
|
663
|
|
|
/** |
|
664
|
|
|
* Notify egw of closing a named window, which removes it from the list |
|
665
|
|
|
* |
|
666
|
|
|
* @param {String} appname |
|
667
|
|
|
* @param {Window|String} closed Window that was closed, or its name |
|
668
|
|
|
*/ |
|
669
|
|
|
windowClosed(appname : string, closed : Window|string) : void; |
|
670
|
|
|
} |
|
671
|
|
|
|
|
672
|
|
|
declare class JsonRequest |
|
673
|
|
|
{ |
|
674
|
|
|
/** |
|
675
|
|
|
* Sends the assembled request to the server |
|
676
|
|
|
* @param {boolean|"keepalive"} _async true: asynchronious request, false: synchronious request, |
|
677
|
|
|
* "keepalive": async. request with keepalive===true / sendBeacon, to be used in beforeunload event |
|
678
|
|
|
* @param {string} method ='POST' allow to eg. use a (cachable) 'GET' request instead of POST |
|
679
|
|
|
* @param {function} error option error callback(_xmlhttp, _err) used instead our default this.error |
|
680
|
|
|
* |
|
681
|
|
|
* @return {jqXHR} jQuery jqXHR request object |
|
682
|
|
|
*/ |
|
683
|
|
|
sendRequest(async? : boolean|"keepalive", method? : "POST"|"GET", error? : Function) |
|
684
|
|
|
/** |
|
685
|
|
|
* Open websocket to push server (and keeps it open) |
|
686
|
|
|
* |
|
687
|
|
|
* @param {string} url this.websocket(s)://host:port |
|
688
|
|
|
* @param {array} tokens tokens to subscribe too |
|
689
|
|
|
* @param {function} error option error callback(_msg) used instead our default this.error |
|
690
|
|
|
* @param {int} reconnect timeout in ms (internal) |
|
691
|
|
|
*/ |
|
692
|
|
|
openWebSocket(url : string, tokens : string[], error : Function, reconnect : number); |
|
693
|
|
|
} |
|
694
|
|
|
|
|
695
|
|
|
/** |
|
696
|
|
|
* Interface for window local methods (plus the global ones) |
|
697
|
|
|
*/ |
|
698
|
|
|
declare interface IegwWndLocal extends IegwGlobal |
|
699
|
|
|
{ |
|
700
|
|
|
window : Window; |
|
701
|
|
|
/** |
|
702
|
|
|
* implemented in egw_css.js |
|
703
|
|
|
*/ |
|
704
|
|
|
/** |
|
705
|
|
|
* The css function can be used to introduce a rule for the given css |
|
706
|
|
|
* selector. So you're capable of adding new custom css selector while |
|
707
|
|
|
* runtime and also update them. |
|
708
|
|
|
* |
|
709
|
|
|
* @param _selector is the css select which can be used to apply the |
|
710
|
|
|
* stlyes to the html elements. |
|
711
|
|
|
* @param _rule is the rule which should be connected to the selector. |
|
712
|
|
|
* if empty or omitted, the given selector gets removed. |
|
713
|
|
|
*/ |
|
714
|
|
|
css(_selector : string, _rule? : string); |
|
715
|
|
|
|
|
716
|
|
|
/** |
|
717
|
|
|
* implemented in egw_json.js |
|
718
|
|
|
*/ |
|
719
|
|
|
/** The constructor of the egw_json_request class. |
|
720
|
|
|
* |
|
721
|
|
|
* @param _menuaction the menuaction function which should be called and |
|
722
|
|
|
* which handles the actual request. If the menuaction is a full featured |
|
723
|
|
|
* url, this one will be used instead. |
|
724
|
|
|
* @param _parameters which should be passed to the menuaction function. |
|
725
|
|
|
* @param {boolean|"keepalive"} _async true: asynchronious request, false: synchronious request, |
|
726
|
|
|
* "keepalive": async. request with keepalive===true / sendBeacon, to be used in beforeunload event |
|
727
|
|
|
* @param _callback specifies the callback function which should be |
|
728
|
|
|
* called, once the request has been sucessfully executed. |
|
729
|
|
|
* @param _context is the context which will be used for the callback function |
|
730
|
|
|
* @param _sender is a parameter being passed to the _callback function |
|
731
|
|
|
*/ |
|
732
|
|
|
json(_menuaction : string, _parameters? : any[], _callback? : Function, _context? : object, _async? : boolean|"keepalive", _sender?) : JsonRequest; |
|
733
|
|
|
/** |
|
734
|
|
|
* Registers a new handler plugin. |
|
735
|
|
|
* |
|
736
|
|
|
* @param _callback is the callback function which should be called |
|
737
|
|
|
* whenever a response is comming from the server. |
|
738
|
|
|
* @param _context is the context in which the callback function should |
|
739
|
|
|
* be called. If null is given, the plugin is executed in the context |
|
740
|
|
|
* of the request object context. |
|
741
|
|
|
* @param _type is an optional parameter defaulting to 'global'. |
|
742
|
|
|
* it describes the response type which this plugin should be |
|
743
|
|
|
* handling. |
|
744
|
|
|
* @param {boolean} [_global=false] Register the handler globally or |
|
745
|
|
|
* locally. Global handlers must stay around, so should be used |
|
746
|
|
|
* for global modules. |
|
747
|
|
|
*/ |
|
748
|
|
|
registerJSONPlugin(_callback : Function, _context, _type, _global); |
|
749
|
|
|
/** |
|
750
|
|
|
* Removes a previously registered plugin. |
|
751
|
|
|
* |
|
752
|
|
|
* @param _callback is the callback function which should be called |
|
753
|
|
|
* whenever a response is comming from the server. |
|
754
|
|
|
* @param _context is the context in which the callback function should |
|
755
|
|
|
* be called. |
|
756
|
|
|
* @param _type is an optional parameter defaulting to 'global'. |
|
757
|
|
|
* it describes the response type which this plugin should be |
|
758
|
|
|
* handling. |
|
759
|
|
|
* @param {boolean} [_global=false] Remove a global or local handler. |
|
760
|
|
|
*/ |
|
761
|
|
|
unregisterJSONPlugin(_callback : Function, _context, _type : string, _global : boolean); |
|
762
|
|
|
|
|
763
|
|
|
/** |
|
764
|
|
|
* implemented in egw_files.js |
|
765
|
|
|
*/ |
|
766
|
|
|
/** |
|
767
|
|
|
* Load and execute javascript file(s) in order |
|
768
|
|
|
* |
|
769
|
|
|
* @memberOf egw |
|
770
|
|
|
* @param {string|array} _jsFiles (array of) urls to include |
|
771
|
|
|
* @param {function} _callback called after JS files are loaded and executed |
|
772
|
|
|
* @param {object} _context |
|
773
|
|
|
* @param {string} _prefix prefix for _jsFiles |
|
774
|
|
|
*/ |
|
775
|
|
|
includeJS(_jsFiles : string|string[], _callback : Function, _context? : object, _prefix? : string); |
|
776
|
|
|
/** |
|
777
|
|
|
* Check if file is already included and optional mark it as included if not yet included |
|
778
|
|
|
* |
|
779
|
|
|
* Check does NOT differenciate between file.min.js and file.js. |
|
780
|
|
|
* Only .js get's recored in files for further checking, if _add_if_not set. |
|
781
|
|
|
* |
|
782
|
|
|
* @param {string} _file |
|
783
|
|
|
* @param {boolean} _add_if_not if true mark file as included |
|
784
|
|
|
* @return boolean true if file already included, false if not |
|
785
|
|
|
*/ |
|
786
|
|
|
included(_file : string, _add_if_not? : boolean) : boolean; |
|
787
|
|
|
/** |
|
788
|
|
|
* Include a CSS file |
|
789
|
|
|
* |
|
790
|
|
|
* @param {string|array} _cssFiles full url of file to include |
|
791
|
|
|
*/ |
|
792
|
|
|
includeCSS(_cssFiles : string|string[]) : void; |
|
793
|
|
|
|
|
794
|
|
|
/** |
|
795
|
|
|
* implemented in egw_jsonq.js |
|
796
|
|
|
*/ |
|
797
|
|
|
/** |
|
798
|
|
|
* Send a queued JSON call to the server |
|
799
|
|
|
* |
|
800
|
|
|
* @param {string} _menuaction the menuaction function which should be called and |
|
801
|
|
|
* which handles the actual request. If the menuaction is a full featured |
|
802
|
|
|
* url, this one will be used instead. |
|
803
|
|
|
* @param {array} _parameters which should be passed to the menuaction function. |
|
804
|
|
|
* @param {function} _callback callback function which should be called upon a "data" response is received |
|
805
|
|
|
* @param {object} _sender is the reference object the callback function should get |
|
806
|
|
|
* @param {function} _callbeforesend optional callback function which can modify the parameters, eg. to do some own queuing |
|
807
|
|
|
* @return string uid of the queued request |
|
808
|
|
|
*/ |
|
809
|
|
|
jsonq(_menuaction : string, _parameters? : any[], _callback? : Function, _sender? : object, _callbeforesend? : Function) : string; |
|
810
|
|
|
|
|
811
|
|
|
/** |
|
812
|
|
|
* implemented in egw_message.js |
|
813
|
|
|
*/ |
|
814
|
|
|
/** |
|
815
|
|
|
* Display an error or regular message |
|
816
|
|
|
* |
|
817
|
|
|
* Alle messages but type "success" are displayed 'til next message or user clicks on it. |
|
818
|
|
|
* |
|
819
|
|
|
* @param {string} _msg message to show or empty to remove previous message |
|
820
|
|
|
* @param {string} _type 'help', 'info', 'error', 'warning' or 'success' (default) |
|
821
|
|
|
* @param {string} _discardID unique string id (appname:id) in order to register |
|
822
|
|
|
* the message as discardable. If no appname given, the id will be prefixed with |
|
823
|
|
|
* current app. The discardID will be stored in local storage. |
|
824
|
|
|
*/ |
|
825
|
|
|
message(_msg : string, _type? : "help"|"info"|"error"|"warning"|"success", _discardID? : string) : void; |
|
826
|
|
|
/** |
|
827
|
|
|
* Are we running in a popup |
|
828
|
|
|
* |
|
829
|
|
|
* @returns {boolean} true: popup, false: main window |
|
830
|
|
|
*/ |
|
831
|
|
|
is_popup() : boolean; |
|
832
|
|
|
/** |
|
833
|
|
|
* Active app independent if we are using a framed template-set or not |
|
834
|
|
|
* |
|
835
|
|
|
* @returns {string} |
|
836
|
|
|
*/ |
|
837
|
|
|
app_name() : string; |
|
838
|
|
|
/** |
|
839
|
|
|
* Update app-header and website-title |
|
840
|
|
|
* |
|
841
|
|
|
* @param {string} _header |
|
842
|
|
|
* @param {string} _app Application name, if not for the current app |
|
843
|
|
|
*/ |
|
844
|
|
|
app_header(_header : string, _app? : string) |
|
845
|
|
|
/** |
|
846
|
|
|
* Loading prompt is for building a loading animation and show it to user |
|
847
|
|
|
* while a request is under progress. |
|
848
|
|
|
* |
|
849
|
|
|
* @param {string} _id a unique id to be able to distinguish loading-prompts |
|
850
|
|
|
* @param {boolean} _stat true to show the loading and false to remove it |
|
851
|
|
|
* @param {string} _msg a message to show while loading |
|
852
|
|
|
* @param {string|jQuery _node} _node DOM selector id or jquery DOM object, default is body |
|
853
|
|
|
* @param {string} _mode defines the animation mode, default mode is spinner |
|
854
|
|
|
* animation modes: |
|
855
|
|
|
* - spinner: a sphere with a spinning bar inside (default) |
|
856
|
|
|
* - horizental: a horizental bar |
|
857
|
|
|
* |
|
858
|
|
|
* @returns {jquery dom object|null} returns jQuery DOM object or null in case of hiding |
|
859
|
|
|
*/ |
|
860
|
|
|
loading_prompt(_id : string, _stat : boolean, _msg? : string, _node? : string|JQuery|HTMLElement, _mode? : "spinner"|"horizontal") : JQuery|null; |
|
861
|
|
|
/** |
|
862
|
|
|
* Refresh given application _targetapp display of entry _app _id, incl. outputting _msg |
|
863
|
|
|
* |
|
864
|
|
|
* Default implementation here only reloads window with it's current url with an added msg=_msg attached |
|
865
|
|
|
* |
|
866
|
|
|
* @param {string} _msg message (already translated) to show, eg. 'Entry deleted' |
|
867
|
|
|
* @param {string} _app application name |
|
868
|
|
|
* @param {(string|number)} _id id of entry to refresh or null |
|
869
|
|
|
* @param {string} _type either 'update', 'edit', 'delete', 'add' or null |
|
870
|
|
|
* - update: request just modified data from given rows. Sorting is not considered, |
|
871
|
|
|
* so if the sort field is changed, the row will not be moved. |
|
872
|
|
|
* - edit: rows changed, but sorting may be affected. Requires full reload. |
|
873
|
|
|
* - delete: just delete the given rows clientside (no server interaction neccessary) |
|
874
|
|
|
* - add: requires full reload for proper sorting |
|
875
|
|
|
* @param {string} _targetapp which app's window should be refreshed, default current |
|
876
|
|
|
* @param {(string|RegExp)} _replace regular expression to replace in url |
|
877
|
|
|
* @param {string} _with |
|
878
|
|
|
* @param {string} _msg_type 'error', 'warning' or 'success' (default) |
|
879
|
|
|
* @param {object|null} _links app => array of ids of linked entries |
|
880
|
|
|
* or null, if not triggered on server-side, which adds that info |
|
881
|
|
|
*/ |
|
882
|
|
|
refresh(_msg : string, _app : string, _id? : string|number, _type? : "update"|"edit"|"delete"|"add"|null, |
|
883
|
|
|
_targetapp? : string, _replace? : string|RegExp, _with? : string, _msg_type? : "error"|"warning"|"success", _links? : object) : void; |
|
884
|
|
|
/** |
|
885
|
|
|
* Handle a push notification about entry changes from the websocket |
|
886
|
|
|
* |
|
887
|
|
|
* @param pushData |
|
888
|
|
|
* @param {string} pushData.app application name |
|
889
|
|
|
* @param {(string|number)} pushData.id id of entry to refresh or null |
|
890
|
|
|
* @param {string} pushData.type either 'update', 'edit', 'delete', 'add' or null |
|
891
|
|
|
* - update: request just modified data from given rows. Sorting is not considered, |
|
892
|
|
|
* so if the sort field is changed, the row will not be moved. |
|
893
|
|
|
* - edit: rows changed, but sorting may be affected. Requires full reload. |
|
894
|
|
|
* - delete: just delete the given rows clientside (no server interaction neccessary) |
|
895
|
|
|
* - add: requires full reload for proper sorting |
|
896
|
|
|
* @param {object|null} pushData.acl Extra data for determining relevance. eg: owner or responsible to decide if update is necessary |
|
897
|
|
|
* @param {number} pushData.account_id User that caused the notification |
|
898
|
|
|
*/ |
|
899
|
|
|
// internal: push(pushData : {app:string, id:string|number}, type?:"update"|"edit"|"delete"|"add", acl? : any, account_id: number}) : void; |
|
900
|
|
|
|
|
901
|
|
|
/** |
|
902
|
|
|
* implemented in egw_notifications.js |
|
903
|
|
|
*/ |
|
904
|
|
|
/** |
|
905
|
|
|
* |
|
906
|
|
|
* @param {string} _title a string to be shown as notification message |
|
907
|
|
|
* @param {object} _options an object of Notification possible options: |
|
908
|
|
|
* options = { |
|
909
|
|
|
* dir: // direction of notification to be shown rtl, ltr or auto |
|
910
|
|
|
* lang: // a valid BCP 47 language tag |
|
911
|
|
|
* body: // DOM body |
|
912
|
|
|
* icon: // parse icon URL, default icon is app icon |
|
913
|
|
|
* tag: // a string value used for tagging an instance of notification, default is app name |
|
914
|
|
|
* onclick: // Callback function dispatches on click on notification message |
|
915
|
|
|
* onshow: // Callback function dispatches when notification is shown |
|
916
|
|
|
* onclose: // Callback function dispateches on notification close |
|
917
|
|
|
* onerror: // Callback function dispatches on error, default is a egw.debug log |
|
918
|
|
|
* } |
|
919
|
|
|
* @return {boolean} false if Notification is not supported by browser |
|
920
|
|
|
*/ |
|
921
|
|
|
notification(_title : string, _options : {dir?: "ltr"|"rtl"|"auto", lang: string, body?: string, icon?: string, |
|
922
|
|
|
tag?: string, onclick: Function, onshow?: Function, onclose?: Function, onerror?: Function}) : false|void; |
|
923
|
|
|
/** |
|
924
|
|
|
* Check Notification availability by browser |
|
925
|
|
|
* |
|
926
|
|
|
* @returns {Boolean} true if notification is supported and permitted otherwise false |
|
927
|
|
|
*/ |
|
928
|
|
|
checkNotification() : boolean; |
|
929
|
|
|
/** |
|
930
|
|
|
* Check if there's any runnig notifications and will close them all |
|
931
|
|
|
* |
|
932
|
|
|
*/ |
|
933
|
|
|
killAliveNotifications() : void; |
|
934
|
|
|
|
|
935
|
|
|
/** |
|
936
|
|
|
* implemented in egw_open.js |
|
937
|
|
|
*/ |
|
938
|
|
|
/** |
|
939
|
|
|
* View an EGroupware entry: opens a popup of correct size or redirects window.location to requested url |
|
940
|
|
|
* |
|
941
|
|
|
* Examples: |
|
942
|
|
|
* - egw.open(123,'infolog') or egw.open('infolog:123') opens popup to edit or view (if no edit rights) infolog entry 123 |
|
943
|
|
|
* - egw.open('infolog:123','timesheet','add') opens popup to add new timesheet linked to infolog entry 123 |
|
944
|
|
|
* - egw.open(123,'addressbook','view') opens addressbook view for entry 123 (showing linked infologs) |
|
945
|
|
|
* - egw.open('','addressbook','view_list',{ search: 'Becker' }) opens list of addresses containing 'Becker' |
|
946
|
|
|
* |
|
947
|
|
|
* @param {string|number|object} id_data either just the id or if app=="" "app:id" or object with all data |
|
948
|
|
|
* to be able to open files you need to give: (mine-)type, path or id, app2 and id2 (path=/apps/app2/id2/id" |
|
949
|
|
|
* @param {string} app app-name or empty (app is part of id) |
|
950
|
|
|
* @param {string} type default "edit", possible "view", "view_list", "edit" (falls back to "view") and "add" |
|
951
|
|
|
* @param {object|string} extra extra url parameters to append as object or string |
|
952
|
|
|
* @param {string} target target of window to open |
|
953
|
|
|
* @param {string} target_app target application to open in that tab |
|
954
|
|
|
* @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check |
|
955
|
|
|
* - This option only makes sense to be enabled when the open_link requested without user interaction |
|
956
|
|
|
*/ |
|
957
|
|
|
open(id_data : string|number|object, app? : string, type? : "edit"|"view"|"view_list"|"add"|"list", |
|
958
|
|
|
extra? : string|object, target? : string, target_app? : string, _check_popup_blocker? : boolean) : string; |
|
959
|
|
|
/** |
|
960
|
|
|
* Open a link, which can be either a menuaction, a EGroupware relative url or a full url |
|
961
|
|
|
* |
|
962
|
|
|
* @param {string} _link menuaction, EGroupware relative url or a full url (incl. "mailto:" or "javascript:") |
|
963
|
|
|
* @param {string} _target optional target / window name |
|
964
|
|
|
* @param {string} _popup widthxheight, if a popup should be used |
|
965
|
|
|
* @param {string} _target_app app-name for opener |
|
966
|
|
|
* @param {boolean} _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check |
|
967
|
|
|
* - This option only makes sense to be enabled when the open_link requested without user interaction |
|
968
|
|
|
* @param {string} _mime_type if given, we check if any app has registered a mime-handler for that type and use it |
|
969
|
|
|
*/ |
|
970
|
|
|
open_link(_link : string, _target? : string, _popup? : string, _target_app? : string, |
|
971
|
|
|
_check_popup_blocker? : boolean, _mime_type? : string) : Window|void; |
|
972
|
|
|
/** |
|
973
|
|
|
* Open a (centered) popup window with given size and url |
|
974
|
|
|
* |
|
975
|
|
|
* @param {string} _url |
|
976
|
|
|
* @param {number} _width |
|
977
|
|
|
* @param {number} _height |
|
978
|
|
|
* @param {string} _windowName or "_blank" |
|
979
|
|
|
* @param {string|boolean} _app app-name for framework to set correct opener or false for current app |
|
980
|
|
|
* @param {boolean} _returnID true: return window, false: return undefined |
|
981
|
|
|
* @param {string} _status "yes" or "no" to display status bar of popup |
|
982
|
|
|
* @param {boolean} _skip_framework |
|
983
|
|
|
* @returns {Window|void} |
|
984
|
|
|
*/ |
|
985
|
|
|
openPopup(_url : string, _width : number, _height : number|"availHeight", _windowName? : string, _app? : string|boolean, |
|
986
|
|
|
_returnID? : boolean, _status? : "yes"|"no", _skip_framework? : boolean) : Window|void; |
|
987
|
|
|
/** |
|
988
|
|
|
* Get available height of screen |
|
989
|
|
|
*/ |
|
990
|
|
|
availHeight() : number; |
|
991
|
|
|
/** |
|
992
|
|
|
* Use frameworks (framed template) link handler to open a url |
|
993
|
|
|
* |
|
994
|
|
|
* @param {string} _url |
|
995
|
|
|
* @param {string} _target |
|
996
|
|
|
*/ |
|
997
|
|
|
link_handler(_url : string, _target : string) : void; |
|
998
|
|
|
/** |
|
999
|
|
|
* Close current window / popup |
|
1000
|
|
|
*/ |
|
1001
|
|
|
close() : void; |
|
1002
|
|
|
/** |
|
1003
|
|
|
* Check if browser pop-up blocker is on/off |
|
1004
|
|
|
* |
|
1005
|
|
|
* @param {string} _link menuaction, EGroupware relative url or a full url (incl. "mailto:" or "javascript:") |
|
1006
|
|
|
* @param {string} _target optional target / window name |
|
1007
|
|
|
* @param {string} _popup widthxheight, if a popup should be used |
|
1008
|
|
|
* @param {string} _target_app app-name for opener |
|
1009
|
|
|
* |
|
1010
|
|
|
* @return boolean returns false if pop-up blocker is off |
|
1011
|
|
|
* - returns true if pop-up blocker is on, |
|
1012
|
|
|
* - and re-call the open_link with provided parameters, after user interaction. |
|
1013
|
|
|
*/ |
|
1014
|
|
|
_check_popupBlocker(_link : string, _target? : string, _popup? : string, _target_app? : string) : boolean; |
|
1015
|
|
|
/** |
|
1016
|
|
|
* This function helps to append content/ run commands into an already |
|
1017
|
|
|
* opened popup window. Popup windows now are getting stored in framework |
|
1018
|
|
|
* object and can be retrived/closed from framework. |
|
1019
|
|
|
* |
|
1020
|
|
|
* @param {string} _app name of application to be requested its popups |
|
1021
|
|
|
* @param {string} _method application method implemented in app.js |
|
1022
|
|
|
* @param {object} _content content to be passed to method |
|
1023
|
|
|
* @param {string|object} _extra url or object of extra |
|
1024
|
|
|
* @param {regexp} _regexp regular expression to get specific popup with matched url |
|
1025
|
|
|
*/ |
|
1026
|
|
|
openWithinWindow(_app : string, _method : string, _content : object, _extra? : string|object, _regexp? : RegExp) : void; |
|
1027
|
|
|
|
|
1028
|
|
|
/** |
|
1029
|
|
|
* implemented in egw_ready.js |
|
1030
|
|
|
*/ |
|
1031
|
|
|
/** |
|
1032
|
|
|
* The readyWaitFor function can be used to register an event, that has |
|
1033
|
|
|
* to be marked as "done" before the ready function will call its |
|
1034
|
|
|
* registered callbacks. The function returns an id that has to be |
|
1035
|
|
|
* passed to the "readDone" function once |
|
1036
|
|
|
*/ |
|
1037
|
|
|
readyWaitFor() : string; |
|
1038
|
|
|
/** |
|
1039
|
|
|
* The readyDone function can be used to mark a event token as |
|
1040
|
|
|
* previously requested by "readyWaitFor" as done. |
|
1041
|
|
|
* |
|
1042
|
|
|
* @param _token is the token which has now been processed. |
|
1043
|
|
|
*/ |
|
1044
|
|
|
readyDone(_token : string) : void; |
|
1045
|
|
|
/** |
|
1046
|
|
|
* The ready function can be used to register a function that will be |
|
1047
|
|
|
* called, when the window is completely loaded. All ready handlers will |
|
1048
|
|
|
* be called exactly once. If the ready handler has already been called, |
|
1049
|
|
|
* the given function will be called defered using setTimeout. |
|
1050
|
|
|
* |
|
1051
|
|
|
* @param _callback is the function which will be called when the page |
|
1052
|
|
|
* is ready. No parameters will be passed. |
|
1053
|
|
|
* @param _context is the context in which the callback function should |
|
1054
|
|
|
* get called. |
|
1055
|
|
|
* @param _beforeDOMContentLoaded specifies, whether the callback should |
|
1056
|
|
|
* get called, before the DOMContentLoaded event has been fired. |
|
1057
|
|
|
*/ |
|
1058
|
|
|
ready(_callback : Function, _context : object, _beforeDOMContentLoaded? : boolean) : void; |
|
1059
|
|
|
/** |
|
1060
|
|
|
* The readyProgress function can be used to register a function that |
|
1061
|
|
|
* will be called whenever a ready event is done or registered. |
|
1062
|
|
|
* |
|
1063
|
|
|
* @param _callback is the function which will be called when the |
|
1064
|
|
|
* progress changes. |
|
1065
|
|
|
* @param _context is the context in which the callback function which |
|
1066
|
|
|
* should get called. |
|
1067
|
|
|
*/ |
|
1068
|
|
|
readyProgress(_callback : Function, _context : object) : void; |
|
1069
|
|
|
/** |
|
1070
|
|
|
* Returns whether the ready events have already been called. |
|
1071
|
|
|
*/ |
|
1072
|
|
|
isReady() : boolean; |
|
1073
|
|
|
|
|
1074
|
|
|
/** |
|
1075
|
|
|
* implemented in egw_tooltip.js |
|
1076
|
|
|
*/ |
|
1077
|
|
|
/** |
|
1078
|
|
|
* Binds a tooltip to the given DOM-Node with the given html. |
|
1079
|
|
|
* It is important to remove all tooltips from all elements which are |
|
1080
|
|
|
* no longer needed, in order to prevent memory leaks. |
|
1081
|
|
|
* |
|
1082
|
|
|
* @param _elem is the element to which the tooltip should get bound. It |
|
1083
|
|
|
* has to be a jQuery node. |
|
1084
|
|
|
* @param _str is the html or text code which should be shown as tooltip. |
|
1085
|
|
|
* @param _isHtml true: add a html (no automatic quoting!), false (default): add as text |
|
1086
|
|
|
*/ |
|
1087
|
|
|
tooltipBind(_elem : HTMLElement, _str : string, _isHtml? : boolean); |
|
1088
|
|
|
/** |
|
1089
|
|
|
* Unbinds the tooltip from the given DOM-Node. |
|
1090
|
|
|
* |
|
1091
|
|
|
* @param _elem is the element from which the tooltip should get |
|
1092
|
|
|
* removed. _elem has to be a jQuery node. |
|
1093
|
|
|
*/ |
|
1094
|
|
|
tooltipUnbind(_elem : HTMLElement); |
|
1095
|
|
|
} |
|
1096
|
|
|
|
|
1097
|
|
|
/** |
|
1098
|
|
|
* Interface for application local methods (returned by global egw function) |
|
1099
|
|
|
*/ |
|
1100
|
|
|
declare interface IegwAppLocal extends IegwWndLocal |
|
1101
|
|
|
{ |
|
1102
|
|
|
/** |
|
1103
|
|
|
* implemented in egw_data.js |
|
1104
|
|
|
*/ |
|
1105
|
|
|
/** |
|
1106
|
|
|
* The dataFetch function provides an abstraction layer for the |
|
1107
|
|
|
* corresponding "EGroupware\Api\Etemplate\Widget\Nextmatch::ajax_get_rows" function. |
|
1108
|
|
|
* The server returns the following structure: |
|
1109
|
|
|
* { |
|
1110
|
|
|
* order: [uid, ...], |
|
1111
|
|
|
* data: |
|
1112
|
|
|
* { |
|
1113
|
|
|
* uid0: data, |
|
1114
|
|
|
* ... |
|
1115
|
|
|
* uidN: data |
|
1116
|
|
|
* }, |
|
1117
|
|
|
* total: <TOTAL COUNT>, |
|
1118
|
|
|
* lastModification: <LAST MODIFICATION TIMESTAMP>, |
|
1119
|
|
|
* readonlys: <READONLYS> |
|
1120
|
|
|
* } |
|
1121
|
|
|
* If a uid got deleted on the server above data is null. |
|
1122
|
|
|
* If a uid is omitted from data, is has not changed since lastModification. |
|
1123
|
|
|
* |
|
1124
|
|
|
* If order/data is null, this means that nothing has changed for the |
|
1125
|
|
|
* given range. |
|
1126
|
|
|
* The dataFetch function stores new data for the uid's inside the |
|
1127
|
|
|
* local data storage, the grid views are then capable of querying the |
|
1128
|
|
|
* data for those uids from the local storage using the |
|
1129
|
|
|
* "dataRegisterUID" function. |
|
1130
|
|
|
* |
|
1131
|
|
|
* @param _execId is the execution context of the etemplate instance |
|
1132
|
|
|
* you're querying the data for. |
|
1133
|
|
|
* @param _queriedRange is an object of the following form: |
|
1134
|
|
|
* { |
|
1135
|
|
|
* start: <START INDEX>, |
|
1136
|
|
|
* num_rows: <COUNT OF ENTRIES> |
|
1137
|
|
|
* } |
|
1138
|
|
|
* The range always corresponds to the given filter settings. |
|
1139
|
|
|
* @param _filters contains the filter settings. The filter settings are |
|
1140
|
|
|
* those which are crucial for the mapping between index and uid. |
|
1141
|
|
|
* @param _widgetId id with full namespace of widget |
|
1142
|
|
|
* @param _callback is the function that should get called, once the data |
|
1143
|
|
|
* is available. The data passed to the callback function has the |
|
1144
|
|
|
* following form: |
|
1145
|
|
|
* { |
|
1146
|
|
|
* order: [uid, ...], |
|
1147
|
|
|
* total: <TOTAL COUNT>, |
|
1148
|
|
|
* lastModification: <LAST MODIFICATION TIMESTAMP>, |
|
1149
|
|
|
* readonlys: <READONLYS> |
|
1150
|
|
|
* } |
|
1151
|
|
|
* Please note that the "uids" comming from the server and the ones |
|
1152
|
|
|
* being parsed to the callback function differ. While the uids |
|
1153
|
|
|
* which are returned from the server are only unique inside the |
|
1154
|
|
|
* application, the uids which are used on the client are "globally" |
|
1155
|
|
|
* unique. |
|
1156
|
|
|
* @param _context is the context in which the callback function will get |
|
1157
|
|
|
* called. |
|
1158
|
|
|
* @param _knownUids is an array of uids already known to the client. |
|
1159
|
|
|
* This parameter may be null in order to indicate that the client |
|
1160
|
|
|
* currently has no data for the given filter settings. |
|
1161
|
|
|
*/ |
|
1162
|
|
|
dataFetch(_execId : string, _queriedRange : {start:number,num_rows:number}, |
|
1163
|
|
|
_filters : object, _widgetId : string, _callback : Function, _context : object, |
|
1164
|
|
|
_knownUids? : string[]); |
|
1165
|
|
|
/** |
|
1166
|
|
|
* Turn on long-term client side cache of a particular request |
|
1167
|
|
|
* (cache the nextmatch query results) for fast, immediate response |
|
1168
|
|
|
* with old data. |
|
1169
|
|
|
* |
|
1170
|
|
|
* The request is still sent to the server, and the cache is updated |
|
1171
|
|
|
* with fresh data, and any needed callbacks are called again with |
|
1172
|
|
|
* the fresh data. |
|
1173
|
|
|
* |
|
1174
|
|
|
* @param {string} prefix UID / Application prefix should match the |
|
1175
|
|
|
* individual record prefix |
|
1176
|
|
|
* @param {function} callback_function A function that will analize the provided fetch |
|
1177
|
|
|
* parameters and return a reproducable cache key, or false to not cache |
|
1178
|
|
|
* the request. |
|
1179
|
|
|
* @param {function} notice_function A function that will be called whenever |
|
1180
|
|
|
* cached data is used. It is passed one parameter, a boolean that indicates |
|
1181
|
|
|
* if the server is or will be queried to refresh the cache. Do not fetch additional data |
|
1182
|
|
|
* inside this callback, and return quickly. |
|
1183
|
|
|
* @param {object} context Context for callback function. |
|
1184
|
|
|
*/ |
|
1185
|
|
|
dataCacheRegister(prefix : string, callback_function : Function, notice_function : Function, context : object); |
|
1186
|
|
|
/** |
|
1187
|
|
|
* Unregister a previously registered cache callback |
|
1188
|
|
|
* @param {string} prefix UID / Application prefix should match the |
|
1189
|
|
|
* individual record prefix |
|
1190
|
|
|
* @param {function} [callback] Callback function to un-register. If |
|
1191
|
|
|
* omitted, all functions for the prefix will be removed. |
|
1192
|
|
|
*/ |
|
1193
|
|
|
dataCacheUnregister(prefix : string, callback : Function); |
|
1194
|
|
|
} |
|
1195
|
|
|
|
|
1196
|
|
|
/** |
|
1197
|
|
|
* Some other global function and objects |
|
1198
|
|
|
* |
|
1199
|
|
|
* Please note the egw_* ones are deprecated in favor of the above API |
|
1200
|
|
|
*/ |
|
1201
|
|
|
declare function egw_getFramework() : any; |
|
1202
|
|
|
declare var chrome : any; |
|
1203
|
|
|
declare var InstallTrigger : any; |
|
1204
|
|
|
declare var app : {classes: any, [propName: string]: any}; |
|
1205
|
|
|
declare var egw_globalObjectManager : any; |
|
1206
|
|
|
declare var framework : any; |
|
1207
|
|
|
declare var egw_LAB : any; |
|
1208
|
|
|
declare function egwIsMobile() : string|null; |
|
1209
|
|
|
|
|
1210
|
|
|
declare var mailvelope : any; |
|
1211
|
|
|
|
|
1212
|
|
|
declare function egw_refresh(_msg : string, app : string, id? : string|number, _type?, targetapp?, replace?, _with?, msgtype?); |
|
1213
|
|
|
declare function egw_open(); |
|
1214
|
|
|
|
|
1215
|
|
|
declare function egw_getWindowLeft() : number; |
|
1216
|
|
|
declare function egw_getWindowTop() : number; |
|
1217
|
|
|
declare function egw_getWindowInnerWidth() : number; |
|
1218
|
|
|
declare function egw_getWindowInnerHeight() : number; |
|
1219
|
|
|
declare function egw_getWindowOuterWidth() : number; |
|
1220
|
|
|
declare function egw_getWindowOuterHeight() : number; |
|
1221
|
|
|
|