diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 672795458..bbd385060 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -37,6 +37,8 @@ define([ var me = this; if (!Common.Utils.isBrowserSupported()){ Common.Utils.showBrowserRestriction(); + $('#editor_sdk').hide().remove(); + $('#toolbar').hide().remove(); Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); return; } @@ -132,6 +134,12 @@ define([ }); window.onbeforeunload = _.bind(this.onBeforeUnload, this); + + this.warnNoLicense = this.warnNoLicense.replace(/%1/g, '{{COMPANY_NAME}}'); + this.warnNoLicenseUsers = this.warnNoLicenseUsers.replace(/%1/g, '{{COMPANY_NAME}}'); + this.textNoLicenseTitle = this.textNoLicenseTitle.replace(/%1/g, '{{COMPANY_NAME}}'); + this.warnLicenseExceeded = this.warnLicenseExceeded.replace(/%1/g, '{{COMPANY_NAME}}'); + this.warnLicenseUsersExceeded = this.warnLicenseUsersExceeded.replace(/%1/g, '{{COMPANY_NAME}}'); }, onDocumentResize: function() { @@ -383,7 +391,6 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); - // this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -438,6 +445,8 @@ define([ if (params.asc_getRights() !== Asc.c_oRights.Edit) this.permissions.edit = this.permissions.review = false; + this.appOptions.trialMode = params.asc_getLicenseMode(); + this.appOptions.isBeta = params.asc_getIsBeta(); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm; this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view'); @@ -529,6 +538,44 @@ define([ }); }, + applyLicense: function() { + if (this._state.licenseType) { + var license = this._state.licenseType, + buttons = ['ok'], + primary = 'ok'; + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && + (license===Asc.c_oLicenseResult.SuccessLimit || license===Asc.c_oLicenseResult.ExpiredLimited || this.appOptions.permissionsLicense===Asc.c_oLicenseResult.SuccessLimit)) { + license = (license===Asc.c_oLicenseResult.ExpiredLimited) ? this.warnLicenseLimitedNoAccess : this.warnLicenseLimitedRenewed; + } else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded; + } else { + license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers; + buttons = [{value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs}]; + primary = 'buynow'; + } + + var value = Common.localStorage.getItem("de-license-warning"); + value = (value!==null) ? parseInt(value) : 0; + var now = (new Date).getTime(); + if (now - value > 86400000) { + Common.UI.info({ + maxwidth: 500, + title: this.textNoLicenseTitle, + msg : license, + buttons: buttons, + primary: primary, + callback: function(btn) { + Common.localStorage.setItem("de-license-warning", now); + if (btn == 'buynow') + window.open('{{PUBLISHER_URL}}', "_blank"); + else if (btn == 'contact') + window.open('mailto:{{SALES_EMAIL}}', "_blank"); + } + }); + } + } + }, + onLongActionBegin: function(type, id) { var action = {id: id, type: type}; this.stackLongActions.push(action); @@ -950,9 +997,12 @@ define([ if (this.appOptions.canFillForms) { this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this)); - // this.api.asc_SetHighlightRequiredFields(true); + this.api.asc_SetHighlightRequiredFields(true); } + if (this.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded + this.applyLicense(); + Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this)); Common.Gateway.on('downloadas', _.bind(this.onDownloadAs, this)); Common.Gateway.on('requestclose', _.bind(this.onRequestClose, this)); @@ -1188,8 +1238,6 @@ define([ txtClose: 'Close', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', - textNext: 'Next Field', - textClear: 'Clear All Fields', textSubmited: 'Form submitted successfully
Click to close the tip.', errorSubmit: 'Submit failed.', errorEditingDownloadas: 'An error occurred during the work with the document.
Use the \'Download as...\' option to save the file backup copy to your computer hard drive.', @@ -1200,6 +1248,20 @@ define([ errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.", textCloseTip: "Click to close the tip.", txtPressLink: 'Press Ctrl and click link', - txtEmpty: '(Empty)' + txtEmpty: '(Empty)', + titleServerVersion: 'Editor updated', + errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.', + titleUpdateVersion: 'Version changed', + errorUpdateVersion: 'The file version has been changed. The page will be reloaded.', + warnLicenseLimitedRenewed: 'License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access', + warnLicenseLimitedNoAccess: 'License expired.
You have no access to document editing functionality.
Please contact your administrator.', + warnLicenseExceeded: "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact your administrator to learn more.", + warnLicenseUsersExceeded: "You've reached the user limit for %1 editors. Contact your administrator to learn more.", + warnNoLicense: "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", + warnNoLicenseUsers: "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", + textBuyNow: 'Visit website', + textNoLicenseTitle: 'License limit reached', + textContactUs: 'Contact sales' + }, DE.Controllers.ApplicationController)); }); diff --git a/apps/documenteditor/forms/index.html b/apps/documenteditor/forms/index.html index 9113d5d23..e1bd0cc0e 100644 --- a/apps/documenteditor/forms/index.html +++ b/apps/documenteditor/forms/index.html @@ -23,7 +23,7 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 10000; + z-index: 1001; } .loadmask > .brendpanel { @@ -113,6 +113,7 @@ + @@ -126,7 +127,8 @@ +
@@ -208,10 +226,6 @@ - - - - @@ -219,28 +233,17 @@ window.sdk_scripts.forEach(function(item){ document.write(' + window.requireTimeourError = function(){ + var reqerr; - - diff --git a/apps/documenteditor/forms/index.html.deploy b/apps/documenteditor/forms/index.html.deploy index ed77608fc..3894cbdcd 100644 --- a/apps/documenteditor/forms/index.html.deploy +++ b/apps/documenteditor/forms/index.html.deploy @@ -21,7 +21,7 @@ overflow: hidden; border: none; background-color: #f4f4f4; - z-index: 10000; + z-index: 1001; } .loadmask > .brendpanel { @@ -119,7 +119,8 @@ + + if ( lang == 'de') reqerr = 'Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.'; + else if ( lang == 'es') reqerr = 'La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.'; + else if ( lang == 'fr') reqerr = 'La connexion est trop lente, certains des composants n\'ons pas pu être chargé. Veuillez recharger la page.'; + else if ( lang == 'ru') reqerr = 'Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.'; + else reqerr = 'The connection is too slow, some of the components could not be loaded. Please reload the page.'; - - + + diff --git a/apps/documenteditor/forms/locale/en.json b/apps/documenteditor/forms/locale/en.json index 2db8c2ef8..982d66587 100644 --- a/apps/documenteditor/forms/locale/en.json +++ b/apps/documenteditor/forms/locale/en.json @@ -21,14 +21,11 @@ "DE.ApplicationController.notcriticalErrorTitle": "Warning", "DE.ApplicationController.scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.", "DE.ApplicationController.textAnonymous": "Anonymous", - "DE.ApplicationController.textClear": "Clear All Fields", "DE.ApplicationController.textGotIt": "Got it", "DE.ApplicationController.textGuest": "Guest", "DE.ApplicationController.textLoadingDocument": "Loading document", - "DE.ApplicationController.textNext": "Next Field", "DE.ApplicationController.textOf": "of", "DE.ApplicationController.textRequired": "Fill all required fields to send form.", - "DE.ApplicationController.textSubmit": "Submit", "DE.ApplicationController.textSubmited": "Form submitted successfully
Click to close the tip", "DE.ApplicationController.txtClose": "Close", "DE.ApplicationController.unknownErrorText": "Unknown error.", @@ -36,6 +33,20 @@ "DE.ApplicationController.waitText": "Please, wait...", "DE.ApplicationController.txtEmpty": "(Empty)", "DE.ApplicationController.txtPressLink": "Press Ctrl and click link", + "DE.ApplicationController.textCloseTip": "Click to close the tip.", + "DE.ApplicationController.titleServerVersion": "Editor updated", + "DE.ApplicationController.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.", + "DE.ApplicationController.titleUpdateVersion": "Version changed", + "DE.ApplicationController.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", + "DE.ApplicationController.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "DE.ApplicationController.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", + "DE.ApplicationController.warnLicenseExceeded": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact your administrator to learn more.", + "DE.ApplicationController.warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.", + "DE.ApplicationController.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", + "DE.ApplicationController.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", + "DE.ApplicationController.textBuyNow": "Visit website", + "DE.ApplicationController.textNoLicenseTitle": "License limit reached", + "DE.ApplicationController.textContactUs": "Contact sales", "DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtDownloadDocx": "Download as docx", "DE.ApplicationView.txtDownloadPdf": "Download as pdf", @@ -43,5 +54,8 @@ "DE.ApplicationView.txtFileLocation": "Open file location", "DE.ApplicationView.txtFullScreen": "Full Screen", "DE.ApplicationView.txtPrint": "Print", - "DE.ApplicationView.txtShare": "Share" + "DE.ApplicationView.txtShare": "Share", + "DE.ApplicationView.textSubmit": "Submit", + "DE.ApplicationView.textClear": "Clear All Fields", + "DE.ApplicationView.textNext": "Next Field" } \ No newline at end of file