From 6892321fb59aab29a3ecca852974e1ba2f55ddf4 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 23 Apr 2020 19:57:36 +0300 Subject: [PATCH] [DE] show warning on locked document open --- .../main/lib/component/SynchronizeTip.js | 4 ++ .../main/resources/less/synchronize-tip.less | 19 ++++++++- .../main/app/controller/Main.js | 39 +++++++++++++++++++ apps/documenteditor/main/locale/en.json | 1 + 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js index 1ce8a0ab5..022d63193 100644 --- a/apps/common/main/lib/component/SynchronizeTip.js +++ b/apps/common/main/lib/component/SynchronizeTip.js @@ -105,6 +105,10 @@ define([ applyPlacement: function () { var showxy = this.target.offset(), innerHeight = Common.Utils.innerHeight(); + + if (this.placement == 'document') { + // this.cmpEl.css('top', $('#editor_sdk').offset().top); + } else if (this.placement == 'top') this.cmpEl.css({bottom : innerHeight - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'}); else {// left or right diff --git a/apps/common/main/resources/less/synchronize-tip.less b/apps/common/main/resources/less/synchronize-tip.less index f78c721e6..921310553 100644 --- a/apps/common/main/resources/less/synchronize-tip.less +++ b/apps/common/main/resources/less/synchronize-tip.less @@ -1,10 +1,27 @@ .synch-tip-root { position: absolute; z-index: @zindex-navbar + 2; - width: 300px; + + &:not(.simple) { + width: 300px; + .tip-text { width: 260px; } + } + + &.simple { + max-width: 700px; + left: 50%; + transform: translate(-50%, 20px); + .tip-arrow { + display: none; + } + + .asc-synchronizetip { + padding-right: 30px; + } + } &.inc-index { z-index: @zindex-navbar + 4; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 0c2c96c87..f686586e4 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1058,6 +1058,10 @@ define([ Common.NotificationCenter.trigger('document:ready', 'main'); me.applyLicense(); + + if ( me.api.asc_isReadOnly() ) { + me.warningDocumentIsLocked(); + } } }, 50); } else { @@ -2219,6 +2223,41 @@ define([ }) }, + warningDocumentIsLocked: function() { + var me = this; + var _disable_ui = function (disable) { + DE.getController('RightMenu').SetDisabled(disable, false, true); + DE.getController('Toolbar').DisableToolbar(disable, disable); + DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable); + DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable); + DE.getController('DocumentHolder').getView().SetDisabled(disable, true); + DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable); + DE.getController('LeftMenu').setPreviewMode(disable); + var comments = DE.getController('Common.Controllers.Comments'); + if (comments) comments.setPreviewMode(disable); + } + + _disable_ui(true); + + var tip = new Common.UI.SynchronizeTip({ + extCls : 'simple', + text : Common.Locale.get("warnFileLocked",{name:"DE.Controllers.Main"}), + textLink : Common.Locale.get("txtContinueEditing",{name:"DE.Views.SignatureSettings"}), + placement : 'document' + }); + tip.on({ + 'dontshowclick': function() { + _disable_ui(false); + me.api.asc_setIsReadOnly(false); + this.close(); + }, + 'closeclick': function() { + this.close(); + } + }); + tip.show(); + }, + 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.', criticalErrorTitle: 'Error', notcriticalErrorTitle: 'Warning', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index aa93d8255..7cc96cf00 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -743,6 +743,7 @@ "DE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.
If you need more please consider purchasing a commercial license.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.warnFileLocked": "Document is in use by another application. You can continue editing and save it as a copy.", "DE.Controllers.Main.textConvertEquation": "This equation was created with an old version of equation editor which is no longer supported. Converting this equation to Office Math ML format will make it editable.
Do you want to convert this equation?", "DE.Controllers.Main.textApplyAll": "Apply to all equations", "DE.Controllers.Main.textLearnMore": "Learn More",