diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 6d3284d4d..1d2c11a5d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1087,6 +1087,8 @@ define([ } else { documentHolderController.getView().createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); + if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded + me.applyLicense(); } // TODO bug 43960 @@ -1116,7 +1118,8 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady) @@ -1124,11 +1127,14 @@ define([ }, applyLicense: function() { - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + (license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint + 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; @@ -1136,15 +1142,17 @@ define([ primary = 'buynow'; } - this.disableEditing(true); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType && this.appOptions.isEdit) { + this.disableEditing(true); + Common.NotificationCenter.trigger('api:disconnect'); + } 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({ - width: 500, + maxwidth: 500, title: this.textNoLicenseTitle, msg : license, buttons: buttons, @@ -2687,7 +2695,9 @@ define([ txtEnterDate: 'Enter a date.', txtTypeEquation: 'Type equation here.', textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', - textRemember: 'Remember my choice' + textRemember: 'Remember my choice', + 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.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index f33f7e4cf..bdba2ff6e 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -340,7 +340,7 @@ define([ SetDisabled: function(disabled, allowMerge, allowSignature) { this.setMode({isEdit: !disabled}); - if (this.rightmenu) { + if (this.rightmenu && this.rightmenu.paragraphSettings) { this.rightmenu.paragraphSettings.disableControls(disabled); this.rightmenu.shapeSettings.disableControls(disabled); this.rightmenu.textartSettings.disableControls(disabled); diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 931c71f50..e5b852189 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -384,12 +384,41 @@ define([ setDeveloperMode: function(mode) { if ( !this.$el.is(':visible') ) return; - if (!this.developerHint) { - this.developerHint = $('
' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '
').appendTo(this.$el); - this.devHeight = this.developerHint.outerHeight(); - $(window).on('resize', _.bind(this.onWindowResize, this)); + if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) { + if (!this.developerHint) { + var str = ''; + if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer)) + str = this.txtTrialDev; + else if ((mode & Asc.c_oLicenseMode.Trial)!==0) + str = this.txtTrial; + else if ((mode & Asc.c_oLicenseMode.Developer)!==0) + str = this.txtDeveloper; + str = str.toUpperCase(); + this.developerHint = $('
' + str + '
').appendTo(this.$el); + this.devHeight = this.developerHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } } - this.developerHint.toggleClass('hidden', !mode); + this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer))); + + var btns = this.$el.find('button.btn-category:visible'), + lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; + this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20; + this.onWindowResize(); + }, + + setLimitMode: function() { + if ( !this.$el.is(':visible') ) return; + + if (!this.limitHint) { + var str = this.txtLimit.toUpperCase(); + this.limitHint = $('
' + str + '
').appendTo(this.$el); + this.limitHeight = this.limitHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } + this.limitHint && this.limitHint.toggleClass('hidden', false); var btns = this.$el.find('button.btn-category:visible'), lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; @@ -398,7 +427,13 @@ define([ }, onWindowResize: function() { - this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition)); + var height = (this.devHeight || 0) + (this.limitHeight || 0); + var top = Math.max((this.$el.height()-height)/2, this.minDevPosition); + if (this.developerHint) { + this.developerHint.css('top', top); + top += this.devHeight; + } + this.limitHint && this.limitHint.css('top', top); }, /** coauthoring begin **/ tipComments : 'Comments', @@ -410,6 +445,8 @@ define([ tipPlugins : 'Plugins', txtDeveloper: 'DEVELOPER MODE', txtTrial: 'TRIAL MODE', - tipNavigation: 'Navigation' + txtTrialDev: 'Trial Developer Mode', + tipNavigation: 'Navigation', + txtLimit: 'Limit Access' }, DE.Views.LeftMenu || {})); }); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 967e233a8..2d160c9ab 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -771,6 +771,8 @@ "DE.Controllers.Main.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.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "DE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "DE.Controllers.Navigation.txtBeginning": "Beginning of document", "DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", @@ -1789,6 +1791,8 @@ "DE.Views.LeftMenu.tipTitles": "Titles", "DE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE", "DE.Views.LeftMenu.txtTrial": "TRIAL MODE", + "DE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode", + "DE.Views.LeftMenu.txtLimit": "Limit Access", "DE.Views.LineNumbersDialog.textAddLineNumbering": "Add line numbering", "DE.Views.LineNumbersDialog.textApplyTo": "Apply changes to", "DE.Views.LineNumbersDialog.textContinuous": "Continuous", diff --git a/apps/documenteditor/main/resources/less/leftmenu.less b/apps/documenteditor/main/resources/less/leftmenu.less index cee2142f2..3686c79f1 100644 --- a/apps/documenteditor/main/resources/less/leftmenu.less +++ b/apps/documenteditor/main/resources/less/leftmenu.less @@ -51,13 +51,13 @@ overflow: hidden; } -#developer-hint { +#developer-hint, #limit-hint { position: absolute; left: 0; padding: 12px 0; background-color: #ffb400; color: #6e4e00 !important; - white-space: nowrap; + white-space: pre; line-height: 20px; writing-mode: tb-rl; -moz-transform: rotate(180deg); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 6cd666fca..554da56cb 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -658,7 +658,8 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -683,10 +684,12 @@ define([ return; } - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + 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; @@ -752,7 +755,6 @@ define([ onEditorPermissions: function(params) { var me = this, licType = params.asc_getLicenseType(); - if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.ExpiredTrial === licType) { @@ -795,6 +797,7 @@ define([ me.appOptions.fileKey = me.document.key; me.appOptions.canFillForms = ((me.permissions.fillForms===undefined) ? me.appOptions.isEdit : me.permissions.fillForms) && (me.editorConfig.mode !== 'view'); me.appOptions.isRestrictedEdit = !me.appOptions.isEdit && me.appOptions.canFillForms; + me.appOptions.trialMode = params.asc_getLicenseMode(); var type = /^(?:(pdf|djvu|xps))$/.exec(me.document.fileType); me.appOptions.canDownloadOrigin = me.permissions.download !== false && (type && typeof type[1] === 'string'); @@ -1588,7 +1591,9 @@ define([ textNo: 'No', errorSessionAbsolute: 'The document editing session has expired. Please reload the page.', errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.', - errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.' + errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.', + 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.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index e41733c7b..da041c509 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -296,6 +296,8 @@ "DE.Controllers.Main.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.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "DE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "DE.Controllers.Search.textNoTextFound": "Text not Found", "DE.Controllers.Search.textReplaceAll": "Replace All", "DE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index d5ebf008a..3a2c61bee 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -815,6 +815,8 @@ define([ } else { documentHolderController.getView('DocumentHolder').createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); + if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded + me.applyLicense(); } // TODO bug 43960 @@ -842,7 +844,8 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady) @@ -850,11 +853,14 @@ define([ }, applyLicense: function() { - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + (license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint + 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; @@ -862,15 +868,17 @@ define([ primary = 'buynow'; } - this.disableEditing(true); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType && this.appOptions.isEdit) { + this.disableEditing(true); + Common.NotificationCenter.trigger('api:disconnect'); + } var value = Common.localStorage.getItem("pe-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); if (now - value > 86400000) { Common.UI.info({ - width: 500, + maxwidth: 500, title: this.textNoLicenseTitle, msg : license, buttons: buttons, @@ -2319,7 +2327,9 @@ define([ 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.', textHasMacros: 'The file contains automatic macros.
Do you want to run macros?', - textRemember: 'Remember my choice' + textRemember: 'Remember my choice', + 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.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index 75c2adc67..8198f2fe1 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -215,7 +215,7 @@ define([ SetDisabled: function(disabled, allowSignature) { this.setMode({isEdit: !disabled}); - if (this.rightmenu) { + if (this.rightmenu && this.rightmenu.paragraphSettings) { this.rightmenu.slideSettings.SetSlideDisabled(disabled, disabled, disabled, disabled); this.rightmenu.paragraphSettings.disableControls(disabled); this.rightmenu.shapeSettings.disableControls(disabled); diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index b47ddeb81..c0c0a02a6 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -362,12 +362,41 @@ define([ setDeveloperMode: function(mode) { if ( !this.$el.is(':visible') ) return; - if (!this.developerHint) { - this.developerHint = $('
' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '
').appendTo(this.$el); - this.devHeight = this.developerHint.outerHeight(); - $(window).on('resize', _.bind(this.onWindowResize, this)); + if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) { + if (!this.developerHint) { + var str = ''; + if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer)) + str = this.txtTrialDev; + else if ((mode & Asc.c_oLicenseMode.Trial)!==0) + str = this.txtTrial; + else if ((mode & Asc.c_oLicenseMode.Developer)!==0) + str = this.txtDeveloper; + str = str.toUpperCase(); + this.developerHint = $('
' + str + '
').appendTo(this.$el); + this.devHeight = this.developerHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } } - this.developerHint.toggleClass('hidden', !mode); + this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer))); + + var btns = this.$el.find('button.btn-category:visible'), + lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; + this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20; + this.onWindowResize(); + }, + + setLimitMode: function() { + if ( !this.$el.is(':visible') ) return; + + if (!this.limitHint) { + var str = this.txtLimit.toUpperCase(); + this.limitHint = $('
' + str + '
').appendTo(this.$el); + this.limitHeight = this.limitHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } + this.limitHint && this.limitHint.toggleClass('hidden', false); var btns = this.$el.find('button.btn-category:visible'), lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; @@ -376,7 +405,13 @@ define([ }, onWindowResize: function() { - this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition)); + var height = (this.devHeight || 0) + (this.limitHeight || 0); + var top = Math.max((this.$el.height()-height)/2, this.minDevPosition); + if (this.developerHint) { + this.developerHint.css('top', top); + top += this.devHeight; + } + this.limitHint && this.limitHint.css('top', top); }, /** coauthoring begin **/ @@ -389,6 +424,8 @@ define([ tipSlides: 'Slides', tipPlugins : 'Plugins', txtDeveloper: 'DEVELOPER MODE', - txtTrial: 'TRIAL MODE' + txtTrial: 'TRIAL MODE', + txtTrialDev: 'Trial Developer Mode', + txtLimit: 'Limit Access' }, PE.Views.LeftMenu || {})); }); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 2ed4b1cd8..ec58a4b3f 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -650,6 +650,8 @@ "PE.Controllers.Main.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.", "PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "PE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
Do you want to continue?", "PE.Controllers.Toolbar.textAccent": "Accents", @@ -1376,6 +1378,8 @@ "PE.Views.LeftMenu.tipTitles": "Titles", "PE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE", "PE.Views.LeftMenu.txtTrial": "TRIAL MODE", + "PE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode", + "PE.Views.LeftMenu.txtLimit": "Limit Access", "PE.Views.ParagraphSettings.strLineHeight": "Line Spacing", "PE.Views.ParagraphSettings.strParagraphSpacing": "Paragraph Spacing", "PE.Views.ParagraphSettings.strSpacingAfter": "After", diff --git a/apps/presentationeditor/main/resources/less/leftmenu.less b/apps/presentationeditor/main/resources/less/leftmenu.less index 65099d00f..8b20f99f4 100644 --- a/apps/presentationeditor/main/resources/less/leftmenu.less +++ b/apps/presentationeditor/main/resources/less/leftmenu.less @@ -485,13 +485,13 @@ } } -#developer-hint { +#developer-hint, #limit-hint { position: absolute; left: 0; padding: 12px 0; background-color: #ffb400; color: #6e4e00 !important; - white-space: nowrap; + white-space: pre; line-height: @app-header-height; writing-mode: tb-rl; -moz-transform: rotate(180deg); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index d2b05eaec..d6776e1d8 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -588,7 +588,8 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -613,10 +614,12 @@ define([ return; } - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + 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; @@ -722,6 +725,7 @@ define([ me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false); me.appOptions.canEditStyles = me.appOptions.canLicense && me.appOptions.canEdit; me.appOptions.canPrint = (me.permissions.print !== false); + me.appOptions.trialMode = params.asc_getLicenseMode(); var type = /^(?:(pdf|djvu|xps))$/.exec(me.document.fileType); me.appOptions.canDownloadOrigin = me.permissions.download !== false && (type && typeof type[1] === 'string'); @@ -1525,7 +1529,9 @@ define([ textNo: 'No', errorSessionAbsolute: 'The document editing session has expired. Please reload the page.', errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.', - errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.' + errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.', + 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.' } })(), PE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 3db178d4c..87620840d 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -264,6 +264,8 @@ "PE.Controllers.Main.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.", "PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "PE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "PE.Controllers.Search.textNoTextFound": "Text not Found", "PE.Controllers.Search.textReplaceAll": "Replace All", "PE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 5017242a1..69584c701 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -866,6 +866,8 @@ define([ } else { documentHolderView.createDelayedElementsViewer(); Common.NotificationCenter.trigger('document:ready', 'main'); + if (me.appOptions.canEdit && me.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded + me.applyLicense(); } // TODO bug 43960 if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) { @@ -909,7 +911,8 @@ define([ var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady) @@ -917,11 +920,14 @@ define([ }, applyLicense: function() { - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = ['ok'], primary = 'ok'; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + (license===Asc.c_oLicenseResult.ExpiredLimited) && this.getApplication().getController('LeftMenu').leftMenu.setLimitMode();// show limited hint + 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; @@ -929,15 +935,17 @@ define([ primary = 'buynow'; } - this.disableEditing(true); - Common.NotificationCenter.trigger('api:disconnect'); + if (this._state.licenseType && this.appOptions.isEdit) { + this.disableEditing(true); + Common.NotificationCenter.trigger('api:disconnect'); + } var value = Common.localStorage.getItem("sse-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); if (now - value > 86400000) { Common.UI.info({ - width: 500, + maxwidth: 500, title: this.textNoLicenseTitle, msg : license, buttons: buttons, @@ -983,7 +991,6 @@ define([ onEditorPermissions: function(params) { var licType = params ? params.asc_getLicenseType() : Asc.c_oLicenseResult.Error; - if ( params && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge)) { if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.ExpiredTrial === licType) { Common.UI.warning({ @@ -2671,7 +2678,9 @@ define([ errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.
Please edit it and try again.', errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,
cell references, and/or names.', errorMoveSlicerError: 'Table slicers cannot be copied from one workbook to another.
Try again by selecting the entire table and the slicers.', - errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.' + errorEditView: 'The existing sheet view cannot be edited and the new ones cannot be created at the moment as some of them are being edited.', + 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.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index 16778fbce..e8c7cb30a 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -352,12 +352,41 @@ define([ setDeveloperMode: function(mode) { if ( !this.$el.is(':visible') ) return; - if (!this.developerHint) { - this.developerHint = $('
' + ((mode == Asc.c_oLicenseMode.Trial) ? this.txtTrial.toLocaleUpperCase() : this.txtDeveloper.toLocaleUpperCase()) + '
').appendTo(this.$el); - this.devHeight = this.developerHint.outerHeight(); - $(window).on('resize', _.bind(this.onWindowResize, this)); + if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) { + if (!this.developerHint) { + var str = ''; + if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer)) + str = this.txtTrialDev; + else if ((mode & Asc.c_oLicenseMode.Trial)!==0) + str = this.txtTrial; + else if ((mode & Asc.c_oLicenseMode.Developer)!==0) + str = this.txtDeveloper; + str = str.toUpperCase(); + this.developerHint = $('
' + str + '
').appendTo(this.$el); + this.devHeight = this.developerHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } } - this.developerHint.toggleClass('hidden', !mode); + this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer))); + + var btns = this.$el.find('button.btn-category:visible'), + lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; + this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20; + this.onWindowResize(); + }, + + setLimitMode: function() { + if ( !this.$el.is(':visible') ) return; + + if (!this.limitHint) { + var str = this.txtLimit.toUpperCase(); + this.limitHint = $('
' + str + '
').appendTo(this.$el); + this.limitHeight = this.limitHint.outerHeight(); + !this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this)); + this.devHintInited = true; + } + this.limitHint && this.limitHint.toggleClass('hidden', false); var btns = this.$el.find('button.btn-category:visible'), lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null; @@ -366,7 +395,13 @@ define([ }, onWindowResize: function() { - this.developerHint.css('top', Math.max((this.$el.height()-this.devHeight)/2, this.minDevPosition)); + var height = (this.devHeight || 0) + (this.limitHeight || 0); + var top = Math.max((this.$el.height()-height)/2, this.minDevPosition); + if (this.developerHint) { + this.developerHint.css('top', top); + top += this.devHeight; + } + this.limitHint && this.limitHint.css('top', top); }, /** coauthoring begin **/ @@ -380,6 +415,8 @@ define([ tipPlugins : 'Plugins', txtDeveloper: 'DEVELOPER MODE', txtTrial: 'TRIAL MODE', - tipSpellcheck: 'Spell checking' + tipSpellcheck: 'Spell checking', + txtTrialDev: 'Trial Developer Mode', + txtLimit: 'Limit Access' }, SSE.Views.LeftMenu || {})); }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index e7fd95c6a..e33025b40 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -853,6 +853,8 @@ "SSE.Controllers.Main.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.", "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "SSE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", @@ -1979,6 +1981,8 @@ "SSE.Views.LeftMenu.tipSupport": "Feedback & Support", "SSE.Views.LeftMenu.txtDeveloper": "DEVELOPER MODE", "SSE.Views.LeftMenu.txtTrial": "TRIAL MODE", + "SSE.Views.LeftMenu.txtTrialDev": "Trial Developer Mode", + "SSE.Views.LeftMenu.txtLimit": "Limit Access", "SSE.Views.MainSettingsPrint.okButtonText": "Save", "SSE.Views.MainSettingsPrint.strBottom": "Bottom", "SSE.Views.MainSettingsPrint.strLandscape": "Landscape", diff --git a/apps/spreadsheeteditor/main/resources/less/leftmenu.less b/apps/spreadsheeteditor/main/resources/less/leftmenu.less index a25fa59ed..fce0d954a 100644 --- a/apps/spreadsheeteditor/main/resources/less/leftmenu.less +++ b/apps/spreadsheeteditor/main/resources/less/leftmenu.less @@ -549,13 +549,13 @@ } } -#developer-hint { +#developer-hint, #limit-hint { position: absolute; left: 0; padding: 12px 0; background-color: #ffb400; color: #6e4e00 !important; - white-space: nowrap; + white-space: pre; line-height: @app-header-height; writing-mode: tb-rl; -moz-transform: rotate(180deg); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 358a909dd..3cbfdf971 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -614,7 +614,8 @@ define([ var licType = params.asc_getLicenseType(); if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && - (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS)) + (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS + || licType===Asc.c_oLicenseResult.ExpiredLimited)) this._state.licenseType = licType; if (this._isDocReady && this._state.licenseType) @@ -638,10 +639,12 @@ define([ SSE.getController('Toolbar').activateControls(); return; } - if (this._state.licenseType) { + if (this._state.licenseType || (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { var license = this._state.licenseType, buttons = [{text: 'OK'}]; - if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0) { + 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; @@ -707,7 +710,6 @@ define([ onEditorPermissions: function(params) { var me = this, licType = params ? params.asc_getLicenseType() : Asc.c_oLicenseResult.Error; - if (params && !(me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge)) { if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || @@ -739,6 +741,7 @@ define([ me.appOptions.canViewComments = me.appOptions.canComments || !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false); me.appOptions.canEditComments = me.appOptions.isOffline || !(typeof (me.editorConfig.customization) == 'object' && me.editorConfig.customization.commentAuthorOnly); me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false); + me.appOptions.trialMode = params.asc_getLicenseMode(); me.appOptions.canBranding = params.asc_getCustomization(); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); @@ -1743,7 +1746,9 @@ define([ textYes: 'Yes', textNo: 'No', errorFrmlMaxLength: 'You cannot add this formula as its length exceeded the allowed number of characters.
Please edit it and try again.', - errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,
cell references, and/or names.' + errorFrmlMaxReference: 'You cannot enter this formula because it has too many values,
cell references, and/or names.', + 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.' } })(), SSE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 45882ce79..6da1af6b2 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -326,6 +326,8 @@ "SSE.Controllers.Main.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.", "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.warnLicenseLimitedRenewed": "License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access", + "SSE.Controllers.Main.warnLicenseLimitedNoAccess": "License expired.
You have no access to document editing functionality.
Please contact your administrator.", "SSE.Controllers.Search.textNoTextFound": "Text not found", "SSE.Controllers.Search.textReplaceAll": "Replace All", "SSE.Controllers.Settings.notcriticalErrorTitle": "Warning",