@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
package/dist/login/login.js
CHANGED
|
@@ -1,537 +1,528 @@
|
|
|
1
1
|
define(['jquery', 'lodash', 'i18n', 'ui/component', 'ui/feedback', 'util/url', 'handlebars', 'lib/dompurify/purify'], function ($$1, _, __, component, feedback, urlUtil, Handlebars, DOMPurify) { 'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
|
|
7
|
+
feedback = feedback && Object.prototype.hasOwnProperty.call(feedback, 'default') ? feedback['default'] : feedback;
|
|
8
|
+
urlUtil = urlUtil && Object.prototype.hasOwnProperty.call(urlUtil, 'default') ? urlUtil['default'] : urlUtil;
|
|
9
|
+
Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
|
|
10
|
+
DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
|
|
11
|
+
|
|
12
|
+
function _typeof(obj) {
|
|
13
|
+
"@babel/helpers - typeof";
|
|
14
|
+
|
|
15
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
16
|
+
return typeof obj;
|
|
17
|
+
} : function (obj) {
|
|
18
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
19
|
+
}, _typeof(obj);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Helpers0 (hb) {
|
|
23
|
+
//register a i18n helper
|
|
24
|
+
hb.registerHelper('__', function (key) {
|
|
25
|
+
return __(key);
|
|
26
|
+
});
|
|
12
27
|
/**
|
|
13
|
-
*
|
|
14
|
-
* modify it under the terms of the GNU General Public License
|
|
15
|
-
* as published by the Free Software Foundation; under version 2
|
|
16
|
-
* of the License (non-upgradable).
|
|
17
|
-
*
|
|
18
|
-
* This program is distributed in the hope that it will be useful,
|
|
19
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
-
* GNU General Public License for more details.
|
|
22
|
-
*
|
|
23
|
-
* You should have received a copy of the GNU General Public License
|
|
24
|
-
* along with this program; if not, write to the Free Software
|
|
25
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
26
|
-
*
|
|
27
|
-
* Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
|
|
28
|
+
* Register dompurify helper
|
|
28
29
|
*
|
|
30
|
+
* https://github.com/cure53/DOMPurify
|
|
31
|
+
* with config SAFE_FOR_TEMPLATES: true
|
|
32
|
+
* to make output safe for template systems
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
hb.registerHelper('dompurify', function (context) {
|
|
36
|
+
return DOMPurify.sanitize(context);
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Register join helper
|
|
29
40
|
*
|
|
41
|
+
* Example :
|
|
42
|
+
* var values = {a:v1, b:v2, c:v3};
|
|
43
|
+
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
44
|
+
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
30
45
|
*/
|
|
31
|
-
function Helpers0 (hb) {
|
|
32
|
-
//register a i18n helper
|
|
33
|
-
hb.registerHelper('__', function (key) {
|
|
34
|
-
return __(key);
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* Register dompurify helper
|
|
38
|
-
*
|
|
39
|
-
* https://github.com/cure53/DOMPurify
|
|
40
|
-
* with config SAFE_FOR_TEMPLATES: true
|
|
41
|
-
* to make output safe for template systems
|
|
42
|
-
*/
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
* Example :
|
|
51
|
-
* var values = {a:v1, b:v2, c:v3};
|
|
52
|
-
* Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
|
|
53
|
-
* Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
|
|
54
|
-
*/
|
|
47
|
+
hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
|
|
48
|
+
var fragments = [];
|
|
49
|
+
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
50
|
+
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
51
|
+
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
|
|
59
|
-
fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
|
|
60
|
-
wrapper = typeof wrapper === 'string' ? wrapper : '"';
|
|
61
|
-
|
|
62
|
-
_.forIn(arr, function (value, key) {
|
|
63
|
-
var fragment = '';
|
|
64
|
-
|
|
65
|
-
if (value !== null || value !== undefined) {
|
|
66
|
-
if (typeof value === 'boolean') {
|
|
67
|
-
value = value ? 'true' : 'false';
|
|
68
|
-
} else if (typeof value === 'object') {
|
|
69
|
-
value = _.values(value).join(' ');
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
value = '';
|
|
73
|
-
}
|
|
53
|
+
_.forIn(arr, function (value, key) {
|
|
54
|
+
var fragment = '';
|
|
74
55
|
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
if (value !== null || value !== undefined) {
|
|
57
|
+
if (typeof value === 'boolean') {
|
|
58
|
+
value = value ? 'true' : 'false';
|
|
59
|
+
} else if (_typeof(value) === 'object') {
|
|
60
|
+
value = _.values(value).join(' ');
|
|
77
61
|
}
|
|
62
|
+
} else {
|
|
63
|
+
value = '';
|
|
64
|
+
}
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return fragments.join(fragmentGlue);
|
|
84
|
-
}); //register a classic "for loop" helper
|
|
85
|
-
//it also adds a local variable "i" as the index in each iteration loop
|
|
86
|
-
|
|
87
|
-
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
88
|
-
var ret = '';
|
|
89
|
-
startIndex = parseInt(startIndex);
|
|
90
|
-
stopIndex = parseInt(stopIndex);
|
|
91
|
-
increment = parseInt(increment);
|
|
92
|
-
|
|
93
|
-
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
94
|
-
ret += options.fn(_.extend({}, this, {
|
|
95
|
-
i: i
|
|
96
|
-
}));
|
|
66
|
+
if (keyValueGlue !== undefined) {
|
|
67
|
+
fragment += key + keyValueGlue;
|
|
97
68
|
}
|
|
98
69
|
|
|
99
|
-
|
|
70
|
+
fragment += wrapper + value + wrapper;
|
|
71
|
+
fragments.push(fragment);
|
|
100
72
|
});
|
|
101
|
-
hb.registerHelper('equal', function (var1, var2, options) {
|
|
102
|
-
if (var1 == var2) {
|
|
103
|
-
return options.fn(this);
|
|
104
|
-
} else {
|
|
105
|
-
return options.inverse(this);
|
|
106
|
-
}
|
|
107
|
-
}); // register a "get property" helper
|
|
108
|
-
// it gets the named property from the provided context
|
|
109
73
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// it checks if value is in array
|
|
74
|
+
return fragments.join(fragmentGlue);
|
|
75
|
+
}); //register a classic "for loop" helper
|
|
76
|
+
//it also adds a local variable "i" as the index in each iteration loop
|
|
114
77
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
78
|
+
hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
|
|
79
|
+
var ret = '';
|
|
80
|
+
startIndex = parseInt(startIndex);
|
|
81
|
+
stopIndex = parseInt(stopIndex);
|
|
82
|
+
increment = parseInt(increment);
|
|
121
83
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
127
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
128
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
129
|
-
var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
|
|
130
|
-
|
|
131
|
-
function program1(depth0,data) {
|
|
132
|
-
|
|
133
|
-
var buffer = "", stack1;
|
|
134
|
-
buffer += "\n <div class=\"xhtml_form_error\">"
|
|
135
|
-
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.message)),stack1 == null || stack1 === false ? stack1 : stack1.error)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
136
|
-
+ "</div>\n ";
|
|
137
|
-
return buffer;
|
|
84
|
+
for (var i = startIndex; i < stopIndex; i += increment) {
|
|
85
|
+
ret += options.fn(_.extend({}, this, {
|
|
86
|
+
i: i
|
|
87
|
+
}));
|
|
138
88
|
}
|
|
139
89
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
90
|
+
return ret;
|
|
91
|
+
});
|
|
92
|
+
hb.registerHelper('equal', function (var1, var2, options) {
|
|
93
|
+
if (var1 == var2) {
|
|
94
|
+
return options.fn(this);
|
|
95
|
+
} else {
|
|
96
|
+
return options.inverse(this);
|
|
144
97
|
}
|
|
98
|
+
}); // register a "get property" helper
|
|
99
|
+
// it gets the named property from the provided context
|
|
145
100
|
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
101
|
+
hb.registerHelper('property', function (name, context) {
|
|
102
|
+
return context[name] || '';
|
|
103
|
+
}); // register an 'includes' helper
|
|
104
|
+
// it checks if value is in array
|
|
151
105
|
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
buffer += "\n <div class=\"form-error\">\n "
|
|
156
|
-
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.login)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
157
|
-
+ "\n </div>\n ";
|
|
158
|
-
return buffer;
|
|
106
|
+
hb.registerHelper('includes', function (haystack, needle, options) {
|
|
107
|
+
if (_.contains(haystack, needle)) {
|
|
108
|
+
return options.fn(this);
|
|
159
109
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
180
|
-
buffer += "\n <div>\n <label class=\"form_desc\" for=\"login\">\n "
|
|
181
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Login", options) : helperMissing.call(depth0, "__", "Login", options)))
|
|
182
|
-
+ "\n </label><input type=\"text\" name=\"login\" id=\"login\" ";
|
|
183
|
-
stack1 = helpers.unless.call(depth0, (depth0 && depth0.disableAutofocus), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
184
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
185
|
-
buffer += " ";
|
|
186
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.disableAutocomplete), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
187
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
188
|
-
buffer += " aria-required=\"true\">\n ";
|
|
189
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.login), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
190
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
191
|
-
buffer += "\n </div>\n <div>\n <label class=\"form_desc\" for=\"password\">\n "
|
|
192
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Password", options) : helperMissing.call(depth0, "__", "Password", options)))
|
|
193
|
-
+ "\n </label><input type=\"password\" name=\"password\" id=\"password\"";
|
|
194
|
-
stack1 = helpers['if'].call(depth0, (depth0 && depth0.disableAutocomplete), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
195
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
196
|
-
buffer += " aria-required=\"true\">\n ";
|
|
197
|
-
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.password), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
198
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
199
|
-
buffer += "\n </div>\n <div class=\"form-toolbar\"><input type=\"submit\" id=\"connect\" name=\"connect\" disabled=\"disabled\" class=\"disabled\" value=\""
|
|
200
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Log in", options) : helperMissing.call(depth0, "__", "Log in", options)))
|
|
201
|
-
+ "\"></div>\n </form>\n</div>\n";
|
|
202
|
-
return buffer;
|
|
203
|
-
});
|
|
204
|
-
function loginTpl(data, options, asString) {
|
|
205
|
-
var html = Template(data, options);
|
|
206
|
-
return (asString || true) ? html : $(html);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!Helpers0.__initialized) {
|
|
114
|
+
Helpers0(Handlebars);
|
|
115
|
+
Helpers0.__initialized = true;
|
|
116
|
+
}
|
|
117
|
+
var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
118
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
119
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
120
|
+
var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
|
|
121
|
+
|
|
122
|
+
function program1(depth0,data) {
|
|
123
|
+
|
|
124
|
+
var buffer = "", stack1;
|
|
125
|
+
buffer += "\n <div class=\"xhtml_form_error\">"
|
|
126
|
+
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.message)),stack1 == null || stack1 === false ? stack1 : stack1.error)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
127
|
+
+ "</div>\n ";
|
|
128
|
+
return buffer;
|
|
207
129
|
}
|
|
208
130
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
214
|
-
this.compilerInfo = [4,'>= 1.0.0'];
|
|
215
|
-
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
216
|
-
var buffer = "", stack1, helper, functionType="function";
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
buffer += "<div class=\"form loginForm fakeForm\">";
|
|
220
|
-
if (helper = helpers.form) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
221
|
-
else { helper = (depth0 && depth0.form); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
222
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
223
|
-
buffer += "</div>";
|
|
224
|
-
return buffer;
|
|
225
|
-
});
|
|
226
|
-
function fakeFormTpl(data, options, asString) {
|
|
227
|
-
var html = Template$1(data, options);
|
|
228
|
-
return (asString || true) ? html : $(html);
|
|
131
|
+
function program3(depth0,data) {
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
return "autofocus=\"autofocus\"";
|
|
229
135
|
}
|
|
230
136
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
137
|
+
function program5(depth0,data) {
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
return " autocomplete=\"off\"";
|
|
234
141
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
else { helper = (depth0 && depth0.elements); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
244
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
245
|
-
buffer += "\n <span class=\"viewable-hiddenbox-toggle\">\n <span aria-label=\""
|
|
246
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Show password", options) : helperMissing.call(depth0, "__", "Show password", options)))
|
|
247
|
-
+ "\" class=\"icon-preview\" role=\"button\" tabindex=\"0\"></span>\n <span aria-label=\""
|
|
248
|
-
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Hide password", options) : helperMissing.call(depth0, "__", "Hide password", options)))
|
|
249
|
-
+ "\" class=\"icon-eye-slash\" style=\"display: none;\" role=\"button\" tabindex=\"0\"></span>\n </span>\n</span>\n";
|
|
250
|
-
return buffer;
|
|
251
|
-
});
|
|
252
|
-
function pwdRevealTpl(data, options, asString) {
|
|
253
|
-
var html = Template$2(data, options);
|
|
254
|
-
return (asString || true) ? html : $(html);
|
|
142
|
+
|
|
143
|
+
function program7(depth0,data) {
|
|
144
|
+
|
|
145
|
+
var buffer = "", stack1;
|
|
146
|
+
buffer += "\n <div class=\"form-error\">\n "
|
|
147
|
+
+ escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.login)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
|
148
|
+
+ "\n </div>\n ";
|
|
149
|
+
return buffer;
|
|
255
150
|
}
|
|
256
151
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
};
|
|
152
|
+
buffer += "<div class=\"xhtml_form login-component\">\n <form action=\"";
|
|
153
|
+
if (helper = helpers.url) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
154
|
+
else { helper = (depth0 && depth0.url); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
155
|
+
buffer += escapeExpression(stack1)
|
|
156
|
+
+ "\" method=\"post\" id=\"";
|
|
157
|
+
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
158
|
+
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
159
|
+
buffer += escapeExpression(stack1)
|
|
160
|
+
+ "\" name=\"";
|
|
161
|
+
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
162
|
+
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
163
|
+
buffer += escapeExpression(stack1)
|
|
164
|
+
+ "\">\n <input type=\"hidden\" class=\"global\" name=\"";
|
|
165
|
+
if (helper = helpers.name) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
166
|
+
else { helper = (depth0 && depth0.name); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
167
|
+
buffer += escapeExpression(stack1)
|
|
168
|
+
+ "_sent\" value=\"1\">\n ";
|
|
169
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.message)),stack1 == null || stack1 === false ? stack1 : stack1.error), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
|
170
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
171
|
+
buffer += "\n <div>\n <label class=\"form_desc\" for=\"login\">\n "
|
|
172
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Login", options) : helperMissing.call(depth0, "__", "Login", options)))
|
|
173
|
+
+ "\n </label><input type=\"text\" name=\"login\" id=\"login\" ";
|
|
174
|
+
stack1 = helpers.unless.call(depth0, (depth0 && depth0.disableAutofocus), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
|
175
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
176
|
+
buffer += " ";
|
|
177
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.disableAutocomplete), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
178
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
179
|
+
buffer += " aria-required=\"true\">\n ";
|
|
180
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.login), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
181
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
182
|
+
buffer += "\n </div>\n <div>\n <label class=\"form_desc\" for=\"password\">\n "
|
|
183
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Password", options) : helperMissing.call(depth0, "__", "Password", options)))
|
|
184
|
+
+ "\n </label><input type=\"password\" name=\"password\" id=\"password\"";
|
|
185
|
+
stack1 = helpers['if'].call(depth0, (depth0 && depth0.disableAutocomplete), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
|
186
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
187
|
+
buffer += " aria-required=\"true\">\n ";
|
|
188
|
+
stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.fieldMessages)),stack1 == null || stack1 === false ? stack1 : stack1.password), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
|
189
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
190
|
+
buffer += "\n </div>\n <div class=\"form-toolbar\"><input type=\"submit\" id=\"connect\" name=\"connect\" disabled=\"disabled\" class=\"disabled\" value=\""
|
|
191
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Log in", options) : helperMissing.call(depth0, "__", "Log in", options)))
|
|
192
|
+
+ "\"></div>\n </form>\n</div>\n";
|
|
193
|
+
return buffer;
|
|
194
|
+
});
|
|
195
|
+
function loginTpl(data, options, asString) {
|
|
196
|
+
var html = Template(data, options);
|
|
197
|
+
return (asString || true) ? html : $(html);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!Helpers0.__initialized) {
|
|
201
|
+
Helpers0(Handlebars);
|
|
202
|
+
Helpers0.__initialized = true;
|
|
203
|
+
}
|
|
204
|
+
var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
205
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
206
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
207
|
+
var buffer = "", stack1, helper, functionType="function";
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
buffer += "<div class=\"form loginForm fakeForm\">";
|
|
211
|
+
if (helper = helpers.form) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
212
|
+
else { helper = (depth0 && depth0.form); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
213
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
214
|
+
buffer += "</div>";
|
|
215
|
+
return buffer;
|
|
216
|
+
});
|
|
217
|
+
function fakeFormTpl(data, options, asString) {
|
|
218
|
+
var html = Template$1(data, options);
|
|
219
|
+
return (asString || true) ? html : $(html);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!Helpers0.__initialized) {
|
|
223
|
+
Helpers0(Handlebars);
|
|
224
|
+
Helpers0.__initialized = true;
|
|
225
|
+
}
|
|
226
|
+
var Template$2 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
|
227
|
+
this.compilerInfo = [4,'>= 1.0.0'];
|
|
228
|
+
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|
229
|
+
var buffer = "", stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
buffer += "<span class=\"viewable-hiddenbox\">\n ";
|
|
233
|
+
if (helper = helpers.elements) { stack1 = helper.call(depth0, {hash:{},data:data}); }
|
|
234
|
+
else { helper = (depth0 && depth0.elements); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
|
|
235
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
236
|
+
buffer += "\n <span class=\"viewable-hiddenbox-toggle\">\n <span aria-label=\""
|
|
237
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Show password", options) : helperMissing.call(depth0, "__", "Show password", options)))
|
|
238
|
+
+ "\" class=\"icon-preview\" role=\"button\" tabindex=\"0\"></span>\n <span aria-label=\""
|
|
239
|
+
+ escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Hide password", options) : helperMissing.call(depth0, "__", "Hide password", options)))
|
|
240
|
+
+ "\" class=\"icon-eye-slash\" style=\"display: none;\" role=\"button\" tabindex=\"0\"></span>\n </span>\n</span>\n";
|
|
241
|
+
return buffer;
|
|
242
|
+
});
|
|
243
|
+
function pwdRevealTpl(data, options, asString) {
|
|
244
|
+
var html = Template$2(data, options);
|
|
245
|
+
return (asString || true) ? html : $(html);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/*
|
|
249
|
+
* This program is free software; you can redistribute it and/or
|
|
250
|
+
* modify it under the terms of the GNU General Public License
|
|
251
|
+
* as published by the Free Software Foundation; under version 2
|
|
252
|
+
* of the License (non-upgradable).
|
|
253
|
+
*
|
|
254
|
+
* This program is distributed in the hope that it will be useful,
|
|
255
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
256
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
257
|
+
* GNU General Public License for more details.
|
|
258
|
+
*
|
|
259
|
+
* You should have received a copy of the GNU General Public License
|
|
260
|
+
* along with this program; if not, write to the Free Software
|
|
261
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
262
|
+
*
|
|
263
|
+
* Copyright (c) 2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
|
|
264
|
+
*/
|
|
265
|
+
var _defaultConfig = {
|
|
266
|
+
disableAutocomplete: false,
|
|
267
|
+
enablePasswordReveal: false,
|
|
268
|
+
disableAutofocus: false,
|
|
269
|
+
message: {
|
|
270
|
+
error: '',
|
|
271
|
+
info: null
|
|
272
|
+
},
|
|
273
|
+
fieldMessages: {},
|
|
274
|
+
name: 'loginForm',
|
|
275
|
+
url: urlUtil.route('login', 'Main', 'tao')
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* The factory that creates a login component
|
|
279
|
+
*
|
|
280
|
+
* @param {jQueryElement} $container - where to append the component
|
|
281
|
+
* @param {Object} config - the component config
|
|
282
|
+
* @param {Object} [config.disableAutocomplete] - depending on this setting autocomplete would be disabled or enabled (and fakeForm rendered)
|
|
283
|
+
* @param {Object} [config.enablePasswordReveal] - depending on this setting password reveal would be disabled or enabled for the password field
|
|
284
|
+
* @param {Object} [config.disableAutofocus] - depending on this setting autofocus attribute will be added to login filed
|
|
285
|
+
* @param {Object} [config.fieldMessages] - field validation messages
|
|
286
|
+
* @param {String} [config.name] - the component name (used by the element)
|
|
287
|
+
* @param {String} [config.url] - the url to send login form to.
|
|
288
|
+
* @param {String} [config.message] - the form wide error|info messages
|
|
289
|
+
* @returns {loginComponent} the component
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
function loginFactory($container, config) {
|
|
286
293
|
/**
|
|
287
|
-
* The
|
|
288
|
-
*
|
|
289
|
-
* @param {jQueryElement} $container - where to append the component
|
|
290
|
-
* @param {Object} config - the component config
|
|
291
|
-
* @param {Object} [config.disableAutocomplete] - depending on this setting autocomplete would be disabled or enabled (and fakeForm rendered)
|
|
292
|
-
* @param {Object} [config.enablePasswordReveal] - depending on this setting password reveal would be disabled or enabled for the password field
|
|
293
|
-
* @param {Object} [config.disableAutofocus] - depending on this setting autofocus attribute will be added to login filed
|
|
294
|
-
* @param {Object} [config.fieldMessages] - field validation messages
|
|
295
|
-
* @param {String} [config.name] - the component name (used by the element)
|
|
296
|
-
* @param {String} [config.url] - the url to send login form to.
|
|
297
|
-
* @param {String} [config.message] - the form wide error|info messages
|
|
298
|
-
* @returns {loginComponent} the component
|
|
294
|
+
* The component API
|
|
299
295
|
*/
|
|
296
|
+
var api = {
|
|
297
|
+
/**
|
|
298
|
+
* Returns whether autocomplete is disabled or not
|
|
299
|
+
* @returns {boolean}
|
|
300
|
+
*/
|
|
301
|
+
isAutocompleteDisabled: function isAutocompleteDisabled() {
|
|
302
|
+
return this.config.disableAutocomplete;
|
|
303
|
+
},
|
|
300
304
|
|
|
301
|
-
function loginFactory($container, config) {
|
|
302
305
|
/**
|
|
303
|
-
*
|
|
306
|
+
* Returns whether password reveal is enabled or not
|
|
307
|
+
* @returns {boolean}
|
|
304
308
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
$pwdInput.autocomplete = 'off';
|
|
407
|
-
window.addEventListener('mousedown', autoHide);
|
|
309
|
+
isPasswordRevealEnabled: function isPasswordRevealEnabled() {
|
|
310
|
+
return this.config.enablePasswordReveal;
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Get messages from config
|
|
315
|
+
* @returns {Object} Object containing passed messages
|
|
316
|
+
*/
|
|
317
|
+
getMessages: function getMessages() {
|
|
318
|
+
return this.config.message;
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Returns form fields validation messages, if any
|
|
323
|
+
* @returns {Object} fieldMessages
|
|
324
|
+
*/
|
|
325
|
+
getFieldMessages: function getFieldMessages() {
|
|
326
|
+
return this.config.fieldMessages;
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Creates fakeForm from the real form
|
|
331
|
+
* @returns {jQuery} jQuery element
|
|
332
|
+
*/
|
|
333
|
+
createFakeForm: function createFakeForm() {
|
|
334
|
+
var $element = this.getElement();
|
|
335
|
+
var $fakeFormDom = $element.clone();
|
|
336
|
+
$element.find('label').remove();
|
|
337
|
+
return $fakeFormDom.html(fakeFormTpl({
|
|
338
|
+
form: $fakeFormDom.find('form').html()
|
|
339
|
+
}));
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Gets real form jQuery element
|
|
344
|
+
* @returns {jQuery} jQuery element
|
|
345
|
+
*/
|
|
346
|
+
getRealForm: function getRealForm() {
|
|
347
|
+
return this.getElement().find('form');
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Gets fake form jQuery element
|
|
352
|
+
* @returns {jQuery} jQuery element
|
|
353
|
+
*/
|
|
354
|
+
getFakeForm: function getFakeForm() {
|
|
355
|
+
return this.getContainer().find('div.fakeForm');
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Gets real or fake form jQuery element, depending on the disableAutocomplete setting
|
|
360
|
+
* @returns {jQuery} jQuery element
|
|
361
|
+
*/
|
|
362
|
+
getForm: function getForm() {
|
|
363
|
+
return this.isAutocompleteDisabled() ? this.getFakeForm() : this.getRealForm();
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Manipulates form dom (adds password reveal elements)
|
|
368
|
+
*/
|
|
369
|
+
manipulateFormDom: function manipulateFormDom() {
|
|
370
|
+
var $form, $pwdInput, $pwdLabel;
|
|
371
|
+
$form = this.getForm();
|
|
372
|
+
$pwdInput = $form.find('input[type=password]');
|
|
373
|
+
$pwdLabel = $form.find('label[for=' + $pwdInput.attr('name') + ']');
|
|
374
|
+
$pwdInput.replaceWith(pwdRevealTpl({
|
|
375
|
+
elements: $pwdLabel[0].outerHTML + $pwdInput[0].outerHTML
|
|
376
|
+
}));
|
|
377
|
+
$pwdLabel.remove();
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Attaches events to password reveal options
|
|
382
|
+
*/
|
|
383
|
+
attachPasswordRevealEvents: function attachPasswordRevealEvents() {
|
|
384
|
+
var $form, $pwdInput, $inputToggle, $viewIcon, $hideIcon;
|
|
385
|
+
var self = this;
|
|
386
|
+
|
|
387
|
+
var autoHide = function autoHide(event) {
|
|
388
|
+
if (!event.target.isSameNode($pwdInput) && !event.target.isSameNode($hideIcon[0]) && !event.target.isSameNode($inputToggle[0])) {
|
|
389
|
+
hide();
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
var show = function show() {
|
|
394
|
+
$viewIcon.hide();
|
|
395
|
+
$hideIcon.show();
|
|
396
|
+
$pwdInput.type = 'text';
|
|
397
|
+
$pwdInput.autocomplete = 'off';
|
|
398
|
+
window.addEventListener('mousedown', autoHide);
|
|
399
|
+
$pwdInput.focus();
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
var hide = function hide(moveFocus) {
|
|
403
|
+
$hideIcon.hide();
|
|
404
|
+
$viewIcon.show();
|
|
405
|
+
$pwdInput.type = 'password';
|
|
406
|
+
$pwdInput.autocomplete = self.isAutocompleteDisabled() ? 'off' : 'on';
|
|
407
|
+
window.removeEventListener('mousedown', autoHide);
|
|
408
|
+
|
|
409
|
+
if (moveFocus) {
|
|
408
410
|
$pwdInput.focus();
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
const hide = function hide(moveFocus) {
|
|
412
|
-
$hideIcon.hide();
|
|
413
|
-
$viewIcon.show();
|
|
414
|
-
$pwdInput.type = 'password';
|
|
415
|
-
$pwdInput.autocomplete = self.isAutocompleteDisabled() ? 'off' : 'on';
|
|
416
|
-
window.removeEventListener('mousedown', autoHide);
|
|
417
|
-
|
|
418
|
-
if (moveFocus) {
|
|
419
|
-
$pwdInput.focus();
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const togglePassword = function togglePassword() {
|
|
424
|
-
if ($pwdInput.type === 'password') {
|
|
425
|
-
show();
|
|
426
|
-
} else {
|
|
427
|
-
hide(true);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
$form = this.getForm();
|
|
432
|
-
$pwdInput = $form.find('input[type=password]')[0];
|
|
433
|
-
$inputToggle = $form.find('.viewable-hiddenbox-toggle');
|
|
434
|
-
$viewIcon = $form.find('span.icon-preview');
|
|
435
|
-
$hideIcon = $form.find('span.icon-eye-slash');
|
|
436
|
-
hide();
|
|
437
|
-
$inputToggle.on('keyup', function (e) {
|
|
438
|
-
if (e.key === ' ') {
|
|
439
|
-
togglePassword();
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
$inputToggle.on('keypress', function (e) {
|
|
443
|
-
if (e.key === 'Enter') {
|
|
444
|
-
togglePassword();
|
|
445
|
-
e.stopPropagation();
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
$inputToggle.on('click', togglePassword);
|
|
449
|
-
},
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Displays the error/info messages
|
|
453
|
-
*/
|
|
454
|
-
displayMessages: function displayMessages(messages) {
|
|
455
|
-
var $fields = this.getForm().find(':input');
|
|
456
|
-
|
|
457
|
-
if (!messages.error && this.getForm().find('.form-error').length) {
|
|
458
|
-
messages.error = __('All fields are required');
|
|
459
411
|
}
|
|
412
|
+
};
|
|
460
413
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
414
|
+
var togglePassword = function togglePassword() {
|
|
415
|
+
if ($pwdInput.type === 'password') {
|
|
416
|
+
show();
|
|
417
|
+
} else {
|
|
418
|
+
hide(true);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
$form = this.getForm();
|
|
423
|
+
$pwdInput = $form.find('input[type=password]')[0];
|
|
424
|
+
$inputToggle = $form.find('.viewable-hiddenbox-toggle');
|
|
425
|
+
$viewIcon = $form.find('span.icon-preview');
|
|
426
|
+
$hideIcon = $form.find('span.icon-eye-slash');
|
|
427
|
+
hide();
|
|
428
|
+
$inputToggle.on('keyup', function (e) {
|
|
429
|
+
if (e.key === ' ') {
|
|
430
|
+
togglePassword();
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
$inputToggle.on('keypress', function (e) {
|
|
434
|
+
if (e.key === 'Enter') {
|
|
435
|
+
togglePassword();
|
|
436
|
+
e.stopPropagation();
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
$inputToggle.on('click', togglePassword);
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Displays the error/info messages
|
|
444
|
+
*/
|
|
445
|
+
displayMessages: function displayMessages(messages) {
|
|
446
|
+
var $fields = this.getForm().find(':input');
|
|
447
|
+
|
|
448
|
+
if (!messages.error && this.getForm().find('.form-error').length) {
|
|
449
|
+
messages.error = __('All fields are required');
|
|
467
450
|
}
|
|
451
|
+
|
|
452
|
+
_.forEach(messages, function (message, level) {
|
|
453
|
+
if (message) {
|
|
454
|
+
feedback().message(level, message).open();
|
|
455
|
+
$fields.addClass(level);
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
var loginComponent = component(api, _defaultConfig).setTemplate(loginTpl).on('init', function () {
|
|
461
|
+
this.render($container);
|
|
462
|
+
}).on('render', function () {
|
|
463
|
+
var $fakeForm, $loginBtn;
|
|
464
|
+
var $loginForm = this.getRealForm();
|
|
465
|
+
var self = this;
|
|
466
|
+
/**
|
|
467
|
+
* Submits the form after a copy of all the inputs the user has made in the fake form
|
|
468
|
+
* @fires submit event when real form gots submitted
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
var submitForm = function submitForm() {
|
|
472
|
+
// if the fake form exists, copy all fields values into the real form
|
|
473
|
+
$fakeForm.find(':input').each(function () {
|
|
474
|
+
var $field = $$1(this);
|
|
475
|
+
$loginForm.find('input[name="' + $field.attr('name') + '"]').val($field.val());
|
|
476
|
+
}); // just submit the real form as if the user did it
|
|
477
|
+
|
|
478
|
+
self.trigger('submit');
|
|
479
|
+
$loginForm.submit();
|
|
468
480
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
var $loginForm = this.getRealForm();
|
|
474
|
-
var self = this;
|
|
475
|
-
/**
|
|
476
|
-
* Submits the form after a copy of all the inputs the user has made in the fake form
|
|
477
|
-
* @fires submit event when real form gots submitted
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
var submitForm = function submitForm() {
|
|
481
|
-
// if the fake form exists, copy all fields values into the real form
|
|
482
|
-
$fakeForm.find(':input').each(function () {
|
|
483
|
-
var $field = $$1(this);
|
|
484
|
-
$loginForm.find('input[name="' + $field.attr('name') + '"]').val($field.val());
|
|
485
|
-
}); // just submit the real form as if the user did it
|
|
486
|
-
|
|
487
|
-
self.trigger('submit');
|
|
488
|
-
$loginForm.submit();
|
|
489
|
-
};
|
|
490
|
-
/**
|
|
491
|
-
* Create fake form and attach event handlers if autocomplete is disabled
|
|
492
|
-
*/
|
|
481
|
+
/**
|
|
482
|
+
* Create fake form and attach event handlers if autocomplete is disabled
|
|
483
|
+
*/
|
|
484
|
+
|
|
493
485
|
|
|
486
|
+
if (this.isAutocompleteDisabled()) {
|
|
487
|
+
$fakeForm = this.createFakeForm();
|
|
488
|
+
this.hide();
|
|
489
|
+
this.getElement().find('form').attr('id', 'loginForm').attr('aria-hidden', 'true');
|
|
490
|
+
this.getContainer().prepend($fakeForm); // submit the form when the user hit the submit button inside the fake form
|
|
494
491
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
this.getContainer().prepend($fakeForm); // submit the form when the user hit the submit button inside the fake form
|
|
492
|
+
$fakeForm.find('input[type="submit"], button[type="submit"]').off('click').on('click', function (e) {
|
|
493
|
+
e.preventDefault();
|
|
494
|
+
submitForm();
|
|
495
|
+
}); // submit the form when the user hit the ENTER key inside the fake form
|
|
500
496
|
|
|
501
|
-
|
|
497
|
+
$fakeForm.on('keypress', function (e) {
|
|
498
|
+
if (e.key === 'Enter') {
|
|
502
499
|
e.preventDefault();
|
|
503
500
|
submitForm();
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Attach elements for password revealing and attach event handlers
|
|
515
|
-
*/
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Attach elements for password revealing and attach event handlers
|
|
506
|
+
*/
|
|
516
507
|
|
|
517
508
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
509
|
+
if (this.isPasswordRevealEnabled()) {
|
|
510
|
+
this.manipulateFormDom();
|
|
511
|
+
this.attachPasswordRevealEvents();
|
|
512
|
+
}
|
|
522
513
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
514
|
+
$loginBtn = this.getForm().find('[name=connect]');
|
|
515
|
+
$loginBtn.removeAttr('disabled').removeClass('disabled');
|
|
516
|
+
this.displayMessages(this.getMessages());
|
|
517
|
+
});
|
|
527
518
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
519
|
+
_.defer(function () {
|
|
520
|
+
loginComponent.init(config);
|
|
521
|
+
});
|
|
531
522
|
|
|
532
|
-
|
|
533
|
-
|
|
523
|
+
return loginComponent;
|
|
524
|
+
}
|
|
534
525
|
|
|
535
|
-
|
|
526
|
+
return loginFactory;
|
|
536
527
|
|
|
537
528
|
});
|