[Mobile] Fix Bug 47689

This commit is contained in:
Julia Radzhabova 2020-11-26 17:32:14 +03:00
parent 2d2a47aa2d
commit f65b9bc254
7 changed files with 89 additions and 54 deletions

View file

@ -143,6 +143,9 @@ define([
setMode: function (mode) { setMode: function (mode) {
this.getView('Settings').setMode(mode); this.getView('Settings').setMode(mode);
if (mode.isDisconnected) {
_canReview = _isReviewOnly = _isEdit = false;
} else {
if (mode.canBranding) if (mode.canBranding)
_licInfo = mode.customization; _licInfo = mode.customization;
_canReview = mode.canReview; _canReview = mode.canReview;
@ -150,6 +153,7 @@ define([
_fileKey = mode.fileKey; _fileKey = mode.fileKey;
_isEdit = mode.isEdit; _isEdit = mode.isEdit;
_lang = mode.lang; _lang = mode.lang;
}
}, },
initEvents: function () { initEvents: function () {

View file

@ -181,13 +181,17 @@ define([
$('#toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled'); $('#toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled');
}, },
deactivateEditControls: function() { deactivateEditControls: function(enableDownload) {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); $('#toolbar-edit, #toolbar-add').addClass('disabled');
if (enableDownload)
DE.getController('Settings').setMode({isDisconnected: true, enableDownload: enableDownload});
else
$('#toolbar-settings').addClass('disabled');
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function(enableDownload) {
this.isDisconnected = true; this.isDisconnected = true;
this.deactivateEditControls(); this.deactivateEditControls(enableDownload);
$('#toolbar-undo').toggleClass('disabled', true); $('#toolbar-undo').toggleClass('disabled', true);
$('#toolbar-redo').toggleClass('disabled', true); $('#toolbar-redo').toggleClass('disabled', true);
DE.getController('AddContainer').hideModal(); DE.getController('AddContainer').hideModal();

View file

@ -106,15 +106,21 @@ define([
}, },
setMode: function (mode) { setMode: function (mode) {
if (mode.isDisconnected) {
_canEdit = _isEdit = false;
_canReview = false;
_isReviewOnly = false;
if (!mode.enableDownload)
_canPrint = _canDownload = _canDownloadOrigin = false;
} else {
_isEdit = mode.isEdit; _isEdit = mode.isEdit;
_canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights; _canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
_canDownload = mode.canDownload;
_canDownloadOrigin = mode.canDownloadOrigin;
_canReader = !mode.isEdit && !mode.isRestrictedEdit && mode.canReader; _canReader = !mode.isEdit && !mode.isRestrictedEdit && mode.canReader;
_canPrint = mode.canPrint;
_canReview = mode.canReview; _canReview = mode.canReview;
_isReviewOnly = mode.isReviewOnly; _isReviewOnly = mode.isReviewOnly;
_canDownload = mode.canDownload;
_canDownloadOrigin = mode.canDownloadOrigin;
_canPrint = mode.canPrint;
if (mode.customization && mode.canBrandingExt) { if (mode.customization && mode.canBrandingExt) {
_canAbout = (mode.customization.about!==false); _canAbout = (mode.customization.about!==false);
} }
@ -123,6 +129,7 @@ define([
_canHelp = (mode.customization.help!==false); _canHelp = (mode.customization.help!==false);
_isShowMacros = (mode.customization.macros!==false); _isShowMacros = (mode.customization.macros!==false);
} }
}
}, },
rootLayout: function () { rootLayout: function () {

View file

@ -190,13 +190,17 @@ define([
$('#toolbar-preview, #toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled'); $('#toolbar-preview, #toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled');
}, },
deactivateEditControls: function() { deactivateEditControls: function(enableDownload) {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); $('#toolbar-edit, #toolbar-add').addClass('disabled');
if (enableDownload)
PE.getController('Settings').setMode({isDisconnected: true, enableDownload: enableDownload});
else
$('#toolbar-settings').addClass('disabled');
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function(enableDownload) {
this.isDisconnected = true; this.isDisconnected = true;
this.deactivateEditControls(); this.deactivateEditControls(enableDownload);
$('#toolbar-undo').toggleClass('disabled', true); $('#toolbar-undo').toggleClass('disabled', true);
$('#toolbar-redo').toggleClass('disabled', true); $('#toolbar-redo').toggleClass('disabled', true);
PE.getController('AddContainer').hideModal(); PE.getController('AddContainer').hideModal();

View file

@ -107,6 +107,11 @@ define([
}, },
setMode: function (mode) { setMode: function (mode) {
if (mode.isDisconnected) {
canEdit = isEdit = false;
if (!mode.enableDownload)
canPrint = canDownload = false;
} else {
isEdit = mode.isEdit; isEdit = mode.isEdit;
canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights; canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
canDownload = mode.canDownload || mode.canDownloadOrigin; canDownload = mode.canDownload || mode.canDownloadOrigin;
@ -120,6 +125,7 @@ define([
canHelp = (mode.customization.help!==false); canHelp = (mode.customization.help!==false);
isShowMacros = (mode.customization.macros!==false); isShowMacros = (mode.customization.macros!==false);
} }
}
}, },
rootLayout: function () { rootLayout: function () {

View file

@ -209,13 +209,17 @@ define([
$('#toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled'); $('#toolbar-search, #document-back, #toolbar-collaboration').removeClass('disabled');
}, },
deactivateEditControls: function() { deactivateEditControls: function(enableDownload) {
$('#toolbar-edit, #toolbar-add, #toolbar-settings').addClass('disabled'); $('#toolbar-edit, #toolbar-add').addClass('disabled');
if (enableDownload)
SSE.getController('Settings').setMode({isDisconnected: true, enableDownload: enableDownload});
else
$('#toolbar-settings').addClass('disabled');
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function(enableDownload) {
this.isDisconnected = true; this.isDisconnected = true;
this.deactivateEditControls(); this.deactivateEditControls(enableDownload);
$('#toolbar-undo').toggleClass('disabled', true); $('#toolbar-undo').toggleClass('disabled', true);
$('#toolbar-redo').toggleClass('disabled', true); $('#toolbar-redo').toggleClass('disabled', true);
SSE.getController('AddContainer').hideModal(); SSE.getController('AddContainer').hideModal();

View file

@ -116,6 +116,11 @@ define([
}, },
setMode: function (mode) { setMode: function (mode) {
if (mode.isDisconnected) {
canEdit = isEdit = false;
if (!mode.enableDownload)
canPrint = canDownload = false;
} else {
isEdit = mode.isEdit; isEdit = mode.isEdit;
canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights; canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
canDownload = mode.canDownload || mode.canDownloadOrigin; canDownload = mode.canDownload || mode.canDownloadOrigin;
@ -129,6 +134,7 @@ define([
canHelp = (mode.customization.help!==false); canHelp = (mode.customization.help!==false);
isShowMacros = (mode.customization.macros!==false); isShowMacros = (mode.customization.macros!==false);
} }
}
}, },
rootLayout: function () { rootLayout: function () {