@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.
Files changed (233) hide show
  1. package/dist/actionbar.js +386 -395
  2. package/dist/adder.js +21 -19
  3. package/dist/animable/absorbable/absorbable.js +204 -213
  4. package/dist/animable/absorbable/css/absorb.css +1 -0
  5. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  6. package/dist/animable/pulsable/pulsable.js +168 -177
  7. package/dist/autocomplete/css/autocomplete.css +1 -0
  8. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  9. package/dist/autocomplete.js +68 -66
  10. package/dist/badge/badge.js +188 -197
  11. package/dist/badge/css/badge.css +1 -0
  12. package/dist/badge/css/badge.css.map +1 -1
  13. package/dist/breadcrumbs.js +275 -284
  14. package/dist/btngrouper.js +5 -5
  15. package/dist/bulkActionPopup.js +490 -495
  16. package/dist/button.js +283 -291
  17. package/dist/cascadingComboBox.js +249 -258
  18. package/dist/ckeditor/ckConfigurator.js +26 -19
  19. package/dist/ckeditor/dtdHandler.js +11 -9
  20. package/dist/class/selector.js +441 -450
  21. package/dist/component/resizable.js +1 -1
  22. package/dist/component/windowed.js +285 -294
  23. package/dist/component.js +419 -428
  24. package/dist/contextualPopup.js +417 -426
  25. package/dist/dashboard.js +300 -309
  26. package/dist/datalist.js +753 -762
  27. package/dist/datatable/filterStrategy/multiple.js +1 -1
  28. package/dist/datatable/filterStrategy/single.js +1 -1
  29. package/dist/datatable.js +1527 -1550
  30. package/dist/dateRange/dateRange.js +393 -402
  31. package/dist/datetime/picker.js +665 -672
  32. package/dist/deleter.js +368 -377
  33. package/dist/destination/selector.js +286 -295
  34. package/dist/dialog/alert.js +3 -3
  35. package/dist/dialog/confirm.js +1 -1
  36. package/dist/dialog/confirmDelete.js +216 -225
  37. package/dist/dialog.js +650 -654
  38. package/dist/disabler.js +8 -8
  39. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
  40. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
  41. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
  42. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
  43. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
  44. package/dist/documentViewer/providers/pdfViewer.js +184 -193
  45. package/dist/documentViewer.js +292 -301
  46. package/dist/dropdown.js +383 -392
  47. package/dist/durationer.js +5 -5
  48. package/dist/dynamicComponent.js +597 -598
  49. package/dist/feedback.js +356 -362
  50. package/dist/figure/FigureStateActive.js +117 -108
  51. package/dist/filesender.js +2 -2
  52. package/dist/filter.js +230 -239
  53. package/dist/form/dropdownForm.js +355 -357
  54. package/dist/form/form.js +919 -690
  55. package/dist/form/simpleForm.js +1 -1
  56. package/dist/form/validator/renderer.js +233 -235
  57. package/dist/form/validator/validator.js +257 -189
  58. package/dist/form/widget/definitions.js +1 -1
  59. package/dist/form/widget/providers/checkBox.js +254 -259
  60. package/dist/form/widget/providers/comboBox.js +187 -192
  61. package/dist/form/widget/providers/default.js +8 -9
  62. package/dist/form/widget/providers/hidden.js +170 -179
  63. package/dist/form/widget/providers/hiddenBox.js +262 -267
  64. package/dist/form/widget/providers/radioBox.js +216 -225
  65. package/dist/form/widget/providers/textArea.js +187 -196
  66. package/dist/form/widget/providers/textBox.js +2 -3
  67. package/dist/form/widget/widget.js +473 -475
  68. package/dist/formValidator/formValidator.js +1 -1
  69. package/dist/formValidator/highlighters/message.js +1 -1
  70. package/dist/generis/form/form.js +314 -323
  71. package/dist/generis/validator/validator.js +209 -218
  72. package/dist/generis/widget/checkBox/checkBox.js +218 -227
  73. package/dist/generis/widget/comboBox/comboBox.js +179 -188
  74. package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
  75. package/dist/generis/widget/textBox/textBox.js +169 -178
  76. package/dist/generis/widget/widget.js +246 -255
  77. package/dist/groupedComboBox.js +222 -231
  78. package/dist/groupvalidator.js +2 -2
  79. package/dist/highlighter.js +967 -958
  80. package/dist/image/ImgStateActive/helper.js +7 -5
  81. package/dist/image/ImgStateActive/initHelper.js +49 -43
  82. package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
  83. package/dist/image/ImgStateActive/mediaSizer.js +14 -12
  84. package/dist/image/ImgStateActive.js +72 -70
  85. package/dist/incrementer.js +6 -6
  86. package/dist/inplacer.js +6 -6
  87. package/dist/itemButtonList/css/item-button-list.css +1 -0
  88. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  89. package/dist/itemButtonList.js +439 -435
  90. package/dist/keyNavigation/navigableDomElement.js +51 -38
  91. package/dist/keyNavigation/navigator.js +85 -70
  92. package/dist/listbox.js +460 -469
  93. package/dist/liststyler.js +8 -8
  94. package/dist/loadingButton/loadingButton.js +209 -218
  95. package/dist/lock.js +476 -485
  96. package/dist/login/login.js +475 -484
  97. package/dist/maths/calculator/basicCalculator.js +235 -244
  98. package/dist/maths/calculator/calculatorComponent.js +3 -3
  99. package/dist/maths/calculator/core/board.js +772 -781
  100. package/dist/maths/calculator/core/expression.js +476 -485
  101. package/dist/maths/calculator/core/labels.js +228 -237
  102. package/dist/maths/calculator/core/tokenizer.js +1 -1
  103. package/dist/maths/calculator/core/tokens.js +163 -170
  104. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
  105. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
  106. package/dist/maths/calculator/scientificCalculator.js +327 -336
  107. package/dist/mediaEditor/mediaEditorComponent.js +238 -245
  108. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
  109. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
  110. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
  111. package/dist/mediaplayer/players/html5.js +666 -675
  112. package/dist/mediaplayer/players/youtube.js +419 -424
  113. package/dist/mediaplayer/support.js +11 -10
  114. package/dist/mediaplayer/utils/reminder.js +14 -13
  115. package/dist/mediaplayer/utils/timeObserver.js +10 -11
  116. package/dist/mediaplayer/youtubeManager.js +164 -145
  117. package/dist/mediaplayer.js +1565 -1520
  118. package/dist/mediasizer.js +669 -678
  119. package/dist/modal.js +10 -17
  120. package/dist/pageSizeSelector.js +219 -228
  121. package/dist/pagination/providers/pages.js +280 -289
  122. package/dist/pagination/providers/simple.js +192 -201
  123. package/dist/previewer.js +30 -30
  124. package/dist/progressbar.js +4 -4
  125. package/dist/report.js +347 -356
  126. package/dist/resource/filters.js +271 -280
  127. package/dist/resource/list.js +1264 -1273
  128. package/dist/resource/selector.js +865 -874
  129. package/dist/resource/tree.js +1483 -1492
  130. package/dist/resourcemgr/fileBrowser.js +564 -569
  131. package/dist/resourcemgr/filePreview.js +16 -16
  132. package/dist/resourcemgr/fileSelector.js +515 -524
  133. package/dist/resourcemgr/util/updatePermissions.js +2 -2
  134. package/dist/resourcemgr.js +306 -315
  135. package/dist/searchModal/advancedSearch.js +796 -767
  136. package/dist/searchModal.js +114 -91
  137. package/dist/switch/switch.js +298 -307
  138. package/dist/tabs.js +598 -575
  139. package/dist/taskQueue/status.js +312 -321
  140. package/dist/taskQueue/table.js +375 -384
  141. package/dist/taskQueue/taskQueueModel.js +488 -472
  142. package/dist/taskQueueButton/taskable.js +264 -273
  143. package/dist/taskQueueButton/treeButton.js +189 -198
  144. package/dist/themeLoader.js +24 -23
  145. package/dist/themes.js +1 -1
  146. package/dist/toggler.js +3 -3
  147. package/dist/tooltip.js +295 -304
  148. package/dist/transformer.js +2 -2
  149. package/dist/tristateCheckboxGroup.js +311 -320
  150. package/dist/uploader.js +687 -696
  151. package/dist/validator/Report.js +1 -1
  152. package/dist/validator/Validator.js +3 -3
  153. package/dist/validator/validators.js +9 -9
  154. package/dist/validator.js +240 -230
  155. package/dist/waitForMedia.js +1 -1
  156. package/package.json +3 -3
  157. package/src/animable/absorbable/css/absorb.css +1 -0
  158. package/src/animable/absorbable/css/absorb.css.map +1 -1
  159. package/src/autocomplete/css/autocomplete.css +1 -0
  160. package/src/autocomplete/css/autocomplete.css.map +1 -1
  161. package/src/badge/css/badge.css +1 -0
  162. package/src/badge/css/badge.css.map +1 -1
  163. package/src/ckeditor/ckConfigurator.js +4 -0
  164. package/src/itemButtonList/css/item-button-list.css +1 -0
  165. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  166. package/src/.DS_Store +0 -0
  167. package/src/css/basic.css +0 -7826
  168. package/src/css/basic.css.map +0 -1
  169. package/src/css/ckeditor/skins/tao/css/dialog.css +0 -950
  170. package/src/css/ckeditor/skins/tao/css/dialog.css.map +0 -1
  171. package/src/css/ckeditor/skins/tao/css/editor.css +0 -1850
  172. package/src/css/ckeditor/skins/tao/css/editor.css.map +0 -1
  173. package/src/scss/.DS_Store +0 -0
  174. package/src/scss/basic.scss +0 -16
  175. package/src/scss/ckeditor/skins/tao/scss/dialog.scss +0 -763
  176. package/src/scss/ckeditor/skins/tao/scss/editor.scss +0 -111
  177. package/src/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +0 -59
  178. package/src/scss/ckeditor/skins/tao/scss/inc/_colorpanel.scss +0 -118
  179. package/src/scss/ckeditor/skins/tao/scss/inc/_elementspath.scss +0 -69
  180. package/src/scss/ckeditor/skins/tao/scss/inc/_mainui.scss +0 -194
  181. package/src/scss/ckeditor/skins/tao/scss/inc/_menu.scss +0 -181
  182. package/src/scss/ckeditor/skins/tao/scss/inc/_panel.scss +0 -200
  183. package/src/scss/ckeditor/skins/tao/scss/inc/_presets.scss +0 -32
  184. package/src/scss/ckeditor/skins/tao/scss/inc/_reset.scss +0 -101
  185. package/src/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -213
  186. package/src/scss/ckeditor/skins/tao/scss/inc/_tao.scss +0 -59
  187. package/src/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +0 -301
  188. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  189. package/src/scss/font/source-sans-pro/source-sans-pro-italic.eot.b64 +0 -1
  190. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  191. package/src/scss/font/source-sans-pro/source-sans-pro-italic.woff.b64 +0 -1
  192. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  193. package/src/scss/font/source-sans-pro/source-sans-pro-regular.eot.b64 +0 -1
  194. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  195. package/src/scss/font/source-sans-pro/source-sans-pro-regular.woff.b64 +0 -1
  196. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot +0 -0
  197. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.eot.b64 +0 -1
  198. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff +0 -0
  199. package/src/scss/font/source-sans-pro/source-sans-pro-semibold-italic.woff.b64 +0 -1
  200. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  201. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.eot.b64 +0 -1
  202. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  203. package/src/scss/font/source-sans-pro/source-sans-pro-semibold.woff.b64 +0 -1
  204. package/src/scss/font/tao/tao.eot +0 -0
  205. package/src/scss/font/tao/tao.svg +0 -235
  206. package/src/scss/font/tao/tao.ttf +0 -0
  207. package/src/scss/font/tao/tao.woff +0 -0
  208. package/src/scss/inc/_base.scss +0 -496
  209. package/src/scss/inc/_bootstrap.scss +0 -6
  210. package/src/scss/inc/_buttons.scss +0 -114
  211. package/src/scss/inc/_colors.scss +0 -88
  212. package/src/scss/inc/_feedback.scss +0 -150
  213. package/src/scss/inc/_flex-grid.scss +0 -15
  214. package/src/scss/inc/_fonts.scss +0 -4
  215. package/src/scss/inc/_forms.scss +0 -827
  216. package/src/scss/inc/_functions.scss +0 -283
  217. package/src/scss/inc/_grid.scss +0 -66
  218. package/src/scss/inc/_jquery.nouislider.scss +0 -254
  219. package/src/scss/inc/_normalize.scss +0 -528
  220. package/src/scss/inc/_report.scss +0 -68
  221. package/src/scss/inc/_secondary-properties.scss +0 -89
  222. package/src/scss/inc/_select2.scss +0 -634
  223. package/src/scss/inc/_toolbars.scss +0 -155
  224. package/src/scss/inc/_tooltip.scss +0 -312
  225. package/src/scss/inc/_variables.scss +0 -21
  226. package/src/scss/inc/base/_highlight.scss +0 -5
  227. package/src/scss/inc/base/_list-style.scss +0 -59
  228. package/src/scss/inc/base/_svg.scss +0 -3
  229. package/src/scss/inc/base/_table.scss +0 -63
  230. package/src/scss/inc/fonts/_source-sans-pro.scss +0 -29
  231. package/src/scss/inc/fonts/_tao-icon-classes.scss +0 -226
  232. package/src/scss/inc/fonts/_tao-icon-def.scss +0 -12
  233. package/src/scss/inc/fonts/_tao-icon-vars.scss +0 -240
