forked from Studio-42/elFinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elFinder.options.js
481 lines (440 loc) · 9.31 KB
/
elFinder.options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
/**
* Default elFinder config
*
* @type Object
* @autor Dmitry (dio) Levashov
*/
elFinder.prototype._options = {
/**
* Connector url. Required!
*
* @type String
*/
url : '',
/**
* Ajax request type.
*
* @type String
* @default "get"
*/
requestType : 'get',
/**
* Transport to send request to backend.
* Required for future extensions using websockets/webdav etc.
* Must be an object with "send" method.
* transport.send must return $.Deferred() object
*
* @type Object
* @default null
* @example
* transport : {
* init : function(elfinderInstance) { },
* send : function(options) {
* var dfrd = $.Deferred();
* // connect to backend ...
* return dfrd;
* },
* upload : function(data) {
* var dfrd = $.Deferred();
* // upload ...
* return dfrd;
* }
*
* }
**/
transport : {},
/**
* URL to upload file to.
* If not set - connector URL will be used
*
* @type String
* @default ''
*/
urlUpload : '',
/**
* Allow to drag and drop to upload files
*
* @type Boolean|String
* @default 'auto'
*/
dragUploadAllow : 'auto',
/**
* Timeout for upload using iframe
*
* @type Number
* @default 0 - no timeout
*/
iframeTimeout : 0,
/**
* Data to append to all requests and to upload files
*
* @type Object
* @default {}
*/
customData : {},
/**
* Event listeners to bind on elFinder init
*
* @type Object
* @default {}
*/
handlers : {},
/**
* Interface language
*
* @type String
* @default "en"
*/
lang : 'en',
/**
* Additional css class for filemanager node.
*
* @type String
*/
cssClass : '',
/**
* Active commands list
* If some required commands will be missed here, elFinder will add its
*
* @type Array
*/
commands : [
'open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook',
'download', 'rm', 'duplicate', 'rename', 'mkdir', 'mkfile', 'upload', 'copy',
'cut', 'paste', 'edit', 'extract', 'archive', 'search', 'info', 'view', 'help', 'resize', 'sort', 'netmount'
],
/**
* Commands options.
*
* @type Object
**/
commandsOptions : {
// "getfile" command options.
getfile : {
onlyURL : false,
// allow to return multiple files info
multiple : false,
// allow to return filers info
folders : false,
// action after callback (""/"close"/"destroy")
oncomplete : ''
},
// "upload" command options.
upload : {
ui : 'uploadbutton'
},
// "quicklook" command options.
quicklook : {
autoplay : true,
jplayer : 'extensions/jplayer'
},
// "quicklook" command options.
edit : {
// list of allowed mimetypes to edit
// if empty - any text files can be edited
mimes : [],
// edit files in wysisyg's
editors : [
// {
// /**
// * files mimetypes allowed to edit in current wysisyg
// * @type Array
// */
// mimes : ['text/html'],
// /**
// * Called when "edit" dialog loaded.
// * Place to init wysisyg.
// * Can return wysisyg instance
// *
// * @param DOMElement textarea node
// * @return Object
// */
// load : function(textarea) { },
// /**
// * Called before "edit" dialog closed.
// * Place to destroy wysisyg instance.
// *
// * @param DOMElement textarea node
// * @param Object wysisyg instance (if was returned by "load" callback)
// * @return void
// */
// close : function(textarea, instance) { },
// /**
// * Called before file content send to backend.
// * Place to update textarea content if needed.
// *
// * @param DOMElement textarea node
// * @param Object wysisyg instance (if was returned by "load" callback)
// * @return void
// */
// save : function(textarea, editor) {}
//
// }
]
},
// "info" command options.
info : {nullUrlDirLinkSelf : true},
help : {view : ['about', 'shortcuts', 'help']}
},
/**
* Callback for "getfile" commands.
* Required to use elFinder with WYSIWYG editors etc..
*
* @type Function
* @default null (command not active)
*/
getFileCallback : null,
/**
* Default directory view. icons/list
*
* @type String
* @default "icons"
*/
defaultView : 'icons',
/**
* UI plugins to load.
* Current dir ui and dialogs loads always.
* Here set not required plugins as folders tree/toolbar/statusbar etc.
*
* @type Array
* @default ['toolbar', 'tree', 'path', 'stat']
* @full ['toolbar', 'places', 'tree', 'path', 'stat']
*/
ui : ['toolbar', 'tree', 'path', 'stat'],
/**
* Some UI plugins options.
* @type Object
*/
uiOptions : {
// toolbar configuration
toolbar : [
['back', 'forward'],
['netmount'],
// ['reload'],
// ['home', 'up'],
['mkdir', 'mkfile', 'upload'],
['open', 'download', 'getfile'],
['info'],
['quicklook'],
['copy', 'cut', 'paste'],
['rm'],
['duplicate', 'rename', 'edit', 'resize'],
['extract', 'archive'],
['search'],
['view', 'sort'],
['help']
],
// directories tree options
tree : {
// expand current root on init
openRootOnLoad : true,
// auto load current dir parents
syncTree : true
},
// navbar options
navbar : {
minWidth : 150,
maxWidth : 500
},
cwd : {
// display parent folder with ".." name :)
oldSchool : false
}
},
/**
* Display only required files by types
*
* @type Array
* @default []
* @example
* onlyMimes : ["image"] - display all images
* onlyMimes : ["image/png", "application/x-shockwave-flash"] - display png and flash
*/
onlyMimes : [],
/**
* Custom files sort rules.
* All default rules (name/size/kind/date) set in elFinder._sortRules
*
* @type {Object}
* @example
* sortRules : {
* name : function(file1, file2) { return file1.name.toLowerCase().localeCompare(file2.name.toLowerCase()); }
* }
*/
sortRules : {},
/**
* Default sort type.
*
* @type {String}
*/
sortType : 'name',
/**
* Default sort order.
*
* @type {String}
* @default "asc"
*/
sortOrder : 'asc',
/**
* Display folders first?
*
* @type {Boolean}
* @default true
*/
sortStickFolders : true,
/**
* If true - elFinder will formating dates itself,
* otherwise - backend date will be used.
*
* @type Boolean
*/
clientFormatDate : true,
/**
* Show UTC dates.
* Required set clientFormatDate to true
*
* @type Boolean
*/
UTCDate : false,
/**
* File modification datetime format.
* Value from selected language data is used by default.
* Set format here to overwrite it.
*
* @type String
* @default ""
*/
dateFormat : '',
/**
* File modification datetime format in form "Yesterday 12:23:01".
* Value from selected language data is used by default.
* Set format here to overwrite it.
* Use $1 for "Today"/"Yesterday" placeholder
*
* @type String
* @default ""
* @example "$1 H:m:i"
*/
fancyDateFormat : '',
/**
* elFinder width
*
* @type String|Number
* @default "auto"
*/
width : 'auto',
/**
* elFinder height
*
* @type Number
* @default "auto"
*/
height : 400,
/**
* Make elFinder resizable if jquery ui resizable available
*
* @type Boolean
* @default true
*/
resizable : true,
/**
* Timeout before open notifications dialogs
*
* @type Number
* @default 500 (.5 sec)
*/
notifyDelay : 500,
/**
* Allow shortcuts
*
* @type Boolean
* @default true
*/
allowShortcuts : true,
/**
* Remeber last opened dir to open it after reload or in next session
*
* @type Boolean
* @default true
*/
rememberLastDir : true,
/**
* Use browser native history with supported browsers
*
* @type Boolean
* @default true
*/
useBrowserHistory : true,
/**
* Lazy load config.
* How many files display at once?
*
* @type Number
* @default 50
*/
showFiles : 30,
/**
* Lazy load config.
* Distance in px to cwd bottom edge to start display files
*
* @type Number
* @default 50
*/
showThreshold : 50,
/**
* Additional rule to valid new file name.
* By default not allowed empty names or '..'
*
* @type false|RegExp|function
* @default false
* @example
* disable names with spaces:
* validName : /^[^\s]$/
*/
validName : false,
/**
* Sync content interval
* @todo - fix in elFinder
* @type Number
* @default 0 (do not sync)
*/
sync : 0,
/**
* How many thumbnails create in one request
*
* @type Number
* @default 5
*/
loadTmbs : 5,
/**
* Cookie option for browsersdoes not suppot localStorage
*
* @type Object
*/
cookie : {
expires : 30,
domain : '',
path : '/',
secure : false
},
/**
* Contextmenu config
*
* @type Object
*/
contextmenu : {
// navbarfolder menu
navbar : ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'],
// current directory menu
cwd : ['reload', 'back', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'sort', '|', 'info'],
// current directory file menu
files : ['getfile', '|','open', 'quicklook', '|', 'download', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'edit', 'rename', 'resize', '|', 'archive', 'extract', '|', 'info']
},
/**
* Debug config
*
* @type Array|Boolean
*/
// debug : true
debug : ['error', 'warning', 'event-destroy']
}