diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 273002026..2d634f94d 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -557,6 +557,7 @@ define([ app.getController('RightMenu').SetDisabled(disable, false); app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); app.getController('DocumentHolder').getView().SetDisabled(disable); + app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable); var leftMenu = app.getController('LeftMenu').leftMenu; leftMenu.btnComments.setDisabled(disable); diff --git a/apps/common/main/lib/view/Plugins.js b/apps/common/main/lib/view/Plugins.js index cdadc1bf8..fe7ded1de 100644 --- a/apps/common/main/lib/view/Plugins.js +++ b/apps/common/main/lib/view/Plugins.js @@ -74,7 +74,7 @@ define([ _.extend(this, options); this._locked = false; this._state = { - DisabledControls: true + DisabledControls: false }; this.lockedControls = []; Common.UI.BaseView.prototype.initialize.call(this, arguments); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 496287233..a090b4f02 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -347,6 +347,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -953,6 +954,8 @@ define([ me.fillTextArt(me.api.asc_getTextArtPreviews()); Common.NotificationCenter.trigger('document:ready', 'main'); + + me.applyLicense(); } }, 50); } else { @@ -973,9 +976,24 @@ define([ Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); + }, + onLicenseChanged: function(params) { + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady) + this.applyLicense(); + }, + + applyLicense: function() { if (this._state.licenseWarning) { - value = Common.localStorage.getItem("de-license-warning"); + 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) { @@ -983,7 +1001,7 @@ define([ Common.UI.info({ width: 500, title: this.textNoLicenseTitle, - msg : this.warnNoLicense, + msg : this._state.licenseWarning, buttons: [ {value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs} @@ -1072,8 +1090,6 @@ define([ this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string'); this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string'); - this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; - this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) appHeader.setBranding(this.editorConfig.customization); @@ -2183,7 +2199,8 @@ define([ txtEvenPage: "Even Page ", txtOddPage: "Odd Page ", txtSameAsPrev: "Same as Previous", - txtCurrentDocument: "Current Document" + txtCurrentDocument: "Current Document", + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 1dc626eff..d812cda17 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2756,6 +2756,7 @@ define([ onApiCoAuthoringDisconnect: function(disableDownload) { this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; + this.DisableToolbar(true, true); }, DisableToolbar: function(disable, viewMode, reviewmode) { diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 9670f0c5f..40da13f04 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -351,6 +351,7 @@ define([ }, showHistory: function() { + this._state.pluginIsRunning = false; this.panelHistory.show(); this.panelHistory.$el.width((parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART) - SCALE_MIN); Common.NotificationCenter.trigger('layout:changed', 'history'); @@ -366,8 +367,9 @@ define([ } this.developerHint.toggleClass('hidden', !mode); - var lastbtn = this.$el.find('button.btn-category:visible:last-of-type'); - this.minDevPosition = lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20; + 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(); }, diff --git a/apps/documenteditor/main/app/view/Statusbar.js b/apps/documenteditor/main/app/view/Statusbar.js index 8b748d4e6..05b758bb8 100644 --- a/apps/documenteditor/main/app/view/Statusbar.js +++ b/apps/documenteditor/main/app/view/Statusbar.js @@ -86,7 +86,7 @@ define([ me.btnZoomDown.updateHint(me.tipZoomOut + Common.Utils.String.platformKey('Ctrl+-')); me.btnZoomUp.updateHint(me.tipZoomIn + Common.Utils.String.platformKey('Ctrl++')); - if ( config.isEdit ) { + if (me.btnLanguage && me.btnLanguage.cmpEl) { me.btnLanguage.updateHint(me.tipSetLang); me.btnLanguage.cmpEl.on({ 'show.bs.dropdown': function () { @@ -325,6 +325,7 @@ define([ if (this.api) { this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); } return this; @@ -356,7 +357,7 @@ define([ this.langMenu.doLayout(); if (this.langMenu.items.length>0) { - this.btnLanguage.setDisabled(false); + this.btnLanguage.setDisabled(!!this.mode.isDisconnected); } }, @@ -393,6 +394,11 @@ define([ this.btnLanguage.setDisabled(disable || !langs); }, + onApiCoAuthoringDisconnect: function() { + this.setMode({isDisconnected:true}); + this.SetDisabled(true); + }, + pageIndexText : 'Page {0} of {1}', goToPageText : 'Go to Page', tipFitPage : 'Fit to Page', diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index c921443a2..13be79f3a 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2076,59 +2076,8 @@ define([ button.setDisabled(true); } }); - this.btnCopy.setDisabled(true); - this.btnPaste.setDisabled(true); - this.btnUndo.setDisabled(true); - this.btnRedo.setDisabled(true); - this.btnIncFontSize.setDisabled(true); - this.btnDecFontSize.setDisabled(true); - this.btnBold.setDisabled(true); - this.btnItalic.setDisabled(true); - this.btnUnderline.setDisabled(true); - this.btnStrikeout.setDisabled(true); - this.btnSuperscript.setDisabled(true); - this.btnSubscript.setDisabled(true); - this.btnHighlightColor.setDisabled(true); - this.btnFontColor.setDisabled(true); - this.btnParagraphColor.setDisabled(true); - this.btnMarkers.setDisabled(true); - this.btnNumbers.setDisabled(true); - this.btnMultilevels.setDisabled(true); - this.btnAlignLeft.setDisabled(true); - this.btnAlignCenter.setDisabled(true); - this.btnAlignRight.setDisabled(true); - this.btnAlignJust.setDisabled(true); - this.btnDecLeftOffset.setDisabled(true); - this.btnIncLeftOffset.setDisabled(true); - this.btnLineSpace.setDisabled(true); - this.btnShowHidenChars.setDisabled(true); - this.btnInsertTable.setDisabled(true); - this.btnInsertImage.setDisabled(true); - this.btnInsertChart.setDisabled(true); - this.btnInsertText.setDisabled(true); - this.btnInsertTextArt.setDisabled(true); - this.btnDropCap.setDisabled(true); - this.btnColumns.setDisabled(true); - this.btnInsertHyperlink.setDisabled(true); - this.btnEditHeader.setDisabled(true); - this.btnInsertShape.setDisabled(true); - this.btnInsertEquation.setDisabled(true); - this.btnPageOrient.setDisabled(true); - this.btnPageMargins.setDisabled(true); - this.btnPageSize.setDisabled(true); - this.btnClearStyle.setDisabled(true); - this.btnCopyStyle.setDisabled(true); - this.btnColorSchemas.setDisabled(true); - this.btnMailRecepients.setDisabled(true); - this.btnHorizontalAlign.setDisabled(true); - this.cmbFontName.setDisabled(true); - this.cmbFontSize.setDisabled(true); - this.listStyles.setDisabled(true); - this.btnNotes.setDisabled(true); if (mode.disableDownload) this.btnPrint.setDisabled(true); - - this.btnsPageBreak.disable(true); } this.mode = mode; diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 920dcefac..d1b233dab 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -429,6 +429,7 @@ "DE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", "DE.Controllers.Statusbar.textTrackChanges": "The document is opened with the Track Changes mode enabled", diff --git a/apps/documenteditor/main/resources/help/en/Contents.json b/apps/documenteditor/main/resources/help/en/Contents.json index 12879ec72..78f5aa4f5 100644 --- a/apps/documenteditor/main/resources/help/en/Contents.json +++ b/apps/documenteditor/main/resources/help/en/Contents.json @@ -29,7 +29,6 @@ {"src": "UsageInstructions/InsertFootnotes.htm", "name": "Insert footnotes" }, {"src": "UsageInstructions/InsertEquation.htm", "name": "Insert equations" }, {"src": "UsageInstructions/InsertTextObjects.htm", "name": "Insert text objects" }, - {"src": "UsageInstructions/InsertRichTextContentControls.htm", "name": "Create forms" }, {"src": "UsageInstructions/UseMailMerge.htm", "name": "Use mail merge"}, {"src": "UsageInstructions/ViewDocInfo.htm", "name": "View document information"}, {"src": "UsageInstructions/SavePrintDownload.htm", "name": "Save/download/print your document"}, diff --git a/apps/documenteditor/main/resources/help/ru/Contents.json b/apps/documenteditor/main/resources/help/ru/Contents.json index 2f66770fc..0faf411c9 100644 --- a/apps/documenteditor/main/resources/help/ru/Contents.json +++ b/apps/documenteditor/main/resources/help/ru/Contents.json @@ -29,7 +29,6 @@ {"src": "UsageInstructions/InsertFootnotes.htm", "name": "Вставка сносок" }, {"src": "UsageInstructions/InsertEquation.htm", "name": "Вставка формул" }, {"src": "UsageInstructions/InsertTextObjects.htm", "name": "Вставка текстовых объектов" }, - {"src": "UsageInstructions/InsertRichTextContentControls.htm", "name": "Создание форм" }, {"src": "UsageInstructions/UseMailMerge.htm", "name": "Использование слияния"}, {"src":"UsageInstructions/ViewDocInfo.htm", "name": "Просмотр сведений о документе"}, {"src":"UsageInstructions/SavePrintDownload.htm", "name": "Сохранение/загрузка/печать документа"}, diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index 127777c59..99df18990 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -88,6 +88,7 @@ define([ me.api.asc_registerCallback('asc_onAuthParticipantsChanged',_.bind(me.onApiUsersChanged, me)); me.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(me.onApiUserConnection, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); + Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me)); me.api.asc_coAuthoringGetUsers(); }, @@ -344,7 +345,7 @@ define([ items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0]; }; - if (!objectLocked && _isEdit) { + if (!objectLocked && _isEdit && !me.isDisconnected) { if (canCopy) { menuItems.push({ caption: me.menuCut, @@ -399,6 +400,10 @@ define([ return menuItems; }, + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + textGuest: 'Guest', menuCut: 'Cut', menuCopy: 'Copy', diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index aeb6c8792..64b305202 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -237,6 +237,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -551,10 +552,27 @@ define([ me.api.zoomFitToWidth(); } - DE.getController('Toolbar').activateControls(); + me.applyLicense(); + }, + onLicenseChanged: function(params) { + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady && this._state.licenseWarning) + this.applyLicense(); + }, + + applyLicense: function() { + var me = this; if (me._state.licenseWarning) { - value = Common.localStorage.getItem("de-license-warning"); + DE.getController('Toolbar').activateViewControls(); + DE.getController('Toolbar').deactivateEditControls(); + Common.NotificationCenter.trigger('api:disconnect'); + + var value = Common.localStorage.getItem("de-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); @@ -562,7 +580,7 @@ define([ Common.localStorage.setItem("de-license-warning", now); uiApp.modal({ title: me.textNoLicenseTitle, - text : me.warnNoLicense, + text : me._state.licenseWarning, buttons: [ { text: me.textBuyNow, @@ -577,10 +595,11 @@ define([ window.open('mailto:sales@onlyoffice.com', "_blank"); } } - ], + ] }); } - } + } else + DE.getController('Toolbar').activateControls(); }, onOpenDocument: function(progress) { @@ -638,8 +657,6 @@ define([ me.appOptions.canDownload = me.permissions.download !== false && (!type || typeof type[1] !== 'string'); me.appOptions.canReader = (!type || typeof type[1] !== 'string'); - me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view'; - me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); @@ -1260,7 +1277,8 @@ define([ txtStyle_Subtitle: 'Subtitle', txtStyle_Quote: 'Quote', txtStyle_Intense_Quote: 'Intense Quote', - txtStyle_List_Paragraph: 'List Paragraph' + txtStyle_List_Paragraph: 'List Paragraph', + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/mobile/app/controller/Toolbar.js b/apps/documenteditor/mobile/app/controller/Toolbar.js index 2da2aca06..3c124346a 100644 --- a/apps/documenteditor/mobile/app/controller/Toolbar.js +++ b/apps/documenteditor/mobile/app/controller/Toolbar.js @@ -79,6 +79,7 @@ define([ this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, setMode: function (mode) { @@ -138,6 +139,8 @@ define([ // API handlers onApiCanRevert: function(which, can) { + if (this.isDisconnected) return; + if (which == 'undo') { $('#toolbar-undo').toggleClass('disabled', !can); } else { @@ -146,6 +149,8 @@ define([ }, onApiFocusObject: function (objects) { + if (this.isDisconnected) return; + if (objects.length > 0) { var topObject = _.find(objects.reverse(), function (obj) { return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck; @@ -161,6 +166,18 @@ define([ $('#toolbar-edit, #toolbar-add, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); }, + activateViewControls: function() { + $('#toolbar-search, #document-back').removeClass('disabled'); + }, + + deactivateEditControls: function() { + $('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); + }, + + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + dlgLeaveTitleText : 'You leave the application', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leaveButtonText : 'Leave this Page', diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 856671908..e335735a9 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -147,6 +147,7 @@ "DE.Controllers.Main.uploadImageTitleText": "Uploading Image", "DE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "DE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "DE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "DE.Controllers.Search.textNoTextFound": "Text not Found", "DE.Controllers.Search.textReplaceAll": "Replace All", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3a327ba14..6c8c004ee 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -323,6 +323,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -719,6 +720,8 @@ define([ me.api.UpdateInterfaceState(); Common.NotificationCenter.trigger('document:ready', 'main'); + + me.applyLicense(); } }, 50); } else { @@ -738,17 +741,32 @@ define([ Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); + }, + onLicenseChanged: function(params) { + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady) + this.applyLicense(); + }, + + applyLicense: function() { if (this._state.licenseWarning) { - value = Common.localStorage.getItem("pe-license-warning"); + 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.localStorage.setItem("de-license-warning", now); + Common.localStorage.setItem("pe-license-warning", now); Common.UI.info({ width: 500, title: this.textNoLicenseTitle, - msg : this.warnNoLicense, + msg : this._state.licenseWarning, buttons: [ {value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs} @@ -765,6 +783,15 @@ define([ } }, + disableEditing: function(disable) { + var app = this.getApplication(); + if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + app.getController('RightMenu').getView('RightMenu').clearSelection(); + app.getController('Toolbar').DisableToolbar(disable); + app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); + } + }, + onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); @@ -812,8 +839,6 @@ define([ this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.canProtect = this.appOptions.isDesktopApp && this.api.asc_isSignaturesSupport(); - this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; - this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) appHeader.setBranding(this.editorConfig.customization); @@ -1946,7 +1971,8 @@ define([ saveTitleText: 'Saving Document', saveTextText: 'Saving document...', txtLoading: 'Loading...', - txtAddNotes: 'Click to add notes' + txtAddNotes: 'Click to add notes', + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index 7e7a77736..5bd9deb5c 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -364,8 +364,9 @@ define([ } this.developerHint.toggleClass('hidden', !mode); - var lastbtn = this.$el.find('button.btn-category:visible:last-of-type'); - this.minDevPosition = lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20; + 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(); }, diff --git a/apps/presentationeditor/main/app/view/Statusbar.js b/apps/presentationeditor/main/app/view/Statusbar.js index 4ff29d867..375d97ebf 100644 --- a/apps/presentationeditor/main/app/view/Statusbar.js +++ b/apps/presentationeditor/main/app/view/Statusbar.js @@ -303,6 +303,7 @@ define([ this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); } return this; @@ -344,7 +345,7 @@ define([ this.langMenu.doLayout(); if (this.langMenu.items.length>0) { this.btnLanguage.setDisabled(false || this._state.no_paragraph); - this.btnDocLanguage.setDisabled(false); + this.btnDocLanguage.setDisabled(!!this.mode.isDisconnected); } }, @@ -392,6 +393,11 @@ define([ this.btnLanguage.setDisabled(this._state.no_paragraph); }, + onApiCoAuthoringDisconnect: function() { + this.setMode({isDisconnected:true}); + this.SetDisabled(true); + }, + pageIndexText : 'Slide {0} of {1}', goToPageText : 'Go to Slide', tipFitPage : 'Fit to Slide', diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index b87e770e6..84941f148 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -361,6 +361,7 @@ "PE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?", diff --git a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js index 0bfa294c7..4f34bb20a 100644 --- a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js @@ -81,6 +81,7 @@ define([ me.api.asc_registerCallback('asc_onShowPopMenu', _.bind(me.onApiShowPopMenu, me)); me.api.asc_registerCallback('asc_onHidePopMenu', _.bind(me.onApiHidePopMenu, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me)); + Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me)); }, setMode: function (mode) { @@ -253,7 +254,7 @@ define([ items[indexAfter] = items.splice(indexBefore, 1, items[indexAfter])[0]; }; - if (!objectLocked && _isEdit) { + if (!objectLocked && _isEdit && !me.isDisconnected) { if (canCopy && isObject) { menuItems.push({ caption: me.menuCut, @@ -309,6 +310,10 @@ define([ return menuItems; }, + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + menuCut: 'Cut', menuCopy: 'Copy', menuPaste: 'Paste', diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 6b167173e..69d23b5c1 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -236,6 +236,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -511,18 +512,35 @@ define([ me.api.zoomFitToPage(); } - PE.getController('Toolbar').activateControls(); + me.applyLicense(); + }, + onLicenseChanged: function(params) { + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady && this._state.licenseWarning) + this.applyLicense(); + }, + + applyLicense: function() { + var me = this; if (me._state.licenseWarning) { - value = Common.localStorage.getItem("de-license-warning"); + PE.getController('Toolbar').activateViewControls(); + PE.getController('Toolbar').deactivateEditControls(); + 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.localStorage.setItem("de-license-warning", now); + Common.localStorage.setItem("pe-license-warning", now); uiApp.modal({ title: me.textNoLicenseTitle, - text : me.warnNoLicense, + text : me._state.licenseWarning, buttons: [ { text: me.textBuyNow, @@ -537,10 +555,11 @@ define([ window.open('mailto:sales@onlyoffice.com', "_blank"); } } - ], + ] }); } - } + } else + PE.getController('Toolbar').activateControls(); }, onOpenDocument: function(progress) { @@ -597,8 +616,6 @@ define([ me.appOptions.canDownloadOrigin = !me.appOptions.nativeApp && me.permissions.download !== false && (type && typeof type[1] === 'string'); me.appOptions.canDownload = !me.appOptions.nativeApp && me.permissions.download !== false && (!type || typeof type[1] !== 'string'); - me._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view'; - me.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof me.editorConfig.customization == 'object'); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object'); @@ -1261,7 +1278,8 @@ define([ txtImage: 'Image', txtSlideNumber: 'Slide number', txtSlideSubtitle: 'Slide subtitle', - txtSlideTitle: 'Slide title' + txtSlideTitle: 'Slide title', + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), PE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/presentationeditor/mobile/app/controller/Toolbar.js b/apps/presentationeditor/mobile/app/controller/Toolbar.js index f9e5c197d..38fe181cc 100644 --- a/apps/presentationeditor/mobile/app/controller/Toolbar.js +++ b/apps/presentationeditor/mobile/app/controller/Toolbar.js @@ -79,6 +79,7 @@ define([ this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, setMode: function (mode) { @@ -138,6 +139,8 @@ define([ // API handlers onApiCanRevert: function(which, can) { + if (this.isDisconnected) return; + if (which == 'undo') { $('#toolbar-undo').toggleClass('disabled', !can); } else { @@ -146,6 +149,8 @@ define([ }, onApiFocusObject: function (objects) { + if (this.isDisconnected) return; + if (objects.length > 0) { var slide_deleted = false, slide_lock = false, @@ -172,6 +177,18 @@ define([ $('#toolbar-preview, #toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); }, + activateViewControls: function() { + $('#toolbar-preview, #toolbar-search, #document-back').removeClass('disabled'); + }, + + deactivateEditControls: function() { + $('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); + }, + + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + dlgLeaveTitleText : 'You leave the application', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leaveButtonText : 'Leave this Page', diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index f3a5064cc..ef5060bc6 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -204,6 +204,7 @@ "PE.Controllers.Main.uploadImageTitleText": "Uploading Image", "PE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "PE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "PE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Search.textNoTextFound": "Text not Found", "PE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index bbc7be312..c7d2fed2f 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1520,6 +1520,9 @@ define([ if (!documentHolder.viewModeMenu) documentHolder.createDelayedElementsViewer(); + if (!documentHolder.viewModeMenu) + documentHolder.createDelayedElementsViewer(); + if (!showMenu && !documentHolder.viewModeMenu.isVisible()) return; if (isimagemenu && this.permissions.canProtect) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 2daa57f60..6f7fb0903 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -363,6 +363,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); }, @@ -731,6 +732,8 @@ define([ toolbarController.onApiCoAuthoringDisconnect(); Common.NotificationCenter.trigger('document:ready', 'main'); + + me.applyLicense(); } }, 50); } else { @@ -764,17 +767,34 @@ define([ if (typeof document.hidden !== 'undefined' && document.hidden) { document.addEventListener('visibilitychange', checkWarns); } else checkWarns(); + }, + onLicenseChanged: function(params) { + if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return; + + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady) + this.applyLicense(); + }, + + applyLicense: function() { if (this._state.licenseWarning) { - value = Common.localStorage.getItem("de-license-warning"); + 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.localStorage.setItem("de-license-warning", now); + Common.localStorage.setItem("sse-license-warning", now); Common.UI.info({ width: 500, title: this.textNoLicenseTitle, - msg : this.warnNoLicense, + msg : this._state.licenseWarning, buttons: [ {value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs} @@ -791,6 +811,14 @@ define([ } }, + disableEditing: function(disable) { + var app = this.getApplication(); + if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + app.getController('RightMenu').getView('RightMenu').clearSelection(); + app.getController('Toolbar').DisableToolbar(disable); + } + }, + onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); @@ -857,8 +885,6 @@ define([ this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); - this._state.licenseWarning = !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; - this.applyModeCommonElements(); this.applyModeEditorElements(); @@ -2133,7 +2159,8 @@ define([ txtStyle_Total: 'Total', txtStyle_Currency: 'Currency', txtStyle_Percent: 'Percent', - txtStyle_Comma: 'Comma' + txtStyle_Comma: 'Comma', + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index a34172be3..116ddb2d3 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -336,8 +336,9 @@ define([ } this.developerHint.toggleClass('hidden', !mode); - var lastbtn = this.$el.find('button.btn-category:visible:last-of-type'); - this.minDevPosition = lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20; + 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(); }, diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 764ae44e9..affc0f6a0 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -477,6 +477,7 @@ "SSE.Controllers.Main.warnBrowserZoom": "Your browser current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.", "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textWarning": "Warning", diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index 6651aaaf3..0690b9cf9 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -82,6 +82,7 @@ define([ this.api.asc_registerCallback('asc_onShowPopMenu', _.bind(this.onApiShowPopMenu, this)); this.api.asc_registerCallback('asc_onHidePopMenu', _.bind(this.onApiHidePopMenu, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); }, setMode: function (mode) { @@ -180,7 +181,7 @@ define([ }, onApiShowPopMenu: function(posX, posY) { - if ( !_isEdit ) return; + if ( !_isEdit || this.isDisconnected) return; if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal-in, .actions-modal').length > 0) { return; @@ -334,6 +335,10 @@ define([ return menuItems; }, + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + warnMergeLostData: 'Operation can destroy data in the selected cells.<br>Continue?', menuCopy: 'Copy', menuCut: 'Cut', diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index fcda864f5..5c2bb4b17 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -239,6 +239,7 @@ define([ } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); + this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -534,10 +535,33 @@ define([ mode: me.appOptions.isEdit ? 'edit' : 'view' }); - SSE.getController('Toolbar').activateControls(); + me.applyLicense(); + $('.view-main').on('click', function (e) { + uiApp.closeModal('.document-menu.modal-in'); + }) + }, + + onLicenseChanged: function(params) { + if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return; + + var licType = params.asc_getLicenseType(); + if (licType !== undefined && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount) && this.appOptions.canEdit && this.editorConfig.mode !== 'view') { + this._state.licenseWarning = (licType===Asc.c_oLicenseResult.Connections) ? this.warnNoLicense : this.warnNoLicenseUsers; + } + + if (this._isDocReady && this._state.licenseWarning) + this.applyLicense(); + }, + + applyLicense: function() { + var me = this; if (me._state.licenseWarning) { - value = Common.localStorage.getItem("sse-license-warning"); + SSE.getController('Toolbar').activateViewControls(); + SSE.getController('Toolbar').deactivateEditControls(); + Common.NotificationCenter.trigger('api:disconnect'); + + var value = Common.localStorage.getItem("sse-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); @@ -545,7 +569,7 @@ define([ Common.localStorage.setItem("sse-license-warning", now); uiApp.modal({ title: me.textNoLicenseTitle, - text : me.warnNoLicense, + text : me._state.licenseWarning, buttons: [ { text: me.textBuyNow, @@ -560,14 +584,11 @@ define([ window.open('mailto:sales@onlyoffice.com', "_blank"); } } - ], + ] }); } - } - - $('.view-main').on('click', function (e) { - uiApp.closeModal('.document-menu.modal-in'); - }) + } else + SSE.getController('Toolbar').activateControls(); }, onOpenDocument: function(progress) { @@ -624,8 +645,6 @@ define([ me.appOptions.canDownload = !me.appOptions.nativeApp && (me.permissions.download !== false); me.appOptions.canPrint = (me.permissions.print !== false); - me._state.licenseWarning = !(me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) && (licType===Asc.c_oLicenseResult.Connections) && me.appOptions.canEdit && me.editorConfig.mode !== 'view'; - me.applyModeCommonElements(); me.applyModeEditorElements(); @@ -1419,7 +1438,8 @@ define([ txtStyle_Total: 'Total', txtStyle_Currency: 'Currency', txtStyle_Percent: 'Percent', - txtStyle_Comma: 'Comma' + txtStyle_Comma: 'Comma', + warnNoLicenseUsers: 'This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.' } })(), SSE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js index 5ed1c7c18..53479d170 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Toolbar.js @@ -86,6 +86,7 @@ define([ this.api.asc_registerCallback('asc_onWorkbookLocked', _.bind(this.onApiWorkbookLocked, this)); this.api.asc_registerCallback('asc_onWorksheetLocked', _.bind(this.onApiWorksheetLocked, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onApiActiveSheetChanged, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('sheet:active', this.onApiActiveSheetChanged.bind(this)); }, @@ -159,6 +160,8 @@ define([ }, onApiCanRevert: function(which, can) { + if (this.isDisconnected) return; + if (which == 'undo') { $('#toolbar-undo').toggleClass('disabled', !can); } else { @@ -167,6 +170,8 @@ define([ }, onApiSelectionChanged: function(info) { + if (this.isDisconnected) return; + if ( !info ) info = this.api.asc_getCellInfo(); var islocked = false; @@ -195,6 +200,18 @@ define([ $('#toolbar-settings, #toolbar-search, #document-back').removeClass('disabled'); }, + activateViewControls: function() { + $('#toolbar-search, #document-back').removeClass('disabled'); + }, + + deactivateEditControls: function() { + $('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); + }, + + onCoAuthoringDisconnect: function() { + this.isDisconnected = true; + }, + dlgLeaveTitleText : 'You leave the application', dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leaveButtonText : 'Leave this Page', diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index a556627fc..9fc71c590 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -256,6 +256,7 @@ "SSE.Controllers.Main.uploadImageTitleText": "Uploading Image", "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.<br>Please update your license and refresh the page.", "SSE.Controllers.Main.warnNoLicense": "This version of ONLYOFFICE Editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", + "SSE.Controllers.Main.warnNoLicenseUsers": "This version of ONLYOFFICE Editors has certain limitations for concurrent users.<br>If you need more please consider upgrading your current license or purchasing a commercial one.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Search.textNoTextFound": "Text not found", "SSE.Controllers.Search.textReplaceAll": "Replace All",