@@ -1,447 +1,438 @@
1
1
  define(['jquery', 'lodash', 'i18n', 'moment', 'ui/taskQueue', 'ui/component', 'ui/taskQueue/status', 'handlebars', 'lib/dompurify/purify', 'ui/datatable', 'ui/modal', 'jquery.fileDownload'], function ($$1, _, __, moment, taskQueueApi, component, taskQueueStatusFactory, Handlebars, DOMPurify, datatable, modal, jquery_fileDownload) { 'use strict';
2
2
 
3
- $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
6
- moment = moment && Object.prototype.hasOwnProperty.call(moment, 'default') ? moment['default'] : moment;
7
- taskQueueApi = taskQueueApi && Object.prototype.hasOwnProperty.call(taskQueueApi, 'default') ? taskQueueApi['default'] : taskQueueApi;
8
- component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
9
- taskQueueStatusFactory = taskQueueStatusFactory && Object.prototype.hasOwnProperty.call(taskQueueStatusFactory, 'default') ? taskQueueStatusFactory['default'] : taskQueueStatusFactory;
10
- Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
11
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
12
-
3
+ $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
6
+ moment = moment && Object.prototype.hasOwnProperty.call(moment, 'default') ? moment['default'] : moment;
7
+ taskQueueApi = taskQueueApi && Object.prototype.hasOwnProperty.call(taskQueueApi, 'default') ? taskQueueApi['default'] : taskQueueApi;
8
+ component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
9
+ taskQueueStatusFactory = taskQueueStatusFactory && Object.prototype.hasOwnProperty.call(taskQueueStatusFactory, 'default') ? taskQueueStatusFactory['default'] : taskQueueStatusFactory;
10
+ Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
11
+ DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
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
- * This program is free software; you can redistribute it and/or
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
35
 
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
- */
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
+ */
56
47
 
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 : '"';
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 : '"';
62
53
 
63
- _.forIn(arr, function (value, key) {
64
- var fragment = '';
54
+ _.forIn(arr, function (value, key) {
55
+ var fragment = '';
65
56
 
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 = '';
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(' ');
74
62
  }
75
-
76
- if (keyValueGlue !== undefined) {
77
- fragment += key + keyValueGlue;
78
- }
79
-
80
- fragment += wrapper + value + wrapper;
81
- fragments.push(fragment);
82
- });
83
-
84
- return fragments.join(fragmentGlue);
85
- }); //register a classic "for loop" helper
86
- //it also adds a local variable "i" as the index in each iteration loop
87
-
88
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
89
- var ret = '';
90
- startIndex = parseInt(startIndex);
91
- stopIndex = parseInt(stopIndex);
92
- increment = parseInt(increment);
93
-
94
- for (var i = startIndex; i < stopIndex; i += increment) {
95
- ret += options.fn(_.extend({}, this, {
96
- i: i
97
- }));
98
- }
99
-
100
- return ret;
101
- });
102
- hb.registerHelper('equal', function (var1, var2, options) {
103
- if (var1 == var2) {
104
- return options.fn(this);
105
63
  } else {
106
- return options.inverse(this);
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
- hb.registerHelper('includes', function (haystack, needle, options) {
117
- if (_.contains(haystack, needle)) {
118
- return options.fn(this);
67
+ if (keyValueGlue !== undefined) {
68
+ fragment += key + keyValueGlue;
119
69
  }
120
- });
121
- }
122
70
 
123
- if (!Helpers0.__initialized) {
124
- Helpers0(Handlebars);
125
- Helpers0.__initialized = true;
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);
130
-
131
-
132
- return "<div class=\"report-container\"></div>";
71
+ fragment += wrapper + value + wrapper;
72
+ fragments.push(fragment);
133
73
  });
134
- function reportTpl(data, options, asString) {
135
- var html = Template(data, options);
136
- return (asString || true) ? html : $(html);
137
- }
138
74
 
139
- /*
140
- * This program is free software; you can redistribute it and/or
141
- * modify it under the terms of the GNU General Public License
142
- * as published by the Free Software Foundation; under version 2
143
- * of the License (non-upgradable).
144
- *
145
- * This program is distributed in the hope that it will be useful,
146
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
147
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148
- * GNU General Public License for more details.
149
- *
150
- * You should have received a copy of the GNU General Public License
151
- * along with this program; if not, write to the Free Software
152
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
153
- *
154
- * Copyright (c) 2017 (original work) Open Assessment Technologies SA ;
155
- *
156
- */
157
- var _defaults = {
158
- context: '',
159
- urls: {
160
- listing: '',
161
- remove: '',
162
- download: ''
163
- },
164
- status: {
165
- loading: __('Loading status'),
166
- created: __('Not started'),
167
- running: __('In progress'),
168
- finished: __('Completed'),
169
- finishedSuccess: __('Completed'),
170
- finishedError: __('Completed - Error')
171
- },
172
- statusFilter: ['loading', 'created', 'running', 'finished', 'finishedSuccess', 'finishedError']
173
- };
174
- /**
175
- * Format the input timestamp into a user friendly format
176
- *
177
- * @param {String} date
178
- * @returns {String}
179
- */
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
180
78
 
181
- var formatDate = function formatDate(date) {
182
- return moment.unix(date).fromNow();
183
- };
184
- /**
185
- * Check if the object is a report
186
- *
187
- * @param {Object} report
188
- * @returns {boolean}
189
- */
79
+ hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
80
+ var ret = '';
81
+ startIndex = parseInt(startIndex);
82
+ stopIndex = parseInt(stopIndex);
83
+ increment = parseInt(increment);
190
84
 
85
+ for (var i = startIndex; i < stopIndex; i += increment) {
86
+ ret += options.fn(_.extend({}, this, {
87
+ i: i
88
+ }));
89
+ }
191
90
 
192
- var isReport = function isReport(report) {
193
- return _.isPlainObject(report) && report.type && report.message;
194
- };
195
- /**
196
- * Check if the report is of a error type
197
- * @param {Object} report
198
- * @returns {boolean}
199
- */
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);
98
+ }
99
+ }); // register a "get property" helper
100
+ // it gets the named property from the provided context
200
101
 
