Merge pull request #1263 from ONLYOFFICE/fix/open-forms
[DE] Fix opening oform files, disable filling forms for not-oform files.
This commit is contained in:
commit
e429c6d185
|
@ -876,17 +876,13 @@
|
|||
|
||||
path += app + "/";
|
||||
if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') {
|
||||
if (config.document.permissions) {
|
||||
(config.document.permissions.fillForms===undefined) && (config.document.permissions.fillForms = (config.document.permissions.edit !== false));
|
||||
config.document.permissions.edit = config.document.permissions.review = config.document.permissions.comment = false;
|
||||
}
|
||||
var canFillForms = !config.document.permissions
|
||||
? true : (config.document.permissions.fillForms===undefined)
|
||||
? (config.document.permissions.edit !== false) : config.document.permissions.fillForms;
|
||||
path_type = (config.type === "mobile" || isSafari_mobile)
|
||||
? "mobile" : config.document.permissions && (config.document.permissions.fillForms === true) && (config.editorConfig.mode !== 'view')
|
||||
? "forms" : "embed";
|
||||
? "mobile" : (config.type === "embedded" || !canFillForms || config.editorConfig.mode === 'view')
|
||||
? "embed" : "forms";
|
||||
} else {
|
||||
if (app==='documenteditor' && config.document && config.document.permissions && (config.document.permissions.edit === false) && (config.document.permissions.review !== true)) {
|
||||
config.document.permissions.fillForms = false;
|
||||
}
|
||||
path_type = (config.type === "mobile" || isSafari_mobile)
|
||||
? "mobile" : (config.type === "embedded")
|
||||
? "embed" : "main";
|
||||
|
|
|
@ -597,7 +597,7 @@ DE.ApplicationController = new(function(){
|
|||
function onEditorPermissions(params) {
|
||||
var licType = params.asc_getLicenseType();
|
||||
appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
|
||||
appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view');
|
||||
appOptions.canFillForms = false; // use forms editor for filling forms
|
||||
appOptions.canSubmitForms = appOptions.canLicense && (typeof (config.customization) == 'object') && !!config.customization.submitForm;
|
||||
appOptions.canBranding = params.asc_getCustomization();
|
||||
appOptions.canBranding && setBranding(config.customization);
|
||||
|
|
|
@ -441,7 +441,9 @@ 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.editorConfig.customization.submitForm;
|
||||
this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view');
|
||||
|
||||
var type = /^(?:(oform))$/.exec(this.document.fileType); // can fill forms only in oform format
|
||||
this.appOptions.canFillForms = this.appOptions.canLicense && !!(type && typeof type[1] === 'string') && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view');
|
||||
this.api.asc_setViewMode(!this.appOptions.canFillForms);
|
||||
|
||||
this.appOptions.canBranding = params.asc_getCustomization();
|
||||
|
|
|
@ -482,6 +482,10 @@ define([
|
|||
var type = data.doc ? /^(?:(docxf))$/.exec(data.doc.fileType) : false;
|
||||
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;
|
||||
|
||||
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));
|
||||
|
@ -1421,7 +1425,8 @@ 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;
|
||||
this.appOptions.canFillForms = this.appOptions.canLicense && ((this.permissions.fillForms===undefined) ? this.appOptions.isEdit : this.permissions.fillForms) && (this.editorConfig.mode !== 'view');
|
||||
// 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.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;
|
||||
|
|
|
@ -133,12 +133,18 @@ class MainController extends Component {
|
|||
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins !== false);
|
||||
docInfo.asc_putIsEnabledPlugins(!!enable);
|
||||
|
||||
const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
|
||||
let type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
|
||||
if (type && typeof type[1] === 'string') {
|
||||
this.permissions.edit = this.permissions.review = false;
|
||||
}
|
||||
}
|
||||
|
||||
let type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : 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', onEditorPermissions);
|
||||
this.api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
|
||||
this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this));
|
||||
|
|
|
@ -118,13 +118,14 @@ export class storeAppOptions {
|
|||
this.canEditStyles = this.canLicense && this.canEdit;
|
||||
this.canPrint = (permissions.print !== false);
|
||||
this.fileKey = document.key;
|
||||
this.canFillForms = this.canLicense && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view');
|
||||
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.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();
|
||||
|
||||
const type = /^(?:(pdf|djvu|xps|oxps))$/.exec(document.fileType);
|
||||
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');
|
||||
|
|
Loading…
Reference in a new issue