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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532 | "getSmartUISprite": {def node ->
def candidates = []
def nodeSprites = [
[
// excel
equals: [
mime_type: [
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/vnd.ms-excel.sheet.macroEnabled.12',
'application/vnd.ms-excel.template.macroEnabled.12',
'application/vnd.ms-excel.addin.macroEnabled.12',
'application/vnd.ms-excel.sheet.binary.macroEnabled.12'
]
],
className: 'csui-icon mime_excel',
sequence: 50
],
[
// visio
equals: [
mime_type: [
'application/visio',
'application/x-visio',
'application/vnd.visio',
'application/visio.drawing',
'application/vsd',
'application/x-vsd',
'image/x-vsd',
'application/vnd.visio2013',
'application/vnd.ms-visio.drawing',
'application/vnd.ms-visio.viewer',
'application/vnd.ms-visio.stencil',
'application/vnd.ms-visio.template'
]
],
className: 'csui-icon mime_visio',
sequence: 50
],
[
// spreadsheets
equals: [
mime_type: [
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.spreadsheet-template',
'application/vnd.sun.xml.calc',
'application/vnd.sun.xml.calc.template',
'application/vnd.stardivision.calc',
'application/x-starcalc'
]
],
className: 'csui-icon mime_spreadsheet',
sequence: 50
],
[
// powerpoint
equals: [
mime_type: [
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'application/vnd.ms-powerpoint.template.macroEnabled.12',
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'
]
],
className: 'csui-icon mime_powerpoint',
sequence: 50
],
[
// presentations
equals: [
mime_type: [
'application/vnd.google-apps.presentation', // GSLIDE - Google Drive Presentation
'application/x-iwork-keynote-sffkey', // KEY, KEYNOTE — Apple Keynote Presentation
'application/vnd.wolfram.mathematica', // NB — Mathematica Slideshow
'application/vnd.wolfram.player', // NBP — Mathematica Player slideshow
'application/vnd.oasis.opendocument.presentation', // ODP — OpenDocument Presentation
'application/vnd.oasis.opendocument.presentation-template', // OTP - ODP Template
'application/vnd.sun.xml.impress',
'application/vnd.sun.xml.impress.template',
'application/vnd.stardivision.impress',
'application/vnd.stardivision.impress-packed',
'application/x-starimpress',
'application/vnd.lotus-freelance', // PRZ — Lotus Freelance Graphics
'application/vnd.stardivision.impress', // SDD - Star Office's StarImpress
'application/vnd.corel-presentations', // SHW — Corel Presentations slide show creation
'application/vnd.sun.xml.impress', // SXI — OpenOffice.org XML (obsolete) Presentation
'application/vnd.ms-officetheme', // THMX — Microsoft PowerPoint theme template
'application/vnd.sun.xml.impress.template '// STI — OpenOffice Impress template
// the following extensions could not mapped to a mime-type
// todo: intro mapping to file extensions
// WATCH — Dataton Watchout Presentation
// PEZ — Prezi Desktop Presentation
// SHF — ThinkFree Show
// SHOW — Haansoft(Hancom) Presentation software document
// SLP — Logix-4D Manager Show Control Project
// SSPSS — SongShow Plus Slide Show
]
],
className: 'csui-icon mime_presentation',
sequence: 50
],
[
// MS Office publisher
equals: [
mime_type: [
'application/vnd.ms-publisher',
'application/x-mspublisher'
]
],
className: 'csui-icon mime_publisher',
sequence: 50
],
[
// formulas
equals: [
mime_type: [
'application/vnd.oasis.opendocument.formula',
'application/vnd.sun.xml.math',
'application/vnd.stardivision.math',
'application/x-starmath'
]
],
className: 'csui-icon mime_formula',
sequence: 50
],
[
// pdf
equals: [
mime_type: [
'application/vnd.pdf',
'application/x-pdf',
'application/pdf'
]
],
className: 'csui-icon mime_pdf',
sequence: 50
],
[
// word
equals: [
mime_type: [
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.ms-word.document.macroEnabled.12',
'application/vnd.ms-word.template.macroEnabled.12'
]
],
className: 'csui-icon mime_word',
sequence: 50
],
[
// MS OneNote
equals: [
mime_type: [
'application/onenote',
'application/msonenote'
]
],
className: 'csui-icon mime_onenote',
sequence: 50
],
[
// MS project
equals: [
mime_type: [
'application/vnd.ms-project',
'application/msproj',
'application/msproject',
'application/x-msproject',
'application/x-ms-project',
'application/mpp'
]
],
className: 'csui-icon mime_project',
sequence: 50
],
[
// image
startsWith: [mime_type: 'image/'],
className: 'csui-icon mime_image',
sequence: 50
],
[
// audio
startsWith: [mime_type: 'audio/'],
className: 'csui-icon mime_audio',
sequence: 50
],
[
// text
startsWith: [mime_type: 'text/'],
className: 'csui-icon mime_paper',
sequence: 50
],
[
// text
equals: [mime_type: 'text/html'],
className: 'csui-icon mime_html',
// startsWith 'text/' operation happens first, which would decide the icon otherwise;
// it has the sequence number 50 in common
// do not set sequence to 30 that would take over the 'type' that has this MIME type
// and do not set to 50 because this object with this MIME type would have a different icon
sequence: 40
],
[
// video
startsWith: [mime_type: 'video/'],
className: 'csui-icon mime_video',
sequence: 50
],
[
// zip
equals: [
mime_type: [
'application/x-rar-compressed',
'application/zip',
'application/x-zip',
'application/x-zip-compressed'
]
],
className: 'csui-icon mime_zip',
sequence: 50
],
[
// compound document
equals: [type: 136],
className: 'csui-icon compound_document',
sequence: 100
],
[
// document
equals: [type: 144],
className: 'csui-icon mime_document',
sequence: 100
],
[
// CAD
equals: [type: 736],
className: 'csui-icon mime_drawing',
sequence: 100
],
[
// saved search query
equals: [type: 258],
className: 'csui-icon csui-icon-saved-search-query',
sequence: 100
],
[
// e-mail
equals: [type: 749],
className: 'csui-icon mime_mail',
sequence: 100
],
[
// URL link
equals: [type: 140],
className: 'csui-icon url1',
sequence: 100
],
[
// shortcut
equals: [type: 1],
className: 'csui-icon shortcut1',
sequence: 100
],
[
// generation
// note: since the RestAPI at the moment does not return the document version, showing the
// latest document mime-type icon with the shortcut overlay is incorrect. Use the
// generation icon for now. When the RestAPI and UI supports Generation, switch this to
// generation-overlay.
equals: [type: 2],
className: 'csui-icon mime_generation',
sequence: 100
],
[
// category
equals: [type: 131],
className: 'csui-icon category1',
sequence: 100
],
[
// project
equals: [type: 202],
className: 'csui-icon csui-icon-project',
sequence: 100
],
[
// collection
equals: [type: 298],
className: 'csui-icon collection',
sequence: 100
],
[
equals: [type: 141],
className: 'csui-icon csui-icon-enterprise-volume',
sequence: 100
],
[
equals: [type: 142],
className: 'csui-icon csui-icon-personal-volume',
sequence: 100
],
[
equals: [type: 133],
className: 'csui-icon csui-icon-category-volume',
sequence: 100
],
[
// Category Folder
equals: [type: 132],
className: 'csui-icon csui-icon-node-category-folder',
sequence: 100
],
[
// E-mail Folder
equals: [type: 751],
className: 'csui-icon csui-icon-node-mail-folder',
sequence: 100
],
[
// LiveReport
equals: [type: 299],
className: 'csui-icon csui-icon-node-livereport',
sequence: 100
],
[
// Milestone
equals: [type: 212],
className: 'csui-icon csui-icon-node-milestone',
sequence: 100
],
[
// Poll
equals: [type: 218],
className: 'csui-icon csui-icon-node-poll',
sequence: 100
],
[
// Prospector
equals: [type: 384],
className: 'csui-icon csui-icon-node-prospector',
sequence: 100
],
[
// Task
equals: [type: 206],
className: 'csui-icon csui-icon-node-task',
sequence: 100
],
[
// Task Group
equals: [type: 205],
className: 'csui-icon csui-icon-node-task-group',
sequence: 100
],
[
// Task List
equals: [type: 204],
className: 'csui-icon csui-icon-node-task-list',
sequence: 100
],
[
// Virtual Folder
equals: [type: 899],
className: 'csui-icon csui-icon-node-virtual-folder',
sequence: 100
],
[
// Custom View
equals: [type: 146],
className: 'csui-icon mime_custom_view',
// Custom View has a MIME type, which would decide the icon otherwise;
// the MIME type icons have the sequence number 50 in common
sequence: 30
],
[
// Workflow Step
equals: [type: 153],
className: 'csui-icon assignment-workflow',
sequence: 100
],
[
// Workflow Map
equals: [type: 128],
className: 'csui-icon mime_workflow_map',
sequence: 100
],
[
// Workflow Status
equals: [type: 190],
className: 'csui-icon mime_workflow_status',
sequence: 100
],
[
// Channel
equals: [type: 207],
className: 'csui-icon mime_channel',
sequence: 100
],
[
// News item
equals: [type: 208],
className: 'csui-icon mime_news',
sequence: 100
],
[
// Discussion
equals: [type: 215],
className: 'csui-icon mime_discussion',
sequence: 100
],
[
// XML DTD
equals: [type: 335],
className: 'csui-icon mime_xml_dtd',
// XML DTD has a MIME type, which would decide the icon otherwise;
// the MIME type icons have the sequence number 50 in common
sequence: 30
],
[
// form
equals: [type: 223],
className: 'csui-icon mime_form',
sequence: 100
],
[
// form template
equals: [type: 230],
className: 'csui-icon mime_form_template',
sequence: 100
],
[
// pulse comments
equals: [type: 1281],
className: 'csui-icon icon-pulse-comment',
sequence: 100
],
[
// wiki pages
equals: [type: 5574],
className: 'csui-icon mime_wiki_page',
sequence: 10
],
// wikis
[
equals: [type: 5573],
className: 'csui-icon mime_wiki',
sequence: 10
],
[
// default container
equals: [container: 'nonselectable'],
className: 'csui-icon mime_folder_nonselectable',
sequence: 1000
],
[
// default container; covers folder-like nodes too
equals: [container: true],
className: 'csui-icon mime_folder',
sequence: 1000
],
[
// default node
className: 'csui-icon mime_document',
sequence: 10000
]
]
nodeSprites.each{ sprite->
if(sprite.startsWith){
if(sprite.startsWith.mime_type){
if(node?.mimeType?.startsWith(sprite.startsWith.mime_type)){
candidates+=sprite
}
}
}else if(sprite.equals){
if(sprite.equals.mime_type){
sprite.equals.mime_type.each{ val->
if(node?.mimeType?.equals(val)){
candidates+=sprite
}
}
}else if(sprite.equals.type){
if(node.subtype == (sprite.equals.type)){
candidates+=sprite
}
}else if(sprite.equals.container && sprite.equals.container == true){
if(node.isContainer){
candidates+=sprite
}
}
}
}
candidates += [
// default node
className: 'csui-icon mime_document',
sequence: 10000
]
return candidates.sort{it.sequence}[0].className
}
|