diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 1fd169e84..5321d8608 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -401,7 +401,8 @@ define([ this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings; this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison"); - this.appOptions.canFeatureContentControl = !!this.api.asc_isSupportFeature("content-controls"); + this.appOptions.canFeatureContentControl = true; + this.appOptions.canFeatureForms = !!this.api.asc_isSupportFeature("forms"); this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false)); @@ -480,8 +481,7 @@ define([ } var type = data.doc ? /^(?:(docxf))$/.exec(data.doc.fileType) : false; - this.appOptions.isFormCreator = !!(type && typeof type[1] === 'string'); - this.appOptions.canFeatureForms = this.appOptions.isFormCreator; // show forms only for docxf + this.appOptions.isFormCreator = !!(type && typeof type[1] === 'string') && this.appOptions.canFeatureForms; // show forms only for docxf type = data.doc ? /^(?:(oform))$/.exec(data.doc.fileType) : false; if (type && typeof type[1] === 'string') { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 45ae88fe9..3297d4b20 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -3168,8 +3168,8 @@ define([ onAppShowed: function (config) { var me = this; - var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.canFeatureForms); - if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.canFeatureForms) { + var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator); + if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) { if ( Common.localStorage.itemExists("de-compact-toolbar") ) { compactview = Common.localStorage.getBool("de-compact-toolbar"); } else @@ -3217,8 +3217,8 @@ define([ links.setApi(me.api).setConfig({toolbar: me}); Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons()); } - if ( config.isEdit && config.canFeatureContentControl || config.isRestrictedEdit && config.canFillForms ) { - if (config.canFeatureForms) { + if ( config.isEdit && config.canFeatureContentControl && config.canFeatureForms || config.isRestrictedEdit && config.canFillForms ) { + if (config.isFormCreator) { tab = {caption: me.textTabForms, action: 'forms', dataHintTitle: 'M'}; var forms = me.getApplication().getController('FormsTab'); forms.setApi(me.api).setConfig({toolbar: me, config: config}); @@ -3226,7 +3226,7 @@ define([ if ($panel) { me.toolbar.addTab(tab, $panel, 4); me.toolbar.setVisible('forms', true); - config.isEdit && config.canFeatureContentControl && Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons()); + config.isEdit && config.canFeatureContentControl && config.canFeatureForms && Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons()); !compactview && (config.isFormCreator || config.isRestrictedEdit && config.canFillForms) && me.toolbar.setTab('forms'); } } diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 7805c9374..470c9a9ec 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -167,7 +167,7 @@ define([ me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]); - if ( !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.canFeatureForms) || + if ( !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) || ( !Common.localStorage.itemExists("de-compact-toolbar") && config.customization && config.customization.compactToolbar )) { @@ -207,8 +207,8 @@ define([ onAppReady: function (config) { var me = this; if ( me.header.btnOptions ) { - var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.canFeatureForms); - if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.canFeatureForms) { + var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator); + if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) { if ( Common.localStorage.itemExists("de-compact-toolbar") ) { compactview = Common.localStorage.getBool("de-compact-toolbar"); } else diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index df1faebee..6cd59c214 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -405,12 +405,12 @@ define([ } if (this.mode.canDownload) { - !this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render())); + !this.panels['saveas'] && (this.panels['saveas'] = ((new DE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType, mode: this.mode})).render())); } else if (this.mode.canDownloadOrigin) $('a',this.miDownload.$el).text(this.textDownload); if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) { - !this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render())); + !this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType, mode: this.mode})).render())); } if (this.mode.canHelp && !this.panels['help']) { diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 54a9acbde..e9d686b3a 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -94,9 +94,16 @@ define([ this.menu = options.menu; this.fileType = options.fileType; + this.mode = options.mode; }, render: function() { + if (this.mode && !this.mode.canFeatureForms) { + this.formats[2].splice(1, 2); + this.formats[2] = this.formats[2].concat(this.formats[3]); + this.formats[3] = undefined; + } + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); @@ -170,9 +177,16 @@ define([ this.menu = options.menu; this.fileType = options.fileType; + this.mode = options.mode; }, render: function() { + if (this.mode && !this.mode.canFeatureForms) { + this.formats[2].splice(1, 2); + this.formats[2] = this.formats[2].concat(this.formats[3]); + this.formats[3] = undefined; + } + this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase()})); $('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this)); diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 4e45e2c23..2183d893b 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -269,7 +269,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon previous-field', caption: this.capBtnPrev, - disabled: true, + disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -280,7 +280,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon next-field', caption: this.capBtnNext, - disabled: true, + disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -292,7 +292,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon submit-form', caption: this.capBtnSubmit, - disabled: true, + disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -304,7 +304,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon save-form', caption: this.capBtnSaveForm, - disabled: true, + disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -327,7 +327,7 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ - if (config.isEdit && config.canFeatureContentControl) { + if (config.isEdit && config.canFeatureContentControl && config.canFeatureForms) { if (config.canEditContentControl) { me.btnHighlight.setMenu(); me.mnuFormsColorPicker = me.btnHighlight.getPicker(); diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index 974fc87e1..9192a239b 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -211,7 +211,7 @@ define([ this.signatureSettings = new DE.Views.SignatureSettings(); } - if (mode && mode.canFeatureContentControl && mode.canEditContentControl && mode.canFeatureForms) { + if (mode && mode.canFeatureContentControl && mode.canEditContentControl && mode.isFormCreator) { this.btnForm = new Common.UI.Button({ hint: this.txtFormSettings, asctype: Common.Utils.documentSettingsType.Form,