From f48f5922c3a428ea0285edbaf6e0c451033128a2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 6 Dec 2024 22:14:35 +0300 Subject: [PATCH 1/3] [PDF form] Change message after submitting form --- .../app/controller/ApplicationController.js | 32 +++++++++++-------- .../main/app/controller/FormsTab.js | 6 ++-- .../main/app/controller/Main.js | 3 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index d8e21aabed..69bec53cfd 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -634,7 +634,8 @@ define([ this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.isBeta = params.asc_getIsBeta(); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); - this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm && !this.appOptions.isOffline; + this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !this.appOptions.isOffline && + !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible); var type = /^(?:(pdf))$/.exec(this.document.fileType); // can fill forms only in pdf format this.appOptions.isOFORM = !!(type && typeof type[1] === 'string'); @@ -931,20 +932,23 @@ define([ Common.Gateway.submitForm(); this.view.btnSubmit.setCaption(this.textFilled); this.view.btnSubmit.cmpEl.removeClass('yellow').removeClass('back-color').addClass('gray'); - if (!this.submitedTooltip) { - this.submitedTooltip = new Common.UI.SynchronizeTip({ - text: this.textSubmitOk, - extCls: 'no-arrow colored', - style: 'max-width: 400px', - showLink: false, - target: $('.toolbar'), - placement: 'bottom' - }); - this.submitedTooltip.on('closeclick', function () { - this.submitedTooltip.hide(); - }, this); + var text = (typeof this.appOptions.customization.submitForm==='object') ? this.appOptions.customization.submitForm.resultMessage : this.textSubmitOk; + if (text!=='') { + if (!this.submitedTooltip) { + this.submitedTooltip = new Common.UI.SynchronizeTip({ + text: text || this.textSubmitOk, + extCls: 'no-arrow colored', + style: 'max-width: 400px', + showLink: false, + target: $('.toolbar'), + placement: 'bottom' + }); + this.submitedTooltip.on('closeclick', function () { + this.submitedTooltip.hide(); + }, this); + } + this.submitedTooltip.show(); } - this.submitedTooltip.show(); this.api.asc_setRestriction(Asc.c_oAscRestrictionType.View); this.onApiServerDisconnect(true); } else diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 01e143ad75..cf25536f2c 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -467,13 +467,15 @@ define([ onLongActionEnd: function(type, id) { if (id==Asc.c_oAscAsyncAction['Submit'] && this.view.btnSubmit) { - Common.Utils.lockControls(Common.enumLock.submit, !this._submitFail, {array: [this.view.btnSubmit]}) + Common.Utils.lockControls(Common.enumLock.submit, !this._submitFail, {array: [this.view.btnSubmit]}); if (!this._submitFail) { Common.Gateway.submitForm(); this.view.btnSubmit.setCaption(this.view.textFilled); + var text = (typeof this.appConfig.customization.submitForm==='object') ? this.appConfig.customization.submitForm.resultMessage : this.view.textSubmitOk; + if (text==='') return; if (!this.submitedTooltip) { this.submitedTooltip = new Common.UI.SynchronizeTip({ - text: this.view.textSubmitOk, + text: text || this.view.textSubmitOk, extCls: 'no-arrow colored', showLink: false, target: $('.toolbar'), diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 147192fd98..57a2644dda 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1733,7 +1733,8 @@ define([ if (this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.appOptions.canFillForms) // must be one restricted mode, priority for filling forms this.appOptions.canComments = false; this.appOptions.canSwitchMode = this.appOptions.isEdit; - this.appOptions.canSubmitForms = this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm && !this.appOptions.isOffline; + this.appOptions.canSubmitForms = this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.appOptions.canLicense && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object') && + !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible); this.appOptions.canStartFilling = this.editorConfig.canStartFilling && this.appOptions.isEdit && this.appOptions.isPDFForm; // show Start Filling button in the header this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; From a2a9e240e3661a703139b9ffca2a834ab7547eeb Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 14:13:46 +0300 Subject: [PATCH 2/3] Submit forms: change default value, handle in the mobile editor --- apps/api/documents/api.js | 4 ++++ .../forms/app/controller/ApplicationController.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/documenteditor/mobile/src/store/appOptions.js | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 4613100f14..162ed9b623 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -252,6 +252,10 @@ mobile: { forceView: true/false (default: true) // turn on/off the 'reader' mode on launch. for mobile document editor only standardView: true/false (default: false) // open editor in 'Standard view' instead of 'Mobile view' + }, + submit: { + visible: true/false (default: true) + resultMessage: 'text'/''/null/undefined // if '' - don't show a message after submitting form, null/undefined - show the default message } }, coEditing: { diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 69bec53cfd..c39f283802 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -635,7 +635,7 @@ define([ this.appOptions.isBeta = params.asc_getIsBeta(); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !this.appOptions.isOffline && - !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible); + !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible!==false); var type = /^(?:(pdf))$/.exec(this.document.fileType); // can fill forms only in pdf format this.appOptions.isOFORM = !!(type && typeof type[1] === 'string'); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 57a2644dda..10bcc68065 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1734,7 +1734,7 @@ define([ this.appOptions.canComments = false; this.appOptions.canSwitchMode = this.appOptions.isEdit; this.appOptions.canSubmitForms = this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.appOptions.canLicense && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object') && - !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible); + !!this.editorConfig.customization.submitForm && (typeof this.editorConfig.customization.submitForm !== 'object' || this.editorConfig.customization.submitForm.visible!==false); this.appOptions.canStartFilling = this.editorConfig.canStartFilling && this.appOptions.isEdit && this.appOptions.isPDFForm; // show Start Filling button in the header this.appOptions.compactHeader = this.appOptions.customization && (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compactHeader; diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index ee26d13539..db29f48eea 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -209,7 +209,8 @@ export class storeAppOptions { this.canFillForms = this.canLicense && this.typeForm && ((permissions.fillForms === undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view'); this.isForm = !this.isXpsViewer && !!window.isPDFForm; this.canProtect = permissions.protect !== false; - this.canSubmitForms = this.canLicense && (typeof (this.customization) == 'object') && !!this.customization.submitForm && !this.isOffline; + this.canSubmitForms = this.canLicense && !this.isOffline && (typeof (this.customization) == 'object') && !!this.customization.submitForm && + (typeof this.customization.submitForm !== 'object' || this.customization.submitForm.visible!==false); this.isEditableForms = this.isForm && this.canSubmitForms; this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms) && isSupportEditFeature; if (this.isRestrictedEdit && this.canComments && this.canFillForms) // must be one restricted mode, priority for filling forms From 30421e376b63216e900edeb3b22431eed2058b00 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 10 Dec 2024 14:19:59 +0300 Subject: [PATCH 3/3] Fix api --- apps/api/documents/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 162ed9b623..2bda81aa1c 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -253,7 +253,7 @@ forceView: true/false (default: true) // turn on/off the 'reader' mode on launch. for mobile document editor only standardView: true/false (default: false) // open editor in 'Standard view' instead of 'Mobile view' }, - submit: { + submitForm: { visible: true/false (default: true) resultMessage: 'text'/''/null/undefined // if '' - don't show a message after submitting form, null/undefined - show the default message }