diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 9f39fe260..ffda935a8 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -95,7 +95,8 @@ define([ 'forms:select-color': this.onSelectControlsColor, 'forms:mode': this.onModeClick, '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); }, + onSaveFormClick: function() { + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.OFORM)); + }, + disableEditing: function(disable) { if (this._state.DisabledEditing != disable) { this._state.DisabledEditing = disable; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 1bc219688..74e7cbdac 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1415,7 +1415,7 @@ define([ this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport); this.appOptions.canEditContentControl = (this.permissions.modifyContentControl!==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.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 @@ -1434,6 +1434,7 @@ define([ var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); 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.canDownloadForms = this.appOptions.canLicense && this.appOptions.canDownload; this.appOptions.fileKey = this.document.key; diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 665c90c4b..b43f30aba 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -75,6 +75,7 @@ define([ '' + ''; @@ -124,6 +125,9 @@ define([ this.btnSubmit && this.btnSubmit.on('click', function (b, e) { me.fireEvent('forms:submit'); }); + this.btnSaveForm && this.btnSaveForm.on('click', function (b, e) { + me.fireEvent('forms:save'); + }); } return { @@ -292,6 +296,17 @@ define([ }); 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}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); @@ -331,6 +346,7 @@ define([ me.btnPrevForm.updateHint(me.tipPrevForm); me.btnNextForm.updateHint(me.tipNextForm); me.btnSubmit && me.btnSubmit.updateHint(me.tipSubmit); + me.btnSaveForm && me.btnSaveForm.updateHint(me.tipSaveForm); setEvents.call(me); }); @@ -340,13 +356,12 @@ define([ this.$el = $(_.template(template)( {} )); var $host = this.$el; - if (this.appConfig.canSubmitForms) { - this.btnSubmit.render($host.find('#slot-btn-form-submit')); - } + this.appConfig.canSubmitForms && 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) { 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 { this.btnTextField.render($host.find('#slot-btn-form-field')); this.btnComboBox.render($host.find('#slot-btn-form-combobox')); @@ -412,7 +427,9 @@ define([ tipNextForm: 'Go to the next field', tipSubmit: 'Submit form', 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 || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 2001e17cf..e229c530b 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1822,6 +1822,8 @@ "DE.Views.FormsTab.tipSubmit": "Submit form", "DE.Views.FormsTab.tipTextField": "Insert text field", "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.textBottomLeft": "Bottom left", "DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page", diff --git a/apps/documenteditor/main/resources/img/toolbar/1.25x/big/save-form.png b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/save-form.png new file mode 100644 index 000000000..9ddb17063 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.25x/big/save-form.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.5x/big/save-form.png b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/save-form.png new file mode 100644 index 000000000..a53bfdd3e Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.5x/big/save-form.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1.75x/big/save-form.png b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/save-form.png new file mode 100644 index 000000000..01147ba15 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1.75x/big/save-form.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/1x/big/save-form.png b/apps/documenteditor/main/resources/img/toolbar/1x/big/save-form.png new file mode 100644 index 000000000..f196711b3 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/1x/big/save-form.png differ diff --git a/apps/documenteditor/main/resources/img/toolbar/2x/big/save-form.png b/apps/documenteditor/main/resources/img/toolbar/2x/big/save-form.png new file mode 100644 index 000000000..8f9956003 Binary files /dev/null and b/apps/documenteditor/main/resources/img/toolbar/2x/big/save-form.png differ