[all] debug locked file open

This commit is contained in:
Maxim Kadushkin 2020-04-29 20:54:48 +03:00
parent 2400e764e6
commit f50d0253ca
9 changed files with 68 additions and 28 deletions

View file

@ -74,6 +74,9 @@ Common.Locale = new(function() {
var res = '';
if (l10n && scope && scope.name) {
res = l10n[scope.name + '.' + prop];
if ( !res && scope.default )
res = scope.default;
}
return res || (scope ? eval(scope.name).prototype[prop] : '');

View file

@ -201,9 +201,11 @@ define([
});
Common.NotificationCenter.on('document:ready', function () {
var maincontroller = webapp.getController('Main');
if ( maincontroller.api.asc_isReadOnly && maincontroller.api.asc_isReadOnly() ) {
maincontroller.warningDocumentIsLocked();
if ( config.isEdit ) {
var maincontroller = webapp.getController('Main');
if (maincontroller.api.asc_isReadOnly && maincontroller.api.asc_isReadOnly()) {
maincontroller.warningDocumentIsLocked();
}
}
});

View file

@ -853,6 +853,30 @@ Common.Utils.injectComponent = function ($slot, cmp) {
}
};
Common.Utils.warningDocumentIsLocked = function (opts) {
if ( opts.disablefunc )
opts.disablefunc(true);
var app = window.DE || window.PE || window.SSE;
var tip = new Common.UI.SynchronizeTip({
extCls : 'simple',
text : Common.Locale.get("warnFileLocked",{name:"Common.Translation", default:'Document is in use by another application. You can continue editing and save it as a copy.'}),
textLink : Common.Locale.get("txtContinueEditing",{name:app.nameSpace + ".Views.SignatureSettings", default:'Edit anyway'}),
placement : 'document'
});
tip.on({
'dontshowclick': function() {
if ( opts.disablefunc ) opts.disablefunc(false);
app.getController('Main').api.asc_setIsReadOnly(false);
this.close();
},
'closeclick': function() {
this.close();
}
});
tip.show();
};
jQuery.fn.extend({
elementById: function (id, parent) {
/**

View file

@ -2222,36 +2222,15 @@ 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);
me.disableEditing(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();
Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui});
},
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.',

View file

@ -71,6 +71,7 @@
"Common.Controllers.ReviewChanges.textUnderline": "Underline",
"Common.Controllers.ReviewChanges.textUrl": "Paste a document URL",
"Common.Controllers.ReviewChanges.textWidow": "Widow control",
"Common.Translation.warnFileLocked": "Document is in use by another application. You can continue editing and save it as a copy.",
"Common.define.chartData.textArea": "Area",
"Common.define.chartData.textBar": "Bar",
"Common.define.chartData.textCharts": "Charts",
@ -743,7 +744,6 @@
"DE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.<br>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.<br>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.<br>Do you want to convert this equation?",
"DE.Controllers.Main.textApplyAll": "Apply to all equations",
"DE.Controllers.Main.textLearnMore": "Learn More",

View file

@ -1866,6 +1866,20 @@ define([
}
},
warningDocumentIsLocked: function() {
var me = this;
Common.Utils.warningDocumentIsLocked({
disablefunc: function (disable) {
me.disableEditing(disable);
PE.getController('RightMenu').SetDisabled(disable, true);
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
PE.getController('LeftMenu').setPreviewMode(disable);
var comments = PE.getController('Common.Controllers.Comments');
if (comments) comments.setPreviewMode(disable);
}});
},
// Translation
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',

View file

@ -1,4 +1,5 @@
{
"Common.Translation.warnFileLocked": "Document is in use by another application. You can continue editing and save it as a copy.",
"Common.Controllers.Chat.notcriticalErrorTitle": "Warning",
"Common.Controllers.Chat.textEnterMessage": "Enter your message here",
"Common.Controllers.ExternalDiagramEditor.textAnonymous": "Anonymous",

View file

@ -2164,6 +2164,22 @@ define([
if (url) this.iframePrint.src = url;
},
warningDocumentIsLocked: function() {
var me = this;
Common.Utils.warningDocumentIsLocked({
disablefunc: function (disable) {
me.disableEditing(disable);
SSE.getController('RightMenu').SetDisabled(disable, true);
SSE.getController('Statusbar').SetDisabled(disable);
SSE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
SSE.getController('DocumentHolder').SetDisabled(disable, true);
SSE.getController('LeftMenu').setPreviewMode(disable);
var comments = SSE.getController('Common.Controllers.Comments');
if (comments) comments.setPreviewMode(disable);
}});
},
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',

View file

@ -1,5 +1,6 @@
{
"cancelButtonText": "Cancel",
"Common.Translation.warnFileLocked": "Document is in use by another application. You can continue editing and save it as a copy.",
"Common.Controllers.Chat.notcriticalErrorTitle": "Warning",
"Common.Controllers.Chat.textEnterMessage": "Enter your message here",
"Common.define.chartData.textArea": "Area",