diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 8f3d8e6d9a..c16aedee32 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -912,6 +912,10 @@ DE.ApplicationController = new(function(){ case Asc.c_oAscError.ID.SessionToken: // don't show error message return; + case Asc.c_oAscError.ID.CopyDisabled: + message= me.errorCopyDisabled; + break; + default: // message = me.errorDefaultMessage.replace('%1', id); // break; @@ -1201,6 +1205,7 @@ DE.ApplicationController = new(function(){ textCancel: 'Cancel', txtSecurityWarningLink: 'This document is trying to connect to %1.
If you trust this site, press \"OK\" while holding down the ctrl key.', txtSecurityWarningOpenFile: 'This document is trying to open file dialog, press \"OK\" to open.', - txtSecurityWarningLinkOk: 'This document is trying to connect to %1.
If you trust this site, press \"OK\".' + txtSecurityWarningLinkOk: 'This document is trying to connect to %1.
If you trust this site, press \"OK\".', + errorCopyDisabled: 'For security reasons, the contents of this document cannot be copied to the clipboard.' } })(); \ No newline at end of file diff --git a/apps/documenteditor/embed/locale/en.json b/apps/documenteditor/embed/locale/en.json index 1f647cdcec..6df3bad897 100644 --- a/apps/documenteditor/embed/locale/en.json +++ b/apps/documenteditor/embed/locale/en.json @@ -63,6 +63,7 @@ "DE.ApplicationController.waitText": "Please, wait...", "DE.ApplicationController.warnLicenseBefore": "License not active. Please contact your administrator.", "DE.ApplicationController.warnLicenseExp": "Your license has expired. Please update your license and refresh the page.", + "DE.ApplicationController.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtDownloadDocx": "Download as DOCX", "DE.ApplicationView.txtDownloadPdf": "Download as PDF", diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 00b01f393b..a2cb14bab4 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -353,6 +353,11 @@ define([ config.msg = this.errorInconsistentExt; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') @@ -673,6 +678,7 @@ define([ this.appOptions.canDownload = this.permissions.download !== false; this.appOptions.canPrint = (this.permissions.print !== false); + this.appOptions.canCopy = this.permissions.copy !== false; this.appOptions.fileKey = this.document.key; this.appOptions.isAnonymousSupport = !!this.api.asc_isAnonymousSupport(); @@ -2112,7 +2118,7 @@ define([ if (this.api) { var res = (item.value == 'cut') ? this.api.Cut() : ((item.value == 'copy') ? this.api.Copy() : this.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("de-forms-hide-copywarning")) { + if (!Common.localStorage.getBool("de-forms-hide-copywarning") && (item.value === 'paste' || this.appOptions.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("de-forms-hide-copywarning", 1); @@ -2393,6 +2399,7 @@ define([ titleReadOnly: 'Read-Only Mode', textContinue: 'Continue', txtSignedForm: 'This document has been signed and cannot be edited.', + errorCopyDisabled: 'For security reasons, the contents of this document cannot be copied to the clipboard.' }, DE.Controllers.ApplicationController)); }); diff --git a/apps/documenteditor/forms/locale/en.json b/apps/documenteditor/forms/locale/en.json index 1efaf8e670..e179011da3 100644 --- a/apps/documenteditor/forms/locale/en.json +++ b/apps/documenteditor/forms/locale/en.json @@ -178,6 +178,7 @@ "DE.Controllers.ApplicationController.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "DE.Controllers.ApplicationController.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "DE.Controllers.ApplicationController.warnStartFilling": "Form filling is in progress.
File editing is not currently available.", + "DE.Controllers.ApplicationController.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "DE.Views.ApplicationView.textClear": "Clear all fields", "DE.Views.ApplicationView.textClearField": "Clear field", "DE.Views.ApplicationView.textClose": "Close file", diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 012c902892..3f285f43fe 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1303,7 +1303,7 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - if (!this.appOptions.canCopy) + if (!me.appOptions.canCopy) Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); Common.Utils.InternalSettings.set("de-settings-datetime-default", Common.localStorage.getItem("de-settings-datetime-default")); diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 9bfb94f16f..c27d190234 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -488,7 +488,8 @@ "uploadDocSizeMessage": "Maximum document size limit exceeded.", "uploadImageExtMessage": "Unknown image format.", "uploadImageFileCountMessage": "No images uploaded.", - "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB." + "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB.", + "errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard." }, "LongActions": { "applyChangesTextText": "Loading data...", diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index fc7cdb445b..fcc0ff243e 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -15,6 +15,7 @@ import EditorUIController from '../lib/patch'; canCoAuthoring: stores.storeAppOptions.canCoAuthoring, canReview: stores.storeAppOptions.canReview, canFillForms: stores.storeAppOptions.canFillForms, + canCopy: stores.storeAppOptions.canCopy, users: stores.users, isDisconnected: stores.users.isDisconnected, displayMode: stores.storeReview.displayMode, @@ -92,11 +93,11 @@ class ContextMenu extends ContextMenuController { const api = Common.EditorApi.get(); switch (action) { case 'cut': - if ( !LocalStorage.getBool("de-hide-copy-cut-paste-warning") ) + if ( !LocalStorage.getBool("de-hide-copy-cut-paste-warning") && this.props.canCopy ) this.showCopyCutPasteModal(); break; case 'copy': - if (!api.Copy() && !LocalStorage.getBool("de-hide-copy-cut-paste-warning") ) + if (!api.Copy() && !LocalStorage.getBool("de-hide-copy-cut-paste-warning") && this.props.canCopy ) this.showCopyCutPasteModal(); break; case 'paste': diff --git a/apps/documenteditor/mobile/src/controller/Error.jsx b/apps/documenteditor/mobile/src/controller/Error.jsx index 71bc8e9194..027699230a 100644 --- a/apps/documenteditor/mobile/src/controller/Error.jsx +++ b/apps/documenteditor/mobile/src/controller/Error.jsx @@ -263,6 +263,10 @@ const ErrorController = inject('storeAppOptions','storeDocumentInfo')(({storeApp config.msg = t('Error.errorEditProtectedRange'); break; + case Asc.c_oAscError.ID.CopyDisabled: + config.msg = t('Error.errorCopyDisabled'); + break; + default: config.msg = _t.errorDefaultMessage.replace('%1', id); break; diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index 6d1f4faef0..39fc562443 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -250,6 +250,7 @@ export class storeAppOptions { this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && !(type && typeof type[1] === 'string') && isSupportEditFeature; this.isAnonymousSupport = !!Common.EditorApi.get().asc_isAnonymousSupport(); + this.canCopy = permissions.copy !== false; } setCanViewReview (value) { diff --git a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js index 9d4b52b41f..23cea8dcd0 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolderExt.js @@ -1360,7 +1360,7 @@ define([], function () { if (me.api) { var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste(item.value == 'paste-before')); if (!res) { - if (!Common.localStorage.getBool("pdfe-hide-copywarning")) { + if (!Common.localStorage.getBool("pdfe-hide-copywarning") && (item.value === 'paste' || me.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("pdfe-hide-copywarning", 1); diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 56478ae1d8..b9048854b3 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -1036,6 +1036,9 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); + if (!me.appOptions.canCopy) + Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); + Common.Utils.InternalSettings.set("pdfe-settings-livecomment", true); Common.Utils.InternalSettings.set("pdfe-settings-resolvedcomment", false); @@ -1382,6 +1385,7 @@ define([ this.appOptions.canDownload = this.permissions.download !== false; this.appOptions.showSaveButton = this.appOptions.isEdit && !this.appOptions.isPDFFill && (this.appOptions.canSaveToFile || this.appOptions.canDownload); this.appOptions.canSuggest = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.suggestFeature===false); + this.appOptions.canCopy = this.permissions.copy !== false; this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; this.appOptions.twoLevelHeader = this.appOptions.isEdit || this.appOptions.isRestrictedEdit; // when compactHeader=true some buttons move to toolbar @@ -1882,6 +1886,11 @@ define([ config.msg = this.errorPDFFormsLocked; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index f8aa2815b1..abb2c8f62e 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -925,7 +925,7 @@ define([ if (me.api) { var res = (type === 'cut') ? me.api.Cut() : ((type === 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("pdfe-hide-copywarning")) { + if (!Common.localStorage.getBool("pdfe-hide-copywarning") && (type === 'paste' || me.toolbar.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("pdfe-hide-copywarning", 1); diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index 15562b4aa2..9216d9f1cb 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1592,6 +1592,7 @@ "PDFE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "PDFE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PDFE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PDFE.Controllers.Main.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "PDFE.Controllers.Navigation.txtBeginning": "Beginning of document", "PDFE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "PDFE.Controllers.Print.textMarginsLast": "Last custom", diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 0826062b5e..5dcd7a6391 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -742,6 +742,10 @@ PE.ApplicationController = new(function(){ message = me.errorEditingDownloadas; break; + case Asc.c_oAscError.ID.CopyDisabled: + message= me.errorCopyDisabled; + break; + default: // message = me.errorDefaultMessage.replace('%1', id); // break; @@ -936,6 +940,7 @@ PE.ApplicationController = new(function(){ txtPressLink: 'Click the link to open it', txtOpenWarning: 'Clicking this link can be harmful to your device and data.To protect you computer, click only those hyperlinks from trusted sources. This location may be unsafe:
%1
Are you sure you want to continue?', txtYes:'Yes', - txtNo: 'No' + txtNo: 'No', + errorCopyDisabled: 'For security reasons, the contents of this document cannot be copied to the clipboard.' } })(); diff --git a/apps/presentationeditor/embed/locale/en.json b/apps/presentationeditor/embed/locale/en.json index a917f16ef2..5a8992c729 100644 --- a/apps/presentationeditor/embed/locale/en.json +++ b/apps/presentationeditor/embed/locale/en.json @@ -48,6 +48,7 @@ "PE.ApplicationController.waitText": "Please, wait...", "PE.ApplicationController.warnLicenseBefore": "License not active. Please contact your administrator.", "PE.ApplicationController.warnLicenseExp": "Your license has expired. Please update your license and refresh the page.", + "PE.ApplicationController.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "PE.ApplicationView.txtDownload": "Download", "PE.ApplicationView.txtEmbed": "Embed", "PE.ApplicationView.txtFileLocation": "Open file location", diff --git a/apps/presentationeditor/main/app/controller/DocumentHolderExt.js b/apps/presentationeditor/main/app/controller/DocumentHolderExt.js index 7a3ed3d552..8852c1ef3f 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolderExt.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolderExt.js @@ -1569,7 +1569,7 @@ define([], function () { if (me.api) { var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("pe-hide-copywarning")) { + if (!Common.localStorage.getBool("pe-hide-copywarning") && (item.value === 'paste' || me.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("pe-hide-copywarning", 1); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 7e4b567ef0..f9f2f5bbc9 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -912,6 +912,9 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); + if (!me.appOptions.canCopy) + Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); + Common.Utils.InternalSettings.set("pe-settings-datetime-default", Common.localStorage.getItem("pe-settings-datetime-default")); value = Common.localStorage.getItem("pe-settings-zoom"); @@ -1383,6 +1386,7 @@ define([ this.appOptions.canSaveToFile = this.appOptions.isEdit || this.appOptions.isRestrictedEdit; this.appOptions.showSaveButton = this.appOptions.isEdit; this.appOptions.canSuggest = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.suggestFeature===false); + this.appOptions.canCopy = this.permissions.copy !== false; this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; this.appOptions.twoLevelHeader = this.appOptions.isEdit; // when compactHeader=true some buttons move to toolbar @@ -1838,6 +1842,11 @@ define([ config.msg = this.errorSaveWatermark; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 576110174a..e89d4598f7 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -1242,7 +1242,7 @@ define([ if (me.api) { var res = (type === 'cut') ? me.api.Cut() : ((type === 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("pe-hide-copywarning")) { + if (!Common.localStorage.getBool("pe-hide-copywarning") && (type === 'paste' || me.toolbar.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("pe-hide-copywarning", 1); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 219e5e2239..f6492106d1 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1761,6 +1761,7 @@ "PE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range", "PE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.", "PE.Controllers.Search.notcriticalErrorTitle": "Warning", diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 6c23e97a7d..3de6962909 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -240,7 +240,8 @@ "unknownErrorText": "Unknown error.", "uploadImageExtMessage": "Unknown image format.", "uploadImageFileCountMessage": "No images uploaded.", - "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB." + "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB.", + "errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard." }, "LongActions": { "applyChangesTextText": "Loading data...", diff --git a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx index 064e29ff74..081984a5ea 100644 --- a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx @@ -14,6 +14,7 @@ import EditorUIController from '../lib/patch'; canComments: stores.storeAppOptions.canComments, canViewComments: stores.storeAppOptions.canViewComments, canCoAuthoring: stores.storeAppOptions.canCoAuthoring, + canCopy: stores.storeAppOptions.canCopy, users: stores.users, isDisconnected: stores.users.isDisconnected, objects: stores.storeFocusObjects.settings, @@ -78,12 +79,12 @@ class ContextMenu extends ContextMenuController { const api = Common.EditorApi.get(); switch (action) { case 'cut': - if ( !LocalStorage.getBool("pe-hide-copy-cut-paste-warning")) { + if ( !LocalStorage.getBool("pe-hide-copy-cut-paste-warning") && this.props.canCopy) { this.showCopyCutPasteModal(); } break; case 'copy': - if (!api.Copy() && !LocalStorage.getBool("pe-hide-copy-cut-paste-warning")) { + if (!api.Copy() && !LocalStorage.getBool("pe-hide-copy-cut-paste-warning") && this.props.canCopy) { this.showCopyCutPasteModal(); } break; diff --git a/apps/presentationeditor/mobile/src/controller/Error.jsx b/apps/presentationeditor/mobile/src/controller/Error.jsx index 4099442812..f6b99c2d8d 100644 --- a/apps/presentationeditor/mobile/src/controller/Error.jsx +++ b/apps/presentationeditor/mobile/src/controller/Error.jsx @@ -211,6 +211,10 @@ const ErrorController = inject('storeAppOptions','storePresentationInfo')(({stor config.msg = t('Error.errorSaveWatermark'); break; + case Asc.c_oAscError.ID.CopyDisabled: + config.msg = t('Error.errorCopyDisabled'); + break; + default: config.msg = _t.errorDefaultMessage.replace('%1', id); break; diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index d7db96ab84..e77564c534 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -161,5 +161,6 @@ export class storeAppOptions { this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && isSupportEditFeature; this.isAnonymousSupport = !!Common.EditorApi.get().asc_isAnonymousSupport(); + this.canCopy = permissions.copy !== false; } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index d24a307d2f..7cab5dbdf0 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -787,6 +787,10 @@ SSE.ApplicationController = new(function(){ message = me.errorEditingDownloadas; break; + case Asc.c_oAscError.ID.CopyDisabled: + message= me.errorCopyDisabled; + break; + default: // message = me.errorDefaultMessage.replace('%1', id); // break; @@ -1026,6 +1030,7 @@ SSE.ApplicationController = new(function(){ txtPressLink: 'Click the link to open it', txtOpenWarning: 'Clicking this link can be harmful to your device and data.To protect you computer, click only those hyperlinks from trusted sources. This location may be unsafe:
%1
Are you sure you want to continue?', txtYes:'Yes', - txtNo: 'No' + txtNo: 'No', + errorCopyDisabled: 'For security reasons, the contents of this document cannot be copied to the clipboard.' } })(); \ No newline at end of file diff --git a/apps/spreadsheeteditor/embed/locale/en.json b/apps/spreadsheeteditor/embed/locale/en.json index 6ca1a40d5e..cd20cbf6d7 100644 --- a/apps/spreadsheeteditor/embed/locale/en.json +++ b/apps/spreadsheeteditor/embed/locale/en.json @@ -48,6 +48,7 @@ "SSE.ApplicationController.waitText": "Please, wait...", "SSE.ApplicationController.warnLicenseBefore": "License not active. Please contact your administrator.", "SSE.ApplicationController.warnLicenseExp": "Your license has expired. Please update your license and refresh the page.", + "SSE.ApplicationController.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "SSE.ApplicationView.txtDownload": "Download", "SSE.ApplicationView.txtEmbed": "Embed", "SSE.ApplicationView.txtFileLocation": "Open file location", diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js index 5699630b48..0a707cecb9 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolderExt.js @@ -306,7 +306,7 @@ define([], function () { var res = (item.value == 'cut') ? me.api.asc_Cut() : ((item.value == 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); if (!res) { var value = Common.localStorage.getItem("sse-hide-copywarning"); - if (!(value && parseInt(value) == 1)) { + if (!(value && parseInt(value) == 1) && (item.value === 'paste' || me.permissions.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("sse-hide-copywarning", 1); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 8b7d6a74d6..b0dc6b7053 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -985,6 +985,8 @@ define([ Common.UI.TooltipManager.showTip({ step: 'openCsv', text: me.warnOpenCsv, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); if (me.appOptions.isEdit && !me.appOptions.canModifyFilter) Common.UI.TooltipManager.showTip({ step: 'cantModifyFilter', text: me.warnModifyFilter, target: '#toolbar', maxwidth: 400, showButton: false, automove: true, noHighlight: true, noArrow: true}); + if (!me.appOptions.canCopy) + Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); value = (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram || this.appOptions.isEditOle) ? 100 : Common.localStorage.getItem("sse-settings-zoom"); Common.Utils.InternalSettings.set("sse-settings-zoom", value); @@ -1493,6 +1495,7 @@ define([ this.appOptions.canSaveToFile = this.appOptions.isEdit || this.appOptions.isRestrictedEdit; this.appOptions.showSaveButton = this.appOptions.isEdit; this.appOptions.canSuggest = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.suggestFeature===false); + this.appOptions.canCopy = this.permissions.copy !== false; this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; this.appOptions.twoLevelHeader = this.appOptions.isEdit; // when compactHeader=true some buttons move to toolbar @@ -2275,6 +2278,11 @@ define([ config.maxwidth = 600; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 0b5a023059..6069c3c746 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -650,7 +650,7 @@ define([ var res = (type === 'cut') ? me.api.asc_Cut() : ((type === 'copy') ? me.api.asc_Copy() : me.api.asc_Paste()); if (!res) { var value = Common.localStorage.getItem("sse-hide-copywarning"); - if (!(value && parseInt(value) == 1)) { + if (!(value && parseInt(value) == 1) && (type === 'paste' || me.toolbar.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("sse-hide-copywarning", 1); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index a19f571617..55d34a9ad7 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1987,6 +1987,7 @@ "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnOpenCsv": "The CSV format does not support saving a multi-sheet file or any elements except text.
Only the active sheet will be saved.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "SSE.Controllers.PivotTable.strSheet": "Sheet", "SSE.Controllers.PivotTable.txtCalculatedItemInPageField": "The item cannot be added or modified. PivotTable report has this field in Filters.", "SSE.Controllers.PivotTable.txtCalculatedItemWarningDefault": "No actions with calculated items are allowed for this active cell.", diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 9ba1301868..bdee07771d 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -379,7 +379,8 @@ "uploadDocSizeMessage": "Maximum document size limit exceeded.", "uploadImageExtMessage": "Unknown image format.", "uploadImageFileCountMessage": "No images uploaded.", - "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB." + "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB.", + "errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard." }, "LongActions": { "advDRMPassword": "Password", diff --git a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx index 861415491f..46a10b4f3f 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx @@ -12,6 +12,7 @@ import EditorUIController from '../lib/patch'; canComments: stores.storeAppOptions.canComments, canViewComments: stores.storeAppOptions.canViewComments, canCoAuthoring: stores.storeAppOptions.canCoAuthoring, + canCopy: stores.storeAppOptions.canCopy, isRestrictedEdit: stores.storeAppOptions.isRestrictedEdit, users: stores.users, isDisconnected: stores.users.isDisconnected, @@ -107,12 +108,12 @@ class ContextMenu extends ContextMenuController { switch (action) { case 'cut': - if (!LocalStorage.getBool("sse-hide-copy-cut-paste-warning")) { + if (!LocalStorage.getBool("sse-hide-copy-cut-paste-warning") && this.props.canCopy) { this.showCopyCutPasteModal(); } break; case 'copy': - if (!api.asc_Copy() && !LocalStorage.getBool("sse-hide-copy-cut-paste-warning")) { + if (!api.asc_Copy() && !LocalStorage.getBool("sse-hide-copy-cut-paste-warning") && this.props.canCopy) { this.showCopyCutPasteModal(); } break; diff --git a/apps/spreadsheeteditor/mobile/src/controller/Error.jsx b/apps/spreadsheeteditor/mobile/src/controller/Error.jsx index 828092eeb0..75ec3e8730 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Error.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Error.jsx @@ -511,6 +511,10 @@ const ErrorController = inject('storeAppOptions','storeSpreadsheetInfo')(({store config.msg = t('Error.errorMacroUnavailableWarning').replace('%1', errData ? "'" + errData + "'" : ''); break; + case Asc.c_oAscError.ID.CopyDisabled: + config.msg = t('Error.errorCopyDisabled'); + break; + default: config.msg = _t.errorDefaultMessage.replace('%1', id); break; diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index be4ea3d9fc..497d8ff286 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -163,5 +163,6 @@ export class storeAppOptions { this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && isSupportEditFeature; this.isAnonymousSupport = !!Common.EditorApi.get().asc_isAnonymousSupport(); + this.canCopy = permissions.copy !== false; } } \ No newline at end of file diff --git a/apps/visioeditor/embed/js/ApplicationController.js b/apps/visioeditor/embed/js/ApplicationController.js index 0678d75506..105b1e08d2 100644 --- a/apps/visioeditor/embed/js/ApplicationController.js +++ b/apps/visioeditor/embed/js/ApplicationController.js @@ -783,6 +783,10 @@ VE.ApplicationController = new(function(){ message = me.errorEditingDownloadas; break; + case Asc.c_oAscError.ID.CopyDisabled: + message= me.errorCopyDisabled; + break; + default: // message = me.errorDefaultMessage.replace('%1', id); // break; @@ -975,6 +979,7 @@ VE.ApplicationController = new(function(){ txtPage: 'Page', txtOpenWarning: 'Clicking this link can be harmful to your device and data.To protect you computer, click only those hyperlinks from trusted sources. This location may be unsafe:
%1
Are you sure you want to continue?', txtYes:'Yes', - txtNo: 'No' + txtNo: 'No', + errorCopyDisabled: 'For security reasons, the contents of this document cannot be copied to the clipboard.' } })(); diff --git a/apps/visioeditor/embed/locale/en.json b/apps/visioeditor/embed/locale/en.json index 1b615a336b..786050e16d 100644 --- a/apps/visioeditor/embed/locale/en.json +++ b/apps/visioeditor/embed/locale/en.json @@ -49,6 +49,7 @@ "VE.ApplicationController.waitText": "Please, wait...", "VE.ApplicationController.warnLicenseBefore": "License not active. Please contact your administrator.", "VE.ApplicationController.warnLicenseExp": "Your license has expired. Please update your license and refresh the page.", + "VE.ApplicationController.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "VE.ApplicationView.txtDownload": "Download", "VE.ApplicationView.txtEmbed": "Embed", "VE.ApplicationView.txtFileLocation": "Open file location", diff --git a/apps/visioeditor/main/app/controller/DocumentHolder.js b/apps/visioeditor/main/app/controller/DocumentHolder.js index 0a4a96b87a..0c09fedebd 100644 --- a/apps/visioeditor/main/app/controller/DocumentHolder.js +++ b/apps/visioeditor/main/app/controller/DocumentHolder.js @@ -531,7 +531,7 @@ define([ if (me.api) { var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - if (!Common.localStorage.getBool("ve-hide-copywarning")) { + if (!Common.localStorage.getBool("ve-hide-copywarning") && (item.value === 'paste' || me.mode.canCopy)) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("ve-hide-copywarning", 1); diff --git a/apps/visioeditor/main/app/controller/Main.js b/apps/visioeditor/main/app/controller/Main.js index 0800e422ca..aacfae0768 100644 --- a/apps/visioeditor/main/app/controller/Main.js +++ b/apps/visioeditor/main/app/controller/Main.js @@ -877,6 +877,9 @@ define([ me.hidePreloader(); me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); + // if (!me.appOptions.canCopy) // Show this warning when copy button is added to the toolbar + // Common.UI.TooltipManager.showTip({ step: 'copyDisabled', text: me.errorCopyDisabled, target: '#toolbar', maxwidth: 350, automove: true, noHighlight: true, noArrow: true, showButton: false}); + if (zf == -1) { this.api.zoomFitToPage(); } else if (zf == -2) { @@ -1180,6 +1183,7 @@ define([ this.appOptions.canSaveToFile = this.appOptions.isEdit || this.appOptions.isRestrictedEdit; this.appOptions.showSaveButton = this.appOptions.isEdit; this.appOptions.canSuggest = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.suggestFeature===false); + this.appOptions.canCopy = this.permissions.copy !== false; this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; this.appOptions.twoLevelHeader = this.appOptions.isEdit; // when compactHeader=true some buttons move to toolbar @@ -1511,6 +1515,11 @@ define([ config.msg = this.errorInconsistentExt; break; + case Asc.c_oAscError.ID.CopyDisabled: + config.maxwidth = 450; + config.msg = this.errorCopyDisabled; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); if (typeof id == 'string') diff --git a/apps/visioeditor/main/locale/en.json b/apps/visioeditor/main/locale/en.json index e7dcdb6e9f..994bbbb53a 100644 --- a/apps/visioeditor/main/locale/en.json +++ b/apps/visioeditor/main/locale/en.json @@ -322,6 +322,7 @@ "VE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "VE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "VE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "VE.Controllers.Main.errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard.", "VE.Controllers.Search.notcriticalErrorTitle": "Warning", "VE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.", "VE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", diff --git a/apps/visioeditor/mobile/locale/en.json b/apps/visioeditor/mobile/locale/en.json index fe08f43977..719c11021f 100644 --- a/apps/visioeditor/mobile/locale/en.json +++ b/apps/visioeditor/mobile/locale/en.json @@ -120,7 +120,8 @@ "unknownErrorText": "Unknown error.", "uploadImageExtMessage": "Unknown image format.", "uploadImageFileCountMessage": "No images uploaded.", - "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB." + "uploadImageSizeMessage": "The image is too big. The maximum size is 25 MB.", + "errorCopyDisabled": "For security reasons, the contents of this document cannot be copied to the clipboard." }, "LongActions": { "applyChangesTextText": "Loading data...", diff --git a/apps/visioeditor/mobile/src/controller/Error.jsx b/apps/visioeditor/mobile/src/controller/Error.jsx index b87988ecf8..7e741a244e 100644 --- a/apps/visioeditor/mobile/src/controller/Error.jsx +++ b/apps/visioeditor/mobile/src/controller/Error.jsx @@ -199,6 +199,10 @@ const ErrorController = inject('storeAppOptions','storeVisioInfo')(({storeAppOpt config.msg = t('Error.errorSaveWatermark'); break; + case Asc.c_oAscError.ID.CopyDisabled: + config.msg = t('Error.errorCopyDisabled'); + break; + default: config.msg = _t.errorDefaultMessage.replace('%1', id); break; diff --git a/apps/visioeditor/mobile/src/store/appOptions.js b/apps/visioeditor/mobile/src/store/appOptions.js index 9363fc0dad..6dfa7ea982 100644 --- a/apps/visioeditor/mobile/src/store/appOptions.js +++ b/apps/visioeditor/mobile/src/store/appOptions.js @@ -151,5 +151,6 @@ export class storeAppOptions { this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && isSupportEditFeature; this.isAnonymousSupport = !!Common.EditorApi.get().asc_isAnonymousSupport(); + this.canCopy = permissions.copy !== false; } } \ No newline at end of file