Merge pull request #1267 from ONLYOFFICE/fix/de-forms

[DE] Support fillForms parameter for not-oform files
This commit is contained in:
Julia Radzhabova 2021-10-22 17:24:44 +03:00 committed by GitHub
commit 7e66b51d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -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')
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));
@ -1425,8 +1426,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;

View file

@ -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');