From a8ca0bb10ac37d468a557286d92bac2584f052cb Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 Oct 2021 17:04:21 +0300 Subject: [PATCH 1/2] [DE] Support fillForms parameter for not-oform files --- apps/documenteditor/main/app/controller/Main.js | 7 +++---- apps/documenteditor/mobile/src/store/appOptions.js | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 13fd10f2c..428a94113 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -483,8 +483,8 @@ define([ this.appOptions.canFeatureForms = !!(type && typeof type[1] === 'string'); type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false; - if (type && typeof type[1] === 'string') - this.permissions.edit = this.permissions.review = this.permissions.comment = false; + if (type && typeof type[1] === 'string') // open oform files in forms editor or in viewer + this.permissions.edit = this.permissions.review = this.permissions.comment = this.permissions.fillForms = false; this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); @@ -1425,8 +1425,7 @@ define([ this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false); this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.canSubmitForms = false; // this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm; - // use forms editor for filling forms mode - this.appOptions.canFillForms = false;// this.appOptions.canLicense && ((this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); + this.appOptions.canFillForms = this.appOptions.canLicense && ((this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && (this.appOptions.canComments || this.appOptions.canFillForms); if (this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.appOptions.canFillForms) // must be one restricted mode, priority for filling forms this.appOptions.canComments = false; diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index caba8775d..3e0d1ac8d 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -118,14 +118,13 @@ export class storeAppOptions { this.canEditStyles = this.canLicense && this.canEdit; this.canPrint = (permissions.print !== false); this.fileKey = document.key; - let type = /^(?:(oform))$/.exec(document.fileType); // can fill forms only in oform format - this.canFillForms = this.canLicense && (!!type && typeof type[1] === 'string') && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view'); + this.canFillForms = this.canLicense && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view'); this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms); if (this.isRestrictedEdit && this.canComments && this.canFillForms) // must be one restricted mode, priority for filling forms this.canComments = false; this.trialMode = params.asc_getLicenseMode(); - type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType); + const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType); this.canDownloadOrigin = permissions.download !== false && (type && typeof type[1] === 'string'); this.canDownload = permissions.download !== false && (!type || typeof type[1] !== 'string'); this.canReader = (!type || typeof type[1] !== 'string'); From fb36397fbd49cb586a15efe467bd39fc264d859b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 Oct 2021 17:17:05 +0300 Subject: [PATCH 2/2] [DE] Fix fillForms mode --- apps/documenteditor/main/app/controller/Main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 428a94113..74c7ead81 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -483,9 +483,10 @@ define([ this.appOptions.canFeatureForms = !!(type && typeof type[1] === 'string'); type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false; - if (type && typeof type[1] === 'string') // open oform files in forms editor or in viewer - this.permissions.edit = this.permissions.review = this.permissions.comment = this.permissions.fillForms = false; - + if (type && typeof type[1] === 'string') { + (this.permissions.fillForms===undefined) && (this.permissions.fillForms = (this.permissions.edit!==false)); + this.permissions.edit = this.permissions.review = this.permissions.comment = false; + } this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this));