Skip to content

Commit

Permalink
Merge pull request '[PDF form] Change message after submitting form' (#…
Browse files Browse the repository at this point in the history
…168) from fix/submit-form into release/v8.3.0
  • Loading branch information
Julia Radzhabova committed Dec 10, 2024
2 parents 8d61d5c + 30421e3 commit c365d66
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
4 changes: 4 additions & 0 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
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
}
},
coEditing: {
Expand Down
32 changes: 18 additions & 14 deletions apps/documenteditor/forms/app/controller/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!==false);

var type = /^(?:(pdf))$/.exec(this.document.fileType); // can fill forms only in pdf format
this.appOptions.isOFORM = !!(type && typeof type[1] === 'string');
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions apps/documenteditor/main/app/controller/FormsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!==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;
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/mobile/src/store/appOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c365d66

Please sign in to comment.