Merge pull request #1194 from ONLYOFFICE/fix/fix-form
Add Save form button
This commit is contained in:
commit
94aa05aaa7
|
@ -95,7 +95,8 @@ define([
|
||||||
'forms:select-color': this.onSelectControlsColor,
|
'forms:select-color': this.onSelectControlsColor,
|
||||||
'forms:mode': this.onModeClick,
|
'forms:mode': this.onModeClick,
|
||||||
'forms:goto': this.onGoTo,
|
'forms:goto': this.onGoTo,
|
||||||
'forms:submit': this.onSubmitClick
|
'forms:submit': this.onSubmitClick,
|
||||||
|
'forms:save': this.onSaveFormClick
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -245,6 +246,10 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSaveFormClick: function() {
|
||||||
|
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.OFORM));
|
||||||
|
},
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable) {
|
||||||
if (this._state.DisabledEditing != disable) {
|
if (this._state.DisabledEditing != disable) {
|
||||||
this._state.DisabledEditing = disable;
|
this._state.DisabledEditing = disable;
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ define([
|
||||||
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
|
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
|
||||||
this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false);
|
this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==false);
|
||||||
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
|
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
|
||||||
this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm;
|
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');
|
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);
|
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
|
if (this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.appOptions.canFillForms) // must be one restricted mode, priority for filling forms
|
||||||
|
@ -1434,6 +1434,7 @@ define([
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
||||||
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
|
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
|
||||||
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
|
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
|
||||||
|
this.appOptions.canDownloadForms = this.appOptions.canLicense && this.appOptions.canDownload;
|
||||||
|
|
||||||
this.appOptions.fileKey = this.document.key;
|
this.appOptions.fileKey = this.document.key;
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,7 @@ define([
|
||||||
'<div class="group no-group-mask form-view" style="display: none;">' +
|
'<div class="group no-group-mask form-view" style="display: none;">' +
|
||||||
'<span class="btn-slot text x-huge" id="slot-btn-form-view"></span>' +
|
'<span class="btn-slot text x-huge" id="slot-btn-form-view"></span>' +
|
||||||
'<span class="btn-slot text x-huge" id="slot-btn-form-submit"></span>' +
|
'<span class="btn-slot text x-huge" id="slot-btn-form-submit"></span>' +
|
||||||
|
'<span class="btn-slot text x-huge" id="slot-btn-form-save"></span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</section>';
|
'</section>';
|
||||||
|
|
||||||
|
@ -124,6 +125,9 @@ define([
|
||||||
this.btnSubmit && this.btnSubmit.on('click', function (b, e) {
|
this.btnSubmit && this.btnSubmit.on('click', function (b, e) {
|
||||||
me.fireEvent('forms:submit');
|
me.fireEvent('forms:submit');
|
||||||
});
|
});
|
||||||
|
this.btnSaveForm && this.btnSaveForm.on('click', function (b, e) {
|
||||||
|
me.fireEvent('forms:save');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -292,6 +296,17 @@ define([
|
||||||
});
|
});
|
||||||
this.paragraphControls.push(this.btnSubmit);
|
this.paragraphControls.push(this.btnSubmit);
|
||||||
}
|
}
|
||||||
|
if (this.appConfig.canDownloadForms) {
|
||||||
|
this.btnSaveForm = new Common.UI.Button({
|
||||||
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
iconCls: 'toolbar__icon save-form',
|
||||||
|
caption: this.capBtnSaveForm,
|
||||||
|
dataHint: '1',
|
||||||
|
dataHintDirection: 'bottom',
|
||||||
|
dataHintOffset: 'small'
|
||||||
|
});
|
||||||
|
this.paragraphControls.push(this.btnSaveForm);
|
||||||
|
}
|
||||||
|
|
||||||
this._state = {disabled: false};
|
this._state = {disabled: false};
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
|
@ -331,6 +346,7 @@ define([
|
||||||
me.btnPrevForm.updateHint(me.tipPrevForm);
|
me.btnPrevForm.updateHint(me.tipPrevForm);
|
||||||
me.btnNextForm.updateHint(me.tipNextForm);
|
me.btnNextForm.updateHint(me.tipNextForm);
|
||||||
me.btnSubmit && me.btnSubmit.updateHint(me.tipSubmit);
|
me.btnSubmit && me.btnSubmit.updateHint(me.tipSubmit);
|
||||||
|
me.btnSaveForm && me.btnSaveForm.updateHint(me.tipSaveForm);
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
|
@ -340,13 +356,12 @@ define([
|
||||||
this.$el = $(_.template(template)( {} ));
|
this.$el = $(_.template(template)( {} ));
|
||||||
var $host = this.$el;
|
var $host = this.$el;
|
||||||
|
|
||||||
if (this.appConfig.canSubmitForms) {
|
this.appConfig.canSubmitForms && this.btnSubmit.render($host.find('#slot-btn-form-submit'));
|
||||||
this.btnSubmit.render($host.find('#slot-btn-form-submit'));
|
this.appConfig.canDownloadForms && this.btnSaveForm.render($host.find('#slot-btn-form-save'));
|
||||||
}
|
|
||||||
|
|
||||||
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
|
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
|
||||||
this.btnClear.render($host.find('#slot-btn-form-clear'));
|
this.btnClear.render($host.find('#slot-btn-form-clear'));
|
||||||
this.btnSubmit && $host.find('.separator.submit').show().next('.group').show();
|
(this.btnSubmit || this.btnSaveForm) && $host.find('.separator.submit').show().next('.group').show();
|
||||||
} else {
|
} else {
|
||||||
this.btnTextField.render($host.find('#slot-btn-form-field'));
|
this.btnTextField.render($host.find('#slot-btn-form-field'));
|
||||||
this.btnComboBox.render($host.find('#slot-btn-form-combobox'));
|
this.btnComboBox.render($host.find('#slot-btn-form-combobox'));
|
||||||
|
@ -412,7 +427,9 @@ define([
|
||||||
tipNextForm: 'Go to the next field',
|
tipNextForm: 'Go to the next field',
|
||||||
tipSubmit: 'Submit form',
|
tipSubmit: 'Submit form',
|
||||||
textSubmited: 'Form submitted successfully',
|
textSubmited: 'Form submitted successfully',
|
||||||
textRequired: 'Fill all required fields to send form.'
|
textRequired: 'Fill all required fields to send form.',
|
||||||
|
capBtnSaveForm: 'Save as a Form',
|
||||||
|
tipSaveForm: 'Save a file as a fillable OFORM document'
|
||||||
}
|
}
|
||||||
}()), DE.Views.FormsTab || {}));
|
}()), DE.Views.FormsTab || {}));
|
||||||
});
|
});
|
|
@ -1822,6 +1822,8 @@
|
||||||
"DE.Views.FormsTab.tipSubmit": "Submit form",
|
"DE.Views.FormsTab.tipSubmit": "Submit form",
|
||||||
"DE.Views.FormsTab.tipTextField": "Insert text field",
|
"DE.Views.FormsTab.tipTextField": "Insert text field",
|
||||||
"DE.Views.FormsTab.tipViewForm": "View form",
|
"DE.Views.FormsTab.tipViewForm": "View form",
|
||||||
|
"DE.Views.FormsTab.capBtnSaveForm": "Save as a Form",
|
||||||
|
"DE.Views.FormsTab.tipSaveForm": "Save a file as a fillable OFORM document",
|
||||||
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center",
|
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center",
|
||||||
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
||||||
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",
|
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 440 B |
Binary file not shown.
After Width: | Height: | Size: 471 B |
Binary file not shown.
After Width: | Height: | Size: 485 B |
Binary file not shown.
After Width: | Height: | Size: 424 B |
Binary file not shown.
After Width: | Height: | Size: 682 B |
Loading…
Reference in a new issue