芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/cloud.pulsehost.co.uk/static/js/app.js
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "EFhx": /*!******************************************!*\ !*** ./modules/CoreWebclient/js/Ajax.js ***! \******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), moment = __webpack_require__(/*! moment */ "sdEb"), ko = __webpack_require__(/*! knockout */ "p09A"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), Utils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Common.js */ "REt5"), Logger = __webpack_require__(/*! modules/CoreWebclient/js/utils/Logger.js */ "4ARn"), Popups = __webpack_require__(/*! modules/CoreWebclient/js/Popups.js */ "oUN1"), AlertPopup = __webpack_require__(/*! modules/CoreWebclient/js/popups/AlertPopup.js */ "hT1I"), App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), Pulse = __webpack_require__(/*! modules/CoreWebclient/js/Pulse.js */ "fDmo"), Settings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT"), aFilterDebugInfo = [] function _getRequestDataString(oReqData) { return ( 'start time:' + oReqData.Time.format('DD.MM, HH:mm:ss') + '
' + JSON.stringify(oReqData.Request).substr(0, 300) + '
' + 'readyState:' + oReqData.Xhr.readyState + (Types.isString(oReqData.Xhr.statusText) ? ':' + oReqData.Xhr.statusText : '') + '
' + (Types.isString(oReqData.Xhr.responseText) ? ':' + oReqData.Xhr.responseText.substr(0, 300) + '
' : '') ) } /** * @constructor */ function CAjax() { this.requests = ko.observableArray([]) this.aOnAllRequestsClosedHandlers = [] this.requests.subscribe(function () { if (this.requests().length === 0) { _.each(this.aOnAllRequestsClosedHandlers, function (fHandler) { if (_.isFunction(fHandler)) { fHandler() } }) } }, this) this.aAbortRequestHandlers = {} this.bAllowRequests = true this.bInternetConnectionProblem = false if (Settings.AllowClientDebug) { App.subscribeEvent( 'CoreWebclient::GetDebugInfo', _.bind(function (oParams) { var aInfo = [] if (this.requests().length) { aInfo.push('
Current requests:
') _.each(this.requests(), function (oReqData) { aInfo.push(_getRequestDataString(oReqData)) }) } if (aFilterDebugInfo.length > 0) { aInfo.push('') aInfo.push('
aFilterDebugInfo:
') aInfo = aInfo.concat(aFilterDebugInfo) } oParams.Info.push(aInfo.join('
')) }, this) ) } } /** * @param {string} sModule * @param {string} sMethod * @returns {object} */ CAjax.prototype.getOpenedRequest = function (sModule, sMethod) { var oFoundReqData = _.find(this.requests(), function (oReqData) { return oReqData.Request.Module === sModule && oReqData.Request.Method === sMethod }) return oFoundReqData ? oFoundReqData.Request : null } /** * @param {string=} sModule = '' * @param {string=} sMethod = '' * @returns {boolean} */ CAjax.prototype.hasOpenedRequests = function (sModule, sMethod) { // Do not change requests here. It calls hasOpenedRequests and we get a loop. sModule = Types.pString(sModule) sMethod = Types.pString(sMethod) if (sMethod === '') { return this.requests().length > 0 } else { return !!_.find(this.requests(), function (oReqData) { return oReqData && oReqData.Request.Module === sModule && oReqData.Request.Method === sMethod }) } } /** * @param {string} sModule * @param {function} fHandler */ CAjax.prototype.registerAbortRequestHandler = function (sModule, fHandler) { this.aAbortRequestHandlers[sModule] = fHandler } /** * @param {function} fHandler */ CAjax.prototype.registerOnAllRequestsClosedHandler = function (fHandler) { this.aOnAllRequestsClosedHandlers.push(fHandler) } /** * @param {string} sModule * @param {string} sMethod * @param {object} oParameters * @param {function=} fResponseHandler * @param {object=} oContext * @param {object=} oMainParams * @param {string=} authToken */ CAjax.prototype.send = function (sModule, sMethod, oParameters, fResponseHandler, oContext, oMainParams, authToken) { oParameters = oParameters || {} var oRequest = _.extendOwn( { Module: sModule, Method: sMethod, Parameters: oParameters, }, App.getCommonRequestParameters() ) if (oMainParams) { oRequest = _.extendOwn(oRequest, oMainParams) } if (this.bAllowRequests && !this.bInternetConnectionProblem) { var oEventParams = { Module: sModule, Method: sMethod, Parameters: oParameters, // can be changed by reference ResponseHandler: fResponseHandler, Context: oContext, Continue: true, } App.broadcastEvent('SendAjaxRequest::before', oEventParams) if (oEventParams.Continue) { this.abortSameRequests(oRequest) this.doSend(oRequest, fResponseHandler, oContext, authToken) } } else { var oResponse = { Result: false, ErrorCode: Enums.Errors.NotDisplayedError } this.executeResponseHandler(fResponseHandler, oContext, oResponse, oRequest, 'error') } } /*************************private*************************************/ /** * @param {Object} oRequest * @param {Function=} fResponseHandler * @param {Object=} oContext * @param {string=} authToken */ CAjax.prototype.doSend = function (oRequest, fResponseHandler, oContext, authToken = '') { var doneFunc = _.bind(this.done, this, oRequest, fResponseHandler, oContext), failFunc = _.bind(this.fail, this, oRequest, fResponseHandler, oContext), alwaysFunc = _.bind(this.always, this, oRequest), oXhr = null, oCloneRequest = _.clone(oRequest), sAuthToken = $.cookie('AuthToken') || authToken, oHeader = { 'X-Client': 'WebClient' } if (sAuthToken === '' && App.getUserRole() !== Enums.UserRole.Anonymous) { App.logoutAndGotoLogin() } if (sAuthToken !== '') { oHeader['Authorization'] = 'Bearer ' + sAuthToken } oHeader['X-DeviceId'] = App.getCurrentDeviceId() oCloneRequest.Parameters = JSON.stringify(oCloneRequest.Parameters) let sHost = '?/Api/' try { if (process.env.NODE_ENV === 'development') { sHost = process.env.VUE_APP_API_HOST + sHost } } catch (e) {} oXhr = $.ajax({ url: sHost, type: 'POST', async: true, dataType: 'json', headers: oHeader, data: oCloneRequest, success: doneFunc, error: failFunc, complete: alwaysFunc, }) this.requests().push({ Request: oRequest, Xhr: oXhr, Time: moment() }) } /** * @param {Object} oRequest */ CAjax.prototype.abortSameRequests = function (oRequest) { var fHandler = this.aAbortRequestHandlers[oRequest.Module] if (_.isFunction(fHandler) && this.requests().length > 0) { _.each( this.requests(), _.bind(function (oReqData) { if (oReqData) { var oOpenedRequest = oReqData.Request if (oRequest.Module === oOpenedRequest.Module) { if (fHandler(oRequest, oOpenedRequest)) { oReqData.Xhr.abort() } } } }, this) ) } } /** * @param {object} oExcept */ CAjax.prototype.abortAllRequests = function (oExcept) { if (typeof oExcept !== 'object') { oExcept = { Module: '', Method: '', } } _.each( this.requests(), function (oReqData) { if (oReqData && (oReqData.Request.Module !== oExcept.Module || oReqData.Request.Method !== oExcept.Method)) { oReqData.Xhr.abort() } }, this ) } /** * @param {object} oExcept */ CAjax.prototype.abortAndStopSendRequests = function (oExcept) { this.bAllowRequests = false this.abortAllRequests(oExcept) } CAjax.prototype.startSendRequests = function () { this.bAllowRequests = true } /** * @param {Object} oRequest * @param {Function} fResponseHandler * @param {Object} oContext * @param {{Result:boolean}} oResponse * @param {string} sType * @param {Object} oXhr */ CAjax.prototype.done = function (oRequest, fResponseHandler, oContext, oResponse, sType, oXhr) { if ( App.getUserRole() !== Enums.UserRole.Anonymous && oResponse && Types.isNumber(oResponse.AuthenticatedUserId) && oResponse.AuthenticatedUserId !== 0 && oResponse.AuthenticatedUserId !== App.getUserId() ) { Popups.showPopup(AlertPopup, [ TextUtils.i18n('COREWEBCLIENT/ERROR_AUTHENTICATED_USER_CONFLICT'), function () { App.logoutAndGotoLogin() }, '', TextUtils.i18n('COREWEBCLIENT/ACTION_LOGOUT'), ]) } // if oResponse.Result === 0 or oResponse.Result === '' this is not an error if (oResponse && (oResponse.Result === false || oResponse.Result === null || oResponse.Result === undefined)) { switch (oResponse.ErrorCode) { case Enums.Errors.InvalidToken: this.abortAndStopSendRequests() App.tokenProblem() break case Enums.Errors.AuthError: if ( App.getUserRole() !== Enums.UserRole.Anonymous && !(oRequest.Module === 'Core' && oRequest.Method === 'Logout') ) { App.logoutAndGotoLogin() } break } oResponse.Result = false } this.executeResponseHandler(fResponseHandler, oContext, oResponse, oRequest, sType, oXhr.status) } /** * @param {Object} oRequest * @param {Function} fResponseHandler * @param {Object} oContext * @param {Object} oXhr * @param {string} sType * @param {string} sErrorText */ CAjax.prototype.fail = function (oRequest, fResponseHandler, oContext, oXhr, sType, sErrorText) { var oResponse = { Result: false, ErrorCode: 0 } switch (sType) { case 'abort': oResponse = { Result: false, ErrorCode: Enums.Errors.NotDisplayedError } break default: case 'error': case 'parseerror': if (sErrorText === '') { oResponse = { Result: false, ErrorCode: Enums.Errors.NotDisplayedError, ResponseText: oXhr.responseText } } else { var oReqData = _.find(this.requests(), function (oTmpReqData, iIndex) { return oTmpReqData && _.isEqual(oTmpReqData.Request, oRequest) }) if (oReqData) { Logger.log('DataTransferFailed', _getRequestDataString(oReqData)) } else { var sResponseText = Types.pString(oXhr && oXhr.responseText) Logger.log('DataTransferFailed', sErrorText, '
' + sResponseText.substr(0, 300)) } oResponse = { Result: false, ErrorCode: Enums.Errors.DataTransferFailed, ResponseText: oXhr.responseText } } break } this.executeResponseHandler(fResponseHandler, oContext, oResponse, oRequest, sType, oXhr.status) } /** * @param {Function} fResponseHandler * @param {Object} oContext * @param {Object} oResponse * @param {Object} oRequest * @param {string} sType * @param {int} status */ CAjax.prototype.executeResponseHandler = function ( fResponseHandler, oContext, oResponse, oRequest, sType, status = 200 ) { if (!oResponse) { oResponse = { Result: false, ErrorCode: 0 } } App.broadcastEvent('ReceiveAjaxResponse::before', { Request: oRequest, Response: oResponse }) // Check the Internet connection before passing control to the modules. // It forbids or allows further AJAX requests. this.checkConnection(oRequest.Module, oRequest.Method, sType) if (_.isFunction(fResponseHandler) && !oResponse.StopExecuteResponse) { fResponseHandler.apply(oContext, [oResponse, oRequest, status]) } App.broadcastEvent('ReceiveAjaxResponse::after', { Request: oRequest, Response: oResponse }) } /** * @param {object} oXhr * @param {string} sType * @param {object} oRequest */ CAjax.prototype.always = function (oRequest, oXhr, sType) { this.filterRequests(oRequest) } CAjax.prototype.filterRequests = function (oRequest, sCallerName) { this.requests( _.filter( this.requests(), function (oReqData, iIndex) { if (oReqData) { if (_.isEqual(oReqData.Request, oRequest)) { return false } var bComplete = oReqData.Xhr.readyState === 4, bFail = oReqData.Xhr.readyState === 0 && (oReqData.Xhr.statusText === 'abort' || oReqData.Xhr.statusText === 'error'), bTooLong = moment().diff(oReqData.Time) > 1000 * 60 * 5 // 5 minutes if (Settings.AllowClientDebug && (bComplete || bFail || bTooLong)) { if (bTooLong) { Logger.log(sCallerName, 'remove more than 5 minutes request', _getRequestDataString(oReqData)) } else if (bFail) { Logger.log(sCallerName, 'remove fail request', _getRequestDataString(oReqData)) } else if (bComplete) { Logger.log(sCallerName, 'remove complete request', _getRequestDataString(oReqData)) } } return !bComplete && !bFail && !bTooLong } }, this ) ) } CAjax.prototype.checkConnection = (function () { var iTimer = -1 return function (sModule, sMethod, sStatus) { clearTimeout(iTimer) if (sStatus !== 'error') { Ajax.bInternetConnectionProblem = false Screens.hideError(true) } else if (this.bAllowRequests) { if (sModule === 'Core' && sMethod === 'Ping') { Ajax.bInternetConnectionProblem = true Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_NO_INTERNET_CONNECTION'), true, true) iTimer = setTimeout(function () { Ajax.doSend({ Module: 'Core', Method: 'Ping' }) }, 10000) } else { Ajax.doSend({ Module: 'Core', Method: 'Ping' }) } } } })() var Ajax = new CAjax() module.exports = { getOpenedRequest: _.bind(Ajax.getOpenedRequest, Ajax), hasInternetConnectionProblem: function () { return Ajax.bInternetConnectionProblem }, hasOpenedRequests: _.bind(Ajax.hasOpenedRequests, Ajax), registerAbortRequestHandler: _.bind(Ajax.registerAbortRequestHandler, Ajax), registerOnAllRequestsClosedHandler: _.bind(Ajax.registerOnAllRequestsClosedHandler, Ajax), abortAndStopSendRequests: _.bind(Ajax.abortAndStopSendRequests, Ajax), startSendRequests: _.bind(Ajax.startSendRequests, Ajax), send: _.bind(Ajax.send, Ajax), } Pulse.registerEveryMinuteFunction(function () { Ajax.filterRequests(null, 'pulse') }) Pulse.registerWakeupFunction(function () { Logger.log( '
wakeup
, hasOpenedRequests: ' + Ajax.hasOpenedRequests() + ', bInternetConnectionProblem: ' + Ajax.bInternetConnectionProblem ) if (Ajax.hasOpenedRequests()) { _.each(Ajax.requests(), function (oReqData) { Logger.log('
wakeup
: ' + _getRequestDataString(oReqData)) }) Ajax.filterRequests(null, 'wakeup') } if (Ajax.bInternetConnectionProblem) { Ajax.checkConnection() } }) /***/ }), /***/ "/QeJ": /*!*****************************************!*\ !*** ./modules/CoreWebclient/js/Api.js ***! \*****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), ModuleErrors = __webpack_require__(/*! modules/CoreWebclient/js/ModuleErrors.js */ "LTsQ"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT"), Api = {} ; /** * @param {Object} response * @param {string=} defaultErrorText = '' */ Api.getErrorByCode = function (response, defaultErrorText = '') { var errorCode = response.ErrorCode, responseErrorMessage = TextUtils.encodeHtml(response.ErrorMessage || ''), errorText = ModuleErrors.getErrorMessage(response) || '' ; if (errorText === '') { switch (errorCode) { default: errorText = defaultErrorText || TextUtils.i18n('COREWEBCLIENT/ERROR_UNKNOWN'); break; case Enums.Errors.AuthError: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_PASS_INCORRECT'); break; case Enums.Errors.DataBaseError: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_DATABASE'); break; case Enums.Errors.LicenseProblem: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_INVALID_LICENSE'); break; case Enums.Errors.LicenseLimit: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_LICENSE_USERS_LIMIT'); break; case Enums.Errors.DemoLimitations: errorText = TextUtils.i18n('COREWEBCLIENT/INFO_DEMO_THIS_FEATURE_IS_DISABLED'); break; case Enums.Errors.Captcha: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_CAPTCHA_IS_INCORRECT'); break; case Enums.Errors.AccessDenied: if (response.AuthenticatedUserId === 0 && App.getUserId() !== 0) { errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_USER_DELETED'); } else { errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_ACCESS_DENIED'); } break; case Enums.Errors.UserAlreadyExists: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_USER_ALREADY_EXISTS'); break; case Enums.Errors.CanNotChangePassword: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_UNABLE_CHANGE_PASSWORD'); break; case Enums.Errors.AccountOldPasswordNotCorrect: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_CURRENT_PASSWORD_NOT_CORRECT'); break; case Enums.Errors.AccountAlreadyExists: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_ACCOUNT_ALREADY_EXISTS'); break; case Enums.Errors.HelpdeskUserNotExists: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_FORGOT_NO_HELPDESK_ACCOUNT'); break; case Enums.Errors.DataTransferFailed: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_DATA_TRANSFER_FAILED'); break; case Enums.Errors.NotDisplayedError: errorText = ''; break; case Enums.Errors.SystemNotConfigured: errorText = TextUtils.i18n('COREWEBCLIENT/ERROR_SYSTEM_NOT_CONFIGURED'); break; } } if (errorText !== '') { if (responseErrorMessage !== '') { errorText += ' (' + responseErrorMessage + ')'; } } else if (responseErrorMessage !== '') { errorText = responseErrorMessage; } return errorText; }; /** * @param {Object} response * @param {string=} defaultErrorText * @param {boolean=} disableAutohide = false */ Api.showErrorByCode = function (response, defaultErrorText = '', disableAutohide = false) { var errorText = this.getErrorByCode(response, defaultErrorText); if (errorText !== '') { Screens.showError(errorText, disableAutohide); } }; module.exports = Api; /***/ }), /***/ "9kOp": /*!*****************************************!*\ !*** ./modules/CoreWebclient/js/App.js ***! \*****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // UserSettings use koExtendings __webpack_require__(/*! modules/CoreWebclient/js/koExtendings.js */ "0zH2") var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), modernizr = __webpack_require__(/*! modules/CoreWebclient/js/vendors/modernizr.js */ "4CsI"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), UrlUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Url.js */ "Tt1R"), Utils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Common.js */ "REt5"), Browser = __webpack_require__(/*! modules/CoreWebclient/js/Browser.js */ "dfnr"), ModulesManager = __webpack_require__(/*! modules/CoreWebclient/js/ModulesManager.js */ "TdEd"), Routing = __webpack_require__(/*! modules/CoreWebclient/js/Routing.js */ "W66n"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), WindowOpener = __webpack_require__(/*! modules/CoreWebclient/js/WindowOpener.js */ "mGms"), Popups = __webpack_require__(/*! modules/CoreWebclient/js/Popups.js */ "oUN1"), ConfirmPopup = __webpack_require__(/*! modules/CoreWebclient/js/popups/ConfirmPopup.js */ "XeMN") __webpack_require__(/*! modules/CoreWebclient/js/enums.js */ "p/cB") __webpack_require__(/*! modules/CoreWebclient/js/koBindings.js */ "/FUc") __webpack_require__(/*! modules/CoreWebclient/js/koOtherBindings.js */ "QaQG") __webpack_require__(/*! modules/CoreWebclient/js/vendors/inputosaurus.js */ "Y3Zv") function InitNotMobileRequires() { __webpack_require__(/*! modules/CoreWebclient/js/CustomTooltip.js */ "rhHV") __webpack_require__(/*! modules/CoreWebclient/js/koBindingsNotMobile.js */ "2kH5") } /** * Modernizr build: * Method - addTest * CSS classes - cssanimations, csstransitions */ function InitModernizr() { if (modernizr && navigator) { modernizr.addTest('pdf', function () { return ( !!_.find(navigator.mimeTypes, function (oMimeType) { return 'application/pdf' === oMimeType.type }) || Browser.firefox ) // FireFox have stopped supporting of 'application/pdf' mime type in navigator since 2016 }) modernizr.addTest('newtab', function () { return App.isNewTab() }) modernizr.addTest('mobile', function () { return App.isMobile() }) if (navigator) { modernizr.addTest('native-android-browser', function () { var ua = navigator.userAgent return ( ua.indexOf('Mozilla/5.0') > -1 && ua.indexOf('Android ') > -1 && ua.indexOf('534') > -1 && ua.indexOf('AppleWebKit') > -1 ) }) } } } function CApp() { this.iUserRole = window.auroraAppData.User ? Types.pInt(window.auroraAppData.User.Role) : Enums.UserRole.Anonymous this.iTenantId = window.auroraAppData.User ? Types.pInt(window.auroraAppData.User.TenantId) : 0 this.sUserName = window.auroraAppData.User ? Types.pString(window.auroraAppData.User.Name) : '' this.sUserPublicId = window.auroraAppData.User ? Types.pString(window.auroraAppData.User.PublicId) : '' this.iUserId = window.auroraAppData.User ? Types.pInt(window.auroraAppData.User.Id) : 0 this.bPublic = false this.bNewTab = false this.userAuthAccountsCountsArray = ko.observableArray([]) this.userAccountsCount = ko.computed(function () { var iCount = _.reduce( this.userAuthAccountsCountsArray(), function (iSum, koUserAccountsCount) { return iSum + koUserAccountsCount() }, 0 ) return iCount }, this) this.userAccountsWithPass = ko.observableArray([]) this.firstAccountWithPassLogin = ko.computed(function () { var sLogin = '' _.each(this.userAccountsWithPass(), function (koAccountsWithPass) { var aAccountsLogins = koAccountsWithPass() if (!Types.isNonEmptyString(sLogin) && aAccountsLogins.length > 0 && Types.isNonEmptyString(aAccountsLogins[0])) { sLogin = aAccountsLogins[0] } }) return sLogin }, this) this.mobileCredentialsHintText = ko.computed(function () { var sLogin = this.firstAccountWithPassLogin() || this.getUserPublicId() return TextUtils.i18n('COREWEBCLIENT/INFO_MOBILE_CREDENTIALS', { LOGIN: sLogin }) }, this) } CApp.prototype.registerUserAccountsCount = function (koUserAccountsCount) { this.userAuthAccountsCountsArray.push(koUserAccountsCount) } CApp.prototype.registerAccountsWithPass = function (koAccountsWithPass) { this.userAccountsWithPass.push(koAccountsWithPass) } CApp.prototype.isAccountDeletingAvailable = function () { if (this.userAccountsCount() <= 1) { Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_ACCOUNT_DELETING_DISABLE'), true) return false } return true } CApp.prototype.getUserRole = function () { return this.iUserRole } CApp.prototype.isUserNormalOrTenant = function () { return this.iUserRole === Enums.UserRole.NormalUser || this.iUserRole === Enums.UserRole.TenantAdmin } CApp.prototype.getTenantId = function () { return this.iTenantId } CApp.prototype.getUserName = function () { return this.sUserName } CApp.prototype.getUserPublicId = function () { return this.sUserPublicId } CApp.prototype.getUserId = function () { return this.iUserId } CApp.prototype.setPublic = function () { this.bPublic = true } CApp.prototype.isPublic = function () { return this.bPublic } CApp.prototype.setNewTab = function () { this.bNewTab = true } CApp.prototype.isNewTab = function () { return this.bNewTab } CApp.prototype.isMobile = function () { return UserSettings.IsMobile === 1 } function saveDeviceId(deviceId) { $.cookie('DeviceId', deviceId, { expires: 365 }) } function refreshOrGenerateAndSaveDeviceId() { const deviceId = $.cookie('DeviceId') || Utils.generateUUID() saveDeviceId(deviceId) } CApp.prototype.getCurrentDeviceId = function () { let deviceId = $.cookie('DeviceId') if (!deviceId) { deviceId = Utils.generateUUID() saveDeviceId(deviceId) } return deviceId } CApp.prototype.init = function () { ModulesManager.run('StandardLoginFormWebclient', 'beforeAppRunning', [this.iUserRole !== Enums.UserRole.Anonymous]) if (App.isUserNormalOrTenant() && UserSettings.AllowChangeSettings) { ModulesManager.run('SettingsWebclient', 'registerSettingsTab', [ function () { return __webpack_require__(/*! modules/CoreWebclient/js/views/CommonSettingsFormView.js */ "p1Rv") }, 'common', TextUtils.i18n('COREWEBCLIENT/LABEL_COMMON_SETTINGS_TABNAME'), ]) } ModulesManager.run('Ios', 'routeToIos') let AccountList if (this.iUserRole !== Enums.UserRole.Anonymous) { var MainTab = App.isNewTab() && window.opener && window.opener.MainTabMailMethods AccountList = MainTab ? MainTab.getAccountList() : ModulesManager.run('MailWebclient', 'getAccountList') if (AccountList) { this.currentAccountId = AccountList.currentId this.hasAccountWithId = _.bind(AccountList.hasAccountWithId, AccountList) this.currentAccountEmail = ko.computed(function () { var oAccount = AccountList.getAccount(this.currentAccountId()) return oAccount ? oAccount.email() : '' }, this) this.getAttendee = function (aAttendees) { return AccountList.getAttendee( _.map( aAttendees, function (mAttendee) { return Types.isString(mAttendee) ? mAttendee : mAttendee.email }, this ) ) } } else { this.currentAccountEmail = _.bind(function () { return this.sUserName }, this) } } if (!this.isMobile()) { InitNotMobileRequires() } Screens.init(this.iUserRole === Enums.UserRole.Anonymous) __webpack_require__(/*! modules/CoreWebclient/js/AppTab.js */ "enoK") if (!this.bNewTab) { __webpack_require__(/*! modules/CoreWebclient/js/Prefetcher.js */ "YO0m") } this.useGoogleAnalytics() if (!this.isMobile()) { $(window).on('unload', function () { WindowOpener.closeAll() }) } window.onbeforeunload = _.bind(function () { if (Screens.hasUnsavedChanges() || Popups.hasUnsavedChanges()) { return '' } WindowOpener.getOpenedWindows() // prepare open windows by removing those that already have a different origin }, this) if (Browser.ie8AndBelow) { $('body').css('overflow', 'hidden') } ModulesManager.start() Screens.start() this.checkCookies() this.showLastErrorOnLogin() if (UserSettings.IsSystemConfigured === false) { Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_SYSTEM_NOT_CONFIGURED'), true) } Routing.init() const Storage = __webpack_require__(/*! modules/CoreWebclient/js/Storage.js */ "HCAJ") Storage.convertStorageData(this.iUserId, AccountList) } CApp.prototype.showLastErrorOnLogin = function () { if (this.iUserRole === Enums.UserRole.Anonymous) { var iError = Types.pInt(UrlUtils.getRequestParam('error')), sErrorModule = Types.pString(UrlUtils.getRequestParam('module')) if (iError !== 0) { var Api = __webpack_require__(/*! modules/CoreWebclient/js/Api.js */ "/QeJ") Api.showErrorByCode({ ErrorCode: iError, Module: sErrorModule }, '', true) } if (UserSettings.LastErrorCode === Enums.Errors.AuthError) { Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_AUTH_PROBLEM'), true) } } } /** * Makes user logout if there are no changes in current screen or popup or user chose to discard them. */ CApp.prototype.logout = function () { const continueLogout = () => { const eventParams = { logoutPromises: [], } App.broadcastEvent('Logout', eventParams) if (Array.isArray(eventParams.logoutPromises)) { Promise.all(eventParams.logoutPromises).then( () => { this.logoutAndGotoLogin() }, () => { // logout was rejected by some module } ) } else { this.logoutAndGotoLogin() } } if (Screens.hasUnsavedChanges() || Popups.hasUnsavedChanges()) { this.askDiscardChanges(continueLogout, null, Screens.getCurrentScreen()) } else { continueLogout() } } /** * Makes user logout and relocate to login screen after that. */ CApp.prototype.logoutAndGotoLogin = function () { function gotoLoginPage() { if (Types.isNonEmptyString(UserSettings.CustomLogoutUrl)) { window.location.href = UserSettings.CustomLogoutUrl } else { UrlUtils.clearAndReloadLocation(Browser.ie8AndBelow, true) } } if ($.cookie('AuthToken')) { var Ajax = __webpack_require__(/*! modules/CoreWebclient/js/Ajax.js */ "EFhx") Ajax.send( 'Core', 'Logout', {}, function () { $.removeCookie('AuthToken') Routing.finalize() this.iUserRole = Enums.UserRole.Anonymous this.sUserName = '' this.sUserPublicId = '' this.iUserId = 0 gotoLoginPage() }, this ) var oExcept = { Module: 'Core', Method: 'Logout', } Ajax.abortAndStopSendRequests(oExcept) } else { gotoLoginPage() } } /** * Asks user if he prefer discard changes or stay on current screen/popup. * @param {function} fOnDiscard Function to execute if user prefer to discard changes. * @param {function} fOnNotDiscard Function to execute if user prefer to stay on current screen/popup. * @param {object} oCurrentScreen Current screen object. */ CApp.prototype.askDiscardChanges = function (fOnDiscard, fOnNotDiscard, oCurrentScreen) { var sConfirm = TextUtils.i18n('COREWEBCLIENT/CONFIRM_DISCARD_CHANGES'), fOnConfirm = _.bind(function (bOk) { if (bOk && _.isFunction(fOnDiscard)) { if (oCurrentScreen && _.isFunction(oCurrentScreen.discardChanges)) { oCurrentScreen.discardChanges() } fOnDiscard() } else if (_.isFunction(fOnNotDiscard)) { fOnNotDiscard() } }, this) Popups.showPopup(ConfirmPopup, [sConfirm, fOnConfirm]) } CApp.prototype.tokenProblem = function () { var sReloadFunc = 'window.location.reload(); return false;', sHtmlError = TextUtils.i18n('COREWEBCLIENT/ERROR_TOKEN_PROBLEM_HTML', { RELOAD_FUNC: sReloadFunc }) Screens.showError(sHtmlError, true) } CApp.prototype.checkMobile = function () { /** * UserSettings.IsMobile: * -1 - first time, mobile is not determined * 0 - mobile is switched off * 1 - mobile is switched on */ if (UserSettings.AllowMobile && UserSettings.IsMobile === -1) { var Ajax = __webpack_require__(/*! modules/CoreWebclient/js/Ajax.js */ "EFhx"), bMobile = !window.matchMedia('all and (min-width: 768px)').matches Ajax.send( 'Core', 'SetMobile', { Mobile: bMobile }, function (oResponse) { if (bMobile && oResponse.Result) { window.location.reload() } }, this ) return bMobile } return false } CApp.prototype.useGoogleAnalytics = function () { var oGoogleAnalytics = null, oFirstScript = null if (UserSettings.GoogleAnalyticsAccount && 0 < UserSettings.GoogleAnalyticsAccount.length) { window._gaq = window._gaq || [] window._gaq.push(['_setAccount', UserSettings.GoogleAnalyticsAccount]) window._gaq.push(['_trackPageview']) oGoogleAnalytics = document.createElement('script') oGoogleAnalytics.type = 'text/javascript' oGoogleAnalytics.async = true oGoogleAnalytics.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js' oFirstScript = document.getElementsByTagName('script')[0] oFirstScript.parentNode.insertBefore(oGoogleAnalytics, oFirstScript) } } /** * @returns {Boolean} */ CApp.prototype.checkCookies = function () { $.cookie('checkCookie', '1') var bCookieWorks = $.cookie('checkCookie') === '1' $.removeCookie('checkCookie') if (!bCookieWorks) { Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_COOKIES_DISABLED'), true) } else { if (this.iUserRole === Enums.UserRole.Anonymous) { $.removeCookie('AuthToken') } else { var sAuthToken = $.cookie('AuthToken') if (sAuthToken) { this.setAuthToken(sAuthToken) } } refreshOrGenerateAndSaveDeviceId() } return bCookieWorks } /** * @param {string} sAuthToken */ CApp.prototype.setAuthToken = function (sAuthToken) { var oParams = {} if (UserSettings.AuthTokenCookieExpireTime > 0) { oParams['expires'] = UserSettings.AuthTokenCookieExpireTime } $.cookie('AuthToken', sAuthToken, oParams) } CApp.prototype.getCommonRequestParameters = function () { var oParameters = { TenantName: UserSettings.TenantName, } return oParameters } CApp.prototype.broadcastEvent = function (sEventName, oArguments) { if (_.isArray(this.aEventsCallbacks) && _.isArray(this.aEventsCallbacks[sEventName])) { _.each(this.aEventsCallbacks[sEventName], function (fCallback) { fCallback(oArguments) }) return true } return false } CApp.prototype.subscribeEvent = function (sEventName, fCallback) { if (!_.isArray(this.aEventsCallbacks)) { this.aEventsCallbacks = [] } if (!_.isArray(this.aEventsCallbacks[sEventName])) { this.aEventsCallbacks[sEventName] = [] } this.aEventsCallbacks[sEventName].push(fCallback) } var App = new CApp() InitModernizr() module.exports = App /***/ }), /***/ "enoK": /*!********************************************!*\ !*** ./modules/CoreWebclient/js/AppTab.js ***! \********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), Browser = __webpack_require__(/*! modules/CoreWebclient/js/Browser.js */ "dfnr"), CFavico = __webpack_require__(/*! modules/CoreWebclient/js/vendors/favico.js */ "EK41"), ModulesManager = __webpack_require__(/*! modules/CoreWebclient/js/ModulesManager.js */ "TdEd"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV") ; function CAppTab() { this.tabs = ModulesManager.getModulesTabs(true); this.focused = ko.observable(true); ko.computed(function () { var sTitle = ''; if (!App.isNewTab() && !this.focused()) { sTitle = this.getInactiveTitle(); } if (sTitle === '') { sTitle = Screens.browserTitle(); } this.setTitle(sTitle); }, this); this.favico = (!Browser.ie8AndBelow && CFavico) ? new CFavico({ 'animation': 'none' }) : null; } CAppTab.prototype.init = function () { if (Browser.ie) { $(document) .bind('focusin', _.bind(this.focused, this, true)) .bind('focusout', _.bind(this.focused, this, false)) ; } else { $(window) .bind('focus', _.bind(this.focused, this, true)) .bind('blur', _.bind(this.focused, this, false)) ; } if (this.favico) { ko.computed(function () { var iCount = 0; _.each(this.tabs, function (oTab) { if (oTab.allowChangeTitle()) { iCount += oTab.unseenCount(); } }); var sBadge = iCount.toString(); if (iCount < 1) { sBadge = ''; } if (iCount > 99) { sBadge = '99+'; } this.favico.badge(sBadge); }, this); } }; /** * @param {string} sTitle */ CAppTab.prototype.setTitle = function (sTitle) { if (sTitle === '') { sTitle = UserSettings.SiteName; } else { sTitle += (UserSettings.SiteName !== '') ? ' - ' + UserSettings.SiteName : ''; } document.title = '.'; document.title = sTitle; }; CAppTab.prototype.getInactiveTitle = function () { var sTitle = '', iCount = 0 ; _.each(this.tabs, function (oTab) { if (oTab.allowChangeTitle()) { iCount += oTab.unseenCount(); if (oTab.unseenCount() > 0 && iCount === oTab.unseenCount()) { sTitle = oTab.inactiveTitle(); } else { sTitle = ''; } } }); if (iCount > 0 && sTitle === '') { sTitle = iCount + ' new'; } return sTitle; }; var AppTab = new CAppTab(); AppTab.init(); module.exports = { focused: AppTab.focused }; /***/ }), /***/ "dfnr": /*!*********************************************!*\ !*** ./modules/CoreWebclient/js/Browser.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"); /** * @constructor */ function CBrowser() { this.ie11 = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./); this.ie = (/msie/.test(navigator.userAgent.toLowerCase()) && !window.opera) || this.ie11; this.ieVersion = this.getIeVersion(); this.ie8AndBelow = this.ie && this.ieVersion <= 8; this.ie9AndBelow = this.ie && this.ieVersion <= 9; this.ie10AndAbove = this.ie && this.ieVersion >= 10; this.opera = !!window.opera || /opr/.test(navigator.userAgent.toLowerCase()); this.firefox = /firefox/.test(navigator.userAgent.toLowerCase()); this.edge = /edge/.test(navigator.userAgent.toLowerCase()); this.chrome = /chrome/.test(navigator.userAgent.toLowerCase()) && !/opr/.test(navigator.userAgent.toLowerCase()) && !this.edge; this.chromeIos = /crios/.test(navigator.userAgent.toLowerCase()); this.safari = /safari/.test(navigator.userAgent.toLowerCase()) && !this.chromeIos && !this.edge; this.windowsPhone = -1 < navigator.userAgent.indexOf('Windows Phone'); this.iosDevice = !this.windowsPhone && ( -1 < navigator.userAgent.indexOf('iPhone') || -1 < navigator.userAgent.indexOf('iPod') || -1 < navigator.userAgent.indexOf('iPad') // works in Chrome on iPad || ( -1 < navigator.userAgent.indexOf('Macintosh') && navigator.maxTouchPoints && navigator.maxTouchPoints > 1) // works in Safary on iPad ); this.androidDevice = !this.windowsPhone && (-1 < navigator.userAgent.toLowerCase().indexOf('android')), this.mobileDevice = this.windowsPhone || this.iosDevice || this.androidDevice; } CBrowser.prototype.getIeVersion = function () { var sUa = navigator.userAgent.toLowerCase(), iVersion = Types.pInt(sUa.slice(sUa.indexOf('msie') + 4, sUa.indexOf(';', sUa.indexOf('msie') + 4))) ; if (this.ie11) { iVersion = 11; } return iVersion; }; module.exports = new CBrowser(); /***/ }), /***/ "rhHV": /*!***************************************************!*\ !*** ./modules/CoreWebclient/js/CustomTooltip.js ***! \***************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), _ = __webpack_require__(/*! underscore */ "C3HO"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L") ; var CustomTooltip = { _$Region: null, _$ArrowTop: null, _$Text: null, _$ArrowBottom: null, _iArrowBorderLeft: 0, _iArrowMarginLeft: 0, _iLeftShift: 0, _bInitialized: false, _bShown: false, iHideTimer: 0, iTimer: 0, init: function () { if (!this._bInitialized) { this._$Region = $('
').appendTo('body').hide(); this._$ArrowTop = $('
').appendTo(this._$Region); this._$Text = $('
').appendTo(this._$Region); this._$ArrowBottom = $('
').appendTo(this._$Region); this._iArrowMarginLeft = Types.pInt(this._$ArrowTop.css('margin-left')); this._iArrowBorderLeft = Types.pInt(this._$ArrowTop.css('border-left-width')); this._iLeftShift = Types.pInt(this._$Region.css('margin-left')) + this._iArrowMarginLeft + this._iArrowBorderLeft; this._bInitialized = true; } this._$ArrowTop.show(); this._$ArrowBottom.hide(); this._$ArrowTop.css({ 'margin-left': this._iArrowMarginLeft + 'px' }); this._$ArrowBottom.css({ 'margin-left': this._iArrowMarginLeft + 'px' }); }, show: function (sText, $ItemToAlign) { this.init(); var oItemOffset = $ItemToAlign.offset(), iItemWidth = $ItemToAlign.width(), iItemHalfWidth = (iItemWidth < 70) ? iItemWidth/2 : iItemWidth/4, iItemPaddingLeft = Types.pInt($ItemToAlign.css('padding-left')), jqBody = $('body'), iTop = oItemOffset.top + $ItemToAlign.outerHeight() - $('html').scrollTop(); ; this._$Text.html(sText); this._bShown = true; this._$Region.stop().fadeIn(260, _.bind(function () { if (!this._bShown) { this._$Region.hide(); } }, this)).css({ 'top': iTop, 'left': oItemOffset.left + iItemPaddingLeft + iItemHalfWidth - this._iLeftShift, 'right': 'auto' }); if (jqBody.outerHeight() < this._$Region.outerHeight() + this._$Region.offset().top) { this._$ArrowTop.hide(); this._$ArrowBottom.show(); this._$Region.css({ 'top': iTop - this._$Region.outerHeight() - $ItemToAlign.outerHeight() }); } setTimeout(function () { if (jqBody.width() < (this._$Region.outerWidth(true) + this._$Region.offset().left)) { this._$Region.css({ 'left': 'auto', 'right': 0 }); this._$ArrowTop.css({ 'margin-left': (iItemHalfWidth + oItemOffset.left - this._$Region.offset().left - this._iArrowBorderLeft) + 'px' }); this._$ArrowBottom.css({ 'margin-left': (iItemHalfWidth + oItemOffset.left - this._$Region.offset().left - this._iArrowBorderLeft + Types.pInt(this._$Region.css('margin-right'))) + 'px' }); } }.bind(this), 1); }, hide: function () { if (this._bInitialized) { this._bShown = false; this._$Region.hide(); } } }; function InitCustomTooltip(oElement, oCommand) { // tooltip text should be HTML encoded because of XSS vulnerability // for example mail attachments names should be HTML encoded var sTooltipText = TextUtils.encodeHtml(_.isFunction(oCommand) ? oCommand() : TextUtils.i18n(oCommand)), $Element = $(oElement), $Dropdown = $Element.find('span.dropdown'), bShown = false, fMouseIn = function () { var $ItemToAlign = $(this); if (!$ItemToAlign.hasClass('expand')) { clearTimeout(CustomTooltip.iHideTimer); bShown = true; clearTimeout(CustomTooltip.iTimer); CustomTooltip.iTimer = setTimeout(function () { if (bShown) { if ($ItemToAlign.hasClass('expand')) { bShown = false; clearTimeout(CustomTooltip.iTimer); CustomTooltip.hide(); } else { CustomTooltip.show(sTooltipText, $ItemToAlign); } } }, 100); } }, fMouseOut = function () { clearTimeout(CustomTooltip.iHideTimer); CustomTooltip.iHideTimer = setTimeout(function () { bShown = false; clearTimeout(CustomTooltip.iTimer); CustomTooltip.hide(); }, 10); }, fEmpty = function () {}, fBindEvents = function () { $Element.unbind('mouseover', fMouseIn); $Element.unbind('mouseout', fMouseOut); $Element.unbind('click', fMouseOut); $Dropdown.unbind('mouseover', fMouseOut); $Dropdown.unbind('mouseout', fEmpty); if (sTooltipText !== '') { $Element.bind('mouseover', fMouseIn); $Element.bind('mouseout', fMouseOut); $Element.bind('click', fMouseOut); $Dropdown.bind('mouseover', fMouseOut); $Dropdown.bind('mouseout', fEmpty); } }, fSubscribtion = null ; fBindEvents(); if (_.isFunction(oCommand) && _.isFunction(oCommand.subscribe) && fSubscribtion === null) { fSubscribtion = oCommand.subscribe(function (sValue) { sTooltipText = sValue; fBindEvents(); }); } } ko.bindingHandlers.customTooltip = { 'update': function (oElement, fValueAccessor) { InitCustomTooltip(oElement, fValueAccessor()); } }; module.exports = { init: InitCustomTooltip }; /***/ }), /***/ "LTsQ": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/ModuleErrors.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), oErrors = Types.pObject(window.auroraAppData && Types.pObject(window.auroraAppData.module_errors), {}) ; module.exports = { getErrorMessage: function (oResponse) { var mResult = false, sMedResult = '', iErrorCode = typeof oResponse.ErrorCode !== 'undefined' ? oResponse.ErrorCode : null, sModuleName = typeof oResponse.Module !== 'undefined' ? oResponse.Module : null ; if (iErrorCode !== null && sModuleName !== null && typeof oErrors[sModuleName] !== 'undefined' && typeof oErrors[sModuleName][iErrorCode] !== 'undefined') { mResult = oErrors[sModuleName][iErrorCode]; } //Check SubscriptionsResult for error messages if (oResponse.SubscriptionsResult) { for (var sSubscriptionIndex in oResponse.SubscriptionsResult) { var oSubscriptionResult = oResponse.SubscriptionsResult[sSubscriptionIndex]; if (oSubscriptionResult.Error && oSubscriptionResult.Error.Code && oSubscriptionResult.Error.ModuleName && typeof oErrors[oSubscriptionResult.Error.ModuleName] !== 'undefined' && typeof oErrors[oSubscriptionResult.Error.ModuleName][oSubscriptionResult.Error.Code] !== 'undefined' ) { if (oSubscriptionResult.Error.Override || !mResult) { mResult = oErrors[oSubscriptionResult.Error.ModuleName][oSubscriptionResult.Error.Code]; } else { mResult += "
" + oErrors[oSubscriptionResult.Error.ModuleName][oSubscriptionResult.Error.Code]; } } } } if (Types.isNonEmptyString(mResult)) { sMedResult = mResult.replace(/[^%]*%(\w+)%[^%]*/g, function(sMatch, sFound, iIndex, sStr) { if (Types.isNonEmptyString(oResponse[sFound])) { return sMatch.replace('%' + sFound + '%', oResponse[sFound]); } return sMatch; }); if (Types.isNonEmptyString(sMedResult)) { mResult = sMedResult; } } return mResult; } }; /***/ }), /***/ "TdEd": /*!****************************************************!*\ !*** ./modules/CoreWebclient/js/ModulesManager.js ***! \****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), oModules = {} ; module.exports = { init: function (oAvailableModules, oAppData) { _.each(oAvailableModules, function (fModuleConstructor, sModuleName) { if (_.isFunction(fModuleConstructor)) { var oModule = fModuleConstructor(oAppData); if (oModule) { oModules[sModuleName] = oModule; } } }); }, start: function (oAvailableModules) { _.each(oModules, _.bind(function (oModule) { if (_.isFunction(oModule.start)) { oModule.start(this); } }, this)); }, getModulesScreens: function () { var oModulesScreens = {}; _.each(oModules, function (oModule, sModuleName) { if (_.isFunction(oModule.getScreens)) { oModulesScreens[sModuleName] = oModule.getScreens(); } }); return oModulesScreens; }, getModulesTabs: function (bOnlyStandard) { if (!_.isArray(this.aTabs)) { this.aTabs = []; this.aStandardTabs = []; _.each(oModules, _.bind(function (oModule, sModuleName) { if (_.isFunction(oModule.getHeaderItem)) { var oHeaderItem = oModule.getHeaderItem(); if (oHeaderItem && oHeaderItem.item) { if (_.isFunction(oHeaderItem.item.setName)) { oHeaderItem.item.setName(oHeaderItem.name || sModuleName); this.aStandardTabs.push(oHeaderItem.item); } this.aTabs.push(oHeaderItem.item); if (oModules[sModuleName] && oModules[sModuleName].enableModule) { oHeaderItem.item.visible(oModules[sModuleName].enableModule()); oModules[sModuleName].enableModule.subscribe(function (bEnableModule) { oHeaderItem.item.visible(bEnableModule); }); } } } }, this)); this.aStandardTabs = _.sortBy(this.aStandardTabs, function (oTab) { var iIndex = _.indexOf(UserSettings.HeaderModulesOrder, oTab.sName); return iIndex !== -1 ? iIndex : UserSettings.HeaderModulesOrder.length; }); this.aTabs = _.sortBy(this.aTabs, function (oTab) { var iIndex = _.indexOf(UserSettings.HeaderModulesOrder, oTab.sName); return iIndex !== -1 ? iIndex : UserSettings.HeaderModulesOrder.length; }); } //TODO actualy, the item's order of aTabs affects on order of tabs in html return bOnlyStandard ? this.aStandardTabs : this.aTabs; }, getModulesPrefetchers: function () { var aPrefetchers = []; _.each(oModules, function (oModule, sModuleName) { if (_.isFunction(oModule.getPrefetcher)) { aPrefetchers.push(oModule.getPrefetcher()); } }); return aPrefetchers; }, isModuleIncluded: function (sModuleName) { return oModules[sModuleName] !== undefined; }, isModuleEnabled: function (sModuleName) { return oModules[sModuleName] && (!oModules[sModuleName].enableModule || oModules[sModuleName].enableModule()); }, isModuleAvailable: function (sModuleName) { return window.aAvailableBackendModules.indexOf(sModuleName) !== -1 || window.aAvailableModules.indexOf(sModuleName) !== -1; }, /** * Calls a specified function of a specified module if the module and the function exist and are available. * @param {string} sModuleName Name of the module. * @param {string} sFunctionName Name of the function. * @param {Array} aParams Array of parameters that will be passed to the function. * @returns {Boolean} */ run: function (sModuleName, sFunctionName, aParams) { if (this.isModuleEnabled(sModuleName)) { var oModule = oModules[sModuleName]; if (oModule && _.isFunction(oModule[sFunctionName])) { if (!_.isArray(aParams)) { aParams = []; } return oModule[sFunctionName].apply(oModule, aParams); } } return false; } }; /***/ }), /***/ "oUN1": /*!********************************************!*\ !*** ./modules/CoreWebclient/js/Popups.js ***! \********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L") ; /** * @constructor */ function CPopups() { this.popups = []; this.$popupsPlace = $('#auroraContent .popups'); } CPopups.prototype.hasOpenedMinimizedPopups = function () { var bOpenedMinimizedPopups = false; _.each(this.popups, function (oPopup) { if (oPopup.minimized && oPopup.minimized()) { bOpenedMinimizedPopups = true; } }); return bOpenedMinimizedPopups; }; CPopups.prototype.getOpenedMinimizedPopup = function (sPopupTemplate) { return _.find(this.popups, function (oPopup) { return sPopupTemplate === oPopup.PopupTemplate && oPopup.minimized && oPopup.minimized(); }); } CPopups.prototype.hasOnlyOneOpenedPopup = function () { return this.popups.length === 1; }; CPopups.prototype.hasOpenedMaximizedPopups = function () { var bOpenedMaximizedPopups = false; _.each(this.popups, function (oPopup) { if (!oPopup.minimized || !oPopup.minimized()) { bOpenedMaximizedPopups = true; } }); return bOpenedMaximizedPopups; }; CPopups.prototype.hasUnsavedChanges = function () { var bHasUnsavedChanges = false; _.each(this.popups, function (oPopup) { if (!bHasUnsavedChanges && oPopup && _.isFunction(oPopup.hasUnsavedChanges) && oPopup.hasUnsavedChanges()) { bHasUnsavedChanges = true; if (_.isFunction(oPopup.minimized) && oPopup.minimized() && _.isFunction(oPopup.maximize)) { oPopup.maximize(); } } }); return bHasUnsavedChanges; }; /** * @param {?} oPopup * @param {Array=} aParameters */ CPopups.prototype.showPopup = function (oPopup, aParameters) { if (oPopup) { if (!oPopup.$popupDom && Types.isNonEmptyString(oPopup.PopupTemplate)) { var $templatePlace = $('').appendTo(this.$popupsPlace); ko.applyBindings(oPopup, $templatePlace[0]); oPopup.$popupDom = $templatePlace.next(); oPopup.$templatePlace = $templatePlace; oPopup.onBind(); } if (_.isFunction(oPopup.openPopup)) { oPopup.openPopup(aParameters); } } }; /** * @param {Object} oPopup */ CPopups.prototype.addPopup = function (oPopup) { this.popups.push(oPopup); if (this.popups.length === 1) { this.keyupPopupBound = _.bind(this.keyupPopup, this); $(document).on('keyup', this.keyupPopupBound); } }; /** * @param {Object} oEvent */ CPopups.prototype.keyupPopup = function (oEvent) { var oPopup = (this.popups.length > 0) ? this.popups[this.popups.length - 1] : null; if (oEvent && oPopup && (!oPopup.minimized || !oPopup.minimized())) { var iKeyCode = Types.pInt(oEvent.keyCode); if (Enums.Key.Esc === iKeyCode) { oPopup.onEscHandler(oEvent); } if ((Enums.Key.Enter === iKeyCode || Enums.Key.Space === iKeyCode)) { oPopup.onEnterHandler(); } } }; /** * @param {?} oPopup */ CPopups.prototype.removePopup = function (oPopup) { if (oPopup) { oPopup.closePopup(); } }; /** * @param {?} oPopup */ CPopups.prototype.removePopup = function (oPopup) { if (this.keyupPopupBound && this.popups.length === 1) { $(document).off('keyup', this.keyupPopupBound); this.keyupPopupBound = undefined; } if (oPopup.$popupDom instanceof $) { oPopup.$popupDom.remove(); oPopup.$popupDom = undefined; } if (oPopup.$templatePlace instanceof $) { oPopup.$templatePlace.remove(); delete oPopup.$templatePlace; } this.popups = _.without(this.popups, oPopup); }; module.exports = new CPopups(); /***/ }), /***/ "YO0m": /*!************************************************!*\ !*** ./modules/CoreWebclient/js/Prefetcher.js ***! \************************************************/ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), Ajax = __webpack_require__(/*! modules/CoreWebclient/js/Ajax.js */ "EFhx"), App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), ModulesManager = __webpack_require__(/*! modules/CoreWebclient/js/ModulesManager.js */ "TdEd"), Settings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), ModulesPrefetchers = ModulesManager.getModulesPrefetchers(), Prefetcher = {}, bServerInitializationsDone = false ; Prefetcher.start = function () { if (App.getUserRole() !== Enums.UserRole.Anonymous && !App.isNewTab() && !Ajax.hasInternetConnectionProblem() && !Ajax.hasOpenedRequests()) { Prefetcher.prefetchAll(); } }; Prefetcher.prefetchAll = function () { var bPrefetchStarted = this.doServerInitializations(); _.each(ModulesPrefetchers, function (oModulePrefetcher) { if (!bPrefetchStarted) { if (Settings.AllowPrefetch && _.isFunction(oModulePrefetcher.startAll)) { bPrefetchStarted = oModulePrefetcher.startAll(); } else if (_.isFunction(oModulePrefetcher.startMin)) { bPrefetchStarted = oModulePrefetcher.startMin(); } } }); }; Prefetcher.doServerInitializations = function () { if (App.getUserRole() !== Enums.UserRole.Anonymous && !App.isNewTab() && !App.isPublic() && !bServerInitializationsDone) { Ajax.send('Core', 'DoServerInitializations', {}); bServerInitializationsDone = true; return true; } return false; }; Ajax.registerOnAllRequestsClosedHandler(function () { Prefetcher.start(); }); /***/ }), /***/ "fDmo": /*!*******************************************!*\ !*** ./modules/CoreWebclient/js/Pulse.js ***! \*******************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), ko = __webpack_require__(/*! knockout */ "p09A"), moment = __webpack_require__(/*! moment */ "sdEb"), Utils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Common.js */ "REt5"), aEveryMinuteFunctions = [], aDayOfMonthFunctions = [], koNowDayOfMonth = ko.observable(moment().date()), aWakeupFunctions = [], oLastCheck = moment() ; window.setInterval(function () { _.each(aEveryMinuteFunctions, function (fEveryMinute) { fEveryMinute(); }); koNowDayOfMonth(moment().date()); if (moment().diff(oLastCheck, 'minute') > 2) { _.each(aWakeupFunctions, function (fWakeup) { fWakeup(); }); } oLastCheck = moment(); }, 1000 * 60); // every minute koNowDayOfMonth.subscribe(function () { _.each(aDayOfMonthFunctions, function (fDayOfMonth) { fDayOfMonth(); }); }, this); module.exports = { registerEveryMinuteFunction: function (fEveryMinute) { if (_.isFunction(fEveryMinute)) { aEveryMinuteFunctions.push(fEveryMinute); } }, registerWakeupFunction: function (fWakeup) { if (_.isFunction(fWakeup)) { aWakeupFunctions.push(fWakeup); } }, registerDayOfMonthFunction: function (fDayOfMonth) { if (_.isFunction(fDayOfMonth)) { aDayOfMonthFunctions.push(fDayOfMonth); } } }; /***/ }), /***/ "W66n": /*!*********************************************!*\ !*** ./modules/CoreWebclient/js/Routing.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), ko = __webpack_require__(/*! knockout */ "p09A"), hasher = __webpack_require__(/*! hasher */ "1Hzh"), UrlUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Url.js */ "Tt1R"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT") ; /** * @constructor */ function CRouting() { this.currentHash = ko.observable(this.getHashFromHref()); this.previousHash = ko.observable(this.getHashFromHref()); } /** * Initializes object. */ CRouting.prototype.init = function () { hasher.initialized.removeAll(); hasher.changed.removeAll(); hasher.initialized.add(this.parseRouting, this); hasher.changed.add(this.parseRouting, this); hasher.init(); hasher.initialized.removeAll(); }; /** * Finalizes the object and puts an empty hash. */ CRouting.prototype.finalize = function () { hasher.dispose(); }; /** * Sets a new hash. * * @param {string} sNewHash * * @return {boolean} */ CRouting.prototype.setHashFromString = function (sNewHash) { var bSame = (location.hash === sNewHash); if (!bSame) { location.hash = sNewHash; } return bSame; }; /** * Sets a new hash without part. * * @param {string} sUid */ CRouting.prototype.replaceHashWithoutMessageUid = function (sUid) { if (typeof sUid === 'string' && sUid !== '') { var sNewHash = location.hash.replace('/msg' + encodeURIComponent(sUid), ''); this.replaceHashFromString(sNewHash); } }; /** * Sets a new hash. * * @param {string} sNewHash */ CRouting.prototype.replaceHashFromString = function (sNewHash) { if (location.hash !== sNewHash) { location.replace(UrlUtils.getAppPath() + window.location.search + sNewHash); } }; /** * Sets a new hash made up of an array. * * @param {Array} aRoutingParts * * @return boolean */ CRouting.prototype.setHash = function (aRoutingParts) { return this.setHashFromString(this.buildHashFromArray(aRoutingParts)); }; /** * @param {Array} aRoutingParts */ CRouting.prototype.replaceHash = function (aRoutingParts) { this.replaceHashFromString(this.buildHashFromArray(aRoutingParts)); }; /** * @param {Array} aRoutingParts */ CRouting.prototype.replaceHashDirectly = function (aRoutingParts) { hasher.stop(); this.replaceHashFromString(this.buildHashFromArray(aRoutingParts)); this.currentHash(location.hash.replace(/^#/, '')); hasher.init(); }; CRouting.prototype.setPreviousHash = function () { var sPrevHash = this.previousHash(), aPrevHash = sPrevHash.split(/[-|\/]/) ; if (this.currentHash() === sPrevHash) { sPrevHash = aPrevHash.length > 0 && aPrevHash[0] !== sPrevHash ? aPrevHash[0] : ''; } location.hash = sPrevHash; }; CRouting.prototype.stopListening = function () { hasher.stop(); }; CRouting.prototype.startListening = function () { hasher.init(); }; /** * Makes a hash of a string array. * * @param {(string|Array)} aRoutingParts * * @return {string} */ CRouting.prototype.buildHashFromArray = function (aRoutingParts) { var iIndex = 0, iLen = 0, sHash = '' ; if (_.isArray(aRoutingParts)) { for (iLen = aRoutingParts.length; iIndex < iLen; iIndex++) { aRoutingParts[iIndex] = encodeURIComponent(aRoutingParts[iIndex]); } } else { aRoutingParts = [encodeURIComponent(aRoutingParts.toString())]; } sHash = aRoutingParts.join('/'); if (sHash !== '') { sHash = '#' + sHash; } return sHash; }; /** * Returns the value of the hash string of location.href. * location.hash returns the decoded string and location.href - not, so it uses location.href. * * @return {string} */ CRouting.prototype.getHashFromHref = function () { var iPos = location.href.indexOf('#'), sHash = '' ; if (iPos !== -1) { sHash = location.href.substr(iPos + 1); } return sHash; }; /** * @param {Array} aRoutingParts * @param {Array} aAddParams */ CRouting.prototype.goDirectly = function (aRoutingParts, aAddParams) { hasher.stop(); this.setHash(aRoutingParts); this.parseRouting(aAddParams); hasher.init(); }; /** * @param {string} sNeedScreen */ CRouting.prototype.historyBackWithoutParsing = function (sNeedScreen) { hasher.stop(); location.hash = this.currentHash(); hasher.init(); }; /** * @returns {String} */ CRouting.prototype.getScreenFromHash = function () { var sHash = this.getHashFromHref(), aHash = sHash.split('/') ; return decodeURIComponent(aHash.shift()); }; /** * Checks if there are changes in current screen and continues screen change or discards changes. * @param {Array} aAddParams */ CRouting.prototype.parseRouting = function (aAddParams) { var App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), fContinueScreenChange = _.bind(this.chooseScreen, this, aAddParams), fRevertScreenChange = _.bind(this.historyBackWithoutParsing, this, aAddParams), oCurrentScreen = _.isFunction(Screens.getCurrentScreen) ? Screens.getCurrentScreen() : null ; if (oCurrentScreen && _.isFunction(oCurrentScreen.hasUnsavedChanges) && oCurrentScreen.hasUnsavedChanges()) { App.askDiscardChanges(fContinueScreenChange, fRevertScreenChange, oCurrentScreen); } else if (_.isFunction(fContinueScreenChange)) { fContinueScreenChange(); } }; /** * Parses the hash string and opens the corresponding routing screen. * * @param {Array} aAddParams */ CRouting.prototype.chooseScreen = function (aAddParams) { var sHash = this.getHashFromHref(), aParams = _.map(sHash.split('/'), function (sHashPart) { return decodeURIComponent(sHashPart); }) ; this.previousHash(this.currentHash()); this.currentHash(sHash); aAddParams = _.isArray(aAddParams) ? aAddParams : []; Screens.route(aParams.concat(aAddParams)); }; var Routing = new CRouting(); module.exports = { init: _.bind(Routing.init, Routing), buildHashFromArray: _.bind(Routing.buildHashFromArray, Routing), replaceHashWithoutMessageUid: _.bind(Routing.replaceHashWithoutMessageUid, Routing), setHash: _.bind(Routing.setHash, Routing), replaceHash: _.bind(Routing.replaceHash, Routing), finalize: _.bind(Routing.finalize, Routing), currentHash: Routing.currentHash, replaceHashDirectly: _.bind(Routing.replaceHashDirectly, Routing), setPreviousHash: _.bind(Routing.setPreviousHash, Routing), clearPreviousHash: function () { Routing.previousHash(''); }, stopListening: _.bind(Routing.stopListening, Routing), startListening: _.bind(Routing.startListening, Routing), goDirectly: _.bind(Routing.goDirectly, Routing), getCurrentHashArray: function () { return Routing.currentHash().split('/'); }, getAppUrlWithHash: function (aRoutingParts) { return UrlUtils.getAppPath() + Routing.buildHashFromArray(aRoutingParts); } }; /***/ }), /***/ "skxT": /*!*********************************************!*\ !*** ./modules/CoreWebclient/js/Screens.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), ModulesManager = __webpack_require__(/*! modules/CoreWebclient/js/ModulesManager.js */ "TdEd"), Settings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV") ; /** * @constructor */ function CScreens() { var $win = $(window); this.resizeAll = _.debounce(function () { $win.resize(); }, 100); this.oGetScreenFunctions = {}; this.screens = ko.observable({}); this.oModulesNames = {}; this.currentScreen = ko.observable(''); this.sDefaultScreen = ''; this.browserTitle = ko.computed(function () { var oCurrScreen = this.screens()[this.currentScreen()]; return oCurrScreen && _.isFunction(oCurrScreen.browserTitle) ? oCurrScreen.browserTitle() : ''; }, this); this.informationScreen = ko.observable(null); this.bStarted = false; this.aPreInitScreens = []; } CScreens.prototype.init = function (bAnonymUser) { var oModulesScreens = ModulesManager.getModulesScreens(), aKeys = [], sDefaultScreenHash = bAnonymUser ? Settings.DefaultAnonymScreenHash.toLowerCase() : Settings.DefaultUserScreenHash.toLowerCase() ; _.each(oModulesScreens, _.bind(function (oScreenList, sModuleName) { this.addToScreenList(sModuleName, oScreenList); }, this)); this.addToScreenList('', __webpack_require__(/*! modules/CoreWebclient/js/screenList.js */ "itIC")); if (this.oGetScreenFunctions[sDefaultScreenHash]) { this.sDefaultScreen = sDefaultScreenHash; } if (this.sDefaultScreen === '') { aKeys = _.keys(this.oGetScreenFunctions); if (Types.isNonEmptyArray(aKeys)) { this.sDefaultScreen = aKeys[0]; } } }; CScreens.prototype.start = function () { var oModulesTabs = ModulesManager.getModulesTabs(false); if (oModulesTabs.length > 0) { this.showView('header'); } this.initInformation(); this.bStarted = true; _.each(this.aPreInitScreens, function (sScreenId) { this.initHiddenView(sScreenId); }.bind(this)); }; /** * @param {string} sModuleName * @param {Object} oScreenList */ CScreens.prototype.addToScreenList = function (sModuleName, oScreenList) { _.each(oScreenList, _.bind(function (fGetScreen, sKey) { this.oGetScreenFunctions[sKey] = fGetScreen; this.oModulesNames[sKey] = sModuleName; }, this)); }; /** * @param {string} sScreen * * @returns {boolean} */ CScreens.prototype.hasScreenData = function (sScreen) { return !!(this.screens()[sScreen] || this.oGetScreenFunctions[sScreen]); }; /** * @param {Array} aParams */ CScreens.prototype.route = function (aParams) { var sCurrentScreen = this.currentScreen(), oCurrentScreen = this.screens()[sCurrentScreen], sNextScreen = aParams.shift(), self = this ; if (sNextScreen === '' || sCurrentScreen === '' && !this.oModulesNames[sNextScreen]) { sNextScreen = this.sDefaultScreen; } if (sCurrentScreen === '' && (!ModulesManager.isModuleEnabled(this.oModulesNames[sNextScreen]) || !this.hasScreenData(sNextScreen))) { sNextScreen = _.find(_.keys(this.oModulesNames), _.bind(function (sScreen) { return ModulesManager.isModuleEnabled(this.oModulesNames[sScreen]) && this.hasScreenData(sScreen); }, this)) || this.sDefaultScreen; } if (ModulesManager.isModuleEnabled(this.oModulesNames[sNextScreen]) && this.hasScreenData(sNextScreen)) { if (sCurrentScreen !== sNextScreen) { this.currentScreen(sNextScreen); if (oCurrentScreen && _.isFunction(oCurrentScreen.hideView)) { oCurrentScreen.hideView(); } oCurrentScreen = this.showView(sNextScreen, function (oScreen) { self.onRouteCallback(oScreen, aParams); }); } else if (oCurrentScreen) { this.onRouteCallback(oCurrentScreen, aParams); } } }; CScreens.prototype.onRouteCallback = function (oScreen, aParams) { if (oScreen && _.isFunction(oScreen.onRoute)) { oScreen.onRoute(aParams); } }; /** * @param {string} sScreen * @param {function} fCallback * * @returns {Object} */ CScreens.prototype.showView = function (sScreen, fCallback) { var sScreenId = sScreen, fGetScreen = this.oGetScreenFunctions[sScreenId], oScreen = this.screens()[sScreenId], self = this ; if (!oScreen && fGetScreen) { // oScreen = this.initView(sScreenId, fGetScreen); this.initView(sScreenId, fGetScreen, function () { self.showView(sScreen, fCallback); }); return null; } if (oScreen && _.isFunction(oScreen.showView)) { oScreen.showView(); } if (_.isFunction(fCallback)) { fCallback(oScreen); } return oScreen; }; CScreens.prototype.initHiddenView = function (sScreenId) { var fGetScreen = this.oGetScreenFunctions[sScreenId], oScreen = this.screens()[sScreenId] ; if (!oScreen && fGetScreen) { if (this.bStarted) { this.initView(sScreenId, fGetScreen); } else { this.aPreInitScreens.push(sScreenId); } } }; /** * @param {string} sScreenId * @param {function} fGetScreen * @param {function} fCallback * * @returns {Object} */ CScreens.prototype.initView = function (sScreenId, fGetScreen, fCallback) { var self = this, oScreen = fGetScreen() ; //TODO better testing for promise is needed if (_.isFunction(oScreen.then)) { oScreen.then(function (oScreen) { self.initViewCallback.call(self, sScreenId, oScreen); if (oScreen && _.isFunction(fCallback)) { fCallback(oScreen); } }); } else { this.initViewCallback.call(this, sScreenId, oScreen); if (oScreen && _.isFunction(fCallback)) { fCallback(oScreen); } } }; CScreens.prototype.initViewCallback = function (sScreenId, oScreen) { if (oScreen.ViewTemplate) { var $templatePlace = $('').appendTo($('#auroraContent .screens')); if ($templatePlace.length > 0) { ko.applyBindings(oScreen, $templatePlace[0]); oScreen.$viewDom = $templatePlace.next(); oScreen.onBind(); } } this.screens()[sScreenId] = oScreen; this.screens.valueHasMutated(); delete this.oGetScreenFunctions[sScreenId]; }; /** * @param {Object} oView */ CScreens.prototype.showAnyView = function (oView) { if (oView.ViewTemplate) { var $templatePlace = $('').appendTo($('#auroraContent .screens')); if ($templatePlace.length > 0) { ko.applyBindings(oView, $templatePlace[0]); } } }; /** * @param {string} sMessage */ CScreens.prototype.showLoading = function (sMessage) { if (this.informationScreen()) { this.informationScreen().showLoading(sMessage); } }; CScreens.prototype.hideLoading = function () { if (this.informationScreen()) { this.informationScreen().hideLoading(); } }; /** * @param {string} sMessage * @param {number=} iDelay */ CScreens.prototype.showReport = function (sMessage, iDelay) { if (this.informationScreen()) { this.informationScreen().showReport(sMessage, iDelay); } }; CScreens.prototype.hideReport = function () { if (this.informationScreen()) { this.informationScreen().hideReport(); } }; /** * @param {string} sMessage * @param {boolean=} bNotHide = false * @param {boolean=} bGray = false */ CScreens.prototype.showError = function (sMessage, bNotHide, bGray) { if (this.informationScreen()) { this.informationScreen().showError(sMessage, bNotHide, bGray); } }; /** * @param {boolean=} bGray = false */ CScreens.prototype.hideError = function (bGray) { if (this.informationScreen()) { this.informationScreen().hideError(bGray); } }; CScreens.prototype.initInformation = function () { var self = this; this.showView('information', function (oScreen) { if (oScreen) { self.informationScreen(oScreen); } }); }; CScreens.prototype.hasUnsavedChanges = function () { var oCurrentScreen = this.screens()[this.currentScreen()]; return oCurrentScreen && _.isFunction(oCurrentScreen.hasUnsavedChanges) && oCurrentScreen.hasUnsavedChanges(); }; /** * Returns current screen object. * @returns {object} */ CScreens.prototype.getCurrentScreen = function () { return this.screens()[this.currentScreen()]; }; var Screens = new CScreens(); module.exports = Screens; /***/ }), /***/ "OfVV": /*!**********************************************!*\ !*** ./modules/CoreWebclient/js/Settings.js ***! \**********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), moment = __webpack_require__(/*! moment-timezone */ "R+qY"), UrlUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Url.js */ "Tt1R"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), AppData = window.auroraAppData, bRtl = $('html').hasClass('rtl') ; __webpack_require__(/*! modules/CoreWebclient/js/vendors/jquery.cookie.js */ "XNy+"); var Settings = { ServerModuleName: 'Core', HashModuleName: 'core', DebugMode: Types.isString(UrlUtils.getRequestParam('debugmode')), // Settings from Core module AuthTokenCookieExpireTime: 30, AutodetectLanguage: false, UserSelectsDateFormat: false, dateFormat: ko.observable('DD/MM/YYYY'), DateFormatList: ['DD/MM/YYYY'], EUserRole: {}, IsSystemConfigured: false, Language: 'English', LastErrorCode: 0, ShortLanguage: 'en', SiteName: 'Afterlogic Platform', SocialName: '', StoreAuthTokenInDB: false, TenantName: '', timeFormat: ko.observable('0'), // 0 - 24, 1 - 12 timezone: ko.observable(''), UserId: 0, PasswordMinLength: 0, PasswordMustBeComplex: false, CookiePath: '/', CookieSecure: false, Version: '', ProductName: '', // Settings from Core module only for super admin AdminHasPassword: '', AdminLanguage: '', AdminLogin: '', CommonLanguage: '', DbHost: '', DbLogin: '', DbName: '', EncryptionKeyNotEmpty: false, dbSettingsChanged: ko.observable(false).extend({'autoResetToFalse': 100}), // Settings from CoreWebclient module AllowChangeSettings: false, AllowClientDebug: false, AllowDesktopNotifications: false, AllowMobile: false, AllowPrefetch: true, AttachmentSizeLimit: 0, AutoRefreshIntervalMinutes: 1, CustomLogoutUrl: '', DefaultAnonymScreenHash: '', DefaultUserScreenHash: '', GoogleAnalyticsAccount: '', HeaderModulesOrder: [], IsDemo: false, IsMobile: -1, LanguageList: [{name: 'English', text: 'English'}], MultipleFilesUploadLimit: 50, ShowQuotaBar: false, ShowQuotaBarTextAsTooltip: true, QuotaWarningPerc: 0, Theme: 'Default', ThemeList: ['Default'], HideLogout: false, // Settings from CoreMobileWebclient module MobileTheme: 'Default', MobileThemeList: ['Default'], // Settings from BrandingWebclient module LogoUrl: '', TopIframeUrl: '', TopIframeHeightPx: 0, // Settings from HTML IsRTL: bRtl, /** * Initializes settings from AppData object sections. * * @param {Object} oAppData Object contained modules settings. */ init: function (oAppData) { var oAppDataCoreSection = oAppData[Settings.ServerModuleName], oAppDataCoreWebclientSection = oAppData['CoreWebclient'], oAppDataCoreMobileWebclientSection = oAppData['CoreMobileWebclient'], oAppDataBrandingWebclientSection = oAppData['BrandingWebclient'] ; if (!_.isEmpty(oAppDataCoreSection)) { this.AuthTokenCookieExpireTime = Types.pInt(oAppDataCoreSection.AuthTokenCookieExpireTime, this.AuthTokenCookieExpireTime); this.AutodetectLanguage = Types.pBool(oAppDataCoreSection.AutodetectLanguage, this.AutodetectLanguage); this.UserSelectsDateFormat = Types.pBool(oAppDataCoreSection.UserSelectsDateFormat, this.UserSelectsDateFormat); this.dateFormat(Types.pString(oAppDataCoreSection.DateFormat, this.dateFormat())); this.DateFormatList = Types.pArray(oAppDataCoreSection.DateFormatList, this.DateFormatList); if (_.indexOf(this.DateFormatList, this.dateFormat()) === -1) { this.DateFormatList.unshift(this.dateFormat()); } this.EUserRole = Types.pObject(oAppDataCoreSection.EUserRole, this.EUserRole); this.IsSystemConfigured = Types.pBool(oAppDataCoreSection.IsSystemConfigured, this.IsSystemConfigured); this.Language = Types.pString(oAppDataCoreSection.Language, this.Language); this.LastErrorCode = Types.pInt(oAppDataCoreSection.LastErrorCode, this.LastErrorCode); this.ShortLanguage = Types.pString(oAppDataCoreSection.ShortLanguage, this.ShortLanguage); this.SiteName = Types.pString(oAppDataCoreSection.SiteName, this.SiteName); this.SocialName = Types.pString(oAppDataCoreSection.SocialName, this.SocialName); this.StoreAuthTokenInDB = Types.pBool(oAppDataCoreSection.StoreAuthTokenInDB, this.StoreAuthTokenInDB); this.TenantName = Types.pString(oAppDataCoreSection.TenantName || UrlUtils.getRequestParam('tenant'), this.TenantName); this.timeFormat(Types.pString(oAppDataCoreSection.TimeFormat, this.timeFormat())); this.timezone(Types.pString(oAppDataCoreSection.Timezone, this.timezone())); this.UserId = Types.pInt(oAppDataCoreSection.UserId, this.UserId); this.PasswordMinLength = Types.pNonNegativeInt(oAppDataCoreSection.PasswordMinLength, this.PasswordMinLength); this.PasswordMustBeComplex = Types.pBool(oAppDataCoreSection.PasswordMustBeComplex, this.PasswordMustBeComplex); this.CookiePath = Types.pString(oAppDataCoreSection.CookiePath, this.CookiePath); if (this.CookiePath === '') { this.CookiePath = '/'; } this.CookieSecure = Types.pBool(oAppDataCoreSection.CookieSecure, this.CookieSecure); $.cookie.defaults = { path: this.CookiePath, secure: this.CookieSecure }; this.Version = Types.pString(oAppDataCoreSection.Version, this.Version); this.ProductName = Types.pString(oAppDataCoreSection.ProductName, this.ProductName); //only for admin this.AdminHasPassword = Types.pBool(oAppDataCoreSection.AdminHasPassword, this.AdminHasPassword); this.AdminLanguage = Types.pString(oAppDataCoreSection.AdminLanguage, this.AdminLanguage); this.AdminLogin = Types.pString(oAppDataCoreSection.AdminLogin, this.AdminLogin); this.CommonLanguage = Types.pString(oAppDataCoreSection.CommonLanguage, this.CommonLanguage); this.DbHost = Types.pString(oAppDataCoreSection.DBHost, this.DbHost); this.DbLogin = Types.pString(oAppDataCoreSection.DBLogin, this.DbLogin); this.DbName = Types.pString(oAppDataCoreSection.DBName, this.DbName); this.EncryptionKeyNotEmpty = Types.pBool(oAppDataCoreSection.EncryptionKeyNotEmpty, this.EncryptionKeyNotEmpty); } if (!_.isEmpty(oAppDataCoreWebclientSection)) { this.AllowChangeSettings = Types.pBool(oAppDataCoreWebclientSection.AllowChangeSettings, this.AllowChangeSettings); this.AllowClientDebug = Types.pBool(oAppDataCoreWebclientSection.AllowClientDebug, this.AllowClientDebug); this.AllowDesktopNotifications = Types.pBool(oAppDataCoreWebclientSection.AllowDesktopNotifications, this.AllowDesktopNotifications); this.AllowMobile = Types.pBool(oAppDataCoreWebclientSection.AllowMobile, this.AllowMobile); this.AllowPrefetch = Types.pBool(oAppDataCoreWebclientSection.AllowPrefetch, this.AllowPrefetch); this.AttachmentSizeLimit = Types.pNonNegativeInt(oAppDataCoreWebclientSection.AttachmentSizeLimit, this.AttachmentSizeLimit); this.AutoRefreshIntervalMinutes = Types.pNonNegativeInt(oAppDataCoreWebclientSection.AutoRefreshIntervalMinutes, this.AutoRefreshIntervalMinutes); this.CustomLogoutUrl = Types.pString(oAppDataCoreWebclientSection.CustomLogoutUrl, this.CustomLogoutUrl); this.DefaultAnonymScreenHash = Types.pString(oAppDataCoreWebclientSection.DefaultAnonymScreenHash, this.DefaultAnonymScreenHash); this.DefaultUserScreenHash = Types.pString(oAppDataCoreWebclientSection.DefaultUserScreenHash, this.DefaultUserScreenHash); this.GoogleAnalyticsAccount = Types.pString(oAppDataCoreWebclientSection.GoogleAnalyticsAccount, this.GoogleAnalyticsAccount); this.HeaderModulesOrder = Types.pArray(oAppDataCoreWebclientSection.HeaderModulesOrder, this.HeaderModulesOrder); this.IsDemo = Types.pBool(oAppDataCoreWebclientSection.IsDemo, this.IsDemo); this.IsMobile = Types.pInt(oAppDataCoreWebclientSection.IsMobile, this.IsMobile); this.LanguageList = Types.pArray(oAppDataCoreWebclientSection.LanguageListWithNames, this.LanguageList); this.MultipleFilesUploadLimit = Types.pNonNegativeInt(oAppDataCoreWebclientSection.MultipleFilesUploadLimit, this.MultipleFilesUploadLimit); this.ShowQuotaBar = Types.pBool(oAppDataCoreWebclientSection.ShowQuotaBar, this.ShowQuotaBar); this.ShowQuotaBarTextAsTooltip = Types.pBool(oAppDataCoreWebclientSection.ShowQuotaBarTextAsTooltip, this.ShowQuotaBarTextAsTooltip); this.QuotaWarningPerc = Types.pInt(oAppDataCoreWebclientSection.QuotaWarningPerc, this.QuotaWarningPerc); this.Theme = Types.pString(oAppDataCoreWebclientSection.Theme, this.Theme); this.ThemeList = Types.pArray(oAppDataCoreWebclientSection.ThemeList, this.ThemeList); this.HideLogout = Types.pBool(oAppDataCoreWebclientSection.HideLogout, this.HideLogout); } if (!_.isEmpty(oAppDataCoreMobileWebclientSection)) { this.MobileTheme = Types.pString(oAppDataCoreMobileWebclientSection.Theme, this.MobileTheme); this.MobileThemeList = Types.pArray(oAppDataCoreMobileWebclientSection.ThemeList, this.MobileThemeList); } if (!_.isEmpty(oAppDataBrandingWebclientSection)) { this.LogoUrl = Types.pString(oAppDataBrandingWebclientSection.TabsbarLogo, this.LogoUrl); this.TopIframeUrl = Types.pString(oAppDataBrandingWebclientSection.TopIframeUrl, this.TopIframeUrl); this.TopIframeHeightPx = Types.pString(oAppDataBrandingWebclientSection.TopIframeHeightPx, this.TopIframeHeightPx); } if (moment.locale() !== this.ShortLanguage && this.Language !== 'Arabic' && this.Language !== 'Persian') { moment.locale(this.ShortLanguage); } setTimeout(_.bind(this.initTimezone, this), 1000); }, initTimezone: function () { var App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"); if (App.isUserNormalOrTenant()) { var TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Ajax = __webpack_require__(/*! modules/CoreWebclient/js/Ajax.js */ "EFhx"), Screens = __webpack_require__(/*! modules/CoreWebclient/js/Screens.js */ "skxT"), Storage = __webpack_require__(/*! modules/CoreWebclient/js/Storage.js */ "HCAJ"), oNowMoment = moment(), sBrowserTimezone = moment.tz.guess(), sServerTimezone = this.timezone() ; if (sServerTimezone === '') { Ajax.send('Core', 'UpdateUserTimezone', {Timezone: sBrowserTimezone}); } else { if (sServerTimezone !== sBrowserTimezone && Storage.getData('aurora_core_browser-timezone') !== sBrowserTimezone) { Screens.showReport(TextUtils.i18n('COREWEBCLIENT/CONFIRM_TIMEZONE_CHANGES', { OLDTIME: oNowMoment.clone().tz(sServerTimezone).format('HH:mm') + ' (' + sServerTimezone + ')', NEWTIME: oNowMoment.format('HH:mm') + ' (' + sBrowserTimezone + ')' }), 0); $('.report_panel.report a').on('click', _.bind(function () { Storage.removeData('aurora_core_browser-timezone'); Ajax.send('Core', 'UpdateUserTimezone', {Timezone: sBrowserTimezone}, _.bind(function (oUpdateResponse) { Screens.hideReport(); if (oUpdateResponse.Result === true) { Storage.setData('aurora_core_browser-timezone', sBrowserTimezone); this.timezone(sBrowserTimezone); } else { Screens.showError(TextUtils.i18n('COREWEBCLIENT/ERROR_TIMEZONE_CHANGES')); } }, this)); }, this)); } Storage.setData('aurora_core_browser-timezone', sBrowserTimezone); } } }, /** * Updates new settings values after saving on server. * * @param {string} sSiteName * @param {number} iAutoRefreshIntervalMinutes * @param {string} sDefaultTheme * @param {string} sDefaultMobileTheme * @param {string} sLanguage * @param {string} sTimeFormat * @param {string} sDateFormat * @param {boolean} bAllowDesktopNotifications */ update: function (sSiteName, iAutoRefreshIntervalMinutes, sDefaultTheme, sDefaultMobileTheme, sLanguage, sTimeFormat, sDateFormat, bAllowDesktopNotifications) { if (typeof(sSiteName) === 'string') { this.SiteName = sSiteName; } if (typeof(sLanguage) === 'string') { this.Language = sLanguage; } if (typeof(sTimeFormat) === 'string') { this.timeFormat(sTimeFormat); } if (typeof(sDateFormat) === 'string') { this.dateFormat(sDateFormat); } if (typeof(bAllowDesktopNotifications) === 'boolean') { this.AllowDesktopNotifications = bAllowDesktopNotifications; } if (typeof(iAutoRefreshIntervalMinutes) === 'number') { this.AutoRefreshIntervalMinutes = iAutoRefreshIntervalMinutes; } if (typeof(sDefaultTheme) === 'string') { this.Theme = sDefaultTheme; } if (typeof(sDefaultMobileTheme) === 'string') { this.MobileTheme = sDefaultMobileTheme; } }, /** * Updates admin login from settings tab in admin panel. * * @param {string} sAdminLogin Admin login. * @param {boolean} bAdminHasPassword */ updateSecurity: function (sAdminLogin, bAdminHasPassword) { this.AdminHasPassword = bAdminHasPassword; this.AdminLogin = sAdminLogin; }, /** * Updates settings from db settings tab in admin panel. * * @param {string} sDbLogin Database login. * @param {string} sDbName Database name. * @param {string} sDbHost Database host. */ updateDb: function (sDbLogin, sDbName, sDbHost) { this.DbHost = sDbHost; this.DbLogin = sDbLogin; this.DbName = sDbName; this.dbSettingsChanged(true); } }; Settings.init(AppData); module.exports = Settings; /***/ }), /***/ "HCAJ": /*!*********************************************!*\ !*** ./modules/CoreWebclient/js/Storage.js ***! \*********************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var $ = __webpack_require__(/*! jquery */ "M4cL"); /** * Object for saving and restoring data in local storage or cookies. * * @constructor */ function CStorage() { this.bHtml5 = true; this.init(); } /** * Returns **true** if data with specified key exists in the storage. * * @param {string} sKey * @returns {boolean} */ CStorage.prototype.hasData = function (sKey) { var sValue = this.bHtml5 ? localStorage.getItem(sKey) : $.cookie(sKey); return !!sValue; }; /** * Returns value of data with specified key from the storage. * * @param {string} sKey * @returns {string|number|Object} */ CStorage.prototype.getData = function (sKey) { var sValue = this.bHtml5 ? localStorage.getItem(sKey) : $.cookie(sKey), oResult = '' ; try { oResult = $.parseJSON(sValue); } catch (oException) { } return oResult; }; /** * Sets value of data with specified key to the storage. * * @param {string} sKey * @param {string|number|Object} mValue */ CStorage.prototype.setData = function (sKey, mValue) { var sValue = JSON.stringify(mValue); if (this.bHtml5) { localStorage.setItem(sKey, sValue); } else { $.cookie(sKey, sValue, { expires: 30 }); } }; /** * Removes data with specified key from the storage. * * @param {srting} sKey */ CStorage.prototype.removeData = function (sKey) { if (this.bHtml5) { localStorage.removeItem(sKey); } else { $.cookie(sKey, null); } }; /** * Initializes the object for work with local storage or cookie. */ CStorage.prototype.init = function () { if (typeof Storage === 'undefined') { this.bHtml5 = false; } else { try { localStorage.setItem('aurora_core_check', 'aurora'); localStorage.removeItem('aurora_core_check'); } catch (err) { this.bHtml5 = false; } } }; CStorage.prototype.replaceStorageDataKey = function(oldKey, newKey) { let data = this.getData(oldKey); if (data) { this.removeData(oldKey); if (oldKey === 'MessageDetailsVisible') { data = data === '1'; } if (newKey) { this.setData(newKey, data); } } }; CStorage.prototype.convertStorageData = function(userId, AccountList) { const convertMap = [ { old: 'showNewTimezone', new: 'aurora_core_browser-timezone' }, { old: 'folderAccordionCleared', new: '' }, { old: 'message_listResizerWidth', new: 'aurora_mail_resizer-width' }, { old: 'folder_2pane_listResizerWidth', new: 'aurora_mail_hr_folders_resizer-width' }, { old: 'message_2pane_listResizerWidth', new: 'aurora_mail_hr_messages_resizer-width' }, { old: 'compose_attachmentsResizerWidth', new: 'aurora_mail_compose_resizer-width' }, { old: 'contact_listResizerWidth', new: 'aurora_contacts_resizer-width' }, { old: 'files_listResizerWidth', new: 'aurora_files_resizer-width' }, { old: 'files_list1ResizerWidth', new: 'aurora_files_preview_resizer-width' }, { old: 'calendarResizerWidth', new: 'aurora_calendar_resizer-width' }, { old: 'tasks_listResizerWidth', new: 'aurora_tasks_resizer-width' }, { old: 'sendersExpanded', new: 'aurora_custom_senders-expanded' }, { old: 'moveMessagesHistoryData', new: 'aurora_custom_move-messages-history-data' }, { old: 'MailtoAsked', new: 'aurora_mail_is-mailto-asked' }, { old: 'MessageDetailsVisible', new: 'aurora_mail_is-message-details-visible' } ]; convertMap.forEach(dataKeys => { this.replaceStorageDataKey(dataKeys.old, dataKeys.new); }); this.replaceStorageDataKey(`user_${userId}_cryptoKeyEncrypted`, `aurora_paranoid_user_${userId}_encrypted-crypto-key`); this.replaceStorageDataKey(`user_${userId}_public-keys`, `aurora_openpgp_user_${userId}_public-keys`); this.replaceStorageDataKey(`user_${userId}_private-keys`, `aurora_openpgp_user_${userId}_private-keys`); if (AccountList) { this.replaceStorageDataKey('folderAccordion', `aurora_mail_account_${AccountList.currentId()}_expanded-folders`); AccountList.collection().forEach(account => { this.replaceStorageDataKey(`customSenderList-${account.id()}`, `aurora_custom_account_${account.id()}_sender-list`); }); } }; module.exports = new CStorage(); /***/ }), /***/ "mGms": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/WindowOpener.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), App = __webpack_require__(/*! modules/CoreWebclient/js/App.js */ "9kOp"), iDefaultRatio = 0.8, aOpenedWins = [] ; /** * @return string */ function GetSizeParameters() { var iScreenWidth = window.screen.width, iWidth = Math.ceil(iScreenWidth * iDefaultRatio), iLeft = Math.ceil((iScreenWidth - iWidth) / 2), iScreenHeight = window.screen.height, iHeight = Math.ceil(iScreenHeight * iDefaultRatio), iTop = Math.ceil((iScreenHeight - iHeight) / 2) ; return ',width=' + iWidth + ',height=' + iHeight + ',top=' + iTop + ',left=' + iLeft; } module.exports = { /** * @param {string} sUrl * @param {string=} sWinName * * @return Object */ openTab: function (sUrl, sWinName) { $.cookie('aft-cache-ctrl', '1'); var oWin = window.open(sUrl, '_blank'); if (oWin) { oWin.focus(); oWin.name = sWinName ? sWinName : (App.currentAccountId ? App.currentAccountId() : 0); aOpenedWins.push(oWin); } return oWin; }, /** * @param {string} sUrl * @param {string} sPopupName * @param {boolean=} bMenubar = false * * @return Object */ open: function (sUrl, sPopupName, bMenubar, sSize = '') { var sMenubar = (bMenubar) ? ',menubar=yes' : ',menubar=no', sParams = 'location=no,toolbar=no,status=no,scrollbars=yes,resizable=yes' + sMenubar, oWin = null ; sPopupName = sPopupName.replace(/\W/g, ''); // forbidden characters in the name of the window for ie sParams += sSize === '' ? GetSizeParameters() : sSize; oWin = window.open(sUrl, sPopupName, sParams); if (oWin) { oWin.focus(); oWin.name = App.currentAccountId ? App.currentAccountId() : 0; aOpenedWins.push(oWin); } return oWin; }, /** * Attempts to get the "origin" value for an opened window. * Returns false if this is not possible. * This means that the user has opened some other site in it. * @param {object} oWin * @returns {bool} */ isSameOrigin: function (oWin) { var sWinOrigin = ''; try { sWinOrigin = oWin.location.origin; } catch (oError) { // There is "accessing a cross-origin frame" error if something else was opened in the oWin tab console.log('The following error was catched:'); console.error(oError); } return window.location.origin === sWinOrigin; }, /** * @returns {Array} */ getOpenedWindows: function () { aOpenedWins = _.filter(aOpenedWins, function (oWin) { return this.isSameOrigin(oWin) && !oWin.closed; }.bind(this)); return aOpenedWins; }, closeAll: function () { _.each(aOpenedWins, function (oWin) { // Check of windows origin doesn't work in unload event handler, so it is moved to onbeforeunload event handler if (!oWin.closed) { oWin.close(); } }); aOpenedWins = []; } }; /***/ }), /***/ "BN3r": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/autocomplete.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var jQuery = __webpack_require__(/*! jquery */ "M4cL"); __webpack_require__(/*! jquery-ui/ui/widgets/autocomplete */ "yLoK"); (function ($) { /** * extend jQuery autocomplete */ // styling results $.ui.autocomplete.prototype._renderItem = function (ul, item) { item.label = item.label.replace(/\/g, '>'); let liClasses = []; if (item.disabled) { liClasses.push('disabled'); } if (item.groupId) { liClasses.push('menu-item-group'); } if (item.hasKey) { liClasses.push('menu-item-has-key'); } let liClass = liClasses.length > 0 ? ` class="${liClasses.join(' ')}"` : '', keyEl = item.hasKey ? '
' : '', groupEl = '', delEl = item.team || item.disabled || item.groupId ? '' : '
' ; if (item.isUserGroup) { groupEl = '
'; } if (item.isAllUsersGroup) { groupEl = '
'; } if (item.isContactGroup) { groupEl = '
'; } return $(`
`) .append(`
${groupEl}
${item.label}
${keyEl}${delEl}
`) .appendTo(ul); }; // add categories $.ui.autocomplete.prototype._renderMenu = function(ul, items) { var self = this, currentCategory = '' ; $.each(items, function(index, item) { if (item && item.category && item.category !== currentCategory) { currentCategory = item.category; ul.append('
' + item.category + '
'); } self._renderItemData(ul, item); }); }; // Prevent blur then you reach last/first element in list of suggestions $.ui.autocomplete.prototype._move = function(direction, event) { if ( !this.menu.element.is( ":visible" ) ) { this.search( null, event ); return; } if ( this.menu.isFirstItem() && /^previous/.test( direction )) { this._value( this.term ); this.menu._move( "first", "first", event ); } else if ( this.menu.isLastItem() && /^next/.test( direction )) { this._value( this.term ); this.menu._move( "last", "last", event ); } this.menu[ direction ]( event ); }; })(jQuery); module.exports = {}; /***/ }), /***/ "p/cB": /*!*******************************************!*\ !*** ./modules/CoreWebclient/js/enums.js ***! \*******************************************/ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), Enums = { has: function (sEnumName, mFoundValue) { return !!_.find(window.Enums[sEnumName], function (mValue) { return mFoundValue === mValue; }); } } ; /** * @enum {number} */ Enums.Key = { 'Backspace': 8, 'Tab': 9, 'Enter': 13, 'Shift': 16, 'Ctrl': 17, 'Alt': 18, 'Esc': 27, 'Space': 32, 'PageUp': 33, 'PageDown': 34, 'End': 35, 'Home': 36, 'Up': 38, 'Down': 40, 'Left': 37, 'Right': 39, 'Del': 46, 'Six': 54, 'a': 65, 'b': 66, 'c': 67, 'f': 70, 'i': 73, 'k': 75, 'n': 78, 'p': 80, 'q': 81, 'r': 82, 's': 83, 'u': 85, 'v': 86, 'y': 89, 'z': 90, 'F5': 116, 'Comma': 188, 'Dot': 190, 'Dash': 192, 'Apostrophe': 222 }; /** * @enum {number} */ Enums.Errors = { 'InvalidToken': 101, 'AuthError': 102, 'DataBaseError': 104, 'LicenseProblem': 105, 'DemoLimitations': 106, 'Captcha': 107, 'AccessDenied': 108, 'UserAlreadyExists': 111, 'SystemNotConfigured': 112, 'LicenseLimit': 115, 'CanNotChangePassword': 502, 'AccountOldPasswordNotCorrect': 1020, 'AccountAlreadyExists': 704, 'HelpdeskThrowInWebmail': 805, 'HelpdeskUserNotExists': 807, 'HelpdeskUserNotActivated': 808, 'IncorrectFileExtension': 811, 'CanNotUploadFileQuota': 812, 'FileAlreadyExists': 813, 'FileNotFound': 814, 'CanNotUploadFileLimit': 815, 'DataTransferFailed': 1100, 'NotDisplayedError': 1155 }; Enums.SortOrder = { 'Asc': 0, 'Desc': 1 }; Enums.MobilePanel = { 'Groups': 1, 'Items': 2, 'View': 3 }; /** * @enum {number} */ Enums.TimeFormat = { 'F24': '0', 'F12': '1' }; /** * @enum {number} */ Enums.UserRole = UserSettings.EUserRole; if (typeof window.Enums === 'undefined') { window.Enums = {}; } _.extendOwn(window.Enums, Enums); /***/ }), /***/ "/FUc": /*!************************************************!*\ !*** ./modules/CoreWebclient/js/koBindings.js ***! \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), Browser = __webpack_require__(/*! modules/CoreWebclient/js/Browser.js */ "dfnr") ; ko.bindingHandlers.avatarIcon = { 'init': function (oElement, fValueAccessor) { var oCommand = _.defaults( fValueAccessor(), { 'image': '', 'label': '', 'color': '#ccc' } ); $(oElement).css('background-color', oCommand.color); if (oCommand.image) { $('
').appendTo(oElement).css('background', 'url(' + oCommand.image + ') center/cover no-repeat'); } else if (oCommand.label[0]) { $(oElement).append('
'+oCommand.label[0].toUpperCase()+'
'); } } }; ko.bindingHandlers.i18n = { 'init': function (oElement, fValueAccessor) { var oCommand = fValueAccessor(), sKey = oCommand.key, sType = oCommand.type || 'text', sValue = TextUtils.i18n(sKey) ; if ('' !== sValue) { switch (sType) { case 'html': $(oElement).html(sValue); break; case 'placeholder': $(oElement).attr({'placeholder': sValue}); break; case 'text': default: $(oElement).text(sValue); break; } } } }; ko.bindingHandlers.dropdown = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var jqElement = $(oElement), oCommand = _.defaults( fValueAccessor(), { 'disabled': 'disabled', 'expand': 'expand', 'control': true, 'container': '.dropdown_content', 'scrollToTopContainer': '.scroll-inner', 'passClick': true, 'trueValue': true } ), bControl = typeof oCommand['control'] === 'function' ? oCommand['control']() : oCommand['control'], jqControl = jqElement.find('.control'), jqDrop = jqElement.find('.dropdown'), jqDropHelper = jqElement.find('.dropdown_helper'), jqDropArrow = jqElement.find('.dropdown_arrow'), jqDropBottomArrow = jqElement.find('.dropdown_arrow.bottom_arrow'), bRightAligned = jqElement.hasClass('right'), oDocument = $(document), bScrollBar = false, oOffset, iLeft, iFitToScreenOffset, fCallback = function () { if (_.isFunction(oCommand['callback'])) { oCommand['callback'].call( oViewModel, jqElement.hasClass(oCommand['expand']) ? oCommand['trueValue'] : false, jqElement ); } }, fStop = function (event) { event.stopPropagation(); }, fScrollToTop = function () { if (oCommand['scrollToTopContainer']) { jqElement.find(oCommand['scrollToTopContainer']).scrollTop(0); } }, fToggleExpand = function (bValue) { if (bValue === undefined) { bValue = !jqElement.hasClass(oCommand['expand']); } if (!bValue && jqElement.hasClass(oCommand['expand'])) { fScrollToTop(); } jqElement.toggleClass(oCommand['expand'], bValue); if (jqDropBottomArrow.length > 0 && jqElement.hasClass(oCommand['expand'])) { jqDrop.css({ 'top': (jqElement.position().top - jqDropHelper.height()) + 'px', 'left': jqElement.position().left + 'px', 'width': 'auto' }); } }, fFitToScreen = function (iOffsetLeft) { oOffset = jqDropHelper.offset(); if (oOffset) { iLeft = oOffset.left + 10; iFitToScreenOffset = $(window).width() - (iLeft + jqDropHelper.outerWidth(true)); if (iFitToScreenOffset > 0) { iFitToScreenOffset = 0; } if (!bRightAligned) { jqDropHelper.css('left', iOffsetLeft || iFitToScreenOffset + 'px'); jqDropArrow.css('left', iOffsetLeft || Math.abs(iFitToScreenOffset ? iFitToScreenOffset + Types.pInt(jqDropArrow.css('margin-left')) : 0) + 'px'); } } }, fControlClick = function (oEv) { var jqDropdownParent = $(oEv.originalEvent.originalTarget).parents('.dropdown'), bHasDropdownParent = jqDropdownParent.length > 0 ; if (!bHasDropdownParent && !jqElement.hasClass(oCommand['disabled']) && !bScrollBar) { fToggleExpand(); _.defer(function () { fCallback(); }); if (jqElement.hasClass(oCommand['expand'])) { if (oCommand['close'] && oCommand['close']['subscribe']) { oCommand['close'](true); } _.defer(function () { oDocument.on('click.dropdown', function (ev) { var iMouseRightClick = 2; if((oCommand['passClick'] || ev.button !== iMouseRightClick) && !bScrollBar) { oDocument.unbind('click.dropdown'); if (oCommand['close'] && oCommand['close']['subscribe']) { oCommand['close'](false); } fToggleExpand(false); fCallback(); fFitToScreen(0); } bScrollBar = false; }); }); fFitToScreen(); } } } ; jqElement.off(); jqControl.off(); if (!oCommand['passClick']) { jqElement.find(oCommand['container']).on('click', fStop); jqElement.on('click', fStop); jqControl.on('click', fStop); } fToggleExpand(false); if (oCommand['close'] && oCommand['close']['subscribe']) { oCommand['close'].subscribe(function (bValue) { if (!bValue) { oDocument.unbind('click.dropdown'); fToggleExpand(false); } fCallback(); }); } jqElement.on('mousedown', function (oEv, oEl) { bScrollBar = ($(oEv.target).hasClass('customscroll-scrollbar') || $(oEv.target.parentElement).hasClass('customscroll-scrollbar')); }); jqElement.on('click', function (oEv) { if (!bControl) { fControlClick(oEv); } }); jqControl.on('click', function (oEv) { if (bControl) { fControlClick(oEv); } }); fFitToScreen(0); } }; ko.bindingHandlers.initDom = { 'init': function (oElement, fValueAccessor) { var oCommand = fValueAccessor(); if (oCommand) { oCommand($(oElement)); } } }; ko.bindingHandlers.command = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var jqElement = $(oElement), oCommand = fValueAccessor() ; if (!oCommand || !oCommand.enabled || !oCommand.canExecute) { throw new Error('You are not using command function'); } jqElement.addClass('command'); ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments); }, 'update': function (oElement, fValueAccessor) { var bResult = true, jqElement = $(oElement), oCommand = fValueAccessor() ; bResult = oCommand.enabled(); jqElement.toggleClass('command-not-enabled', !bResult); if (bResult) { bResult = oCommand.canExecute(); jqElement.toggleClass('unavailable', !bResult); } jqElement.toggleClass('command-disabled disable disabled', !bResult); jqElement.toggleClass('enable', bResult); } }; function deferredUpdate(element, state, duration, callback) { if (!element.__interval && !!state) { element.__state = true; callback(element, true); element.__interval = window.setInterval(function () { if (!element.__state) { callback(element, false); window.clearInterval(element.__interval); element.__interval = null; } }, duration); } else if (!state) { element.__state = false; } }; ko.bindingHandlers.checkstate = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { var oOptions = oElement.oOptions || null, jqElement = oElement.jqElement || null, oIconIE = oElement.oIconIE || null, values = fValueAccessor(), state = values.state ; if (values.state !== undefined) { if (!jqElement) { oElement.jqElement = jqElement = $(oElement); } if (!oOptions) { oElement.oOptions = oOptions = _.defaults( values, { 'activeClass': 'process', 'duration': 800 } ); } deferredUpdate(jqElement, state, oOptions['duration'], function (element, state) { if (Browser.ie9AndBelow) { if (!oIconIE) { oElement.oIconIE = oIconIE = jqElement.find('.icon'); } if (!oIconIE.__intervalIE && !!state) { var i = 0, style = '' ; oIconIE.__intervalIE = setInterval(function () { style = '0px -' + (20 * i) + 'px'; i = i < 7 ? i + 1 : 0; oIconIE.css({'background-position': style}); }, 1000/12); } else { oIconIE.css({'background-position': '0px 0px'}); clearInterval(oIconIE.__intervalIE); oIconIE.__intervalIE = null; } } else { element.toggleClass(oOptions['activeClass'], state); } }); } } }; ko.bindingHandlers.heightAdjust = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) { var jqElement = oElement.jqElement || null, height = 0, sLocation = fValueAccessor().location, sDelay = fValueAccessor().delay || 400 ; if (!jqElement) { oElement.jqElement = jqElement = $(oElement); } _.delay(function () { _.each(fValueAccessor().elements, function (mItem) { var element = mItem(); if (element) { height += element.is(':visible') ? element.outerHeight() : 0; } }); if (sLocation === 'top' || sLocation === undefined) { jqElement.css({ 'padding-top': height, 'margin-top': -height }); } else if (sLocation === 'bottom') { jqElement.css({ 'padding-bottom': height, 'margin-bottom': -height }); } }, sDelay); } }; ko.bindingHandlers.minHeightAdjust = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) { var jqEl = $(oElement), oOptions = fValueAccessor(), jqAdjustEl = oOptions.adjustElement || $('body'), iMinHeight = oOptions.minHeight || 0 ; if (oOptions.removeTrigger) { jqAdjustEl.css('min-height', 'inherit'); } if (oOptions.trigger) { _.delay(function () { jqAdjustEl.css({'min-height': jqEl.outerHeight(true) + iMinHeight}); }, 100); } } }; ko.bindingHandlers.listWithMoreButton = { 'init': function (oElement, fValueAccessor) { var $Element = $(oElement); $Element.resize(function () { var $ItemsVisible = $Element.find('span.hotkey'), $ItemsHidden = $Element.find('span.item'), $MoreHints = $Element.find('span.more_hints').show(), iElementWidth = $Element.width(), iMoreWidth = $MoreHints.width(), bHideMoreHints = true ; _.each($ItemsVisible, function (oItem, index) { var $Item = $(oItem), iItemWidth = $Item.width() ; if ($Item && !$Item.hasClass('not-display')) { if (bHideMoreHints && iMoreWidth + iItemWidth < iElementWidth) { $Item.show(); $($ItemsHidden[index]).hide(); iMoreWidth += iItemWidth; } else { bHideMoreHints = false; $Item.hide(); $($ItemsHidden[index]).show(); } } }); if (bHideMoreHints) { $MoreHints.hide(); } }); } }; ko.bindingHandlers.onEnter = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { $(oElement).on('keydown', function (oEvent) { if (oEvent.keyCode === Enums.Key.Enter) { $(oElement).trigger('change'); // sometimes nockoutjs doesn't see changes here in FF (maybe because of saved passwords functionality) // so we put new value in observable variable if (fAllBindingsAccessor() && fAllBindingsAccessor().value) { fAllBindingsAccessor().value($(oElement).val()); } var mResult = fValueAccessor().call(oViewModel); if (typeof mResult === 'boolean') { return mResult; } } }); } }; ko.bindingHandlers.onFocusSelect = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { $(oElement).on('focus', function (oEvent) { oElement.select(); }); } }; //helpdesk ko.bindingHandlers.watchWidth = { 'init': function (oElement, fValueAccessor) { var bTriggered = false; if (!bTriggered) { fValueAccessor().subscribe(function () { fValueAccessor()($(oElement).outerWidth()); bTriggered = true; }, this); } } }; //files ko.bindingHandlers.columnCalc = { 'init': function (oElement, fValueAccessor) { var $oElement = $(oElement), oProp = fValueAccessor()['prop'], $oItem = null, iWidth = 0 ; $oItem = $oElement.find(fValueAccessor()['itemSelector']); if ($oItem[0] === undefined) { return; } iWidth = $oItem.outerWidth(true); iWidth = 1 >= iWidth ? 1 : iWidth; if (oProp) { $(window).bind('resize', function () { var iW = $oElement.width(); oProp(0 < iW ? Math.floor(iW / iWidth) : 1); }); } } }; //settings ko.bindingHandlers.adjustHeightToContent = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { var jqEl = $(oElement), jqTargetEl = null, jqParentEl = null, jqNearEl = null ; _.delay(_.bind(function(){ var oTitles = jqEl.find('.title .text'); if (oTitles.length > 0) { jqTargetEl = $(_.max(oTitles, function(domEl){ return domEl.offsetWidth; })); jqParentEl = jqTargetEl.parent(); jqNearEl = jqParentEl.find('.icon'); jqEl.css('min-width', Types.pInt(jqParentEl.css("margin-left")) + Types.pInt(jqParentEl.css("padding-left")) + Types.pInt(jqNearEl.width()) + Types.pInt(jqNearEl.css("margin-left")) + Types.pInt(jqNearEl.css("margin-right")) + Types.pInt(jqNearEl.css("padding-left")) + Types.pInt(jqNearEl.css("padding-right")) + Types.pInt(jqTargetEl.width()) + Types.pInt(jqTargetEl.css("margin-left")) + Types.pInt(jqTargetEl.css("padding-left")) + 10 ); } },this), 1); } }; module.exports = {}; /***/ }), /***/ "2kH5": /*!*********************************************************!*\ !*** ./modules/CoreWebclient/js/koBindingsNotMobile.js ***! \*********************************************************/ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var ko = __webpack_require__(/*! knockout */ "p09A"), _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), Utils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Common.js */ "REt5"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), Browser = __webpack_require__(/*! modules/CoreWebclient/js/Browser.js */ "dfnr"), Storage = __webpack_require__(/*! modules/CoreWebclient/js/Storage.js */ "HCAJ"), Splitter = __webpack_require__(/*! modules/CoreWebclient/js/vendors/split.js */ "QD3V") ; __webpack_require__(/*! jquery-ui/ui/widgets/droppable */ "O/kJ"); __webpack_require__(/*! jquery-ui/ui/widgets/draggable */ "6gxe"); __webpack_require__(/*! jquery-ui/ui/widgets/autocomplete */ "yLoK"); __webpack_require__(/*! modules/CoreWebclient/js/vendors/customscroll.js */ "1kC8"); __webpack_require__(/*! modules/CoreWebclient/js/autocomplete.js */ "BN3r"); ko.bindingHandlers.splitterFlex = { 'valiateStorageData': function (aData, aDefaultValue) { if ((!_.isArray(aData) || _.contains(aData, 0) || _.contains(aData, null) || _.contains(aData, NaN)) && _.isArray(aDefaultValue)) { aData = aDefaultValue; } return aData; }, 'init': function (oElement, fValueAccessor) { _.defer(function() { //https://nathancahill.github.io/Split.js/ var oCommand = Object.assign({ minSize : 200, sizes: [20, 80], storagePrefix: '' }, fValueAccessor()), storageKey = `${oCommand['storagePrefix']}resizer-width`, aInitSizes = ko.bindingHandlers.splitterFlex.valiateStorageData(Storage.getData(storageKey), oCommand['sizes']), gutterCallback = function (i, gutterDirection) { var elGutter = document.createElement('div'); elGutter.appendChild(document.createElement('div')); elGutter.className = "gutter gutter-" + gutterDirection; return elGutter; }, oSplitter = null, aElements = [].slice.call(oElement.children), oSplitterParams = { minSize: oCommand['minSize'], gutterSize: 0, gutter: gutterCallback, onDragEnd: function () { Storage.setData(storageKey, oSplitter.getSizes()); if (oCommand.expandSecondPaneWidth) { oCommand.expandSecondPaneWidth(false); } if (oCommand.expandThirdPaneWidth) { oCommand.expandThirdPaneWidth(false); } } } ; if (_.isArray(aInitSizes)) { oSplitterParams['sizes'] = aInitSizes; } if (oCommand['direction'] && oCommand['direction'] === 'vertical') { oSplitterParams['direction'] = 'vertical'; } oSplitter = Splitter(aElements, oSplitterParams); function _setPrevSizes() { var secondPaneExpanded = oCommand.expandSecondPaneWidth && oCommand.expandSecondPaneWidth(), thirdPaneExpanded = oCommand.expandThirdPaneWidth && oCommand.expandThirdPaneWidth() ; if (!secondPaneExpanded && !thirdPaneExpanded) { var aPrevSizes = Storage.getData(storageKey); if (_.isArray(aPrevSizes)) { oSplitter.setSizes(aPrevSizes); } } } var collapsedPercent = 1; if (oCommand.expandSecondPaneWidth) { oCommand.expandSecondPaneWidth.subscribe(function () { if (oCommand.expandThirdPaneWidth) { oCommand.expandThirdPaneWidth(false); } var aSizes = oSplitter.getSizes(); if (oCommand.expandSecondPaneWidth()) { oSplitter.setSizes([aSizes[0], 100 - collapsedPercent - aSizes[0], collapsedPercent]); } else { _setPrevSizes(); } }); } if (oCommand.expandThirdPaneWidth) { oCommand.expandThirdPaneWidth.subscribe(function () { if (oCommand.expandSecondPaneWidth) { oCommand.expandSecondPaneWidth(false); } var aSizes = oSplitter.getSizes(); if (oCommand.expandThirdPaneWidth()) { oSplitter.setSizes([aSizes[0], collapsedPercent, 100 - collapsedPercent - aSizes[0]]); } else { _setPrevSizes(); } }); } }); } }; ko.bindingHandlers.customScrollbar = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var jqElement = $(oElement), oCommand = _.defaults(fValueAccessor(), { 'oScroll' : null, 'scrollToTopTrigger': null, 'scrollToBottomTrigger': null, 'scrollTo': null }), oScroll = null ; oCommand = /** @type {{scrollToTopTrigger:{subscribe:Function},scrollToBottomTrigger:{subscribe:Function},scrollTo:{subscribe:Function},reset:Function}}*/ oCommand; jqElement.addClass('scroll-wrap').customscroll(oCommand); oScroll = jqElement.data('customscroll'); if (oCommand['oScroll'] && _.isFunction(oCommand['oScroll'].subscribe)) { oCommand['oScroll'](oScroll); } else { oCommand['oScroll'] = oScroll; } if (!oCommand.reset) { oElement._customscroll_reset = _.throttle(function () { oScroll.reset(); }, 100); } if (oCommand['scrollToTopTrigger'] && _.isFunction(oCommand.scrollToTopTrigger.subscribe)) { oCommand.scrollToTopTrigger.subscribe(function () { if (oScroll) { oScroll['scrollToTop'](); } }); } if (oCommand['scrollToBottomTrigger'] && _.isFunction(oCommand.scrollToBottomTrigger.subscribe)) { oCommand.scrollToBottomTrigger.subscribe(function () { if (oScroll) { oScroll['scrollToBottom'](); } }); } if (oCommand['scrollTo'] && _.isFunction(oCommand.scrollTo.subscribe)) { oCommand.scrollTo.subscribe(function () { if (oScroll) { oScroll['scrollTo'](oCommand.scrollTo()); } }); } }, 'update': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { if (oElement._customscroll_reset) { oElement._customscroll_reset(); } if (fValueAccessor().top) { $(oElement).data('customscroll')['vertical'].set(fValueAccessor().top); } } }; function removeActiveFocus() { if (document && document.activeElement && document.activeElement.blur) { var oA = $(document.activeElement); if (oA.is('input') || oA.is('textarea')) { document.activeElement.blur(); } } } ko.bindingHandlers.draggable = { 'init': function (oElement, fValueAccessor) { $(oElement).attr('draggable', ko.utils.unwrapObservable(fValueAccessor())); } }; ko.bindingHandlers.draggablePlace = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { if (fValueAccessor() === null) { if ($(oElement).draggable()) { $(oElement).draggable('destroy'); } return null; } var oAllBindingsAccessor = fAllBindingsAccessor ? fAllBindingsAccessor() : null; $(oElement).draggable({ 'distance': 20, 'handle': '.dragHandle', 'cursorAt': {'top': 0, 'left': 0}, 'helper': function (oEvent) { var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0, ctrlOrCmdUsed = isMac ? oEvent.metaKey : oEvent.ctrlKey ; if (isMac && oEvent.ctrlKey) { return $('
'); } return fValueAccessor().apply(oViewModel, oEvent && oEvent.target ? [ko.dataFor(oEvent.target), ctrlOrCmdUsed] : null); }, 'start': (oAllBindingsAccessor && oAllBindingsAccessor['draggableDragStartCallback']) ? oAllBindingsAccessor['draggableDragStartCallback'] : function () {}, 'stop': (oAllBindingsAccessor && oAllBindingsAccessor['draggableDragStopCallback']) ? oAllBindingsAccessor['draggableDragStopCallback'] : function () {} }).on('mousedown', function () { removeActiveFocus(); }); } }; ko.bindingHandlers.droppable = { 'update': function (oElement, fValueAccessor) { var oOptions = fValueAccessor(), fValueFunc = oOptions.valueFunc, fSwitchObserv = oOptions.switchObserv ; if (!_.isFunction(fValueFunc)) { if ($(oElement).droppable()) { $(oElement).droppable('destroy'); } return; } $(oElement).droppable({ 'hoverClass': 'droppableHover', 'drop': function (oEvent, oUi) { fValueFunc(oEvent, oUi); } }); if (fSwitchObserv) { fSwitchObserv.subscribe(function (bIsSelected) { if($(oElement).data().uiDroppable) { if(bIsSelected) { $(oElement).droppable('disable'); } else { $(oElement).droppable('enable'); } } }, this); fSwitchObserv.valueHasMutated(); } } }; ko.bindingHandlers.quickReplyAnim = { 'update': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { var jqTextarea = oElement.jqTextarea || null, jqStatus = oElement.jqStatus || null, jqButtons = oElement.jqButtons || null, jqElement = oElement.jqElement || null, oPrevActions = oElement.oPrevActions || null, values = fValueAccessor(), oActions = null ; oActions = _.defaults( values, { 'saveAction': false, 'sendAction': false, 'activeAction': false } ); if (!jqElement) { oElement.jqElement = jqElement = $(oElement); oElement.jqTextarea = jqTextarea = jqElement.find('textarea'); oElement.jqStatus = jqStatus = jqElement.find('.status'); oElement.jqButtons = jqButtons = jqElement.find('.buttons'); oElement.oPrevActions = oPrevActions = { 'saveAction': null, 'sendAction': null, 'activeAction': null }; } if (true) { if (Browser.ie9AndBelow) { if (jqTextarea && !jqElement.defualtHeight && !jqTextarea.defualtHeight) { jqElement.defualtHeight = jqElement.outerHeight(); jqTextarea.defualtHeight = jqTextarea.outerHeight(); jqStatus.defualtHeight = jqButtons.outerHeight(); jqButtons.defualtHeight = jqButtons.outerHeight(); } _.defer(function () { var activeChanged = oPrevActions.activeAction !== oActions['activeAction'], sendChanged = oPrevActions.sendAction !== oActions['sendAction'], saveChanged = oPrevActions.saveAction !== oActions['saveAction'] ; if (activeChanged) { if (oActions['activeAction']) { jqTextarea.animate({ 'height': jqTextarea.defualtHeight + 50 }, 300); jqElement.animate({ 'max-height': jqElement.defualtHeight + jqButtons.defualtHeight + 50 }, 300); } else { jqTextarea.animate({ 'height': jqTextarea.defualtHeight }, 300); jqElement.animate({ 'max-height': jqElement.defualtHeight }, 300); } } if (sendChanged || saveChanged) { if (oActions['sendAction']) { jqElement.animate({ 'max-height': '30px' }, 300); jqStatus.animate({ 'max-height': '30px', 'opacity': 1 }, 300); } else if (oActions['saveAction']) { jqElement.animate({ 'max-height': 0 }, 300); } else { jqElement.animate({ 'max-height': jqElement.defualtHeight + jqButtons.defualtHeight + 50 }, 300); jqStatus.animate({ 'max-height': 0, 'opacity': 0 }, 300); } } }); } else { jqElement.toggleClass('saving', oActions['saveAction']); jqElement.toggleClass('sending', oActions['sendAction']); jqElement.toggleClass('active', oActions['activeAction']); } } _.defer(function () { oPrevActions = oActions; }); } }; ko.bindingHandlers.onCtrlEnter = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var $Element = $(oElement); $Element.on('keydown', function (oEvent) { if (oEvent.ctrlKey && oEvent.keyCode === Enums.Key.Enter) { $Element.trigger('change'); fValueAccessor().call(oViewModel); } }); } }; ko.bindingHandlers.onEsc = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var $Element = $(oElement); $Element.on('keydown', function (oEvent) { if (oEvent.keyCode === Enums.Key.Esc) { $Element.trigger('change'); fValueAccessor().call(oViewModel); } }); } }; ko.bindingHandlers.autocompleteSimple = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel, bindingContext) { var jqEl = $(oElement), oOptions = fValueAccessor(), fCallback = oOptions['callback'], fDataAccessor = oOptions.dataAccessor ? oOptions.dataAccessor : Utils.emptyFunction(), fDelete = function () { fDeleteAccessor(oSelectedItem); var oAutocomplete = jqEl.data('customAutocomplete') || jqEl.data('uiAutocomplete') || jqEl.data('autocomplete') || jqEl.data('ui-autocomplete'); $.ui.autocomplete.prototype.__response.call(oAutocomplete, _.filter(aSourceResponseItems, function (oItem) { return oItem.value !== oSelectedItem.value; })); }, aSourceResponseItems = null, oSelectedItem = null ; if (fCallback && jqEl && jqEl[0]) { jqEl.autocomplete({ 'minLength': 1, 'autoFocus': true, 'position': { collision: "flip" //prevents the escape off the screen }, 'source': function (oRequest, fSourceResponse) { fCallback(oRequest, function (oItems) { //additional layer for story oItems aSourceResponseItems = oItems; fSourceResponse(oItems); }); }, 'focus': function (oEvent, oItem) { if (!oItem.item || oItem.item.disabled) { return false; } else { oSelectedItem = oItem.item; return true; } }, 'open': function (oEvent, oItem) { $(jqEl.autocomplete('widget')).find('span.del').on('click', function(oEvent, oItem) { Utils.calmEvent(oEvent); fDelete(); }); }, 'select': function (oEvent, oItem) { if (!oItem.item || oItem.item.disabled) { return false; } else { _.delay(function () { jqEl.trigger('change'); }, 5); fDataAccessor(oItem.item); return true; } } }).on('click', function(oEvent, oItem) { if (jqEl.val() === '') { if (!$(jqEl.autocomplete('widget')).is(':visible')) { jqEl.autocomplete("option", "minLength", 0); //for triggering search on empty field jqEl.autocomplete("search"); jqEl.autocomplete("option", "minLength", 1); } else { jqEl.autocomplete("close"); } } }).on('keydown', function(oEvent, oItem) { if (aSourceResponseItems && oSelectedItem && !oSelectedItem.global && oEvent.keyCode === Enums.Key.Del && oEvent.shiftKey) //shift+del on suggestions list { Utils.calmEvent(oEvent); fDelete(); } }); var oAutocomplete = jqEl.data('customAutocomplete') || jqEl.data('uiAutocomplete') || jqEl.data('autocomplete') || jqEl.data('ui-autocomplete'); if (oAutocomplete) { if (_.isFunction(oOptions.renderItem)) { oAutocomplete._renderItem = oOptions.renderItem; } oAutocomplete._resizeMenu = function () { var oUl = this.menu.element; oUl.outerWidth(this.element.outerWidth()); }; } jqEl.autocomplete('widget').addClass('autocomplete-simple'); } } }; ko.bindingHandlers.customSelect = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var jqElement = $(oElement), oCommand = _.defaults( fValueAccessor(), { 'disabled': 'disabled', 'selected': 'selected', 'expand': 'expand', 'control': true, 'input': false, 'expandState': function () {}, 'options': [], 'optionsValue': 'value', 'optionsText': 'text', 'timeOptions': null, } ), aOptions = [], oControl = oCommand['control'] ? jqElement.find('.control') : jqElement, oContainer = jqElement.find('.dropdown_content'), oText = jqElement.find('.link'), updateField = function (value) { const options = ko.isObservable(oCommand['options']) ? oCommand['options']() : oCommand['options']; _.each(aOptions, function (item) { item.removeClass(oCommand['selected']); }); var item = _.find(options, function (item) { return item[oCommand['optionsValue']] === value; }); if (!item) { item = options[0]; } else { aOptions[_.indexOf(options, item)].addClass(oCommand['selected']); oText.text(TextUtils.trim(item[oCommand['optionsText']])); } return item[oCommand['optionsValue']]; }, updateList = function () { oContainer.empty(); aOptions = []; _.each(ko.isObservable(oCommand['options']) ? oCommand['options']() : oCommand['options'], function (item) { var oOption = $('
') .text(item[oCommand['optionsText']]) .data('value', item[oCommand['optionsValue']]) ; oOption.data('isDisabled', item['isDisabled']).toggleClass('disabled', !!item['isDisabled']); aOptions.push(oOption); oContainer.append(oOption); }, this); } ; updateList(); oContainer.on('click', '.item', function () { var jqItem = $(this); if(!jqItem.data('isDisabled')) { oCommand['value'](jqItem.data('value')); } }); if (ko.isObservable(oCommand['value'])) { oCommand['value'].subscribe(function () { const mValue = updateField(oCommand['value']()); if (!oCommand['input'] && oCommand['value']() !== mValue) { oCommand['value'](mValue); } }, oViewModel); oCommand['value'].valueHasMutated(); } if (ko.isObservable(oCommand['options'])) { oCommand['options'].subscribe(function () { updateList(); }, oViewModel); } //TODO fix data-bind click jqElement.removeClass(oCommand['expand']); oControl.on('click', function () { if (!jqElement.hasClass(oCommand['disabled'])) { jqElement.toggleClass(oCommand['expand']); oCommand['expandState'](jqElement.hasClass(oCommand['expand'])); if (jqElement.hasClass(oCommand['expand'])) { var jqContent = jqElement.find('.dropdown_content'), jqSelected = jqContent.find('.selected') ; if (jqSelected.position()) { jqContent.scrollTop(0);// need for proper calculation position().top jqContent.scrollTop(jqSelected.position().top - 100);// 100 - hardcoded indent to the element in pixels } _.defer(function () { $(document).one('click', function () { jqElement.removeClass(oCommand['expand']); oCommand['expandState'](false); }); }); } } }); } }; /***/ }), /***/ "0zH2": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/koExtendings.js ***! \**************************************************/ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var ko = __webpack_require__(/*! knockout */ "p09A"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L") ; /** * @param {Object} oTarget * @returns {Object} */ ko.extenders.reversible = function (oTarget) { var mValue = oTarget(); oTarget.commit = function () { mValue = oTarget(); }; oTarget.revert = function () { oTarget(mValue); }; oTarget.commitedValue = function () { return mValue; }; oTarget.changed = function () { return mValue !== oTarget(); }; return oTarget; }; /** * @param {Object} oTarget * @param {Object} iOption * @returns {Object} */ ko.extenders.autoResetToFalse = function (oTarget, iOption) { oTarget.iTimeout = 0; oTarget.subscribe(function (bValue) { if (bValue) { window.clearTimeout(oTarget.iTimeout); oTarget.iTimeout = window.setTimeout(function () { oTarget.iTimeout = 0; oTarget(false); }, Types.pInt(iOption)); } }); return oTarget; }; //calendar ko.extenders.disableLinebreaks = function (oTarget, bDisable) { if (bDisable) { var oResult = ko.computed({ 'read': function () { return oTarget(); }, 'write': function(sNewValue) { oTarget(sNewValue.replace(/[\r\n\t]+/gm, ' ')); } }); oResult(oTarget()); return oResult; } return oTarget; }; /***/ }), /***/ "QaQG": /*!*****************************************************!*\ !*** ./modules/CoreWebclient/js/koOtherBindings.js ***! \*****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A") ; //js-in-html-template ko.bindingHandlers.simpleTemplate = { 'init': function (oElement, fValueAccessor) { var oEl = $(oElement); if (oEl.length > 0 && oEl.data('replaced') !== 'replaced') { oEl.html(oEl.html().replace(/<script(.*?)>/i, '')); oEl.data('replaced', 'replaced'); } } }; //gregwar-captcha ko.bindingHandlers.findFocused = { 'init': function (oElement) { var $oEl = $(oElement), $oInp = null ; $oInp = $oEl.find('.catch-focus'); if ($oInp && 1 === $oInp.length && $oInp[0]) { $oInp.on('blur', function () { $oEl.removeClass('focused'); }).on('focus', function () { $oEl.addClass('focused'); }); } } }; //gregwar-captcha ko.bindingHandlers.findFilled = { 'init': function (oElement) { var $oEl = $(oElement), $oInp = null, fFunc = null ; $oInp = $oEl.find('.catch-filled'); if ($oInp && 1 === $oInp.length && $oInp[0]) { fFunc = function () { $oEl.toggleClass('filled', '' !== $oInp.val()); }; fFunc(); _.delay(fFunc, 200); $oInp.on('change', fFunc); } } }; module.exports = {}; /***/ }), /***/ "hT1I": /*!*******************************************************!*\ !*** ./modules/CoreWebclient/js/popups/AlertPopup.js ***! \*******************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), ko = __webpack_require__(/*! knockout */ "p09A"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), CAbstractPopup = __webpack_require__(/*! modules/CoreWebclient/js/popups/CAbstractPopup.js */ "o1lX") ; /** * @constructor */ function CAlertPopup() { CAbstractPopup.call(this); this.alertDesc = ko.observable(''); this.closeCallback = null; this.popupHeading = ko.observable(''); this.okButtonText = ko.observable(TextUtils.i18n('COREWEBCLIENT/ACTION_OK')); } _.extendOwn(CAlertPopup.prototype, CAbstractPopup.prototype); CAlertPopup.prototype.PopupTemplate = 'CoreWebclient_AlertPopup'; /** * @param {string} sDesc * @param {Function=} fCloseCallback = null * @param {string=} sHeading = '' * @param {string=} sOkButtonText = 'Ok' */ CAlertPopup.prototype.onOpen = function (sDesc, fCloseCallback, sHeading, sOkButtonText) { this.alertDesc(sDesc); this.closeCallback = fCloseCallback || null; this.popupHeading(sHeading || ''); this.okButtonText(sOkButtonText || TextUtils.i18n('COREWEBCLIENT/ACTION_OK')); }; CAlertPopup.prototype.onEnterHandler = function () { this.cancelPopup(); }; CAlertPopup.prototype.cancelPopup = function () { if (_.isFunction(this.closeCallback)) { this.closeCallback(); } this.closePopup(); }; module.exports = new CAlertPopup(); /***/ }), /***/ "o1lX": /*!***********************************************************!*\ !*** ./modules/CoreWebclient/js/popups/CAbstractPopup.js ***! \***********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), ko = __webpack_require__(/*! knockout */ "p09A"), Popups = __webpack_require__(/*! modules/CoreWebclient/js/Popups.js */ "oUN1") ; function CAbstractPopup() { this.opened = ko.observable(false); this.$popupDom = null; } CAbstractPopup.prototype.PopupTemplate = ''; CAbstractPopup.prototype.openPopup = function (aParameters) { if (this.$popupDom && !this.opened()) { this.showPopup(); Popups.addPopup(this); } this.onOpen.apply(this, aParameters); }; CAbstractPopup.prototype.closePopup = function () { if (this.$popupDom && this.opened()) { this.hidePopup(); Popups.removePopup(this); this.onClose(); } }; CAbstractPopup.prototype.showPopup = function () { if (this.$popupDom && !this.opened()) { this.$popupDom.show(); this.opened(true); _.delay(_.bind(function() { if (this.$popupDom) { this.$popupDom.addClass('visible'); } }, this), 50); this.onShow(); } }; CAbstractPopup.prototype.hidePopup = function () { if (this.$popupDom && this.opened()) { this.$popupDom.hide(); this.opened(false); this.$popupDom.removeClass('visible').hide(); this.onHide(); } }; CAbstractPopup.prototype.cancelPopup = function () { this.closePopup(); }; CAbstractPopup.prototype.onEscHandler = function (oEvent) { this.cancelPopup(); }; CAbstractPopup.prototype.onEnterHandler = function () { }; CAbstractPopup.prototype.onBind = function () { }; CAbstractPopup.prototype.onOpen = function () { }; CAbstractPopup.prototype.onClose = function () { }; CAbstractPopup.prototype.onShow = function () { }; CAbstractPopup.prototype.onHide = function () { }; CAbstractPopup.prototype.onRoute = function (aParams) { }; module.exports = CAbstractPopup; /***/ }), /***/ "XeMN": /*!*********************************************************!*\ !*** ./modules/CoreWebclient/js/popups/ConfirmPopup.js ***! \*********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), ko = __webpack_require__(/*! knockout */ "p09A"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), CAbstractPopup = __webpack_require__(/*! modules/CoreWebclient/js/popups/CAbstractPopup.js */ "o1lX") ; /** * @constructor */ function CConfirmPopup() { CAbstractPopup.call(this); this.fConfirmCallback = null; this.confirmDesc = ko.observable(''); this.popupHeading = ko.observable(''); this.okButtonText = ko.observable(TextUtils.i18n('COREWEBCLIENT/ACTION_OK')); this.cancelButtonText = ko.observable(TextUtils.i18n('COREWEBCLIENT/ACTION_CANCEL')); this.shown = false; } _.extendOwn(CConfirmPopup.prototype, CAbstractPopup.prototype); CConfirmPopup.prototype.PopupTemplate = 'CoreWebclient_ConfirmPopup'; /** * @param {string} sDesc * @param {Function} fConfirmCallback * @param {string=} sHeading = '' * @param {string=} sOkButtonText = '' * @param {string=} sCancelButtonText = '' */ CConfirmPopup.prototype.onOpen = function (sDesc, fConfirmCallback, sHeading, sOkButtonText, sCancelButtonText) { this.confirmDesc(sDesc); this.popupHeading(sHeading || ''); this.okButtonText(sOkButtonText || TextUtils.i18n('COREWEBCLIENT/ACTION_OK')); this.cancelButtonText(sCancelButtonText || TextUtils.i18n('COREWEBCLIENT/ACTION_CANCEL')); if (_.isFunction(fConfirmCallback)) { this.fConfirmCallback = fConfirmCallback; } this.shown = true; }; CConfirmPopup.prototype.onHide = function () { this.shown = false; }; CConfirmPopup.prototype.onEnterHandler = function () { this.yesClick(); }; CConfirmPopup.prototype.yesClick = function () { if (this.shown && this.fConfirmCallback) { this.fConfirmCallback(true); } this.closePopup(); }; CConfirmPopup.prototype.cancelPopup = function () { if (this.fConfirmCallback) { this.fConfirmCallback(false); } this.closePopup(); }; module.exports = new CConfirmPopup(); /***/ }), /***/ "itIC": /*!************************************************!*\ !*** ./modules/CoreWebclient/js/screenList.js ***! \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; module.exports = { 'header': function () { return __webpack_require__(/*! modules/CoreWebclient/js/views/HeaderView.js */ "b3rV"); }, 'information': function () { return __webpack_require__(/*! modules/CoreWebclient/js/views/InformationView.js */ "XmZn"); } }; /***/ }), /***/ "kG5I": /*!***************************************************!*\ !*** ./modules/CoreWebclient/js/utils/Address.js ***! \***************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), AddressUtils = {} ; /** * Checks if specified email is correct. * * @param {string} sValue String to check. * * @return {boolean} */ AddressUtils.isCorrectEmail = function (sValue) { // \p{L} matches a single code point in the category "letter" const regex = /^[0-9A-Z"!#$%^{}`~&'+-=_./]+@[0-9\p{L}.-]+$/iu; return !!(sValue.match(regex)); }; /** * @param {string} sName * @param {string} sEmail * @returns {string} */ AddressUtils.getFullEmail = function (sName, sEmail) { var sFull = ''; if (sEmail.length > 0) { if (sName.length > 0) { if (AddressUtils.isCorrectEmail(sName) || sName.indexOf(',') !== -1) { sFull = '"' + sName + '" <' + sEmail + '>'; } else { sFull = sName + ' <' + sEmail + '>'; } } else { sFull = sEmail; } } else { sFull = sName; } return sFull; }; /** * Obtains Recipient-object which include "name", "email" and "fullEmail" fields from string. * * @param {string} sFullEmail String includes only name, only email or both name and email. * @param {boolean} bIgnoreQuotesInName * * @return {Object} */ AddressUtils.getEmailParts = function (sFullEmail, bIgnoreQuotesInName) { var iQuote1Pos = sFullEmail.indexOf('"'), iQuote2Pos = sFullEmail.indexOf('"', iQuote1Pos + 1), iLeftBrocketPos = sFullEmail.indexOf('<', iQuote2Pos), iPrevLeftBroketPos = -1, iRightBrocketPos = -1, sName = '', sEmail = '' ; while (iLeftBrocketPos !== -1) { iPrevLeftBroketPos = iLeftBrocketPos; iLeftBrocketPos = sFullEmail.indexOf('<', iLeftBrocketPos + 1); } iLeftBrocketPos = iPrevLeftBroketPos; iRightBrocketPos = sFullEmail.indexOf('>', iLeftBrocketPos + 1); if (iLeftBrocketPos === -1) { sEmail = TextUtils.trim(sFullEmail); } else { iQuote1Pos = bIgnoreQuotesInName ? -1 : iQuote1Pos; sName = (iQuote1Pos === -1) ? TextUtils.trim(sFullEmail.substring(0, iLeftBrocketPos)) : TextUtils.trim(sFullEmail.substring(iQuote1Pos + 1, iQuote2Pos)); sEmail = TextUtils.trim(sFullEmail.substring(iLeftBrocketPos + 1, iRightBrocketPos)); } return { 'name': sName, 'email': sEmail, 'fullEmail': AddressUtils.getFullEmail(sName, sEmail) }; }; /** * Obtains list of Recipient-objects which include "name", "email" and "fullEmail" fields from string. * * @param {string} sRecipients Includes recipients, separated by separators. * @param {boolean} bIncludeLastIncorrectEmail If true, last recipient will be included to list, even if it is not correct email. * * @returns {Array} */ AddressUtils.getArrayRecipients = function (sRecipients, bIncludeLastIncorrectEmail) { var aSeparators = [',', ';', ' '], sStartRcp = '', sEndRcp = sRecipients, iPos = 0, iNextPos = 0, sFullEmail = '', oRecipient = null, aRecipients = [] ; while (sEndRcp.length > 0) { iPos = AddressUtils._getFirstSeparatorPosition(sEndRcp, aSeparators); iNextPos = iPos; while (_.indexOf(aSeparators, sEndRcp[iNextPos + 1]) !== -1) { iNextPos++; } if (iPos === -1) { sFullEmail = sStartRcp + sEndRcp; oRecipient = AddressUtils.getEmailParts(sFullEmail); if (bIncludeLastIncorrectEmail || AddressUtils.isCorrectEmail(oRecipient.email)) { aRecipients.push(oRecipient); } sEndRcp = ''; } else { sFullEmail = sStartRcp + sEndRcp.substring(0, iPos); oRecipient = AddressUtils.getEmailParts(sFullEmail); if (AddressUtils.isCorrectEmail(oRecipient.email)) { aRecipients.push(oRecipient); sStartRcp = ''; } else { sStartRcp += sEndRcp.substring(0, iNextPos + 1); } sEndRcp = sEndRcp.substring(iNextPos + 1); } } return aRecipients; }; /** * Obtains position number of first separator-symbol in string. Available separator symbols are specified in array. * * @param {string} sValue String for search separator-symbol in. * @param {Array} aSeparators List of separators. * @returns {number} */ AddressUtils._getFirstSeparatorPosition = function (sValue, aSeparators) { var iPos = -1; _.each(aSeparators, function (sSep) { var iSepPos = sValue.indexOf(sSep); if (iSepPos !== -1 && (iPos === -1 || iSepPos < iPos)) { iPos = iSepPos; } }); return iPos; }; /** * @param {string} sAddresses * * @return {Array} */ AddressUtils.getIncorrectEmailsFromAddressString = function (sAddresses) { var aEmails = sAddresses.replace(/"[^"]*"/g, '').replace(/;/g, ',').split(','), aIncorrectEmails = [], iIndex = 0, iLen = aEmails.length, sFullEmail = '', oEmailParts = null ; for (; iIndex < iLen; iIndex++) { sFullEmail = TextUtils.trim(aEmails[iIndex]); if (sFullEmail.length > 0) { oEmailParts = AddressUtils.getEmailParts(TextUtils.trim(aEmails[iIndex])); if (!AddressUtils.isCorrectEmail(oEmailParts.email)) { aIncorrectEmails.push(oEmailParts.email); } } } return aIncorrectEmails; }; AddressUtils.getDomain = function (sEmail) { var aParts = this.isCorrectEmail(sEmail) ? sEmail.split('@') : ['']; return aParts[aParts.length - 1]; }; module.exports = AddressUtils; /***/ }), /***/ "REt5": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/utils/Common.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), $ = __webpack_require__(/*! jquery */ "M4cL"), ko = __webpack_require__(/*! knockout */ "p09A"), Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), Utils = {} ; __webpack_require__(/*! jquery.easing */ "m2Mp"); /** * @param {(Object|null|undefined)} oContext * @param {Function} fExecute * @param {(Function|boolean|null)=} mCanExecute * @return {Function} */ Utils.createCommand = function (oContext, fExecute, mCanExecute) { var fResult = fExecute ? function () { if (fResult.canExecute && fResult.canExecute()) { return fExecute.apply(oContext, Array.prototype.slice.call(arguments)); } return false; } : function () {} ; fResult.enabled = ko.observable(true); if (_.isFunction(mCanExecute)) { fResult.canExecute = ko.computed(function () { return fResult.enabled() && mCanExecute.call(oContext); }); } else { if (mCanExecute === undefined) { mCanExecute = true; } fResult.canExecute = ko.computed(function () { return fResult.enabled() && !!mCanExecute; }); } return fResult; }; Utils.isTextFieldFocused = function () { var mTag = document && document.activeElement ? document.activeElement : null, mTagName = mTag ? mTag.tagName : null, mTagType = mTag && mTag.type ? mTag.type.toLowerCase() : null, mContentEditable = mTag ? mTag.contentEditable : null ; return ('INPUT' === mTagName && (mTagType === 'text' || mTagType === 'password' || mTagType === 'email' || mTagType === 'search')) || 'TEXTAREA' === mTagName || 'IFRAME' === mTagName || mContentEditable === 'true'; }; /** * @param {object} oEvent */ Utils.calmEvent = function (oEvent) { if (oEvent) { if (oEvent.stop) { oEvent.stop(); } if (oEvent.preventDefault) { oEvent.preventDefault(); } if (oEvent.stopPropagation) { oEvent.stopPropagation(); } if (oEvent.stopImmediatePropagation) { oEvent.stopImmediatePropagation(); } oEvent.cancelBubble = true; oEvent.returnValue = false; } }; Utils.removeSelection = function () { if (window.getSelection) { window.getSelection().removeAllRanges(); } else if (document.selection) { document.selection.empty(); } }; Utils.desktopNotify = (function () { var aNotifications = []; return function (oData) { var AppTab = __webpack_require__(/*! modules/CoreWebclient/js/AppTab.js */ "enoK"); var UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV") if (oData && UserSettings.AllowDesktopNotifications && window.Notification && !AppTab.focused()) { switch (oData.action) { case 'show': if (window.Notification.permission !== 'denied') { // oData - action, body, dir, lang, tag, icon, callback, timeout var oOptions = { //https://developer.mozilla.org/en-US/docs/Web/API/Notification body: oData.body || '', //A string representing an extra content to display within the notification dir: oData.dir || 'auto', //The direction of the notification; it can be auto, ltr, or rtl lang: oData.lang || '', //Specify the lang used within the notification. This string must be a valid BCP 47 language tag tag: oData.tag || Math.floor(Math.random() * (1000 - 100) + 100), //An ID for a given notification that allows to retrieve, replace or remove it if necessary icon: oData.icon || false //The URL of an image to be used as an icon by the notification }, oNotification, fShowNotification = function() { oNotification = new window.Notification(oData.title, oOptions); //Firefox and Safari close the notifications automatically after a few moments, e.g. 4 seconds. oNotification.onclick = function (oEv) { //there are also onshow, onclose & onerror events if(oData.callback) { oData.callback(); } oNotification.close(); }; if (oData.timeout) { setTimeout(function() { oNotification.close(); }, oData.timeout); } aNotifications.push(oNotification); } ; if (window.Notification.permission === 'granted') { fShowNotification(); } else if (window.Notification.permission === 'default') { window.Notification.requestPermission(function (sPermission) { if(sPermission === 'granted') { fShowNotification(); } }); } } break; case 'hide': _.each(aNotifications, function (oNotifi, ikey) { if (oData.tag === oNotifi.tag) { oNotifi.close(); aNotifications.splice(ikey, 1); } }); break; case 'hideAll': _.each(aNotifications,function (oNotifi) { oNotifi.close(); }); aNotifications.length = 0; break; } } }; }()); /** * @param {string} sFile * * @return {string} */ Utils.getFileExtension = function (sFile) { var sResult = '', iIndex = sFile.lastIndexOf('.') ; if (iIndex > -1) { sResult = sFile.substr(iIndex + 1); } return sResult; }; Utils.draggableItems = function () { return $('
').appendTo('#pSevenHidden'); }; Utils.uiDropHelperAnim = function (oEvent, oUi) { var iLeft = 0, iTop = 0, iNewLeft = 0, iNewTop = 0, iWidth = 0, iHeight = 0, helper = oUi.helper.clone().appendTo('#pSevenHidden'), target = $(oEvent.target).find('.animGoal'), position = null ; target = target[0] ? $(target[0]) : $(oEvent.target); position = target && target[0] ? target.offset() : null; if (position) { iLeft = window.Math.round(position.left); iTop = window.Math.round(position.top); iWidth = target.width(); iHeight = target.height(); iNewLeft = iLeft; if (0 < iWidth) { iNewLeft += window.Math.round(iWidth / 2); } iNewTop = iTop; if (0 < iHeight) { iNewTop += window.Math.round(iHeight / 2); } helper.animate({ 'left': iNewLeft + 'px', 'top': iNewTop + 'px', 'font-size': '0px', 'opacity': 0 }, 800, 'easeOutQuint', function() { $(this).remove(); }); } }; /** * @param {string} sName * @return {boolean} */ Utils.validateFileOrFolderName = function (sName) { return '' !== sName && !/["\/\\*?<>|:]/.test(sName); }; /** * @param {string} sFile * * @return {string} */ Utils.getFileNameWithoutExtension = function (sFile) { var sResult = sFile, iIndex = sFile.lastIndexOf('.') ; if (iIndex > -1) { sResult = sFile.substr(0, iIndex); } return sResult; }; /** * @param {Object} oElement * @param {Object} oItem */ Utils.defaultOptionsAfterRender = function (oElement, oItem) { if (oItem && oItem.disable !== undefined) { ko.applyBindingsToNode(oElement, { 'disable': !!oItem.disable }, oItem); } }; /** * @param {string} dateFormat * * @return string */ Utils.getDateFormatForMoment = function (dateFormat) { // 'MM/DD/YYYY' -> 'MM/DD/YYYY' // 'DD/MM/YYYY' -> 'DD/MM/YYYY' // 'DD Month YYYY' -> 'DD MMMM YYYY' return dateFormat.replace('Month', 'MMMM'); }; /** * @param {string} sUniqVal */ Utils.getHash = function (sUniqVal) { var iHash = 0, iIndex = 0, iLen = sUniqVal.length ; while (iIndex < iLen) { iHash = ((iHash << 5) - iHash + sUniqVal.charCodeAt(iIndex++)) << 0; } return Types.pString(iHash); }; /** * Disposes all observable properties of the object and destroys them along with all others. * After that, deletes the object reference from its parent so that the GC will free up memory. * @param {object} oParent * @param {mixed} mObjectKey */ Utils.destroyObjectWithObservables = function (oParent, mObjectKey) { var oObject = oParent[mObjectKey]; for (var mKey in oObject) { if (oObject[mKey] && _.isFunction(oObject[mKey].dispose)) { oObject[mKey].dispose(); } delete oObject[mKey]; } delete oParent[mObjectKey]; }; Utils.getRandomHash = function (length) { const sSymbols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const iSymbolsLength = sSymbols.length; let sResult = ''; length = typeof length === 'number' ? length : 10; if (window.crypto && window.crypto.getRandomValues) { const aRandomValues = new Uint32Array(length); window.crypto.getRandomValues(aRandomValues); aRandomValues.forEach((value) => { sResult += sSymbols.charAt(value % iSymbolsLength); }); } else { for (let i = 0; i < length; i++) { sResult += sSymbols.charAt(Math.floor(Math.random() * iSymbolsLength)); } } return sResult; }; Utils.generateUUID = function () { if (window.crypto && window.crypto.getRandomValues) { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ); } return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }; module.exports = Utils; /***/ }), /***/ "4ARn": /*!**************************************************!*\ !*** ./modules/CoreWebclient/js/utils/Logger.js ***! \**************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _ = __webpack_require__(/*! underscore */ "C3HO"), moment = __webpack_require__(/*! moment */ "sdEb"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), Logger = {} ; Logger.log = (function () { if (UserSettings.AllowClientDebug) { window.auroraLogs = []; return function () { var aNewRow = []; aNewRow.unshift(moment().format('DD.MM, HH:mm:ss')); _.each(arguments, function (mArg) { aNewRow.push(mArg); }); if (window.auroraLogs.length > 100) { window.auroraLogs.shift(); } window.auroraLogs.push(aNewRow); }; } else { return function () {}; } }()); module.exports = Logger; /***/ }), /***/ "1D84": /*!****************************************************!*\ !*** ./modules/CoreWebclient/js/utils/Settings.js ***! \****************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var _ = __webpack_require__(/*! underscore */ "C3HO"), TextUtils = __webpack_require__(/*! modules/CoreWebclient/js/utils/Text.js */ "H20a"), UserSettings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), SettingsUtils = {} ; /** * @return Array */ SettingsUtils.getDateFormatsForSelector = function () { return _.map(UserSettings.DateFormatList, function (sDateFormat) { switch (sDateFormat) { case 'MM/DD/YYYY': return {name: TextUtils.i18n('COREWEBCLIENT/LABEL_DATEFORMAT_MMDDYYYY'), value: sDateFormat}; case 'DD/MM/YYYY': return {name: TextUtils.i18n('COREWEBCLIENT/LABEL_DATEFORMAT_DDMMYYYY'), value: sDateFormat}; case 'DD Month YYYY': return {name: TextUtils.i18n('COREWEBCLIENT/LABEL_DATEFORMAT_DDMONTHYYYY'), value: sDateFormat}; default: return {name: sDateFormat, value: sDateFormat}; } }); }; module.exports = SettingsUtils; /***/ }), /***/ "H20a": /*!************************************************!*\ !*** ./modules/CoreWebclient/js/utils/Text.js ***! \************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var Types = __webpack_require__(/*! modules/CoreWebclient/js/utils/Types.js */ "KC/L"), Settings = __webpack_require__(/*! modules/CoreWebclient/js/Settings.js */ "OfVV"), TextUtils = {} ; TextUtils.trim = function (text = '') { return typeof text === 'string' ? text.trim() : ''; }; TextUtils.isHtml = function (text = '') { // Alternative way // var doc = new DOMParser().parseFromString(text, "text/html"); // return Array.from(doc.body.childNodes).some(node => node.nodeType === 1); // checking for tags (including closing ones) with names that consist of letters and dashes only return /<\/?[a-zA-Z-]+(?:\s|\s[^>]+|\S)?>/i.test(text) }; /** * Converts plaintext to HTML text. * @param {string} text * @param {boolean} prepareLinks * @returns {string} */ TextUtils.plainToHtml = function (text = '', prepareLinks = false) { let html = text.toString() .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, ''') .replaceAll('>', ' >') /* whitespace is required to separate encoded > from the end of a link */ ; if (prepareLinks) { //URLs starting with http://, https://, or ftp:// const replacePattern1 = /(\b(?:https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim; html = html.replace(replacePattern1, '
$1
'); //URLs starting with "www." (without // before it, or it'd re-link the ones done above). const replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim; html = html.replace(replacePattern2, '$1
$2
'); //Change email addresses to mailto:: links. const replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim; html = html.replace(replacePattern3, '
$1
'); } /* removing spaces befor > that where added on purpose */ html = html.replaceAll(' >', '>'); return html.replace(/\r/g, '').replace(/\n/g, '
'); }; /** * Converts HTML text to plaintext. * @param {string} html * @returns {string} */ TextUtils.htmlToPlain = function(html = '') { return html.toString() .replace(/([^>]{1})
/gi, '$1\n') .replace(/