102
+ hb.registerHelper('property', function (name, context) {
103
+ return context[name] || '';
104
+ }); // register an 'includes' helper
105
+ // it checks if value is in array
201
106
 
202
- var isTaskErrorReport = function isTaskErrorReport(report) {
203
- if (isReport(report) && _.isArray(report.children) && isReport(report.children[0])) {
204
- return report.children[0].type === 'error';
107
+ hb.registerHelper('includes', function (haystack, needle, options) {
108
+ if (_.contains(haystack, needle)) {
109
+ return options.fn(this);
205
110
  }
206
- };
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);
121
+
122
+
123
+ return "<div class=\"report-container\"></div>";
124
+ });
125
+ function reportTpl(data, options, asString) {
126
+ var html = Template(data, options);
127
+ return (asString || true) ? html : $(html);
128
+ }
129
+
130
+ /*
131
+ * This program is free software; you can redistribute it and/or
132
+ * modify it under the terms of the GNU General Public License
133
+ * as published by the Free Software Foundation; under version 2
134
+ * of the License (non-upgradable).
135
+ *
136
+ * This program is distributed in the hope that it will be useful,
137
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
138
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139
+ * GNU General Public License for more details.
140
+ *
141
+ * You should have received a copy of the GNU General Public License
142
+ * along with this program; if not, write to the Free Software
143
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
144
+ *
145
+ * Copyright (c) 2017 (original work) Open Assessment Technologies SA ;
146
+ *
147
+ */
148
+ var _defaults = {
149
+ context: '',
150
+ urls: {
151
+ listing: '',
152
+ remove: '',
153
+ download: ''
154
+ },
155
+ status: {
156
+ loading: __('Loading status'),
157
+ created: __('Not started'),
158
+ running: __('In progress'),
159
+ finished: __('Completed'),
160
+ finishedSuccess: __('Completed'),
161
+ finishedError: __('Completed - Error')
162
+ },
163
+ statusFilter: ['loading', 'created', 'running', 'finished', 'finishedSuccess', 'finishedError']
164
+ };
165
+ /**
166
+ * Format the input timestamp into a user friendly format
167
+ *
168
+ * @param {String} date
169
+ * @returns {String}
170
+ */
171
+
172
+ var formatDate = function formatDate(date) {
173
+ return moment.unix(date).fromNow();
174
+ };
175
+ /**
176
+ * Check if the object is a report
177
+ *
178
+ * @param {Object} report
179
+ * @returns {boolean}
180
+ */
181
+
182
+
183
+ var isReport = function isReport(report) {
184
+ return _.isPlainObject(report) && report.type && report.message;
185
+ };
186
+ /**
187
+ * Check if the report is of a error type
188
+ * @param {Object} report
189
+ * @returns {boolean}
190
+ */
191
+
192
+
193
+ var isTaskErrorReport = function isTaskErrorReport(report) {
194
+ if (isReport(report) && _.isArray(report.children) && isReport(report.children[0])) {
195
+ return report.children[0].type === 'error';
196
+ }
197
+ };
198
+ /**
199
+ * Creates the taskQueueTable component
200
+ *
201
+ * @param {String} testCenterId - the test center URI
202
+ * @returns {taskQueueTable} the component
203
+ * @throws {TypeError} when the task queue context (type) is absent in the config
204
+ */
205
+
206
+
207
+ function taskQueueTableFactory(config) {
208
+ var tasks, errorRows;
209
+ config = _.defaults(config, _defaults);
210
+
211
+ if (_.isEmpty(config.context)) {
212
+ throw new TypeError('The task queue provider needs to be initalized with a context');
213
+ }
207
214
  /**
208
- * Creates the taskQueueTable component
209
- *
210
- * @param {String} testCenterId - the test center URI
211
- * @returns {taskQueueTable} the component
212
- * @throws {TypeError} when the task queue context (type) is absent in the config
215
+ * The task queue table component
216
+ * @typedef taskQueueTable
217
+ * @see ui/component
218
+ * @fires taskQueueTable#loading when the table is loading
219
+ * @fires taskQueueTable#loaded when the data is loaded
220
+ * @fires taskQueueTable#refresh when refreshing table content
213
221
  */
214
222
 
215
223
 
216
- function taskQueueTableFactory(config) {
217
- var tasks, errorRows;
218
- config = _.defaults(config, _defaults);
219
-
220
- if (_.isEmpty(config.context)) {
221
- throw new TypeError('The task queue provider needs to be initalized with a context');
222
- }
224
+ return component({
223
225
  /**
224
- * The task queue table component
225
- * @typedef taskQueueTable
226
- * @see ui/component
227
- * @fires taskQueueTable#loading when the table is loading
228
- * @fires taskQueueTable#loaded when the data is loaded
229
- * @fires taskQueueTable#refresh when refreshing table content
226
+ * Display a report for a task
227
+ * @param taskId
228
+ * @returns {taskQueueTable}
230
229
  */
230
+ showReport: function showReport(taskId) {
231
+ var status, data;
232
+ var $report = this.$component.find('.report-container');
233
+ var $dataTable = this.$component.find('.datatable-wrapper');
231
234
 
235
+ if (!$report.length) {
236
+ $report = $$1(reportTpl());
237
+ this.$component.append($report);
238
+ } //toggle display fo queue table
232
239
 
233
- return component({
234
- /**
235
- * Display a report for a task
236
- * @param taskId
237
- * @returns {taskQueueTable}
238
- */
239
- showReport: function showReport(taskId) {
240
- var status, data;
241
- var $report = this.$component.find('.report-container');
242
- var $dataTable = this.$component.find('.datatable-wrapper');
243
240
 
244
- if (!$report.length) {
245
- $report = $$1(reportTpl());
246
- this.$component.append($report);
247
- } //toggle display fo queue table
241
+ $dataTable.hide();
248
242
 
243
+ var task = _.find(tasks, {
244
+ id: taskId
245
+ });
249
246
 
250
- $dataTable.hide();
247
+ if (task && task.status === 'finished' && task.report) {
248
+ data = task;
249
+ }
251
250
 
252
- var task = _.find(tasks, {
253
- id: taskId
254
- });
251
+ status = taskQueueStatusFactory({
252
+ replace: true,
253
+ taskId: taskId,
254
+ serviceUrl: this.config.statusUrl,
255
+ showDetailsButton: false,
256
+ actions: [{
257
+ id: 'back',
258
+ icon: 'backward',
259
+ title: __('Back to listing'),
260
+ label: __('Back')
261
+ }],
262
+ data: data
263
+ }).on('action-back', function () {
264
+ status.destroy();
265
+ $dataTable.show();
266
+ }).render($report).start();
267
+ return this;
268
+ },
255
269
 
256
- if (task && task.status === 'finished' && task.report) {
257
- data = task;
270
+ /**
271
+ * Remove a task from the datatable
272
+ * @param taskId
273
+ * @returns {taskQueueTable}
274
+ * @fires taskQueueTable#removed
275
+ * @fires taskQueueTable#error
276
+ */
277
+ remove: function remove(taskId) {
278
+ var self = this;
279
+ this.taskQueueApi.remove(taskId).then(function () {
280
+ self.$component.datatable('refresh');
281
+ self.trigger('removed', taskId);
282
+ }).catch(function (err) {
283
+ self.trigger('error', err);
284
+ });
285
+ return this;
286
+ },
287
+ download: function download(taskId) {
288
+ var self = this;
289
+ $$1.fileDownload(this.config.downloadUrl, {
290
+ data: {
291
+ taskId: taskId
292
+ },
293
+ failCallback: function failCallback() {
294
+ self.trigger('error', __('File download failed'));
295
+ }
296
+ });
297
+ return this;
298
+ }
299
+ }, config).on('init', function () {
300
+ this.taskQueueApi = taskQueueApi({
301
+ url: {
302
+ status: this.config.serviceUrl,
303
+ remove: this.config.removeUrl
304
+ }
305
+ });
306
+ }).on('render', function () {
307
+ var self = this;
308
+ var $component = this.getElement();
309
+ var actions = [{
310
+ id: 'delete',
311
+ icon: 'bin',
312
+ title: __('Remove'),
313
+ disabled: function disabled() {
314
+ if (this.status === config.status.finished || this.status === config.status.finishedError || this.status === config.status.finishedSuccess) {
315
+ return false;
258
316
  }
259
317
 
260
- status = taskQueueStatusFactory({
261
- replace: true,
262
- taskId: taskId,
263
- serviceUrl: this.config.statusUrl,
264
- showDetailsButton: false,
265
- actions: [{
266
- id: 'back',
267
- icon: 'backward',
268
- title: __('Back to listing'),
269
- label: __('Back')
270
- }],
271
- data: data
272
- }).on('action-back', function () {
273
- status.destroy();
274
- $dataTable.show();
275
- }).render($report).start();
276
- return this;
318
+ return true;
277
319
  },
320
+ action: function action(id) {
321
+ self.remove(id);
322
+ }
323
+ }, {
324
+ id: 'report',
325
+ icon: 'templates',
326
+ title: __('View report'),
327
+ disabled: function disabled() {
328
+ if (this.status !== config.status.created) {
329
+ return false;
330
+ }
278
331
 
279
- /**
280
- * Remove a task from the datatable
281
- * @param taskId
282
- * @returns {taskQueueTable}
283
- * @fires taskQueueTable#removed
284
- * @fires taskQueueTable#error
285
- */
286
- remove: function remove(taskId) {
287
- var self = this;
288
- this.taskQueueApi.remove(taskId).then(function () {
289
- self.$component.datatable('refresh');
290
- self.trigger('removed', taskId);
291
- }).catch(function (err) {
292
- self.trigger('error', err);
293
- });
294
- return this;
332
+ return true;
295
333
  },
296
- download: function download(taskId) {
297
- var self = this;
298
- $$1.fileDownload(this.config.downloadUrl, {
299
- data: {
300
- taskId: taskId
301
- },
302
- failCallback: function () {
303
- self.trigger('error', __('File download failed'));
304
- }
305
- });
306
- return this;
334
+ action: function action(id) {
335
+ self.showReport(id);
307
336
  }
308
- }, config).on('init', function () {
309
- this.taskQueueApi = taskQueueApi({
310
- url: {
311
- status: this.config.serviceUrl,
312
- remove: this.config.removeUrl
313
- }
314
- });
315
- }).on('render', function () {
316
- var self = this;
317
- var $component = this.getElement();
318
- var actions = [{
319
- id: 'delete',
320
- icon: 'bin',
321
- title: __('Remove'),
322
- disabled: function disabled() {
323
- if (this.status === config.status.finished || this.status === config.status.finishedError || this.status === config.status.finishedSuccess) {
324
- return false;
325
- }
337
+ }];
326
338
 
327
- return true;
328
- },
329
- action: function action(id) {
330
- self.remove(id);
331
- }
332
- }, {
333
- id: 'report',
334
- icon: 'templates',
335
- title: __('View report'),
339
+ if (typeof this.config.downloadUrl !== 'undefined' && this.config.downloadUrl !== '') {
340
+ actions.push({
341
+ id: 'download',
342
+ icon: 'download',
343
+ title: __('Download'),
336
344
  disabled: function disabled() {
337
- if (this.status !== config.status.created) {
345
+ if (this.status === config.status.finished || this.status === config.status.finishedSuccess) {
338
346
  return false;
339
347
  }
340
348
 
341
349
  return true;
342
350
  },
343
351
  action: function action(id) {
344
- self.showReport(id);
352
+ self.download(id);
345
353
  }
346
- }];
347
-
348
- if (typeof this.config.downloadUrl !== 'undefined' && this.config.downloadUrl !== '') {
349
- actions.push({
350
- id: 'download',
351
- icon: 'download',
352
- title: __('Download'),
353
- disabled: function disabled() {
354
- if (this.status === config.status.finished || this.status === config.status.finishedSuccess) {
355
- return false;
356
- }
354
+ });
355
+ } //set up the ui/datatable
357
356
 
358
- return true;
359
- },
360
- action: function action(id) {
361
- self.download(id);
362
- }
363
- });
364
- } //set up the ui/datatable
365
357
 
358
+ $component.addClass('task-queue-table').on('beforeload.datatable', function (e, dataSet) {
359
+ if (dataSet && dataSet.data) {
360
+ tasks = dataSet.data;
361
+ }
362
+ }).on('query.datatable', function () {
363
+ errorRows = [];
364
+ self.trigger('loading');
365
+ }).on('load.datatable', function () {
366
+ // highlight rows
367
+ if (_.isArray(errorRows) && errorRows.length) {
368
+ _.forEach(errorRows, function (id) {
369
+ $component.datatable('addRowClass', id, 'error');
370
+ });
371
+ }
366
372
 
367
- $component.addClass('task-queue-table').on('beforeload.datatable', function (e, dataSet) {
368
- if (dataSet && dataSet.data) {
369
- tasks = dataSet.data;
373
+ self.trigger('loaded');
374
+ }).datatable({
375
+ url: this.config.dataUrl,
376
+ rows: this.config.rows,
377
+ sortorder: 'desc',
378
+ filtercolumns: {
379
+ type: this.config.context,
380
+ status: this.config.statusFilter
381
+ },
382
+ status: {
383
+ empty: __('No Task yet'),
384
+ available: __('Task Listing'),
385
+ loading: __('Loading')
386
+ },
387
+ tools: [{
388
+ id: 'refresh',
389
+ icon: 'reset',
390
+ title: __('Refresh'),
391
+ label: __('Refresh'),
392
+ action: function action() {
393
+ self.$component.datatable('refresh');
394
+ self.trigger('refresh');
370
395
  }
371
- }).on('query.datatable', function () {
372
- errorRows = [];
373
- self.trigger('loading');
374
- }).on('load.datatable', function () {
375
- // highlight rows
376
- if (_.isArray(errorRows) && errorRows.length) {
377
- _.forEach(errorRows, function (id) {
378
- $component.datatable('addRowClass', id, 'error');
379
- });
396
+ }],
397
+ model: [{
398
+ id: 'label',
399
+ label: __('Task Name')
400
+ }, {
401
+ id: 'creationDate',
402
+ label: __('Created'),
403
+ transform: function transform(value) {
404
+ return formatDate(value, self.config);
380
405
  }
381
-
382
- self.trigger('loaded');
383
- }).datatable({
384
- url: this.config.dataUrl,
385
- rows: this.config.rows,
386
- sortorder: 'desc',
387
- filtercolumns: {
388
- type: this.config.context,
389
- status: this.config.statusFilter
390
- },
391
- status: {
392
- empty: __('No Task yet'),
393
- available: __('Task Listing'),
394
- loading: __('Loading')
395
- },
396
- tools: [{
397
- id: 'refresh',
398
- icon: 'reset',
399
- title: __('Refresh'),
400
- label: __('Refresh'),
401
- action: function () {
402
- self.$component.datatable('refresh');
403
- self.trigger('refresh');
404
- }
405
- }],
406
- model: [{
407
- id: 'label',
408
- label: __('Task Name')
409
- }, {
410
- id: 'creationDate',
411
- label: __('Created'),
412
- transform: function (value) {
413
- return formatDate(value, self.config);
414
- }
415
- }, {
416
- id: 'status',
417
- label: __('Status'),
418
- transform: function (value, row) {
419
- if (row.status === 'finished') {
420
- if (isTaskErrorReport(row.report)) {
421
- errorRows.push(row.id);
422
- return config.status.finishedError;
423
- } else {
424
- return config.status.finishedSuccess;
425
- }
406
+ }, {
407
+ id: 'status',
408
+ label: __('Status'),
409
+ transform: function transform(value, row) {
410
+ if (row.status === 'finished') {
411
+ if (isTaskErrorReport(row.report)) {
412
+ errorRows.push(row.id);
413
+ return config.status.finishedError;
426
414
  } else {
427
- return config.status[row.status] || '';
415
+ return config.status.finishedSuccess;
428
416
  }
417
+ } else {
418
+ return config.status[row.status] || '';
429
419
  }
430
- }, {
431
- id: 'actions',
432
- label: __('Actions'),
433
- type: 'actions',
434
- actions: actions
435
- }],
436
- selectable: false
437
- });
438
- }).on('reload', function () {
439
- if (this.$component) {
440
- this.$component.datatable('refresh');
441
- }
420
+ }
421
+ }, {
422
+ id: 'actions',
423
+ label: __('Actions'),
424
+ type: 'actions',
425
+ actions: actions
426
+ }],
427
+ selectable: false
442
428
  });
443
- }
429
+ }).on('reload', function () {
430
+ if (this.$component) {
431
+ this.$component.datatable('refresh');
432
+ }
433
+ });
434
+ }
444
435
 
445
- return taskQueueTableFactory;
436
+ return taskQueueTableFactory;
446
437
 
447
438
  });