@oat-sa/tao-core-ui 1.58.1 → 1.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actionbar.js +386 -395
- package/dist/adder.js +21 -19
- package/dist/animable/absorbable/absorbable.js +204 -213
- package/dist/animable/absorbable/css/absorb.css +1 -0
- package/dist/animable/absorbable/css/absorb.css.map +1 -1
- package/dist/animable/pulsable/pulsable.js +168 -177
- package/dist/autocomplete/css/autocomplete.css +1 -0
- package/dist/autocomplete/css/autocomplete.css.map +1 -1
- package/dist/autocomplete.js +68 -66
- package/dist/badge/badge.js +188 -197
- package/dist/badge/css/badge.css +1 -0
- package/dist/badge/css/badge.css.map +1 -1
- package/dist/breadcrumbs.js +275 -284
- package/dist/btngrouper.js +5 -5
- package/dist/bulkActionPopup.js +490 -495
- package/dist/button.js +283 -291
- package/dist/cascadingComboBox.js +249 -258
- package/dist/ckeditor/ckConfigurator.js +26 -19
- package/dist/ckeditor/dtdHandler.js +11 -9
- package/dist/class/selector.js +441 -450
- package/dist/component/resizable.js +1 -1
- package/dist/component/windowed.js +285 -294
- package/dist/component.js +419 -428
- package/dist/contextualPopup.js +417 -426
- package/dist/dashboard.js +300 -309
- package/dist/datalist.js +753 -762
- package/dist/datatable/filterStrategy/multiple.js +1 -1
- package/dist/datatable/filterStrategy/single.js +1 -1
- package/dist/datatable.js +1527 -1550
- package/dist/dateRange/dateRange.js +393 -402
- package/dist/datetime/picker.js +665 -672
- package/dist/deleter.js +368 -377
- package/dist/destination/selector.js +286 -295
- package/dist/dialog/alert.js +3 -3
- package/dist/dialog/confirm.js +1 -1
- package/dist/dialog/confirmDelete.js +216 -225
- package/dist/dialog.js +650 -654
- package/dist/disabler.js +8 -8
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
- package/dist/documentViewer/providers/pdfViewer.js +184 -193
- package/dist/documentViewer.js +292 -301
- package/dist/dropdown.js +383 -392
- package/dist/durationer.js +5 -5
- package/dist/dynamicComponent.js +597 -598
- package/dist/feedback.js +356 -362
- package/dist/figure/FigureStateActive.js +117 -108
- package/dist/filesender.js +2 -2
- package/dist/filter.js +230 -239
- package/dist/form/dropdownForm.js +355 -357
- package/dist/form/form.js +919 -690
- package/dist/form/simpleForm.js +1 -1
- package/dist/form/validator/renderer.js +233 -235
- package/dist/form/validator/validator.js +257 -189
- package/dist/form/widget/definitions.js +1 -1
- package/dist/form/widget/providers/checkBox.js +254 -259
- package/dist/form/widget/providers/comboBox.js +187 -192
- package/dist/form/widget/providers/default.js +8 -9
- package/dist/form/widget/providers/hidden.js +170 -179
- package/dist/form/widget/providers/hiddenBox.js +262 -267
- package/dist/form/widget/providers/radioBox.js +216 -225
- package/dist/form/widget/providers/textArea.js +187 -196
- package/dist/form/widget/providers/textBox.js +2 -3
- package/dist/form/widget/widget.js +473 -475
- package/dist/formValidator/formValidator.js +1 -1
- package/dist/formValidator/highlighters/message.js +1 -1
- package/dist/generis/form/form.js +314 -323
- package/dist/generis/validator/validator.js +209 -218
- package/dist/generis/widget/checkBox/checkBox.js +218 -227
- package/dist/generis/widget/comboBox/comboBox.js +179 -188
- package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
- package/dist/generis/widget/textBox/textBox.js +169 -178
- package/dist/generis/widget/widget.js +246 -255
- package/dist/groupedComboBox.js +222 -231
- package/dist/groupvalidator.js +2 -2
- package/dist/highlighter.js +967 -958
- package/dist/image/ImgStateActive/helper.js +7 -5
- package/dist/image/ImgStateActive/initHelper.js +49 -43
- package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
- package/dist/image/ImgStateActive/mediaSizer.js +14 -12
- package/dist/image/ImgStateActive.js +72 -70
- package/dist/incrementer.js +6 -6
- package/dist/inplacer.js +6 -6
- package/dist/itemButtonList/css/item-button-list.css +1 -0
- package/dist/itemButtonList/css/item-button-list.css.map +1 -1
- package/dist/itemButtonList.js +439 -435
- package/dist/keyNavigation/navigableDomElement.js +51 -38
- package/dist/keyNavigation/navigator.js +85 -70
- package/dist/listbox.js +460 -469
- package/dist/liststyler.js +8 -8
- package/dist/loadingButton/loadingButton.js +209 -218
- package/dist/lock.js +476 -485
- package/dist/login/login.js +475 -484
- package/dist/maths/calculator/basicCalculator.js +235 -244
- package/dist/maths/calculator/calculatorComponent.js +3 -3
- package/dist/maths/calculator/core/board.js +772 -781
- package/dist/maths/calculator/core/expression.js +476 -485
- package/dist/maths/calculator/core/labels.js +228 -237
- package/dist/maths/calculator/core/tokenizer.js +1 -1
- package/dist/maths/calculator/core/tokens.js +163 -170
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
- package/dist/maths/calculator/scientificCalculator.js +327 -336
- package/dist/mediaEditor/mediaEditorComponent.js +238 -245
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
- package/dist/mediaplayer/players/html5.js +666 -675
- package/dist/mediaplayer/players/youtube.js +419 -424
- package/dist/mediaplayer/support.js +11 -10
- package/dist/mediaplayer/utils/reminder.js +14 -13
- package/dist/mediaplayer/utils/timeObserver.js +10 -11
- package/dist/mediaplayer/youtubeManager.js +164 -145
- package/dist/mediaplayer.js +1565 -1520
- package/dist/mediasizer.js +669 -678
- package/dist/modal.js +10 -17
- package/dist/pageSizeSelector.js +219 -228
- package/dist/pagination/providers/pages.js +280 -289
- package/dist/pagination/providers/simple.js +192 -201
- package/dist/previewer.js +30 -30
- package/dist/progressbar.js +4 -4
- package/dist/report.js +347 -356
- package/dist/resource/filters.js +271 -280
- package/dist/resource/list.js +1264 -1273
- package/dist/resource/selector.js +865 -874
- package/dist/resource/tree.js +1483 -1492
- package/dist/resourcemgr/fileBrowser.js +564 -569
- package/dist/resourcemgr/filePreview.js +16 -16
- package/dist/resourcemgr/fileSelector.js +515 -524
- package/dist/resourcemgr/util/updatePermissions.js +2 -2
- package/dist/resourcemgr.js +306 -315
- package/dist/searchModal/advancedSearch.js +796 -767
- package/dist/searchModal.js +114 -91
- package/dist/switch/switch.js +298 -307
- package/dist/tabs.js +598 -575
- package/dist/taskQueue/status.js +312 -321
- package/dist/taskQueue/table.js +375 -384
- package/dist/taskQueue/taskQueueModel.js +488 -472
- package/dist/taskQueueButton/taskable.js +264 -273
- package/dist/taskQueueButton/treeButton.js +189 -198
- package/dist/themeLoader.js +24 -23
- package/dist/themes.js +1 -1
- package/dist/toggler.js +3 -3
- package/dist/tooltip.js +295 -304
- package/dist/transformer.js +2 -2
- package/dist/tristateCheckboxGroup.js +311 -320
- package/dist/uploader.js +687 -696
- package/dist/validator/Report.js +1 -1
- package/dist/validator/Validator.js +3 -3
- package/dist/validator/validators.js +9 -9
- package/dist/validator.js +240 -230
- package/dist/waitForMedia.js +1 -1
- package/package.json +3 -3
- package/src/animable/absorbable/css/absorb.css +1 -0
- package/src/animable/absorbable/css/absorb.css.map +1 -1
- package/src/autocomplete/css/autocomplete.css +1 -0
- package/src/autocomplete/css/autocomplete.css.map +1 -1
- package/src/badge/css/badge.css +1 -0
- package/src/badge/css/badge.css.map +1 -1
- package/src/ckeditor/ckConfigurator.js +4 -0
- package/src/itemButtonList/css/item-button-list.css +1 -0
- package/src/itemButtonList/css/item-button-list.css.map +1 -1
- package/src/.DS_Store +0 -0
- package/src/css/basic.css +0 -7826
- package/src/css/basic.css.map +0 -1
- package/src/css/ckeditor/skins/tao/css/dialog.css +0 -950
- package/src/css/ckeditor/skins/tao/css/dialog.css.map +0 -1
- package/src/css/ckeditor/skins/tao/css/editor.css +0 -1850
- package/src/css/ckeditor/skins/tao/css/editor.css.map +0 -1
- package/src/scss/.DS_Store +0 -0
- package/src/scss/basic.scss +0 -16
- package/src/scss/ckeditor/skins/tao/scss/dialog.scss +0 -763
- package/src/scss/ckeditor/skins/tao/scss/editor.scss +0 -111
- package/src/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +0 -59
- package/src/scss/ckeditor/skins/tao/scss/inc/_colorpanel.scss +0 -118
- package/src/scss/ckeditor/skins/tao/scss/inc/_elementspath.scss +0 -69
- package/src/scss/ckeditor/skins/tao/scss/inc/_mainui.scss +0 -194
- package/src/scss/ckeditor/skins/tao/scss/inc/_menu.scss +0 -181
- package/src/scss/ckeditor/skins/tao/scss/inc/_panel.scss +0 -200
- package/src/scss/ckeditor/skins/tao/scss/inc/_presets.scss +0 -32
- package/src/scss/ckeditor/skins/tao/scss/inc/_reset.scss +0 -101
- package/src/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -213
- package/src/scss/ckeditor/skins/tao/scss/inc/_tao.scss +0 -59
- package/src/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +0 -301
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot.b64 +0 -1
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
- package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff.b64 +0 -1
- package/src/scss/font/tao/tao.eot +0 -0
- package/src/scss/font/tao/tao.svg +0 -235
- package/src/scss/font/tao/tao.ttf +0 -0
- package/src/scss/font/tao/tao.woff +0 -0
- package/src/scss/inc/_base.scss +0 -496
- package/src/scss/inc/_bootstrap.scss +0 -6
- package/src/scss/inc/_buttons.scss +0 -114
- package/src/scss/inc/_colors.scss +0 -88
- package/src/scss/inc/_feedback.scss +0 -150
- package/src/scss/inc/_flex-grid.scss +0 -15
- package/src/scss/inc/_fonts.scss +0 -4
- package/src/scss/inc/_forms.scss +0 -827
- package/src/scss/inc/_functions.scss +0 -283
- package/src/scss/inc/_grid.scss +0 -66
- package/src/scss/inc/_jquery.nouislider.scss +0 -254
- package/src/scss/inc/_normalize.scss +0 -528
- package/src/scss/inc/_report.scss +0 -68
- package/src/scss/inc/_secondary-properties.scss +0 -89
- package/src/scss/inc/_select2.scss +0 -634
- package/src/scss/inc/_toolbars.scss +0 -155
- package/src/scss/inc/_tooltip.scss +0 -312
- package/src/scss/inc/_variables.scss +0 -21
- package/src/scss/inc/base/_highlight.scss +0 -5
- package/src/scss/inc/base/_list-style.scss +0 -59
- package/src/scss/inc/base/_svg.scss +0 -3
- package/src/scss/inc/base/_table.scss +0 -63
- package/src/scss/inc/fonts/_source-sans-pro.scss +0 -29
- package/src/scss/inc/fonts/_tao-icon-classes.scss +0 -226
- package/src/scss/inc/fonts/_tao-icon-def.scss +0 -12
- package/src/scss/inc/fonts/_tao-icon-vars.scss +0 -240
|
@@ -1,614 +1,605 @@
|
|
|
1
1
|
define(['jquery', 'lodash', 'async', 'i18n', 'core/mimetype', 'handlebars', 'lib/dompurify/purify', 'ui/feedback', 'context', 'ui/uploader'], function ($$1, _, async, __, mimeType, Handlebars, DOMPurify, feedback, context, uploader) { 'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
$$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
|
|
4
|
+
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
5
|
+
async = async && Object.prototype.hasOwnProperty.call(async, 'default') ? async['default'] : async;
|
|
6
|
+
__ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
|
|
7
|
+
mimeType = mimeType && Object.prototype.hasOwnProperty.call(mimeType, 'default') ? mimeType['default'] : mimeType;
|
|
8
|
+
Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
|
|
9
|
+
DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
|
|
10
|
+
feedback = feedback && Object.prototype.hasOwnProperty.call(feedback, 'default') ? feedback['default'] : feedback;
|
|
11
|
+
context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
|
|
12
|
+
|
|
13
|
+
function _typeof(obj) {
|
|
14
|
+
"@babel/helpers - typeof";
|
|
15
|
+
|
|
16
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
17
|
+
return typeof obj;
|
|
18
|
+
} : function (obj) {
|
|
19
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
20
|
+
}, _typeof(obj);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Helpers0 (hb) {
|
|
24
|
+
//register a i18n helper
|
|
25
|
+
hb.registerHelper('__', function (key) {
|
|
26
|
+
return __(key);
|
|
27
|
+
});
|
|
13
28
|
/**
|
|
14
|
-
*
|
|
15
|
-
* modify it under the terms of the GNU General Public License
|
|
16
|
-
* as published by the Free Software Foundation; under version 2
|
|
17
|
-
* of the License (non-upgradable).
|
|
18
|
-
*
|
|
19
|
-
* This program is distributed in the hope that it will be useful,
|
|
20
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
-
* GNU General Public License for more details.
|
|
23
|
-
*
|
|
24
|
-
* You should have received a copy of the GNU General Public License
|
|
25
|
-
* along with this program; if not, write to the Free Software
|
|
26
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
27
|
-
*
|
|
28
|
-
* Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
|
|
29
|
-
*
|
|
29
|
+
* Register dompurify helper
|
|
30
30
|
*
|
|
31
|
+
* https://github.com/cure53/DOMPurify
|
|
32
|
+
* with config SAFE_FOR_TEMPLATES: true
|
|
33
|
+
* to make output safe for template systems
|
|
31
34
|
*/
|
|
32
|
-
function Helpers0 (hb) {
|
|
33
|
-
//register a i18n helper
|
|
34
|
-
hb.registerHelper('__', function (key) {
|
|
35
|
-
return __(key);
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* Register dompurify helper
|
|
39
|
-
*
|
|
40
|
-
* https://github.com/cure53/DOMPurify
|
|
41
|
-
* with config SAFE_FOR_TEMPLATES: true
|
|
42
|
-
* to make output safe for template systems
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
hb.registerHelper('dompurify', function (context) {
|
|
46
|
-
return DOMPurify.sanitize(context);
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* Register join helper
|
|
50
|
-
*
|
|
51
|
-
* Example :
|
|
52
|
-
* var values = {a:v1, b:v2, c:v3};
|
|
53
|
-
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
54
|
-
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
|
|
58
|
-
var fragments = [];
|
|
59
|
-
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
60
|
-
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
61
|
-
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
62
|
-
|
|
63
|
-
_.forIn(arr, function (value, key) {
|
|
64
|
-
var fragment = '';
|
|
65
|
-
|
|
66
|
-
if (value !== null || value !== undefined) {
|
|
67
|
-
if (typeof value === 'boolean') {
|
|
68
|
-
value = value ? 'true' : 'false';
|
|
69
|
-
} else if (typeof value === 'object') {
|
|
70
|
-
value = _.values(value).join(' ');
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
value = '';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (keyValueGlue !== undefined) {
|
|
77
|
-
fragment += key + keyValueGlue;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fragment += wrapper + value + wrapper;
|
|
81
|
-
fragments.push(fragment);
|
|
82
|
-
});
|
|
83
35
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
36
|
+
hb.registerHelper('dompurify', function (context) {
|
|
37
|
+
return DOMPurify.sanitize(context);
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Register join helper
|
|
41
|
+
*
|
|
42
|
+
* Example :
|
|
43
|
+
* var values = {a:v1, b:v2, c:v3};
|
|
44
|
+
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
45
|
+
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
46
|
+
*/
|
|
87
47
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
48
|
+
hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
|
|
49
|
+
var fragments = [];
|
|
50
|
+
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
51
|
+
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
52
|
+
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
93
53
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
i: i
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
54
|
+
_.forIn(arr, function (value, key) {
|
|
55
|
+
var fragment = '';
|
|
99
56
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
57
|
+
if (value !== null || value !== undefined) {
|
|
58
|
+
if (typeof value === 'boolean') {
|
|
59
|
+
value = value ? 'true' : 'false';
|
|
60
|
+
} else if (_typeof(value) === 'object') {
|
|
61
|
+
value = _.values(value).join(' ');
|
|
62
|
+
}
|
|
105
63
|
} else {
|
|
106
|
-
|
|
64
|
+
value = '';
|
|
107
65
|
}
|
|
108
|
-
}); // register a "get property" helper
|
|
109
|
-
// it gets the named property from the provided context
|
|
110
|
-
|
|
111
|
-
hb.registerHelper('property', function (name, context) {
|
|
112
|
-
return context[name] || '';
|
|
113
|
-
}); // register an 'includes' helper
|
|
114
|
-
// it checks if value is in array
|
|
115
66
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return options.fn(this);
|
|
67
|
+
if (keyValueGlue !== undefined) {
|
|
68
|
+
fragment += key + keyValueGlue;
|
|
119
69
|
}
|
|
70
|
+
|
|
71
|
+
fragment += wrapper + value + wrapper;
|
|
72
|
+
fragments.push(fragment);
|
|
120
73
|
});
|
|
121
|
-
}
|
|
122
74
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
128
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
129
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
130
|
-
var buffer = "", stack1, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this;
|
|
131
|
-
|
|
132
|
-
function program1(depth0,data) {
|
|
133
|
-
|
|
134
|
-
var buffer = "", stack1, helper;
|
|
135
|
-
buffer += "\n <li data-type=\"";
|
|
136
|
-
if (helper = helpers.type) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
137
|
-
else { helper = (depth0 && depth0.type); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
138
|
-
buffer += escapeExpression(stack1)
|
|
139
|
-
+ "\" \n data-file=\"";
|
|
140
|
-
if (helper = helpers.uri) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
141
|
-
else { helper = (depth0 && depth0.uri); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
142
|
-
buffer += escapeExpression(stack1)
|
|
143
|
-
+ "\" \n data-display=\"";
|
|
144
|
-
if (helper = helpers.display) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
145
|
-
else { helper = (depth0 && depth0.display); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
146
|
-
buffer += escapeExpression(stack1)
|
|
147
|
-
+ "\" \n data-mime=\"";
|
|
148
|
-
if (helper = helpers.mime) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
149
|
-
else { helper = (depth0 && depth0.mime); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
150
|
-
buffer += escapeExpression(stack1)
|
|
151
|
-
+ "\" \n data-size=\"";
|
|
152
|
-
if (helper = helpers.size) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
153
|
-
else { helper = (depth0 && depth0.size); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
154
|
-
buffer += escapeExpression(stack1)
|
|
155
|
-
+ "\" \n data-url=\"";
|
|
156
|
-
if (helper = helpers.viewUrl) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
157
|
-
else { helper = (depth0 && depth0.viewUrl); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
158
|
-
buffer += escapeExpression(stack1)
|
|
159
|
-
+ "\" \n ";
|
|
160
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.download), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
|
161
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
162
|
-
buffer += "\n ";
|
|
163
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.preview), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
|
|
164
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
165
|
-
buffer += "\n ";
|
|
166
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.read), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
167
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
168
|
-
buffer += "\n data-alt=\"";
|
|
169
|
-
if (helper = helpers.alt) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
170
|
-
else { helper = (depth0 && depth0.alt); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
171
|
-
buffer += escapeExpression(stack1)
|
|
172
|
-
+ "\">\n <span class=\"desc truncate\">";
|
|
173
|
-
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
174
|
-
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
175
|
-
buffer += escapeExpression(stack1)
|
|
176
|
-
+ "</span>\n <div class=\"actions\">\n <div class=\"tlb\">\n <div class=\"tlb-top\">\n <span class=\"tlb-box\">\n <span class=\"tlb-bar\">\n <span class=\"tlb-start\"></span>\n ";
|
|
177
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.read), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
178
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
179
|
-
buffer += "\n <span class=\"tlb-end\"></span>\n </span>\n </span>\n </div>\n </div>\n </div>\n </li>\n";
|
|
180
|
-
return buffer;
|
|
181
|
-
}
|
|
182
|
-
function program2(depth0,data) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return " data-download=\"true\" ";
|
|
186
|
-
}
|
|
75
|
+
return fragments.join(fragmentGlue);
|
|
76
|
+
}); //register a classic "for loop" helper
|
|
77
|
+
//it also adds a local variable "i" as the index in each iteration loop
|
|
187
78
|
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
79
|
+
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
80
|
+
var ret = '';
|
|
81
|
+
startIndex = parseInt(startIndex);
|
|
82
|
+
stopIndex = parseInt(stopIndex);
|
|
83
|
+
increment = parseInt(increment);
|
|
193
84
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
85
|
+
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
86
|
+
ret += options.fn(_.extend({}, this, {
|
|
87
|
+
i: i
|
|
88
|
+
}));
|
|
198
89
|
}
|
|
199
90
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.download), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
208
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
209
|
-
buffer += "\n ";
|
|
210
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1['delete']), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
211
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
212
|
-
buffer += "\n </span>\n ";
|
|
213
|
-
return buffer;
|
|
214
|
-
}
|
|
215
|
-
function program9(depth0,data) {
|
|
216
|
-
|
|
217
|
-
var buffer = "", helper, options;
|
|
218
|
-
buffer += "\n <a href=\"#\" class=\"tlb-button-off select\" title=\""
|
|
219
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Select this file", options) : helperMissing.call(depth0, "__", "Select this file", options)))
|
|
220
|
-
+ "\"><span class=\"icon-move-item\"></span></a>\n ";
|
|
221
|
-
return buffer;
|
|
91
|
+
return ret;
|
|
92
|
+
});
|
|
93
|
+
hb.registerHelper('equal', function (var1, var2, options) {
|
|
94
|
+
if (var1 == var2) {
|
|
95
|
+
return options.fn(this);
|
|
96
|
+
} else {
|
|
97
|
+
return options.inverse(this);
|
|
222
98
|
}
|
|
99
|
+
}); // register a "get property" helper
|
|
100
|
+
// it gets the named property from the provided context
|
|
223
101
|
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (helper = helpers.downloadUrl) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
229
|
-
else { helper = (depth0 && depth0.downloadUrl); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
230
|
-
buffer += escapeExpression(stack1)
|
|
231
|
-
+ "\" download=\"";
|
|
232
|
-
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
233
|
-
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
234
|
-
buffer += escapeExpression(stack1)
|
|
235
|
-
+ "\" target=\"_blank\" class=\"tlb-button-off download\" title=\""
|
|
236
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Download this file", options) : helperMissing.call(depth0, "__", "Download this file", options)))
|
|
237
|
-
+ "\"><span class=\"icon-download\"></span></a>\n ";
|
|
238
|
-
return buffer;
|
|
239
|
-
}
|
|
102
|
+
hb.registerHelper('property', function (name, context) {
|
|
103
|
+
return context[name] || '';
|
|
104
|
+
}); // register an 'includes' helper
|
|
105
|
+
// it checks if value is in array
|
|
240
106
|
|
|
241
|
-
function
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
buffer += "\n <a href=\"#\" class=\"tlb-button-off\" title=\""
|
|
245
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove this file", options) : helperMissing.call(depth0, "__", "Remove this file", options)))
|
|
246
|
-
+ "\" data-delete=\":parent li\"><span class=\"icon-bin\"></span></a>\n ";
|
|
247
|
-
return buffer;
|
|
107
|
+
hb.registerHelper('includes', function (haystack, needle, options) {
|
|
108
|
+
if (_.contains(haystack, needle)) {
|
|
109
|
+
return options.fn(this);
|
|
248
110
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!Helpers0.__initialized) {
|
|
115
|
+
Helpers0(Handlebars);
|
|
116
|
+
Helpers0.__initialized = true;
|
|
117
|
+
}
|
|
118
|
+
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
119
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
120
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
121
|
+
var buffer = "", stack1, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this;
|
|
122
|
+
|
|
123
|
+
function program1(depth0,data) {
|
|
124
|
+
|
|
125
|
+
var buffer = "", stack1, helper;
|
|
126
|
+
buffer += "\n <li data-type=\"";
|
|
127
|
+
if (helper = helpers.type) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
128
|
+
else { helper = (depth0 && depth0.type); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
129
|
+
buffer += escapeExpression(stack1)
|
|
130
|
+
+ "\" \n data-file=\"";
|
|
131
|
+
if (helper = helpers.uri) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
132
|
+
else { helper = (depth0 && depth0.uri); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
133
|
+
buffer += escapeExpression(stack1)
|
|
134
|
+
+ "\" \n data-display=\"";
|
|
135
|
+
if (helper = helpers.display) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
136
|
+
else { helper = (depth0 && depth0.display); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
137
|
+
buffer += escapeExpression(stack1)
|
|
138
|
+
+ "\" \n data-mime=\"";
|
|
139
|
+
if (helper = helpers.mime) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
140
|
+
else { helper = (depth0 && depth0.mime); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
141
|
+
buffer += escapeExpression(stack1)
|
|
142
|
+
+ "\" \n data-size=\"";
|
|
143
|
+
if (helper = helpers.size) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
144
|
+
else { helper = (depth0 && depth0.size); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
145
|
+
buffer += escapeExpression(stack1)
|
|
146
|
+
+ "\" \n data-url=\"";
|
|
147
|
+
if (helper = helpers.viewUrl) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
148
|
+
else { helper = (depth0 && depth0.viewUrl); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
149
|
+
buffer += escapeExpression(stack1)
|
|
150
|
+
+ "\" \n ";
|
|
151
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.download), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
|
152
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
153
|
+
buffer += "\n ";
|
|
154
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.preview), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
|
|
155
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
156
|
+
buffer += "\n ";
|
|
157
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.read), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
|
158
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
159
|
+
buffer += "\n data-alt=\"";
|
|
160
|
+
if (helper = helpers.alt) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
161
|
+
else { helper = (depth0 && depth0.alt); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
162
|
+
buffer += escapeExpression(stack1)
|
|
163
|
+
+ "\">\n <span class=\"desc truncate\">";
|
|
164
|
+
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
165
|
+
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
166
|
+
buffer += escapeExpression(stack1)
|
|
167
|
+
+ "</span>\n <div class=\"actions\">\n <div class=\"tlb\">\n <div class=\"tlb-top\">\n <span class=\"tlb-box\">\n <span class=\"tlb-bar\">\n <span class=\"tlb-start\"></span>\n ";
|
|
168
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.read), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
|
|
169
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
170
|
+
buffer += "\n <span class=\"tlb-end\"></span>\n </span>\n </span>\n </div>\n </div>\n </div>\n </li>\n";
|
|
171
|
+
return buffer;
|
|
172
|
+
}
|
|
173
|
+
function program2(depth0,data) {
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
return " data-download=\"true\" ";
|
|
258
177
|
}
|
|
259
178
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
function updatePermissions(item) {
|
|
266
|
-
const isAssets = (item.uri || item.path || '').includes('mediamanager');
|
|
267
|
-
let permissions = {
|
|
268
|
-
read: true,
|
|
269
|
-
write: true,
|
|
270
|
-
preview: true,
|
|
271
|
-
download: true,
|
|
272
|
-
upload: true,
|
|
273
|
-
delete: true
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
if (item.permissions) {
|
|
277
|
-
if (!item.permissions.includes('READ')) {
|
|
278
|
-
permissions.read = false;
|
|
279
|
-
}
|
|
179
|
+
function program4(depth0,data) {
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return " data-preview=\"true\" ";
|
|
183
|
+
}
|
|
280
184
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
185
|
+
function program6(depth0,data) {
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
return " data-select=\"true\" ";
|
|
189
|
+
}
|
|
284
190
|
|
|
191
|
+
function program8(depth0,data) {
|
|
192
|
+
|
|
193
|
+
var buffer = "", stack1;
|
|
194
|
+
buffer += "\n <span class=\"tlb-group\">\n ";
|
|
195
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.read), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
|
|
196
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
197
|
+
buffer += "\n ";
|
|
198
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1.download), {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
|
|
199
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
200
|
+
buffer += "\n ";
|
|
201
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.permissions)),stack1 == null || stack1 === false ? stack1 : stack1['delete']), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
|
202
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
203
|
+
buffer += "\n </span>\n ";
|
|
204
|
+
return buffer;
|
|
205
|
+
}
|
|
206
|
+
function program9(depth0,data) {
|
|
207
|
+
|
|
208
|
+
var buffer = "", helper, options;
|
|
209
|
+
buffer += "\n <a href=\"#\" class=\"tlb-button-off select\" title=\""
|
|
210
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Select this file", options) : helperMissing.call(depth0, "__", "Select this file", options)))
|
|
211
|
+
+ "\"><span class=\"icon-move-item\"></span></a>\n ";
|
|
212
|
+
return buffer;
|
|
213
|
+
}
|
|
285
214
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
215
|
+
function program11(depth0,data) {
|
|
216
|
+
|
|
217
|
+
var buffer = "", stack1, helper, options;
|
|
218
|
+
buffer += "\n <a href=\"";
|
|
219
|
+
if (helper = helpers.downloadUrl) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
220
|
+
else { helper = (depth0 && depth0.downloadUrl); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
221
|
+
buffer += escapeExpression(stack1)
|
|
222
|
+
+ "\" download=\"";
|
|
223
|
+
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
224
|
+
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
225
|
+
buffer += escapeExpression(stack1)
|
|
226
|
+
+ "\" target=\"_blank\" class=\"tlb-button-off download\" title=\""
|
|
227
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Download this file", options) : helperMissing.call(depth0, "__", "Download this file", options)))
|
|
228
|
+
+ "\"><span class=\"icon-download\"></span></a>\n ";
|
|
229
|
+
return buffer;
|
|
230
|
+
}
|
|
290
231
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
232
|
+
function program13(depth0,data) {
|
|
233
|
+
|
|
234
|
+
var buffer = "", helper, options;
|
|
235
|
+
buffer += "\n <a href=\"#\" class=\"tlb-button-off\" title=\""
|
|
236
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Remove this file", options) : helperMissing.call(depth0, "__", "Remove this file", options)))
|
|
237
|
+
+ "\" data-delete=\":parent li\"><span class=\"icon-bin\"></span></a>\n ";
|
|
238
|
+
return buffer;
|
|
239
|
+
}
|
|
294
240
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
241
|
+
stack1 = helpers.each.call(depth0, (depth0 && depth0.files), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
|
242
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
243
|
+
buffer += "\n";
|
|
244
|
+
return buffer;
|
|
245
|
+
});
|
|
246
|
+
function fileSelectTpl(data, options, asString) {
|
|
247
|
+
var html = Template(data, options);
|
|
248
|
+
return (asString || true) ? html : $(html);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Update the permissions in HTML Tree
|
|
253
|
+
* @param {Object} item - the tree item
|
|
254
|
+
* @return {Object} - item with permissions
|
|
255
|
+
*/
|
|
256
|
+
function updatePermissions(item) {
|
|
257
|
+
var isAssets = (item.uri || item.path || '').includes('mediamanager');
|
|
258
|
+
var permissions = {
|
|
259
|
+
read: true,
|
|
260
|
+
write: true,
|
|
261
|
+
preview: true,
|
|
262
|
+
download: true,
|
|
263
|
+
upload: true,
|
|
264
|
+
delete: true
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
if (item.permissions) {
|
|
268
|
+
if (!item.permissions.includes('READ')) {
|
|
269
|
+
permissions.read = false;
|
|
270
|
+
}
|
|
298
271
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
272
|
+
if (!item.permissions.includes('WRITE')) {
|
|
273
|
+
permissions.write = false;
|
|
274
|
+
} // Atomic permissions for Assets
|
|
302
275
|
|
|
303
|
-
} else {
|
|
304
|
-
if (!permissions.read) {
|
|
305
|
-
permissions.preview = false;
|
|
306
|
-
permissions.download = false;
|
|
307
|
-
}
|
|
308
276
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
277
|
+
if (isAssets) {
|
|
278
|
+
if (!item.permissions.includes('PREVIEW')) {
|
|
279
|
+
permissions.preview = false;
|
|
313
280
|
}
|
|
314
|
-
}
|
|
315
281
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
282
|
+
if (!item.permissions.includes('DOWNLOAD')) {
|
|
283
|
+
permissions.download = false;
|
|
284
|
+
}
|
|
319
285
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
* as published by the Free Software Foundation; under version 2
|
|
324
|
-
* of the License (non-upgradable).
|
|
325
|
-
*
|
|
326
|
-
* This program is distributed in the hope that it will be useful,
|
|
327
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
328
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
329
|
-
* GNU General Public License for more details.
|
|
330
|
-
*
|
|
331
|
-
* You should have received a copy of the GNU General Public License
|
|
332
|
-
* along with this program; if not, write to the Free Software
|
|
333
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
334
|
-
*
|
|
335
|
-
* Copyright (c) 2015 (original work) Open Assessment Technologies SA;
|
|
336
|
-
*
|
|
337
|
-
*/
|
|
338
|
-
let ns = 'resourcemgr';
|
|
286
|
+
if (!item.permissions.includes('UPLOAD')) {
|
|
287
|
+
permissions.upload = false;
|
|
288
|
+
}
|
|
339
289
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
let end = tokens.length - 1;
|
|
290
|
+
if (!item.permissions.includes('DELETE')) {
|
|
291
|
+
permissions.delete = false;
|
|
292
|
+
} // Generic permissions for item gallery media
|
|
344
293
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
294
|
+
} else {
|
|
295
|
+
if (!permissions.read) {
|
|
296
|
+
permissions.preview = false;
|
|
297
|
+
permissions.download = false;
|
|
298
|
+
}
|
|
348
299
|
|
|
349
|
-
|
|
350
|
-
|
|
300
|
+
if (!permissions.write) {
|
|
301
|
+
permissions.delete = false;
|
|
302
|
+
permissions.upload = false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
351
305
|
}
|
|
352
306
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
307
|
+
item.permissions = permissions;
|
|
308
|
+
return item;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/*
|
|
312
|
+
* This program is free software; you can redistribute it and/or
|
|
313
|
+
* modify it under the terms of the GNU General Public License
|
|
314
|
+
* as published by the Free Software Foundation; under version 2
|
|
315
|
+
* of the License (non-upgradable).
|
|
316
|
+
*
|
|
317
|
+
* This program is distributed in the hope that it will be useful,
|
|
318
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
319
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
320
|
+
* GNU General Public License for more details.
|
|
321
|
+
*
|
|
322
|
+
* You should have received a copy of the GNU General Public License
|
|
323
|
+
* along with this program; if not, write to the Free Software
|
|
324
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
325
|
+
*
|
|
326
|
+
* Copyright (c) 2015 (original work) Open Assessment Technologies SA;
|
|
327
|
+
*
|
|
328
|
+
*/
|
|
329
|
+
var ns = 'resourcemgr';
|
|
330
|
+
|
|
331
|
+
function shortenPath(path) {
|
|
332
|
+
var tokens = path.replace(/\/$/, '').split('/');
|
|
333
|
+
var start = tokens.length - 3;
|
|
334
|
+
var end = tokens.length - 1;
|
|
335
|
+
|
|
336
|
+
var title = _.map(tokens, function (token, index) {
|
|
337
|
+
return index > start && token ? index < end ? token[0] : token : undefined;
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
title = title.filter(Boolean);
|
|
341
|
+
return title.join('/');
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function isTextLarger($element, text) {
|
|
345
|
+
var $dummy = $element.clone().detach().css({
|
|
346
|
+
position: 'absolute',
|
|
347
|
+
visibility: 'hidden',
|
|
348
|
+
'text-overflow': 'clip',
|
|
349
|
+
width: 'auto'
|
|
350
|
+
}).text(text).insertAfter($element);
|
|
351
|
+
var textSize = $dummy.width();
|
|
352
|
+
$dummy.remove();
|
|
353
|
+
return textSize > $element.width();
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function fileSelector (options) {
|
|
357
|
+
var root = options.root || '/';
|
|
358
|
+
var disableUpload = options.disableUpload || false;
|
|
359
|
+
var $container = options.$target;
|
|
360
|
+
var $fileSelector = $$1('.file-selector', $container);
|
|
361
|
+
var $fileContainer = $$1('.files', $fileSelector);
|
|
362
|
+
var $placeholder = $$1('.empty', $fileSelector);
|
|
363
|
+
var $uploader = $$1('.file-upload-container', $fileSelector);
|
|
364
|
+
var parentSelector = "#".concat($container.attr('id'), " .file-selector");
|
|
365
|
+
var $pathTitle = $fileSelector.find('h1 > .title');
|
|
366
|
+
var $browserTitle = $$1('.file-browser > h1', $container); //set up the uploader
|
|
367
|
+
|
|
368
|
+
if (disableUpload) {
|
|
369
|
+
var $switcher = $$1('.upload-switcher', $fileSelector);
|
|
370
|
+
$switcher.remove();
|
|
371
|
+
} else {
|
|
372
|
+
setUpUploader(root);
|
|
373
|
+
} //update current folder
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
$container.on("folderselect.".concat(ns), function (e, fullPath, data, activePath, content) {
|
|
377
|
+
var files;
|
|
378
|
+
data = data.map(function (dataItem) {
|
|
379
|
+
if (Array.isArray(dataItem.permissions)) {
|
|
380
|
+
updatePermissions(dataItem);
|
|
381
|
+
}
|
|
364
382
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
let disableUpload = options.disableUpload || false;
|
|
368
|
-
let $container = options.$target;
|
|
369
|
-
let $fileSelector = $$1('.file-selector', $container);
|
|
370
|
-
let $fileContainer = $$1('.files', $fileSelector);
|
|
371
|
-
let $placeholder = $$1('.empty', $fileSelector);
|
|
372
|
-
let $uploader = $$1('.file-upload-container', $fileSelector);
|
|
373
|
-
let parentSelector = `#${$container.attr('id')} .file-selector`;
|
|
374
|
-
let $pathTitle = $fileSelector.find('h1 > .title');
|
|
375
|
-
let $browserTitle = $$1('.file-browser > h1', $container); //set up the uploader
|
|
376
|
-
|
|
377
|
-
if (disableUpload) {
|
|
378
|
-
let $switcher = $$1('.upload-switcher', $fileSelector);
|
|
379
|
-
$switcher.remove();
|
|
380
|
-
} else {
|
|
381
|
-
setUpUploader(root);
|
|
382
|
-
} //update current folder
|
|
383
|
+
return dataItem;
|
|
384
|
+
}); //update title
|
|
383
385
|
|
|
386
|
+
if ($container[0].querySelector('.upload')) {
|
|
387
|
+
if (content && content.permissions && content.permissions.upload) {
|
|
388
|
+
$container[0].querySelector('.upload').classList.remove('hidden');
|
|
389
|
+
} else {
|
|
390
|
+
$container[0].querySelector('.upload').classList.add('hidden');
|
|
391
|
+
}
|
|
392
|
+
}
|
|
384
393
|
|
|
385
|
-
$
|
|
386
|
-
let files;
|
|
387
|
-
data = data.map(function (dataItem) {
|
|
388
|
-
if (Array.isArray(dataItem.permissions)) {
|
|
389
|
-
updatePermissions(dataItem);
|
|
390
|
-
}
|
|
394
|
+
$pathTitle.text(isTextLarger($pathTitle, fullPath) ? shortenPath(fullPath) : fullPath); //update content here
|
|
391
395
|
|
|
392
|
-
|
|
393
|
-
|
|
396
|
+
if (_.isArray(data)) {
|
|
397
|
+
files = _.filter(data, function (item) {
|
|
398
|
+
return !!item.uri;
|
|
399
|
+
}).map(function (file) {
|
|
400
|
+
file.type = mimeType.getFileType(file);
|
|
394
401
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
$container[0].querySelector('.upload').classList.remove('hidden');
|
|
402
|
+
if (file.identifier === undefined) {
|
|
403
|
+
file.display = "".concat(fullPath, "/").concat(file.name).replace('//', '/');
|
|
398
404
|
} else {
|
|
399
|
-
|
|
405
|
+
file.display = file.identifier + file.name;
|
|
400
406
|
}
|
|
407
|
+
|
|
408
|
+
file.viewUrl = "".concat(options.downloadUrl, "?").concat($$1.param(options.params), "&").concat(options.pathParam, "=").concat(encodeURIComponent(file.uri));
|
|
409
|
+
file.downloadUrl = "".concat(file.viewUrl, "&svgzsupport=true");
|
|
410
|
+
return file;
|
|
411
|
+
});
|
|
412
|
+
updateFiles(fullPath, files);
|
|
413
|
+
|
|
414
|
+
if (activePath) {
|
|
415
|
+
$$1("li[data-file=\"".concat(activePath, "\"]")).trigger('click');
|
|
401
416
|
}
|
|
417
|
+
}
|
|
418
|
+
}); //listen for file activation
|
|
402
419
|
|
|
403
|
-
|
|
420
|
+
$$1(parentSelector).off('click', '.files li').on('click', '.files li', function (e) {
|
|
421
|
+
var clickedItem = e.target;
|
|
404
422
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}).map(function (file) {
|
|
409
|
-
file.type = mimeType.getFileType(file);
|
|
423
|
+
if (clickedItem.hasAttribute('data-delete') || $$1(clickedItem).hasClass('icon-bin')) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
410
426
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
} else {
|
|
414
|
-
file.display = file.identifier + file.name;
|
|
415
|
-
}
|
|
427
|
+
var $selected = $$1(this);
|
|
428
|
+
var $files = $$1('.files > li', $fileSelector);
|
|
416
429
|
|
|
417
|
-
|
|
418
|
-
file.downloadUrl = `${file.viewUrl}&svgzsupport=true`;
|
|
419
|
-
return file;
|
|
420
|
-
});
|
|
421
|
-
updateFiles(fullPath, files);
|
|
430
|
+
var data = _.clone($selected.data());
|
|
422
431
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}); //listen for file activation
|
|
432
|
+
$files.removeClass('active');
|
|
433
|
+
$selected.addClass('active');
|
|
434
|
+
$container.trigger("fileselect.".concat(ns), [data]);
|
|
435
|
+
}); //select a file
|
|
428
436
|
|
|
429
|
-
|
|
430
|
-
|
|
437
|
+
$$1(parentSelector).off('click', '.files li a.select').on('click', '.files li a.select', function (e) {
|
|
438
|
+
e.preventDefault();
|
|
431
439
|
|
|
432
|
-
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
440
|
+
var data = _.pick($$1(this).parents('li').data(), ['file', 'type', 'mime', 'size', 'alt']);
|
|
435
441
|
|
|
436
|
-
|
|
437
|
-
|
|
442
|
+
if (context.mediaSources && context.mediaSources.length === 0 && data.file.indexOf('local/') > -1) {
|
|
443
|
+
data.file = data.file.substring(6);
|
|
444
|
+
}
|
|
438
445
|
|
|
439
|
-
|
|
446
|
+
$container.trigger("select.".concat(ns), [[data]]);
|
|
447
|
+
}); //delete a file
|
|
440
448
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}); //select a file
|
|
449
|
+
$fileContainer.on('delete.deleter', function (e, $target) {
|
|
450
|
+
var path,
|
|
451
|
+
params = {};
|
|
445
452
|
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
if (e.namespace === 'deleter' && $target.length) {
|
|
454
|
+
path = $target.data('file');
|
|
455
|
+
params[options.pathParam] = path;
|
|
456
|
+
$$1.getJSON(options.deleteUrl, _.merge(params, options.params), function (response) {
|
|
457
|
+
if (response.deleted) {
|
|
458
|
+
$container.trigger("filedelete.".concat(ns), [path]);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
});
|
|
448
463
|
|
|
449
|
-
|
|
464
|
+
function setUpUploader(currentPath) {
|
|
465
|
+
var errors = [];
|
|
466
|
+
var $switcher = $$1('.upload-switcher a', $fileSelector);
|
|
467
|
+
$uploader.on('upload.uploader', function (e, file, result) {
|
|
468
|
+
var path = $$1("[data-display=\"".concat(currentPath, "\"]")).data('path') || $$1("[data-display=\"/".concat(currentPath, "\"]")).data('path');
|
|
450
469
|
|
|
451
|
-
if (
|
|
452
|
-
|
|
470
|
+
if (!path) {
|
|
471
|
+
path = currentPath;
|
|
453
472
|
}
|
|
454
473
|
|
|
455
|
-
$container.trigger(
|
|
456
|
-
});
|
|
474
|
+
$container.trigger("filenew.".concat(ns), [result, path]);
|
|
475
|
+
});
|
|
476
|
+
$uploader.on('fail.uploader', function (e, file, err) {
|
|
477
|
+
errors.push(__('Unable to upload file %s : %s', file.name, err.message));
|
|
478
|
+
});
|
|
479
|
+
$uploader.on('end.uploader', function () {
|
|
480
|
+
if (errors.length === 0) {
|
|
481
|
+
_.delay(switchUpload, 500);
|
|
482
|
+
} else {
|
|
483
|
+
feedback().error("<ul><li>".concat(errors.join('</li><li>'), "</li></ul>"), {
|
|
484
|
+
encodeHtml: false
|
|
485
|
+
});
|
|
486
|
+
} //reset errors
|
|
457
487
|
|
|
458
|
-
$fileContainer.on('delete.deleter', function (e, $target) {
|
|
459
|
-
let path,
|
|
460
|
-
params = {};
|
|
461
488
|
|
|
462
|
-
|
|
463
|
-
path = $target.data('file');
|
|
464
|
-
params[options.pathParam] = path;
|
|
465
|
-
$$1.getJSON(options.deleteUrl, _.merge(params, options.params), function (response) {
|
|
466
|
-
if (response.deleted) {
|
|
467
|
-
$container.trigger(`filedelete.${ns}`, [path]);
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
}
|
|
489
|
+
errors = [];
|
|
471
490
|
});
|
|
491
|
+
$uploader.uploader({
|
|
492
|
+
upload: true,
|
|
493
|
+
multiple: true,
|
|
494
|
+
uploadUrl: "".concat(options.uploadUrl, "?").concat($$1.param(options.params), "&").concat(options.pathParam, "=").concat(currentPath),
|
|
495
|
+
fileSelect: function fileSelect(files, done) {
|
|
496
|
+
var givenLength = files.length;
|
|
497
|
+
var fileNames = [];
|
|
498
|
+
$fileContainer.find('li > .desc').each(function () {
|
|
499
|
+
fileNames.push($$1(this).text().toLowerCase());
|
|
500
|
+
}); //check the mime-type
|
|
501
|
+
|
|
502
|
+
if (options.params.filters) {
|
|
503
|
+
var filters = [],
|
|
504
|
+
i;
|
|
505
|
+
|
|
506
|
+
if (!_.isString(options.params.filters)) {
|
|
507
|
+
for (i in options.params.filters) {
|
|
508
|
+
filters.push(options.params.filters[i]['mime']);
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
filters = options.params.filters.split(',');
|
|
512
|
+
} //TODO check stars
|
|
472
513
|
|
|
473
|
-
function setUpUploader(currentPath) {
|
|
474
|
-
let errors = [];
|
|
475
|
-
let $switcher = $$1('.upload-switcher a', $fileSelector);
|
|
476
|
-
$uploader.on('upload.uploader', function (e, file, result) {
|
|
477
|
-
let path = $$1(`[data-display="${currentPath}"]`).data('path') || $$1(`[data-display="/${currentPath}"]`).data('path');
|
|
478
|
-
|
|
479
|
-
if (!path) {
|
|
480
|
-
path = currentPath;
|
|
481
|
-
}
|
|
482
514
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
$uploader.on('end.uploader', function () {
|
|
489
|
-
if (errors.length === 0) {
|
|
490
|
-
_.delay(switchUpload, 500);
|
|
491
|
-
} else {
|
|
492
|
-
feedback().error(`<ul><li>${errors.join('</li><li>')}</li></ul>`, {
|
|
493
|
-
encodeHtml: false
|
|
515
|
+
files = _.filter(files, function (file) {
|
|
516
|
+
// Under rare circumstances a browser may report the mime type
|
|
517
|
+
// with quotes (e.g. "application/foo" instead of application/foo)
|
|
518
|
+
var checkType = file.type.replace(/^["']+|['"]+$/g, '');
|
|
519
|
+
return _.contains(filters, checkType);
|
|
494
520
|
});
|
|
495
|
-
} //reset errors
|
|
496
521
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
$uploader.uploader({
|
|
501
|
-
upload: true,
|
|
502
|
-
multiple: true,
|
|
503
|
-
uploadUrl: `${options.uploadUrl}?${$$1.param(options.params)}&${options.pathParam}=${currentPath}`,
|
|
504
|
-
fileSelect: function (files, done) {
|
|
505
|
-
let givenLength = files.length;
|
|
506
|
-
let fileNames = [];
|
|
507
|
-
$fileContainer.find('li > .desc').each(function () {
|
|
508
|
-
fileNames.push($$1(this).text().toLowerCase());
|
|
509
|
-
}); //check the mime-type
|
|
510
|
-
|
|
511
|
-
if (options.params.filters) {
|
|
512
|
-
let filters = [],
|
|
513
|
-
i;
|
|
514
|
-
|
|
515
|
-
if (!_.isString(options.params.filters)) {
|
|
516
|
-
for (i in options.params.filters) {
|
|
517
|
-
filters.push(options.params.filters[i]['mime']);
|
|
518
|
-
}
|
|
519
|
-
} else {
|
|
520
|
-
filters = options.params.filters.split(',');
|
|
521
|
-
} //TODO check stars
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
files = _.filter(files, function (file) {
|
|
525
|
-
// Under rare circumstances a browser may report the mime type
|
|
526
|
-
// with quotes (e.g. "application/foo" instead of application/foo)
|
|
527
|
-
let checkType = file.type.replace(/^["']+|['"]+$/g, '');
|
|
528
|
-
return _.contains(filters, checkType);
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
if (files.length !== givenLength) {
|
|
532
|
-
//TODO use a feedback popup
|
|
533
|
-
feedback().error('Unauthorized files have been removed');
|
|
534
|
-
}
|
|
522
|
+
if (files.length !== givenLength) {
|
|
523
|
+
//TODO use a feedback popup
|
|
524
|
+
feedback().error('Unauthorized files have been removed');
|
|
535
525
|
}
|
|
526
|
+
}
|
|
536
527
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
result = window.confirm(__('Do you want to override "%s"?', file.name));
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
cb(result);
|
|
549
|
-
});
|
|
550
|
-
} else {
|
|
551
|
-
//fallback on client side check
|
|
552
|
-
if (_.contains(fileNames, file.name.toLowerCase())) {
|
|
528
|
+
async.filter(files, function (file, cb) {
|
|
529
|
+
var result = true; //try to call a server side service to check whether the selected files exists or not.
|
|
530
|
+
|
|
531
|
+
if (options.fileExistsUrl) {
|
|
532
|
+
var pathParam = "".concat(currentPath, "/").concat(file.name);
|
|
533
|
+
pathParam.replace('//', '/');
|
|
534
|
+
$$1.getJSON("".concat(options.fileExistsUrl, "?").concat($$1.param(options.params), "&").concat(options.pathParam, "=").concat(pathParam), function (response) {
|
|
535
|
+
if (response && response.exists === true) {
|
|
553
536
|
result = window.confirm(__('Do you want to override "%s"?', file.name));
|
|
554
537
|
}
|
|
555
538
|
|
|
556
539
|
cb(result);
|
|
540
|
+
});
|
|
541
|
+
} else {
|
|
542
|
+
//fallback on client side check
|
|
543
|
+
if (_.contains(fileNames, file.name.toLowerCase())) {
|
|
544
|
+
result = window.confirm(__('Do you want to override "%s"?', file.name));
|
|
557
545
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
546
|
+
|
|
547
|
+
cb(result);
|
|
548
|
+
}
|
|
549
|
+
}, done);
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
$container.on("folderselect.".concat(ns), function (e, fullPath, data, uri) {
|
|
553
|
+
currentPath = uri;
|
|
554
|
+
$uploader.uploader('options', {
|
|
555
|
+
uploadUrl: "".concat(options.uploadUrl, "?").concat($$1.param(options.params), "&").concat(options.pathParam, "=").concat(currentPath, "&relPath=").concat(currentPath)
|
|
566
556
|
});
|
|
557
|
+
});
|
|
567
558
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
559
|
+
var switchUpload = function switchUpload() {
|
|
560
|
+
if ($fileContainer.css('display') === 'none') {
|
|
561
|
+
$uploader.hide();
|
|
562
|
+
$fileContainer.show(); // Note: show() would display as inline, not inline-block!
|
|
572
563
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
564
|
+
$switcher.filter('.upload').css({
|
|
565
|
+
display: 'inline-block'
|
|
566
|
+
});
|
|
567
|
+
$switcher.filter('.listing').hide();
|
|
568
|
+
$browserTitle.text(__('Browse folders:'));
|
|
569
|
+
} else {
|
|
570
|
+
$fileContainer.hide();
|
|
571
|
+
$placeholder.hide();
|
|
572
|
+
$uploader.show();
|
|
573
|
+
$switcher.filter('.upload').hide();
|
|
574
|
+
$switcher.filter('.listing').css({
|
|
575
|
+
display: 'inline-block'
|
|
576
|
+
});
|
|
577
|
+
$browserTitle.text(__('Upload into:'));
|
|
578
|
+
$uploader.uploader('reset');
|
|
579
|
+
}
|
|
580
|
+
}; //switch to upload mode
|
|
590
581
|
|
|
591
582
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
583
|
+
$switcher.click(function (e) {
|
|
584
|
+
e.preventDefault();
|
|
585
|
+
switchUpload();
|
|
586
|
+
});
|
|
587
|
+
}
|
|
597
588
|
|
|
598
|
-
|
|
599
|
-
|
|
589
|
+
function updateFiles(path, files) {
|
|
590
|
+
$fileContainer.empty();
|
|
600
591
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
592
|
+
if (files.length) {
|
|
593
|
+
$placeholder.hide();
|
|
594
|
+
$fileContainer.append(fileSelectTpl({
|
|
595
|
+
files: files
|
|
596
|
+
}));
|
|
597
|
+
} else if ($fileContainer.css('display') !== 'none') {
|
|
598
|
+
$placeholder.show();
|
|
609
599
|
}
|
|
610
600
|
}
|
|
601
|
+
}
|
|
611
602
|
|
|
612
|
-
|
|
603
|
+
return fileSelector;
|
|
613
604
|
|
|
614
605
|
});
|