diff --git a/commons/tool/src/webapp/lib/handlebars.runtime-v4.0.5.js b/commons/tool/src/webapp/lib/handlebars.runtime-v4.0.5.js deleted file mode 100644 index 95049f3b8d4d..000000000000 --- a/commons/tool/src/webapp/lib/handlebars.runtime-v4.0.5.js +++ /dev/null @@ -1,1240 +0,0 @@ -/*! - - handlebars v4.0.5 - -Copyright (C) 2011-2015 by Yehuda Katz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -@license -*/ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["Handlebars"] = factory(); - else - root["Handlebars"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(1)['default']; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _handlebarsBase = __webpack_require__(3); - - var base = _interopRequireWildcard(_handlebarsBase); - - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) - - var _handlebarsSafeString = __webpack_require__(17); - - var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); - - var _handlebarsException = __webpack_require__(5); - - var _handlebarsException2 = _interopRequireDefault(_handlebarsException); - - var _handlebarsUtils = __webpack_require__(4); - - var Utils = _interopRequireWildcard(_handlebarsUtils); - - var _handlebarsRuntime = __webpack_require__(18); - - var runtime = _interopRequireWildcard(_handlebarsRuntime); - - var _handlebarsNoConflict = __webpack_require__(19); - - var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); - - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { - var hb = new base.HandlebarsEnvironment(); - - Utils.extend(hb, base); - hb.SafeString = _handlebarsSafeString2['default']; - hb.Exception = _handlebarsException2['default']; - hb.Utils = Utils; - hb.escapeExpression = Utils.escapeExpression; - - hb.VM = runtime; - hb.template = function (spec) { - return runtime.template(spec, hb); - }; - - return hb; - } - - var inst = create(); - inst.create = create; - - _handlebarsNoConflict2['default'](inst); - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - -/***/ }, -/* 1 */ -/***/ function(module, exports) { - - "use strict"; - - exports["default"] = function (obj) { - if (obj && obj.__esModule) { - return obj; - } else { - var newObj = {}; - - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; - } - } - - newObj["default"] = obj; - return newObj; - } - }; - - exports.__esModule = true; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - "use strict"; - - exports["default"] = function (obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; - }; - - exports.__esModule = true; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; - - var _utils = __webpack_require__(4); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - var _helpers = __webpack_require__(6); - - var _decorators = __webpack_require__(14); - - var _logger = __webpack_require__(16); - - var _logger2 = _interopRequireDefault(_logger); - - var VERSION = '4.0.5'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 7; - - exports.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1', - 7: '>= 4.0.0' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials, decorators) { - this.helpers = helpers || {}; - this.partials = partials || {}; - this.decorators = decorators || {}; - - _helpers.registerDefaultHelpers(this); - _decorators.registerDefaultDecorators(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: _logger2['default'], - log: _logger2['default'].log, - - registerHelper: function registerHelper(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple helpers'); - } - _utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (_utils.toString.call(name) === objectType) { - _utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - }, - - registerDecorator: function registerDecorator(name, fn) { - if (_utils.toString.call(name) === objectType) { - if (fn) { - throw new _exception2['default']('Arg not supported with multiple decorators'); - } - _utils.extend(this.decorators, name); - } else { - this.decorators[name] = fn; - } - }, - unregisterDecorator: function unregisterDecorator(name) { - delete this.decorators[name]; - } - }; - - var log = _logger2['default'].log; - - exports.log = log; - exports.createFrame = _utils.createFrame; - exports.logger = _logger2['default']; - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.createFrame = createFrame; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' - }; - - var badChars = /[&<>"'`=]/g, - possible = /[&<>"'`=]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /* eslint-disable func-style */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - exports.isFunction = isFunction; - - /* eslint-enable func-style */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - }; - - exports.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function createFrame(object) { - var frame = extend({}, object); - frame._parent = object; - return frame; - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - /* istanbul ignore else */ - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.registerDefaultHelpers = registerDefaultHelpers; - - var _helpersBlockHelperMissing = __webpack_require__(7); - - var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - - var _helpersEach = __webpack_require__(8); - - var _helpersEach2 = _interopRequireDefault(_helpersEach); - - var _helpersHelperMissing = __webpack_require__(9); - - var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - - var _helpersIf = __webpack_require__(10); - - var _helpersIf2 = _interopRequireDefault(_helpersIf); - - var _helpersLog = __webpack_require__(11); - - var _helpersLog2 = _interopRequireDefault(_helpersLog); - - var _helpersLookup = __webpack_require__(12); - - var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - - var _helpersWith = __webpack_require__(13); - - var _helpersWith2 = _interopRequireDefault(_helpersWith); - - function registerDefaultHelpers(instance) { - _helpersBlockHelperMissing2['default'](instance); - _helpersEach2['default'](instance); - _helpersHelperMissing2['default'](instance); - _helpersIf2['default'](instance); - _helpersLog2['default'](instance); - _helpersLookup2['default'](instance); - _helpersWith2['default'](instance); - } - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (_utils.isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (_utils.isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = _utils.createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (_utils.isArray(context)) { - for (var j = context.length; i < j; i++) { - if (i in context) { - execIteration(i, i, i === context.length - 1); - } - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey !== undefined) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - exports['default'] = function (instance) { - instance.registerHelper('helperMissing', function () /* [args, ]options */{ - if (arguments.length === 1) { - // A missing field in a {{foo}} construct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerHelper('if', function (conditional, options) { - if (_utils.isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('log', function () /* message, options */{ - var args = [undefined], - options = arguments[arguments.length - 1]; - for (var i = 0; i < arguments.length - 1; i++) { - args.push(arguments[i]); - } - - var level = 1; - if (options.hash.level != null) { - level = options.hash.level; - } else if (options.data && options.data.level != null) { - level = options.data.level; - } - args[0] = level; - - instance.log.apply(instance, args); - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerHelper('with', function (context, options) { - if (_utils.isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!_utils.isEmpty(context)) { - var data = options.data; - if (options.data && options.ids) { - data = _utils.createFrame(options.data); - data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); - } - - return fn(context, { - data: data, - blockParams: _utils.blockParams([context], [data && data.contextPath]) - }); - } else { - return options.inverse(this); - } - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.registerDefaultDecorators = registerDefaultDecorators; - - var _decoratorsInline = __webpack_require__(15); - - var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - - function registerDefaultDecorators(instance) { - _decoratorsInline2['default'](instance); - } - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - exports['default'] = function (instance) { - instance.registerDecorator('inline', function (fn, props, container, options) { - var ret = fn; - if (!props.partials) { - props.partials = {}; - ret = function (context, options) { - // Create a new partials stack frame prior to exec. - var original = container.partials; - container.partials = _utils.extend({}, original, props.partials); - var ret = fn(context, options); - container.partials = original; - return ret; - }; - } - - props.partials[options.args[0]] = options.fn; - - return ret; - }); - }; - - module.exports = exports['default']; - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _utils = __webpack_require__(4); - - var logger = { - methodMap: ['debug', 'info', 'warn', 'error'], - level: 'info', - - // Maps a given level value to the `methodMap` indexes above. - lookupLevel: function lookupLevel(level) { - if (typeof level === 'string') { - var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); - if (levelMap >= 0) { - level = levelMap; - } else { - level = parseInt(level, 10); - } - } - - return level; - }, - - // Can be overridden in the host environment - log: function log(level) { - level = logger.lookupLevel(level); - - if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { - var method = logger.methodMap[level]; - if (!console[method]) { - // eslint-disable-line no-console - method = 'log'; - } - - for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - message[_key - 1] = arguments[_key]; - } - - console[method].apply(console, message); // eslint-disable-line no-console - } - } - }; - - exports['default'] = logger; - module.exports = exports['default']; - -/***/ }, -/* 17 */ -/***/ function(module, exports) { - - // Build out our basic SafeString type - 'use strict'; - - exports.__esModule = true; - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(1)['default']; - - var _interopRequireDefault = __webpack_require__(2)['default']; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _utils = __webpack_require__(4); - - var Utils = _interopRequireWildcard(_utils); - - var _exception = __webpack_require__(5); - - var _exception2 = _interopRequireDefault(_exception); - - var _base = __webpack_require__(3); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _base.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _base.REVISION_CHANGES[currentRevision], - compilerVersions = _base.REVISION_CHANGES[compilerRevision]; - throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - templateSpec.main.decorator = templateSpec.main_d; - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - var ret = templateSpec[i]; - ret.decorator = templateSpec[i + '_d']; - return ret; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; - } else { - depths = [context]; - } - } - - function main(context /*, options*/) { - return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); - } - main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); - return main(context, options); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - if (templateSpec.usePartial || templateSpec.useDecorators) { - container.decorators = container.merge(options.decorators, env.decorators); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - container.decorators = options.decorators; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var currentDepths = depths; - if (depths && context !== depths[0]) { - currentDepths = [context].concat(depths); - } - - return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); - } - - prog = executeDecorators(fn, prog, container, depths, data, blockParams); - - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - function resolvePartial(partial, context, options) { - if (!partial) { - if (options.name === '@partial-block') { - partial = options.data['partial-block']; - } else { - partial = options.partials[options.name]; - } - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } - - var partialBlock = undefined; - if (options.fn && options.fn !== noop) { - options.data = _base.createFrame(options.data); - partialBlock = options.data['partial-block'] = options.fn; - - if (partialBlock.partials) { - options.partials = Utils.extend({}, options.partials, partialBlock.partials); - } - } - - if (partial === undefined && partialBlock) { - partial = partialBlock; - } - - if (partial === undefined) { - throw new _exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _base.createFrame(data) : {}; - data.root = context; - } - return data; - } - - function executeDecorators(fn, prog, container, depths, data, blockParams) { - if (fn.decorator) { - var props = {}; - prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); - Utils.extend(prog, props); - } - return prog; - } - -/***/ }, -/* 19 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {/* global window */ - 'use strict'; - - exports.__esModule = true; - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - return Handlebars; - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ } -/******/ ]) -}); -; \ No newline at end of file diff --git a/feedback/pom.xml b/feedback/pom.xml index 4a0ad8b93c07..ee33627a9c30 100644 --- a/feedback/pom.xml +++ b/feedback/pom.xml @@ -114,51 +114,12 @@ - - - templates - - - - com.github.jknack - handlebars-maven-plugin - ${handlebars1.version} - - - precompile - prepare-package - - precompile - - - ${basedir}/src/webapp/templates/all.handlebars.js - ${basedir}/src/webapp/WEB-INF/templates/ - .handlebars - false - false - false - UTF-8 - - - - - - - - - - - - - - - com.github.jknack handlebars-maven-plugin - ${handlebars1.version} + ${handlebars4.version} precompile @@ -171,7 +132,6 @@ ${basedir}/src/webapp/WEB-INF/templates/ .handlebars false - false false UTF-8 diff --git a/feedback/src/webapp/WEB-INF/bootstrap.jsp b/feedback/src/webapp/WEB-INF/bootstrap.jsp index 0ec89f21d22c..4d0ae41c9177 100644 --- a/feedback/src/webapp/WEB-INF/bootstrap.jsp +++ b/feedback/src/webapp/WEB-INF/bootstrap.jsp @@ -1,96 +1,96 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - - - - - - - - - + + - - - + + - + ${sakaiHtmlHead} + - var feedback = { - state: 'home', - previousState: '', - userId: '${userId}', - siteId: '${siteId}', - siteExists: '${siteExists}', - language: '${language}', - featureSuggestionUrl: '${featureSuggestionUrl}', - technicalToAddress: '${technicalToAddress}', - helpToAddress: '${helpToAddress}', - suggestionsToAddress: '${suggestionsToAddress}', - supplementalAToAddress: '${supplementalAToAddress}', - supplementalBToAddress: '${supplementalBToAddress}', - contactName: '${contactName}', - enableTechnical: ${enableTechnical}, - enableHelp: ${enableHelp}, - enableSuggestions: ${enableSuggestions}, - enableSupplementalA: ${enableSupplementalA}, - enableSupplementalB: ${enableSupplementalB}, - helpPagesUrl: '${helpPagesUrl}', - helpdeskUrl: '${helpdeskUrl}', - technicalUrl: '${technicalUrl}', - supplementalAUrl: '${supplementalAUrl}', - supplementalBUrl: '${supplementalBUrl}', - helpPagesTarget: '${helpPagesTarget}', - supplementaryInfo: '${supplementaryInfo}', - recaptchaPublicKey: '${recaptchaPublicKey}', - maxAttachmentsMB: ${maxAttachmentsMB}, - showContentPanel: ${showContentPanel}, - showHelpPanel: ${showHelpPanel}, - showTechnicalPanel: ${showTechnicalPanel}, - showSuggestionsPanel: ${showSuggestionsPanel}, - showSupplementalAPanel: ${showSupplementalAPanel}, - showSupplementalBPanel: ${showSupplementalBPanel}, - helpPanelAsLink: ${helpPanelAsLink}, - technicalPanelAsLink: ${technicalPanelAsLink}, - suggestionsPanelAsLink: ${suggestionsPanelAsLink}, - supplementalAPanelAsLink: ${supplementalAPanelAsLink}, - supplementalBPanelAsLink: ${supplementalBPanelAsLink}, - siteUpdaters: [ - - {id: '${su.key}', displayName: '${su.value}'}, - - ], - i18n: { - - ${i.key}: "${i.value}", - - } - }; - - - - ${sakaiHtmlHead} - + + +
+ +
+ +
+
+ +
+
+
- - -
- -
-
- -
-
- -
-
-
-
- + + + + + + + + + - + + \ No newline at end of file diff --git a/feedback/src/webapp/js/feedback.js b/feedback/src/webapp/js/feedback.js index 71cd615d8f6d..365768649b87 100644 --- a/feedback/src/webapp/js/feedback.js +++ b/feedback/src/webapp/js/feedback.js @@ -1,419 +1,412 @@ -(function ($) { - - var TOOLBAR = 'toolbar'; +import FeedbackUtils from "/feedback-tool/js/feedbackutils.js"; +class Feedback { + static TOOLBAR = 'toolbar'; /* STATES */ - var HOME = 'home'; - var CONTENT = 'content'; - var HELPDESK = 'helpdesk'; - var TECHNICAL = 'technical'; - var SUGGESTIONS = 'suggestions'; - var SUPPLEMENTALA = 'supplementala'; - var SUPPLEMENTALB = 'supplementalb'; - var REPORTTECHNICAL = 'reporttechnical'; - var REPORTHELPDESK = 'reporthelpdesk'; - var REPORTSUGGESTIONS = 'reportsuggestions'; - var REPORTSUPPLEMENTALA = 'reportsupplementala'; - var REPORTSUPPLEMENTALB = 'reportsupplementalb'; - + static HOME = 'home'; + static CONTENT = 'content'; + static HELPDESK = 'helpdesk'; + static TECHNICAL = 'technical'; + static SUGGESTIONS = 'suggestions'; + static SUPPLEMENTALA = 'supplementala'; + static SUPPLEMENTALB = 'supplementalb'; + static REPORTTECHNICAL = 'reporttechnical'; + static REPORTHELPDESK = 'reporthelpdesk'; + static REPORTSUGGESTIONS = 'reportsuggestions'; + static REPORTSUPPLEMENTALA = 'reportsupplementala'; + static REPORTSUPPLEMENTALB = 'reportsupplementalb'; /* RESPONSE CODES */ - var SUCCESS = 'SUCCESS'; - var FORBIDDEN = 'FORBIDDEN'; - var BAD_REQUEST = 'BAD_REQUEST'; - var ATTACHMENTS_TOO_BIG = 'ATTACHMENTS_TOO_BIG'; - var BAD_TITLE = 'BAD_TITLE'; - var BAD_DESCRIPTION = 'BAD_DESCRIPTION'; - var RECAPTCHA_FAILURE = 'RECAPTCHA_FAILURE'; - var BAD_RECIPIENT = 'BAD_RECIPIENT'; - var NO_SENDER_ADDRESS = 'NO_SENDER_ADDRESS'; - var BAD_SENDER_ADDRESS = 'BAD_SENDER_ADDRESS'; - var DB_ERROR = 'DB_ERROR'; - - var loggedIn = (feedback.userId != '') ? true : false; - var siteUpdater; - var toAddress; - - feedback.switchState = function (state) { - feedback.switchState(state, null); - }; - - feedback.switchState = function (state, url) { - - $('#feedback-toolbar > li > span').removeClass('current'); + static SUCCESS = 'SUCCESS'; + static FORBIDDEN = 'FORBIDDEN'; + static BAD_REQUEST = 'BAD_REQUEST'; + static ATTACHMENTS_TOO_BIG = 'ATTACHMENTS_TOO_BIG'; + static BAD_TITLE = 'BAD_TITLE'; + static BAD_DESCRIPTION = 'BAD_DESCRIPTION'; + static RECAPTCHA_FAILURE = 'RECAPTCHA_FAILURE'; + static BAD_RECIPIENT = 'BAD_RECIPIENT'; + static NO_SENDER_ADDRESS = 'NO_SENDER_ADDRESS'; + static BAD_SENDER_ADDRESS = 'BAD_SENDER_ADDRESS'; + static DB_ERROR = 'DB_ERROR'; + + constructor(feedback) { + this.feedback = feedback; + this.loggedIn = feedback.userId !== ''; + this.siteUpdater = null; + this.toAddress = null; + + this.initialize(); + } + + initialize() { + Handlebars.registerHelper("translate", FeedbackUtils.translate); + FeedbackUtils.renderTemplate(Feedback.TOOLBAR, { + featureSuggestionUrl: this.feedback.featureSuggestionUrl, + loggedIn: this.loggedIn, + helpPagesUrl: this.feedback.helpPagesUrl, + helpPagesTarget: this.feedback.helpPagesTarget + }, 'feedback-toolbar'); + + $(document).ready(() => { + $('#feedback-home-item').click(() => this.switchState(Feedback.HOME)); + $('#feedback-content-item').click(() => this.switchState(Feedback.CONTENT)); + $('#feedback-technical-item').click(() => this.switchState(Feedback.TECHNICAL, Feedback.REPORTTECHNICAL)); + $('#feedback-helpdesk-item').click(() => this.switchState(Feedback.HELPDESK, Feedback.REPORTHELPDESK)); + }); - $('#feedback-' + state + '-item > span').addClass('current'); + this.switchState(Feedback.HOME); + } + switchState(state, url = null) { + $('#feedback-toolbar > li > span').removeClass('current'); + $('#feedback-' + state + '-item > span').addClass('current'); $('#feedback-error-message-wrapper').hide(); - $('#feedback-info-message-wrapper').hide(); - if (HOME === state) { - - siteUpdater = $('#feedback-siteupdaters').find(':selected').text(); - if (siteUpdater=='') siteUpdater = $('#feedback-contactname').val(); - - toAddress = $('#feedback-destination-email').val(); - - feedback.utils.renderTemplate(HOME, { featureSuggestionUrl: feedback.featureSuggestionUrl, - helpdeskUrl : feedback.helpdeskUrl, - technicalUrl : feedback.technicalUrl, - supplementalAUrl : feedback.supplementalAUrl, - supplementalBUrl : feedback.supplementalBUrl, - supplementaryInfo: feedback.supplementaryInfo, - helpPagesUrl: feedback.helpPagesUrl, - helpPagesTarget: feedback.helpPagesTarget, - loggedIn: loggedIn, showContentPanel : feedback.showContentPanel, - showHelpPanel : feedback.showHelpPanel, - showTechnicalPanel : feedback.showTechnicalPanel, - showSuggestionsPanel : feedback.showSuggestionsPanel, - showSupplementalAPanel : feedback.showSupplementalAPanel, - showSupplementalBPanel : feedback.showSupplementalBPanel, - helpPanelAsLink : feedback.helpPanelAsLink, - technicalPanelAsLink : feedback.technicalPanelAsLink, - suggestionsPanelAsLink : feedback.suggestionsPanelAsLink, - supplementalAPanelAsLink : feedback.supplementalAPanelAsLink, - supplementalBPanelAsLink : feedback.supplementalBPanelAsLink, - enableTechnical : feedback.enableTechnical, - enableSuggestions : feedback.enableSuggestions, - enableSupplementalA : feedback.enableSupplementalA, - enableSupplementalB : feedback.enableSupplementalB, - enableHelp : feedback.enableHelp}, 'feedback-content'); - - $(document).ready(function () { - - if (feedback.helpPagesUrl.length > 0 ) { - $('#feedback-help-wrapper').show(); - } - - $('#feedback-report-content-link').click(function (e) { - feedback.switchState(CONTENT); - }); - - if (!feedback.technicalPanelAsLink && feedback.enableTechnical) { - $('#feedback-technical-item').show().css('display', 'inline'); - $('#feedback-report-technical-wrapper').show(); - $('#feedback-report-technical-link').click(function (e) { - feedback.switchState(TECHNICAL, REPORTTECHNICAL); - }); - } + if (Feedback.HOME === state) { + this.handleHomeState(); + } else if (Feedback.CONTENT === state) { + this.handleContentState(); + } else if ([Feedback.TECHNICAL, Feedback.HELPDESK, Feedback.SUGGESTIONS, Feedback.SUPPLEMENTALA, Feedback.SUPPLEMENTALB].includes(state)) { + this.handleOtherStates(state, url); + } - if(!feedback.helpPanelAsLink && feedback.enableHelp) { - $('#feedback-report-helpdesk-link').click(function (e) { - feedback.switchState(HELPDESK, REPORTHELPDESK); - }); - } - - if(!feedback.suggestionsPanelAsLink && feedback.enableSuggestions) { - $('#feedback-suggest-feature-link').click(function(e) { - feedback.switchState(SUGGESTIONS, REPORTSUGGESTIONS); - }); - } + return false; + } + + handleHomeState() { + this.siteUpdater = $('#feedback-siteupdaters').find(':selected').text(); + if (this.siteUpdater === '') this.siteUpdater = $('#feedback-contactname').val(); + this.toAddress = $('#feedback-destination-email').val(); + FeedbackUtils.renderTemplate(Feedback.HOME, { + featureSuggestionUrl: this.feedback.featureSuggestionUrl, + helpdeskUrl: this.feedback.helpdeskUrl, + technicalUrl: this.feedback.technicalUrl, + supplementalAUrl: this.feedback.supplementalAUrl, + supplementalBUrl: this.feedback.supplementalBUrl, + supplementaryInfo: this.feedback.supplementaryInfo, + helpPagesUrl: this.feedback.helpPagesUrl, + helpPagesTarget: this.feedback.helpPagesTarget, + loggedIn: this.loggedIn, + showContentPanel: this.feedback.showContentPanel, + showHelpPanel: this.feedback.showHelpPanel, + showTechnicalPanel: this.feedback.showTechnicalPanel, + showSuggestionsPanel: this.feedback.showSuggestionsPanel, + showSupplementalAPanel: this.feedback.showSupplementalAPanel, + showSupplementalBPanel: this.feedback.showSupplementalBPanel, + helpPanelAsLink: this.feedback.helpPanelAsLink, + technicalPanelAsLink: this.feedback.technicalPanelAsLink, + suggestionsPanelAsLink: this.feedback.suggestionsPanelAsLink, + supplementalAPanelAsLink: this.feedback.supplementalAPanelAsLink, + supplementalBPanelAsLink: this.feedback.supplementalBPanelAsLink, + enableTechnical: this.feedback.enableTechnical, + enableSuggestions: this.feedback.enableSuggestions, + enableSupplementalA: this.feedback.enableSupplementalA, + enableSupplementalB: this.feedback.enableSupplementalB, + enableHelp: this.feedback.enableHelp + }, 'feedback-content'); + + $(document).ready(() => { + this.setupHomeStateEvents(); + }); + } - if(!feedback.supplementalAPanelAsLink && feedback.enableSupplementalA) { - $('#feedback-report-supplemental-a-link').click(function(e) { - feedback.switchState(SUPPLEMENTALA, REPORTSUPPLEMENTALA); - }); - } + setupHomeStateEvents() { + if (this.feedback.helpPagesUrl.length > 0) { + $('#feedback-help-wrapper').show(); + } + $('#feedback-report-content-link').click(() => this.switchState(Feedback.CONTENT)); - if(!feedback.supplementalBPanelAsLink && feedback.enableSupplementalB) { - $('#feedback-report-supplemental-b-link').click(function(e) { - feedback.switchState(SUPPLEMENTALB, REPORTSUPPLEMENTALB); - }); - } + if (!this.feedback.technicalPanelAsLink && this.feedback.enableTechnical) { + $('#feedback-technical-item').show().css('display', 'inline'); + $('#feedback-report-technical-wrapper').show(); + $('#feedback-report-technical-link').click(() => this.switchState(Feedback.TECHNICAL, Feedback.REPORTTECHNICAL)); + } - if (feedback.supplementaryInfo.length > 0) { - $('#feedback-supplementary-info').show(); - } + if (!this.feedback.helpPanelAsLink && this.feedback.enableHelp) { + $('#feedback-report-helpdesk-link').click(() => this.switchState(Feedback.HELPDESK, Feedback.REPORTHELPDESK)); + } - $('.feedback-explanation-link').click(function (e) { + if (!this.feedback.suggestionsPanelAsLink && this.feedback.enableSuggestions) { + $('#feedback-suggest-feature-link').click(() => this.switchState(Feedback.SUGGESTIONS, Feedback.REPORTSUGGESTIONS)); + } - $(this).next().toggle({ duration: 'fast', - complete: function () { - feedback.fitFrame(); - } }); - }); + if (!this.feedback.supplementalAPanelAsLink && this.feedback.enableSupplementalA) { + $('#feedback-report-supplemental-a-link').click(() => this.switchState(Feedback.SUPPLEMENTALA, Feedback.REPORTSUPPLEMENTALA)); + } + if (!this.feedback.supplementalBPanelAsLink && this.feedback.enableSupplementalB) { + $('#feedback-report-supplemental-b-link').click(() => this.switchState(Feedback.SUPPLEMENTALB, Feedback.REPORTSUPPLEMENTALB)); + } - $('#feedback-info-message-wrapper a').click(function (e) { - $('#feedback-info-message-wrapper').hide(); - }); + if (this.feedback.supplementaryInfo.length > 0) { + $('#feedback-supplementary-info').show(); + } - if(feedback.previousState === CONTENT && (siteUpdater !== null && siteUpdater !=='')) { - feedback.displayInfo(siteUpdater); - } else { - feedback.displayInfo(toAddress); + $('.feedback-explanation-link').click(() => { + $(this).next().toggle({ + duration: 'fast', + complete: () => { + this.fitFrame(); } - - feedback.fitFrame(); }); - } else if (CONTENT === state) { - - feedback.utils.renderTemplate(state, { plugins : feedback.getPluginList(), screenWidth: screen.width, screenHeight: screen.height, oscpu: navigator.oscpu, windowWidth: window.outerWidth, - windowHeight: window.outerHeight, siteExists: feedback.siteExists, siteId: feedback.siteId, contentUrl : feedback.contentUrl, siteUpdaters: feedback.siteUpdaters, loggedIn: loggedIn, destinationAddress: feedback.technicalToAddress, contactName: feedback.contactName}, 'feedback-content'); - - feedback.previousState = state; - $(document).ready(function () { - - feedback.addMouseUpToTextArea(); - feedback.fitFrame(); - - if (feedback.siteUpdaters.length > 0) { - $('#feedback-siteupdaters-wrapper').show(); - } - - $('#feedback-form').ajaxForm(feedback.getFormOptions(feedback.userId.length > 0)); + }); - $('#feedback-max-attachments-mb').html(feedback.maxAttachmentsMB); + $('#feedback-info-message-wrapper a').click(() => { + $('#feedback-info-message-wrapper').hide(); + }); - $('#feedback-attachment').MultiFile( { - max: 5, - namePattern: '$name_$i' - }); + if (this.feedback.previousState === Feedback.CONTENT && (this.siteUpdater !== null && this.siteUpdater !== '')) { + this.displayInfo(this.siteUpdater); + } else { + this.displayInfo(this.toAddress); + } - feedback.setUpCancelButton(); + this.fitFrame(); + } + + handleContentState() { + FeedbackUtils.renderTemplate(Feedback.CONTENT, { + plugins: this.getPluginList(), + screenWidth: screen.width, + screenHeight: screen.height, + oscpu: navigator.oscpu, + windowWidth: window.outerWidth, + windowHeight: window.outerHeight, + siteExists: this.feedback.siteExists, + siteId: this.feedback.siteId, + contentUrl: this.feedback.contentUrl, + siteUpdaters: this.feedback.siteUpdaters, + loggedIn: this.loggedIn, + destinationAddress: this.feedback.technicalToAddress, + contactName: this.feedback.contactName + }, 'feedback-content'); + + this.feedback.previousState = Feedback.CONTENT; + + $(document).ready(() => { + this.addMouseUpToTextArea(); + this.fitFrame(); + + if (this.feedback.siteUpdaters.length > 0) { + $('#feedback-siteupdaters-wrapper').show(); + } - if (!loggedIn) { - // Not logged in, show the sender email box. - $('#feedback-sender-address-wrapper').show(); + $('#feedback-form').ajaxForm(this.getFormOptions(this.feedback.userId.length > 0)); + $('#feedback-max-attachments-mb').html(this.feedback.maxAttachmentsMB); + $('#feedback-attachment').MultiFile({ + max: 5, + namePattern: '$name_$i' + }); - feedback.setUpRecaptcha(); - } else { - // logged in, hide the sender form address - $('#feedback-sender-address-wrapper').hide(); - } + this.setUpCancelButton(); - }); - } else if (TECHNICAL === state || HELPDESK === state || SUGGESTIONS === state || SUPPLEMENTALA === state || SUPPLEMENTALB === state) { - var options = { plugins : feedback.getPluginList(), screenWidth: screen.width, screenHeight: screen.height, oscpu: navigator.oscpu, windowWidth: window.outerWidth, - windowHeight: window.outerHeight, siteExists: feedback.siteExists, url: url, siteId: feedback.siteId, siteUpdaters: feedback.siteUpdaters, loggedIn: loggedIn, contactName: feedback.contactName }; - - if (TECHNICAL === state) { - options['destinationAddress'] = feedback.technicalToAddress; - options['instructionUrl'] = feedback.technicalUrl; - options['instructionKey'] = 'technical_instruction'; - } else if (HELPDESK === state) { - options['destinationAddress'] = feedback.helpToAddress; - options['instructionUrl'] = feedback.helpdeskUrl; - options['instructionKey'] = 'ask_instruction'; - } else if (SUGGESTIONS === state) { - options['destinationAddress'] = feedback.suggestionsToAddress; - options['instructionUrl'] = feedback.featureSuggestionUrl; - options['instructionKey'] = 'suggestion_instruction'; - } else if (SUPPLEMENTALA === state) { - options['destinationAddress'] = feedback.supplementalAToAddress; - options['instructionUrl'] = feedback.supplementalAUrl; - options['instructionKey'] = 'supplemental_a_instruction'; + if (!this.loggedIn) { + $('#feedback-sender-address-wrapper').show(); + this.setUpRecaptcha(); } else { - options['destinationAddress'] = feedback.supplementalBToAddress; - options['instructionUrl'] = feedback.supplementalBUrl; - options['instructionKey'] = 'supplemental_b_instruction'; + $('#feedback-sender-address-wrapper').hide(); } - feedback.utils.renderTemplate("emailForm", options, 'feedback-content'); - - feedback.previousState = state; - $(document).ready(function () { - - feedback.addMouseUpToTextArea(); - - if (!loggedIn) { - // Not logged in, show the sender email box. - $('#feedback-sender-address-wrapper').show(); - - feedback.setUpRecaptcha(); - } else { - // logged in, hide the sender form address - $('#feedback-sender-address-wrapper').hide(); - } + }); + } + + handleOtherStates(state, url) { + let options = { + plugins: this.getPluginList(), + screenWidth: screen.width, + screenHeight: screen.height, + oscpu: navigator.oscpu, + windowWidth: window.outerWidth, + windowHeight: window.outerHeight, + siteExists: this.feedback.siteExists, + url: url, + siteId: this.feedback.siteId, + siteUpdaters: this.feedback.siteUpdaters, + loggedIn: this.loggedIn, + contactName: this.feedback.contactName + }; - feedback.fitFrame(); + options = this.setOptionsForOtherStates(options, state); - $('#feedback-form').ajaxForm(feedback.getFormOptions(feedback.userId.length > 0)); + FeedbackUtils.renderTemplate("emailForm", options, 'feedback-content'); + this.feedback.previousState = state; - $('#feedback-max-attachments-mb').html(feedback.maxAttachmentsMB); + $(document).ready(() => { + this.addMouseUpToTextArea(); - $('#feedback-attachment').MultiFile( { - max: 5, - namePattern: '$name_$i' - } ); + if (!this.loggedIn) { + $('#feedback-sender-address-wrapper').show(); + this.setUpRecaptcha(); + } else { + $('#feedback-sender-address-wrapper').hide(); + } - feedback.setUpCancelButton(); + this.fitFrame(); + $('#feedback-form').ajaxForm(this.getFormOptions(this.feedback.userId.length > 0)); + $('#feedback-max-attachments-mb').html(this.feedback.maxAttachmentsMB); + $('#feedback-attachment').MultiFile({ + max: 5, + namePattern: '$name_$i' }); + + this.setUpCancelButton(); + }); + } + + setOptionsForOtherStates(options, state) { + if (Feedback.TECHNICAL === state) { + options.destinationAddress = this.feedback.technicalToAddress; + options.instructionUrl = this.feedback.technicalUrl; + options.instructionKey = 'technical_instruction'; + } else if (Feedback.HELPDESK === state) { + options.destinationAddress = this.feedback.helpToAddress; + options.instructionUrl = this.feedback.helpdeskUrl; + options.instructionKey = 'ask_instruction'; + } else if (Feedback.SUGGESTIONS === state) { + options.destinationAddress = this.feedback.suggestionsToAddress; + options.instructionUrl = this.feedback.featureSuggestionUrl; + options.instructionKey = 'suggestion_instruction'; + } else if (Feedback.SUPPLEMENTALA === state) { + options.destinationAddress = this.feedback.supplementalAToAddress; + options.instructionUrl = this.feedback.supplementalAUrl; + options.instructionKey = 'supplemental_a_instruction'; + } else { + options.destinationAddress = this.feedback.supplementalBToAddress; + options.instructionUrl = this.feedback.supplementalBUrl; + options.instructionKey = 'supplemental_b_instruction'; } - return false; - }; + return options; + } - feedback.getPluginList = function () { - var plugins = ''; - for(var i = 0; i 0) { - // Recaptcha is enabled, show it. - Recaptcha.create(feedback.recaptchaPublicKey, "feedback-recaptcha-block", - { - theme: "red", - callback: function () { - - feedback.fitFrame(); - $('#feedback-recaptcha-wrapper').show(); - } + } + + setUpRecaptcha() { + if (this.feedback.recaptchaPublicKey.length > 0) { + Recaptcha.create(this.feedback.recaptchaPublicKey, "feedback-recaptcha-block", { + theme: "red", + callback: () => { + this.fitFrame(); + $('#feedback-recaptcha-wrapper').show(); } - ); + }); } - }; + } - feedback.setUpCancelButton = function () { - $('#feedback-cancel-button').click(function (e) { - location.href=""; + setUpCancelButton() { + $('#feedback-cancel-button').click((e) => { + location.href = ""; e.preventDefault(); }); - }; - - feedback.fitFrame = function () { + } + fitFrame() { try { if (window.frameElement) { setMainFrameHeight(window.frameElement.id); } - } catch (err) { } - }; + } catch (err) {} + } - feedback.addMouseUpToTextArea = function () { - - $('textarea').mouseup(function (e) { - feedback.fitFrame(); + addMouseUpToTextArea() { + $('textarea').mouseup(() => { + this.fitFrame(); }); - }; - - feedback.getFormOptions = function (loggedIn) { + } + getFormOptions(loggedIn) { return { dataType: 'html', iframe: true, timeout: 30000, - success: function (responseText, statusText, xhr) { - - if (responseText === SUCCESS) { - feedback.switchState(HOME); + success: (responseText, statusText, xhr) => { + if (responseText === Feedback.SUCCESS) { + this.switchState(Feedback.HOME); } else { - feedback.displayError(responseText); + this.displayError(responseText); } }, - beforeSubmit: function (formArray, $form, options) { - - for (var i=0,j=formArray.length;i { + for (let i = 0, j = formArray.length; i < j; i++) { + let el = formArray[i]; + if (el.name === 'title' && el.value.length < 1) { + this.displayError(Feedback.BAD_TITLE); + return false; + } else if (el.name === 'description' && el.value.length < 1) { + this.displayError(Feedback.BAD_DESCRIPTION); + return false; + } else if (!loggedIn && el.name === 'senderaddress' && (el.value.length === 0 || !this.validateEmail(el.value))) { + this.displayError(el.value.length === 0 ? Feedback.NO_SENDER_ADDRESS : Feedback.BAD_SENDER_ADDRESS); + return false; } } return true; } }; - }; + } - feedback.validateEmail = function (email) { - var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + validateEmail(email) { + const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); - }; - - feedback.displayError = function (errorCode) { - - if (errorCode === FORBIDDEN) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_forbidden); - } else if (errorCode === BAD_REQUEST) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_bad_request); - } else if (errorCode === ATTACHMENTS_TOO_BIG) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_attachments_too_big); - } else if (errorCode === BAD_TITLE) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_bad_title); - } else if (errorCode === BAD_DESCRIPTION) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_bad_description); - } else if (errorCode === RECAPTCHA_FAILURE) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_recaptcha_failure); - } else if (errorCode === BAD_RECIPIENT) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_bad_recipient); - } else if (errorCode === NO_SENDER_ADDRESS) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_no_sender_address); - } else if (errorCode === BAD_SENDER_ADDRESS) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_bad_sender_address); - } else if (errorCode === DB_ERROR) { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error_db_error); - } else { - $('#feedback-error-message-wrapper span').html(feedback.i18n.error); + } + + displayError(errorCode) { + let errorMessage; + + switch (errorCode) { + case Feedback.FORBIDDEN: + errorMessage = this.feedback.i18n.error_forbidden; + break; + case Feedback.BAD_REQUEST: + errorMessage = this.feedback.i18n.error_bad_request; + break; + case Feedback.ATTACHMENTS_TOO_BIG: + errorMessage = this.feedback.i18n.error_attachments_too_big; + break; + case Feedback.BAD_TITLE: + errorMessage = this.feedback.i18n.error_bad_title; + break; + case Feedback.BAD_DESCRIPTION: + errorMessage = this.feedback.i18n.error_bad_description; + break; + case Feedback.RECAPTCHA_FAILURE: + errorMessage = this.feedback.i18n.error_recaptcha_failure; + break; + case Feedback.BAD_RECIPIENT: + errorMessage = this.feedback.i18n.error_bad_recipient; + break; + case Feedback.NO_SENDER_ADDRESS: + errorMessage = this.feedback.i18n.error_no_sender_address; + break; + default: + errorMessage = this.feedback.i18n.error; + break; } - $('#feedback-error-message-wrapper a').click(function (e) { + $('#feedback-error-message-wrapper span').html(errorMessage); + $('#feedback-error-message-wrapper a').click(() => { $('#feedback-error-message-wrapper').hide(); }); - $('#feedback-error-message-wrapper').show(); - feedback.fitFrame(); + this.fitFrame(); - if (feedback.recaptchaPublicKey.length > 0) { - // Recaptcha is enabled, so we need to reset it. + if (this.feedback.recaptchaPublicKey.length > 0) { Recaptcha.reload(); } - }; + } - - feedback.displayInfo = function (destination) { - if (destination!=null && destination!=''){ - $('#feedback-info-message-wrapper span').html(feedback.i18n['email_success'] + ' ' + destination); + displayInfo(destination) { + if (destination !== undefined && destination !== '') { + $('#feedback-info-message-wrapper span').html(this.feedback.i18n.email_success + ' ' + destination); $('#feedback-info-message-wrapper').show(); - feedback.fitFrame(); + this.fitFrame(); } - }; - - var loggedIn = (feedback.userId != '') ? true : false; - feedback.utils.renderTemplate(TOOLBAR , { featureSuggestionUrl: feedback.featureSuggestionUrl, - loggedIn: loggedIn, - helpPagesUrl: feedback.helpPagesUrl, - helpPagesTarget: feedback.helpPagesTarget}, 'feedback-toolbar'); - - $(document).ready(function () { - - $('#feedback-home-item').click(function (e) { - return feedback.switchState(HOME); - }); - - $('#feedback-content-item').click(function (e) { - return feedback.switchState(CONTENT); - }); - - $('#feedback-technical-item').click(function (e) { - return feedback.switchState(TECHNICAL, REPORTTECHNICAL); - }); - - $('#feedback-helpdesk-item').click(function (e) { - return feedback.switchState(HELPDESK, REPORTHELPDESK); - }); - }); - - feedback.switchState(HOME); + } +} -}) (jQuery); +export default Feedback; \ No newline at end of file diff --git a/feedback/src/webapp/js/feedbackutils.js b/feedback/src/webapp/js/feedbackutils.js index 2ab7ada4ef2b..27debbd45359 100644 --- a/feedback/src/webapp/js/feedbackutils.js +++ b/feedback/src/webapp/js/feedbackutils.js @@ -1,22 +1,18 @@ -(function ($) { +class FeedbackUtils { + static renderTemplate(name, data, output) { + const template = Handlebars.templates[name]; + document.getElementById(output).innerHTML = template(data); + } - feedback.utils = {}; + static translate(key, options) { + let ret = feedback.i18n[key]; + if (options !== undefined) { + for (const prop in options.hash) { + ret = ret.replace("{${prop}}", options.hash[prop]); + } + } + return new Handlebars.SafeString(ret); + } +} - feedback.utils.renderTemplate = function (name, data, output) { - - var template = Handlebars.templates[name]; - document.getElementById(output).innerHTML = template(data); - }; - - Handlebars.registerHelper('translate', function (key, options) { - var ret = feedback.i18n[key]; - if(options != undefined) { - for (var prop in options.hash) { - ret = ret.replace('{'+prop+'}', options.hash[prop]); - } - } - - return new Handlebars.SafeString(ret); - }); - -}) (jQuery); +export default FeedbackUtils; \ No newline at end of file diff --git a/feedback/src/webapp/lib/handlebars.runtime-v1.3.0.js b/feedback/src/webapp/lib/handlebars.runtime-v1.3.0.js deleted file mode 100644 index b94930fa82c7..000000000000 --- a/feedback/src/webapp/lib/handlebars.runtime-v1.3.0.js +++ /dev/null @@ -1,530 +0,0 @@ -/*! - - handlebars v1.3.0 - -Copyright (C) 2011 by Yehuda Katz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -@license -*/ -/* exported Handlebars */ -var Handlebars = (function() { -// handlebars/safe-string.js -var __module3__ = (function() { - "use strict"; - var __exports__; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = function() { - return "" + this.string; - }; - - __exports__ = SafeString; - return __exports__; -})(); - -// handlebars/utils.js -var __module2__ = (function(__dependency1__) { - "use strict"; - var __exports__ = {}; - /*jshint -W004 */ - var SafeString = __dependency1__; - - var escape = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'", - "`": "`" - }; - - var badChars = /[&<>"'`]/g; - var possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr] || "&"; - } - - function extend(obj, value) { - for(var key in value) { - if(Object.prototype.hasOwnProperty.call(value, key)) { - obj[key] = value[key]; - } - } - } - - __exports__.extend = extend;var toString = Object.prototype.toString; - __exports__.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - var isFunction = function(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - __exports__.isFunction = isFunction; - var isArray = Array.isArray || function(value) { - return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; - }; - __exports__.isArray = isArray; - - function escapeExpression(string) { - // don't escape SafeStrings, since they're already safe - if (string instanceof SafeString) { - return string.toString(); - } else if (!string && string !== 0) { - return ""; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = "" + string; - - if(!possible.test(string)) { return string; } - return string.replace(badChars, escapeChar); - } - - __exports__.escapeExpression = escapeExpression;function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - __exports__.isEmpty = isEmpty; - return __exports__; -})(__module3__); - -// handlebars/exception.js -var __module4__ = (function() { - "use strict"; - var __exports__; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var line; - if (node && node.firstLine) { - line = node.firstLine; - - message += ' - ' + line + ':' + node.firstColumn; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (line) { - this.lineNumber = line; - this.column = node.firstColumn; - } - } - - Exception.prototype = new Error(); - - __exports__ = Exception; - return __exports__; -})(); - -// handlebars/base.js -var __module1__ = (function(__dependency1__, __dependency2__) { - "use strict"; - var __exports__ = {}; - var Utils = __dependency1__; - var Exception = __dependency2__; - - var VERSION = "1.3.0"; - __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; - __exports__.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '>= 1.0.0' - }; - __exports__.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function(name, fn, inverse) { - if (toString.call(name) === objectType) { - if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } - Utils.extend(this.helpers, name); - } else { - if (inverse) { fn.not = inverse; } - this.helpers[name] = fn; - } - }, - - registerPartial: function(name, str) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - this.partials[name] = str; - } - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function(arg) { - if(arguments.length === 2) { - return undefined; - } else { - throw new Exception("Missing helper: '" + arg + "'"); - } - }); - - instance.registerHelper('blockHelperMissing', function(context, options) { - var inverse = options.inverse || function() {}, fn = options.fn; - - if (isFunction(context)) { context = context.call(this); } - - if(context === true) { - return fn(this); - } else if(context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if(context.length > 0) { - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - return fn(context); - } - }); - - instance.registerHelper('each', function(context, options) { - var fn = options.fn, inverse = options.inverse; - var i = 0, ret = "", data; - - if (isFunction(context)) { context = context.call(this); } - - if (options.data) { - data = createFrame(options.data); - } - - if(context && typeof context === 'object') { - if (isArray(context)) { - for(var j = context.length; i").get(0).files,e.formdata=void 0!==window.FormData;var f=!!a.fn.prop;a.fn.attr2=function(){if(!f)return this.attr.apply(this,arguments);var a=this.prop.apply(this,arguments);return a&&a.jquery||"string"==typeof a?a:this.attr.apply(this,arguments)},a.fn.ajaxSubmit=function(b){function c(c){var d,e,f=a.param(c,b.traditional).split("&"),g=f.length,h=[];for(d=0;g>d;d++)f[d]=f[d].replace(/\+/g," "),e=f[d].split("="),h.push([decodeURIComponent(e[0]),decodeURIComponent(e[1])]);return h}function g(d){for(var e=new FormData,f=0;f').val(m.extraData[n].value).appendTo(x)[0]):k.push(a('').val(m.extraData[n]).appendTo(x)[0]));m.iframeTarget||q.appendTo("body"),r.attachEvent?r.attachEvent("onload",h):r.addEventListener("load",h,!1),setTimeout(b,15);try{x.submit()}catch(p){var s=document.createElement("form").submit;s.apply(x)}}finally{x.setAttribute("action",f),x.setAttribute("enctype",j),c?x.setAttribute("target",c):l.removeAttr("target"),a(k).remove()}}function h(b){if(!s.aborted&&!F){if(E=e(r),E||(d("cannot access response document"),b=A),b===z&&s)return s.abort("timeout"),y.reject(s,"timeout"),void 0;if(b==A&&s)return s.abort("server abort"),y.reject(s,"error","server abort"),void 0;if(E&&E.location.href!=m.iframeSrc||v){r.detachEvent?r.detachEvent("onload",h):r.removeEventListener("load",h,!1);var c,f="success";try{if(v)throw"timeout";var g="xml"==m.dataType||E.XMLDocument||a.isXMLDoc(E);if(d("isXml="+g),!g&&window.opera&&(null===E.body||!E.body.innerHTML)&&--G)return d("requeing onLoad callback, DOM not available"),setTimeout(h,250),void 0;var i=E.body?E.body:E.documentElement;s.responseText=i?i.innerHTML:null,s.responseXML=E.XMLDocument?E.XMLDocument:E,g&&(m.dataType="xml"),s.getResponseHeader=function(a){var b={"content-type":m.dataType};return b[a.toLowerCase()]},i&&(s.status=Number(i.getAttribute("status"))||s.status,s.statusText=i.getAttribute("statusText")||s.statusText);var j=(m.dataType||"").toLowerCase(),k=/(json|script|text)/.test(j);if(k||m.textarea){var l=E.getElementsByTagName("textarea")[0];if(l)s.responseText=l.value,s.status=Number(l.getAttribute("status"))||s.status,s.statusText=l.getAttribute("statusText")||s.statusText;else if(k){var o=E.getElementsByTagName("pre")[0],p=E.getElementsByTagName("body")[0];o?s.responseText=o.textContent?o.textContent:o.innerText:p&&(s.responseText=p.textContent?p.textContent:p.innerText)}}else"xml"==j&&!s.responseXML&&s.responseText&&(s.responseXML=H(s.responseText));try{D=J(s,j,m)}catch(t){f="parsererror",s.error=c=t||f}}catch(t){d("error caught: ",t),f="error",s.error=c=t||f}s.aborted&&(d("upload aborted"),f=null),s.status&&(f=s.status>=200&&s.status<300||304===s.status?"success":"error"),"success"===f?(m.success&&m.success.call(m.context,D,"success",s),y.resolve(s.responseText,"success",s),n&&a.event.trigger("ajaxSuccess",[s,m])):f&&(void 0===c&&(c=s.statusText),m.error&&m.error.call(m.context,s,f,c),y.reject(s,"error",c),n&&a.event.trigger("ajaxError",[s,m,c])),n&&a.event.trigger("ajaxComplete",[s,m]),n&&!--a.active&&a.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,s,f),F=!0,m.timeout&&clearTimeout(w),setTimeout(function(){m.iframeTarget?q.attr("src",m.iframeSrc):q.remove(),s.responseXML=null},100)}}}var j,k,m,n,o,q,r,s,t,u,v,w,x=l[0],y=a.Deferred();if(y.abort=function(a){s.abort(a)},c)for(k=0;k'),q.css({position:"absolute",top:"-1000px",left:"-1000px"})),r=q[0],s={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(b){var c="timeout"===b?"timeout":"aborted";d("aborting upload... "+c),this.aborted=1;try{r.contentWindow.document.execCommand&&r.contentWindow.document.execCommand("Stop")}catch(e){}q.attr("src",m.iframeSrc),s.error=c,m.error&&m.error.call(m.context,s,c,b),n&&a.event.trigger("ajaxError",[s,m,c]),m.complete&&m.complete.call(m.context,s,c)}},n=m.global,n&&0===a.active++&&a.event.trigger("ajaxStart"),n&&a.event.trigger("ajaxSend",[s,m]),m.beforeSend&&m.beforeSend.call(m.context,s,m)===!1)return m.global&&a.active--,y.reject(),y;if(s.aborted)return y.reject(),y;t=x.clk,t&&(u=t.name,u&&!t.disabled&&(m.extraData=m.extraData||{},m.extraData[u]=t.value,"image"==t.type&&(m.extraData[u+".x"]=x.clk_x,m.extraData[u+".y"]=x.clk_y)));var z=1,A=2,B=a("meta[name=csrf-token]").attr("content"),C=a("meta[name=csrf-param]").attr("content");C&&B&&(m.extraData=m.extraData||{},m.extraData[C]=B),m.forceSync?g():setTimeout(g,10);var D,E,F,G=50,H=a.parseXML||function(a,b){return window.ActiveXObject?(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)):b=(new DOMParser).parseFromString(a,"text/xml"),b&&b.documentElement&&"parsererror"!=b.documentElement.nodeName?b:null},I=a.parseJSON||function(a){return window.eval("("+a+")")},J=function(b,c,d){var e=b.getResponseHeader("content-type")||"",f="xml"===c||!c&&e.indexOf("xml")>=0,g=f?b.responseXML:b.responseText;return f&&"parsererror"===g.documentElement.nodeName&&a.error&&a.error("parsererror"),d&&d.dataFilter&&(g=d.dataFilter(g,c)),"string"==typeof g&&("json"===c||!c&&e.indexOf("json")>=0?g=I(g):("script"===c||!c&&e.indexOf("javascript")>=0)&&a.globalEval(g)),g};return y}if(!this.length)return d("ajaxSubmit: skipping submit process - no element selected"),this;var i,j,k,l=this;"function"==typeof b?b={success:b}:void 0===b&&(b={}),i=b.type||this.attr2("method"),j=b.url||this.attr2("action"),k="string"==typeof j?a.trim(j):"",k=k||window.location.href||"",k&&(k=(k.match(/^([^#]+)/)||[])[1]),b=a.extend(!0,{url:k,success:a.ajaxSettings.success,type:i||a.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},b);var m={};if(this.trigger("form-pre-serialize",[this,b,m]),m.veto)return d("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(b.beforeSerialize&&b.beforeSerialize(this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var n=b.traditional;void 0===n&&(n=a.ajaxSettings.traditional);var o,p=[],q=this.formToArray(b.semantic,p);if(b.data&&(b.extraData=b.data,o=a.param(b.data,n)),b.beforeSubmit&&b.beforeSubmit(q,this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[q,this,b,m]),m.veto)return d("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var r=a.param(q,n);o&&(r=r?r+"&"+o:o),"GET"==b.type.toUpperCase()?(b.url+=(b.url.indexOf("?")>=0?"&":"?")+r,b.data=null):b.data=r;var s=[];if(b.resetForm&&s.push(function(){l.resetForm()}),b.clearForm&&s.push(function(){l.clearForm(b.includeHidden)}),!b.dataType&&b.target){var t=b.success||function(){};s.push(function(c){var d=b.replaceTarget?"replaceWith":"html";a(b.target)[d](c).each(t,arguments)})}else b.success&&s.push(b.success);if(b.success=function(a,c,d){for(var e=b.context||this,f=0,g=s.length;g>f;f++)s[f].apply(e,[a,c,d||l,l])},b.error){var u=b.error;b.error=function(a,c,d){var e=b.context||this;u.apply(e,[a,c,d,l])}}if(b.complete){var v=b.complete;b.complete=function(a,c){var d=b.context||this;v.apply(d,[a,c,l])}}var w=a("input[type=file]:enabled",this).filter(function(){return""!==a(this).val()}),x=w.length>0,y="multipart/form-data",z=l.attr("enctype")==y||l.attr("encoding")==y,A=e.fileapi&&e.formdata;d("fileAPI :"+A);var B,C=(x||z)&&!A;b.iframe!==!1&&(b.iframe||C)?b.closeKeepAlive?a.get(b.closeKeepAlive,function(){B=h(q)}):B=h(q):B=(x||z)&&A?g(q):a.ajax(b),l.removeData("jqxhr").data("jqxhr",B);for(var D=0;Dj;j++)if(n=i[j],l=n.name,l&&!n.disabled)if(b&&g.clk&&"image"==n.type)g.clk==n&&(d.push({name:l,value:a(n).val(),type:n.type}),d.push({name:l+".x",value:g.clk_x},{name:l+".y",value:g.clk_y}));else if(m=a.fieldValue(n,!0),m&&m.constructor==Array)for(c&&c.push(n),k=0,p=m.length;p>k;k++)d.push({name:l,value:m[k]});else if(e.fileapi&&"file"==n.type){c&&c.push(n);var q=n.files;if(q.length)for(k=0;kf;f++)c.push({name:d,value:e[f]});else null!==e&&"undefined"!=typeof e&&c.push({name:this.name,value:e})}}),a.param(c)},a.fn.fieldValue=function(b){for(var c=[],d=0,e=this.length;e>d;d++){var f=this[d],g=a.fieldValue(f,b);null===g||"undefined"==typeof g||g.constructor==Array&&!g.length||(g.constructor==Array?a.merge(c,g):c.push(g))}return c},a.fieldValue=function(b,c){var d=b.name,e=b.type,f=b.tagName.toLowerCase();if(void 0===c&&(c=!0),c&&(!d||b.disabled||"reset"==e||"button"==e||("checkbox"==e||"radio"==e)&&!b.checked||("submit"==e||"image"==e)&&b.form&&b.form.clk!=b||"select"==f&&-1==b.selectedIndex))return null;if("select"==f){var g=b.selectedIndex;if(0>g)return null;for(var h=[],i=b.options,j="select-one"==e,k=j?g+1:i.length,l=j?g:0;k>l;l++){var m=i[l];if(m.selected){var n=m.value;if(n||(n=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),j)return n;h.push(n)}}return h}return a(b).val()},a.fn.clearForm=function(b){return this.each(function(){a("input,select,textarea",this).clearFields(b)})},a.fn.clearFields=a.fn.clearInputs=function(b){var c=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var d=this.type,e=this.tagName.toLowerCase();c.test(d)||"textarea"==e?this.value="":"checkbox"==d||"radio"==d?this.checked=!1:"select"==e?this.selectedIndex=-1:"file"==d?/MSIE/.test(navigator.userAgent)?a(this).replaceWith(a(this).clone(!0)):a(this).val(""):b&&(b===!0&&/hidden/.test(d)||"string"==typeof b&&a(this).is(b))&&(this.value="")})},a.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},a.fn.enable=function(a){return void 0===a&&(a=!0),this.each(function(){this.disabled=!a})},a.fn.selected=function(b){return void 0===b&&(b=!0),this.each(function(){var c=this.type;if("checkbox"==c||"radio"==c)this.checked=b;else if("option"==this.tagName.toLowerCase()){var d=a(this).parent("select");b&&d[0]&&"select-one"==d[0].type&&d.find("option").selected(!1),this.selected=b}})},a.fn.ajaxSubmit.debug=!1}); \ No newline at end of file diff --git a/library/pom.xml b/library/pom.xml index 3e2599ef88b2..a98a56acff66 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -114,7 +114,7 @@ runtime - org.webjars + org.webjars.bower handlebars ${handlebars4.version} runtime diff --git a/library/src/webapp/js/headscripts.js b/library/src/webapp/js/headscripts.js index 7a62c3972a37..08954534752d 100644 --- a/library/src/webapp/js/headscripts.js +++ b/library/src/webapp/js/headscripts.js @@ -685,7 +685,7 @@ function includeWebjarLibrary(library, options = {}) { // Include the CSS if requested const includeCss = options.includeCss || false; - switch(library) { + switch (library) { case 'bootstrap': libraryVersion = "5.2.0"; jsReferences.push('/js/bootstrap.bundle.min.js'); @@ -753,7 +753,7 @@ function includeWebjarLibrary(library, options = {}) { jsReferences.push('/lib/browser/math.js'); break; case 'handlebars': - libraryVersion = "4.0.6"; + libraryVersion = "4.4.0"; jsReferences.push('/handlebars.runtime.min.js'); break; case 'qtip2': @@ -798,6 +798,10 @@ function includeWebjarLibrary(library, options = {}) { libraryVersion = "5.1.0"; jsReferences.push('/dist/wavesurfer.min.js'); break; + case 'multifile': + libraryVersion = "2.2.2"; + jsReferences.push('/jquery.MultiFile.min.js'); + break; default: if (library.endsWith(".js")) { document.write('\x3Cscript src="' + webjars + library + ver + '">' + '\x3C/script>'); diff --git a/master/pom.xml b/master/pom.xml index 8bb51e690c98..58841d5808c1 100644 --- a/master/pom.xml +++ b/master/pom.xml @@ -89,10 +89,8 @@ 0.12.0 0.9.20 1.1.1 - 1.3.2 2.3.2 - - 4.0.6 + 4.4.0 1.3 4.13.2 9.37.2 @@ -2907,29 +2905,29 @@ ${sakai.jdk.version} true - --add-opens=java.base/java.io=ALL-UNNAMED - --add-opens=java.base/java.lang.invoke=ALL-UNNAMED - --add-opens=java.base/java.lang.reflect=ALL-UNNAMED - --add-opens=java.base/java.lang=ALL-UNNAMED - --add-opens=java.base/java.math=ALL-UNNAMED - --add-opens=java.base/java.net=ALL-UNNAMED - --add-opens=java.base/java.nio=ALL-UNNAMED - --add-opens=java.base/java.text=ALL-UNNAMED - --add-opens=java.base/java.time=ALL-UNNAMED - --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED - --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED - --add-opens=java.base/java.util.concurrent=ALL-UNNAMED - --add-opens=java.base/java.util=ALL-UNNAMED - --add-opens=java.base/jdk.internal.access=ALL-UNNAMED - --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED - --add-opens=java.base/sun.nio.ch=ALL-UNNAMED - --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED - --add-opens=java.base/sun.util.calendar=ALL-UNNAMED - --add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED - --add-opens=java.management/sun.management=ALL-UNNAMED - --add-opens=java.sql/java.sql=ALL-UNNAMED - --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED - --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED + --add-exports=java.base/java.io=ALL-UNNAMED + --add-exports=java.base/java.lang.invoke=ALL-UNNAMED + --add-exports=java.base/java.lang.reflect=ALL-UNNAMED + --add-exports=java.base/java.lang=ALL-UNNAMED + --add-exports=java.base/java.math=ALL-UNNAMED + --add-exports=java.base/java.net=ALL-UNNAMED + --add-exports=java.base/java.nio=ALL-UNNAMED + --add-exports=java.base/java.text=ALL-UNNAMED + --add-exports=java.base/java.time=ALL-UNNAMED + --add-exports=java.base/java.util.concurrent.atomic=ALL-UNNAMED + --add-exports=java.base/java.util.concurrent.locks=ALL-UNNAMED + --add-exports=java.base/java.util.concurrent=ALL-UNNAMED + --add-exports=java.base/java.util=ALL-UNNAMED + --add-exports=java.base/jdk.internal.access=ALL-UNNAMED + --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED + --add-exports=java.base/sun.nio.ch=ALL-UNNAMED + --add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED + --add-exports=java.base/sun.util.calendar=ALL-UNNAMED + --add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED + --add-exports=java.management/sun.management=ALL-UNNAMED + --add-exports=java.sql/java.sql=ALL-UNNAMED + --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED + --add-exports=jdk.management/com.sun.management.internal=ALL-UNNAMED
diff --git a/portal/portal-render-engine-impl/impl/src/webapp/vm/morpheus/includeBodyScripts.vm b/portal/portal-render-engine-impl/impl/src/webapp/vm/morpheus/includeBodyScripts.vm index 5927762699df..9295103510cb 100644 --- a/portal/portal-render-engine-impl/impl/src/webapp/vm/morpheus/includeBodyScripts.vm +++ b/portal/portal-render-engine-impl/impl/src/webapp/vm/morpheus/includeBodyScripts.vm @@ -186,7 +186,7 @@