From 87415ea8020630f870f8d976b75aeacfcf49a793 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 17 Jan 2022 18:09:45 +0300 Subject: [PATCH 1/2] [DE forms] Disable edit buttons when no license (Bug 54910) --- .../app/controller/ApplicationController.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 1e6a01a15..793371f41 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -673,6 +673,10 @@ define([ primary = 'buynow'; } + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.canFillForms) { + this.disableEditing(true); + } + var value = Common.localStorage.getItem("de-license-warning"); value = (value!==null) ? parseInt(value) : 0; var now = (new Date).getTime(); @@ -1001,6 +1005,8 @@ define([ }, onShowContentControlsActions: function(obj, x, y) { + if (this._isDisabled) return; + var me = this; switch (obj.type) { case Asc.c_oAscContentControlSpecificType.DateTime: @@ -1761,12 +1767,12 @@ define([ if (this.textMenu && !noobject) { var cancopy = this.api.can_CopyCut(), disabled = menu_props.paraProps && menu_props.paraProps.locked || menu_props.headerProps && menu_props.headerProps.locked || - menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked); + menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked) || this._isDisabled; this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo - this.textMenu.items[3].setDisabled(!cancopy); // copy - this.textMenu.items[4].setDisabled(disabled || !cancopy); // cut + this.textMenu.items[3].setDisabled(disabled || !cancopy); // cut + this.textMenu.items[4].setDisabled(!cancopy); // copy this.textMenu.items[5].setDisabled(disabled) // paste; this.showPopupMenu(this.textMenu, {}, event); @@ -1800,6 +1806,11 @@ define([ } }, + disableEditing: function(state) { + this.view && this.view.btnClear && this.view.btnClear.setDisabled(state); + this._isDisabled = state; + }, + errorDefaultMessage : 'Error code: %1', unknownErrorText : 'Unknown error.', convertationTimeoutText : 'Conversion timeout exceeded.', From efa0ca0e65c2609e2dca30426af5cd686b55daba Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 17 Jan 2022 18:59:46 +0300 Subject: [PATCH 2/2] [DE][PE][SSE] Disable comment, fillForms when no license in the restricted editing mode --- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/presentationeditor/main/app/controller/Main.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Main.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 38b419858..cda8b75f0 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1293,7 +1293,7 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); - if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && + if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && this.editorConfig.mode !== 'view' && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; @@ -1319,7 +1319,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); } diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 72428694d..856092514 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -935,7 +935,7 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); - if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && + if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && this.editorConfig.mode !== 'view' && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; @@ -961,7 +961,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 15e20d05f..b32e41c92 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1031,7 +1031,7 @@ define([ if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return; var licType = params.asc_getLicenseType(); - if (licType !== undefined && this.appOptions.canEdit && this.editorConfig.mode !== 'view' && + if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && this.editorConfig.mode !== 'view' && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; @@ -1057,7 +1057,7 @@ define([ primary = 'buynow'; } - if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isEdit) { + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.isEdit || this.appOptions.isRestrictedEdit)) { this.disableEditing(true); Common.NotificationCenter.trigger('api:disconnect'); }