From 0dd09875b825e93fd1351166177c24c6437471fc Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 12 Oct 2016 16:32:48 +0300 Subject: [PATCH] Disable download as, print, save and version history when server is disconnected. --- apps/documenteditor/main/app/controller/LeftMenu.js | 6 +++--- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/documenteditor/main/app/controller/Toolbar.js | 6 +++--- apps/documenteditor/main/app/view/FileMenu.js | 6 ++++-- apps/documenteditor/main/app/view/Toolbar.js | 2 ++ apps/documenteditor/main/locale/de.json | 2 +- apps/documenteditor/main/locale/en.json | 4 +--- apps/documenteditor/main/locale/es.json | 2 +- apps/documenteditor/main/locale/fr.json | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 6 +++--- apps/presentationeditor/main/app/controller/Main.js | 4 ++-- apps/presentationeditor/main/app/controller/Toolbar.js | 6 +++--- apps/presentationeditor/main/app/view/FileMenu.js | 4 ++++ apps/presentationeditor/main/app/view/Toolbar.js | 2 +- apps/presentationeditor/main/locale/en.json | 2 +- apps/presentationeditor/main/locale/es.json | 2 +- apps/presentationeditor/main/locale/fr.json | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 6 +++--- apps/spreadsheeteditor/main/app/controller/Main.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 6 +++--- apps/spreadsheeteditor/main/app/view/FileMenu.js | 4 ++++ apps/spreadsheeteditor/main/app/view/Toolbar.js | 1 + apps/spreadsheeteditor/main/locale/en.json | 2 +- apps/spreadsheeteditor/main/locale/es.json | 2 +- apps/spreadsheeteditor/main/locale/fr.json | 2 +- 25 files changed, 50 insertions(+), 39 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 45b04c8c6..30626e67f 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -122,7 +122,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -446,7 +446,7 @@ define([ } }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -456,7 +456,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ce7988140..ce3302791 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1195,7 +1195,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1964,7 +1964,7 @@ define([ textNoLicenseTitle: 'ONLYOFFICE open source version', warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index c2f40c4ad..a07326226 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -304,7 +304,7 @@ define([ this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this)); this.api.asc_registerCallback('asc_onTextHighLight', _.bind(this.onApiHighlightColor, this)); this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this)); @@ -2592,8 +2592,8 @@ define([ }); }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 7187d1305..d9a6eed04 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -215,6 +215,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -261,8 +262,7 @@ define([ this.panels['help'].setLangConfig(this.mode.lang); - this.items[11][this.mode.canUseHistory?'show':'hide'](); - this.items[11].setDisabled(this.mode.isDisconnected); + this.items[11][this.mode.canUseHistory&&!this.mode.isDisconnected?'show':'hide'](); }, setMode: function(mode, delay) { @@ -271,6 +271,8 @@ define([ this.mode.canOpenRecent = this.mode.canCreateNew = false; this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = this.mode.canDownloadOrigin = false; } else { this.mode = mode; } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index bb8aabb8e..dfdc84a85 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1517,6 +1517,8 @@ define([ this.cmbFontName.setDisabled(true); this.cmbFontSize.setDisabled(true); this.listStyles.setDisabled(true); + if (mode.disableDownload) + this.btnPrint.setDisabled(true); } this.mode = mode; diff --git a/apps/documenteditor/main/locale/de.json b/apps/documenteditor/main/locale/de.json index 9f54529ef..61e3cf093 100644 --- a/apps/documenteditor/main/locale/de.json +++ b/apps/documenteditor/main/locale/de.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "Die Dateiversion wurde geändert. Die Seite wird neu geladen.", "DE.Controllers.Main.errorUserDrop": "Kein Zugriff auf diese Datei ist möglich.", "DE.Controllers.Main.errorUsersExceed": "Die nach dem Zahlungsplan erlaubte Anzahl der Benutzer ist überschritten", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Dieses Dokument enthält ungespeicherte Änderungen. Klicken Sie auf \"Auf dieser Seite bleiben\" und dann auf \"Speichern\", um sie zu speichern. Klicken Sie auf \"Diese Seite verlassen\", um alle nicht gespeicherten Änderungen zu verwerfen.\n", "DE.Controllers.Main.loadFontsTextText": "Daten werden geladen...", "DE.Controllers.Main.loadFontsTitleText": "Daten werden geladen", diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 93734ac68..23c72830c 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -198,8 +198,6 @@ "DE.Controllers.Main.applyChangesTextText": "Loading the changes...", "DE.Controllers.Main.applyChangesTitleText": "Loading the Changes", "del_DE.Controllers.Main.convertationErrorText": "Conversion failed.", - "DE.Controllers.Main.openErrorText": "An error has occurred while opening the file", - "DE.Controllers.Main.saveErrorText": "An error has occurred while saving the file", "DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.", "DE.Controllers.Main.criticalErrorExtText": "Press \"OK\" to return to document list.", "DE.Controllers.Main.criticalErrorTitle": "Error", @@ -224,7 +222,7 @@ "DE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "DE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "DE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "You have unsaved changes in this document. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "DE.Controllers.Main.loadFontsTextText": "Loading data...", "DE.Controllers.Main.loadFontsTitleText": "Loading Data", diff --git a/apps/documenteditor/main/locale/es.json b/apps/documenteditor/main/locale/es.json index 7076c79d7..fc1790b27 100644 --- a/apps/documenteditor/main/locale/es.json +++ b/apps/documenteditor/main/locale/es.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "DE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "DE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Hay cambios no guardados en este documento. Haga clic en 'Permanecer en esta página', después 'Guardar' para guardarlos. Haga clic en 'Abandonar esta página' para descartar todos los cambios no guardados.", "DE.Controllers.Main.loadFontsTextText": "Cargando datos...", "DE.Controllers.Main.loadFontsTitleText": "Cargando datos", diff --git a/apps/documenteditor/main/locale/fr.json b/apps/documenteditor/main/locale/fr.json index 238e8d94f..3533035f1 100644 --- a/apps/documenteditor/main/locale/fr.json +++ b/apps/documenteditor/main/locale/fr.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "DE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "DE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans ce document. Cliquez sur 'Rester sur cette page', ensuite sur 'Enregistrer' pour enregistrer les modifications. Cliquez sur 'Quitter cette page' pour annuler toutes les modifications non enregistrées.", "DE.Controllers.Main.loadFontsTextText": "Chargement des données...", "DE.Controllers.Main.loadFontsTitleText": "Chargement des données", diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index f8794b990..7e563df19 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -119,7 +119,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onThumbnailsShow', _.bind(this.onThumbnailsShow, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -344,7 +344,7 @@ define([ // this.api.asc_selectSearchingResults(false); }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -354,7 +354,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index baa3c69c8..57efa7dfc 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -963,7 +963,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1779,7 +1779,7 @@ define([ textNoLicenseTitle: 'ONLYOFFICE open source version', warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index a7062bf86..0db6a057b 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -278,7 +278,7 @@ define([ this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); @@ -684,8 +684,8 @@ define([ this.toolbar.lockToolbar(PE.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas]}); }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index 46b94f94b..da463c62d 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -212,6 +212,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -258,7 +259,10 @@ define([ if (mode.isDisconnected) { this.mode.canEdit = this.mode.isEdit = false; this.mode.canOpenRecent = this.mode.canCreateNew = false; + this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = false; } else { this.mode = mode; } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index f9c837390..7f2ee762c 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1287,7 +1287,7 @@ define([ this.mnuitemHideTitleBar.hide(); } - this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); + this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint || mode.disableDownload, {array: [this.btnPrint]}); }, changeViewMode: function(item, compact) { diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index d44929f8b..7f5687b99 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -135,7 +135,7 @@ "PE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "PE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "PE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "You have unsaved changes in this presentation. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "PE.Controllers.Main.loadFontsTextText": "Loading data...", "PE.Controllers.Main.loadFontsTitleText": "Loading Data", diff --git a/apps/presentationeditor/main/locale/es.json b/apps/presentationeditor/main/locale/es.json index 9fbd8f50c..21a2fe207 100644 --- a/apps/presentationeditor/main/locale/es.json +++ b/apps/presentationeditor/main/locale/es.json @@ -123,7 +123,7 @@ "PE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "PE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "PE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "Hay cambios no guardados en esta presentación. Pulse \"Permanecer en esta página\", después \"Guardar\" para guardadarlos. Pulse \"Abandonar esta página\" para descartar todos los cambios no guardados.", "PE.Controllers.Main.loadFontsTextText": "Cargando datos...", "PE.Controllers.Main.loadFontsTitleText": "Cargando datos", diff --git a/apps/presentationeditor/main/locale/fr.json b/apps/presentationeditor/main/locale/fr.json index 406607cd3..7201bf8a1 100644 --- a/apps/presentationeditor/main/locale/fr.json +++ b/apps/presentationeditor/main/locale/fr.json @@ -123,7 +123,7 @@ "PE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "PE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "PE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans cette présentation. Cliquez sur \"Rester sur cette page\", ensuite sur \"Enregistrer\" pour enregistrer les modifications. Cliquez sur \"Quitter cette page\" pour annuler toutes les modifications non enregistrées.", "PE.Controllers.Main.loadFontsTextText": "Chargement des données...", "PE.Controllers.Main.loadFontsTitleText": "Chargement des données", diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index e5482dcbc..3bc0df158 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -127,7 +127,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onRenameCellTextEnd', _.bind(this.onRenameText, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -509,7 +509,7 @@ define([ } }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -519,7 +519,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 5f64f6fdb..ba4b3cc2b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1076,7 +1076,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1969,7 +1969,7 @@ define([ warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', confirmPutMergeRange: 'The source data contains merged cells.
They will be unmerged before they are pasted into the table.', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index bd2b39d10..5129c25fc 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -269,7 +269,7 @@ define([ this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this)); this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); @@ -1374,8 +1374,8 @@ define([ window.styles_loaded = true; }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 69577f294..ff7b248c5 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -198,6 +198,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -242,7 +243,10 @@ define([ if (mode.isDisconnected) { this.mode.canEdit = this.mode.isEdit = false; this.mode.canOpenRecent = this.mode.canCreateNew = false; + this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = false; } else { this.mode = mode; } diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 5d4f096c6..d9afcc7a3 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1684,6 +1684,7 @@ define([ this.lockToolbar( SSE.enumLock.lostConnect, true ); this.lockToolbar( SSE.enumLock.lostConnect, true, {array:[this.btnEditChart,this.btnUndo,this.btnRedo,this.btnOpenDocument,this.btnNewDocument,this.btnSave]} ); + this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint || mode.disableDownload, {array: [this.btnPrint]}); } else { this.mode = mode; diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index c5900342b..05ed1e1ee 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -173,7 +173,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "SSE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "SSE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "An error in the entered formula.
Wrong number of brackets is used.", "SSE.Controllers.Main.errorWrongOperator": "An error in the entered formula. Wrong operator is used.
Please correct the error or use the Esc button to cancel the formula editing.", "SSE.Controllers.Main.leavePageText": "You have unsaved changes in this spreadsheet. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.", diff --git a/apps/spreadsheeteditor/main/locale/es.json b/apps/spreadsheeteditor/main/locale/es.json index 891234a3a..edc45f3ef 100644 --- a/apps/spreadsheeteditor/main/locale/es.json +++ b/apps/spreadsheeteditor/main/locale/es.json @@ -167,7 +167,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "SSE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "SSE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "Un error en la fórmula introducida.
Número incorrecto de corchetes es usado.", "SSE.Controllers.Main.errorWrongOperator": "Un error en la fórmula introducida.Operador inválido es usado.
Por favor, corrija el error o utilice el botón Esc para cancelar la edición de fórmulas.", "SSE.Controllers.Main.leavePageText": "Usted tiene cambios no guardados en esta hoja de cálculo. Haga clic en 'Permanecer en esta página', después 'Guardar' para guardarlos. Haga clic en 'Abandonar esta página' para descartar todos los cambios no guardados.", diff --git a/apps/spreadsheeteditor/main/locale/fr.json b/apps/spreadsheeteditor/main/locale/fr.json index 33baf2931..49a50d198 100644 --- a/apps/spreadsheeteditor/main/locale/fr.json +++ b/apps/spreadsheeteditor/main/locale/fr.json @@ -167,7 +167,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "SSE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "SSE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "Une erreur dans la formule entrée.
Nombre utilisé entre parenthèses est incorrect.", "SSE.Controllers.Main.errorWrongOperator": "Une erreur dans la formule entrée.
Opérateur utilisé est incorrect.
Veuillez corriger l'erreur ou utilisez le bouton Esc pour annuler l'édition de formule.", "SSE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans cette feuille de calcul. Cliquez sur 'Rester sur cette page ' ensuite 'Enregistrer' pour les enregistrer. Cliquez sur 'Quitter cette page' pour annuler toutes les modifications non enregistrées.",