diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index dc64e7e64..36c65b014 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -356,6 +356,7 @@ define([ this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false)); this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; this.appOptions.canFeaturePivot = !!this.api.asc_isSupportFeature("pivot-tables"); + this.appOptions.canFeatureViews = !!this.api.asc_isSupportFeature("sheet-views"); this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header'); this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 6b916879a..848d9085b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3306,7 +3306,7 @@ define([ } var viewtab = me.getApplication().getController('ViewTab'); - viewtab.setApi(me.api).setConfig({toolbar: me}); + viewtab.setApi(me.api).setConfig({toolbar: me, mode: config}); } } diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 52b79e327..9b901fdf3 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -77,7 +77,8 @@ define([ setConfig: function(config) { this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { - toolbar: this.toolbar.toolbar + toolbar: this.toolbar.toolbar, + mode: config.mode }); this.addListeners({ 'ViewTab': { diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 312b2bc1c..b7b156a9d 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -226,10 +226,10 @@
-
+
-
+
@@ -237,7 +237,7 @@
-
+
diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index 1617c409b..cb94ebea8 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -48,15 +48,18 @@ define([ SSE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ function setEvents() { var me = this; + if ( me.appConfig.canFeatureViews ) { + me.btnCloseView.on('click', function (btn, e) { + me.fireEvent('viewtab:openview', [{name: 'default', value: 'default'}]); + }); + me.btnCreateView.on('click', function (btn, e) { + me.fireEvent('viewtab:createview'); + }); + } + me.btnFreezePanes.on('click', function (btn, e) { me.fireEvent('viewtab:freeze', [btn.pressed]); }); - me.btnCloseView.on('click', function (btn, e) { - me.fireEvent('viewtab:openview', [{name: 'default', value: 'default'}]); - }); - me.btnCreateView.on('click', function (btn, e) { - me.fireEvent('viewtab:createview'); - }); this.chFormula.on('change', function (field, value) { me.fireEvent('viewtab:formula', [0, value]); }); @@ -77,6 +80,7 @@ define([ initialize: function (options) { Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; + this.appConfig = options.mode; this.lockedControls = []; @@ -84,35 +88,37 @@ define([ $host = me.toolbar.$el, _set = SSE.enumLock; - this.btnSheetView = new Common.UI.Button({ - parentEl: $host.find('#slot-btn-sheet-view'), - cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-sheetview', - caption: me.capBtnSheetView, - lock : [_set.lostConnect, _set.coAuth], - menu: true - }); - this.lockedControls.push(this.btnSheetView); + if ( me.appConfig.canFeatureViews ) { + this.btnSheetView = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-sheet-view'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-sheetview', + caption: me.capBtnSheetView, + lock : [_set.lostConnect, _set.coAuth], + menu: true + }); + this.lockedControls.push(this.btnSheetView); - this.btnCreateView = new Common.UI.Button({ - id : 'id-toolbar-btn-createview', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-createview', - caption : this.textCreate, - lock : [_set.coAuth, _set.lostConnect] - }); - this.lockedControls.push(this.btnCreateView); - Common.Utils.injectComponent($host.find('#slot-createview'), this.btnCreateView); + this.btnCreateView = new Common.UI.Button({ + id : 'id-toolbar-btn-createview', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-createview', + caption : this.textCreate, + lock : [_set.coAuth, _set.lostConnect] + }); + this.lockedControls.push(this.btnCreateView); + Common.Utils.injectComponent($host.find('#slot-createview'), this.btnCreateView); - this.btnCloseView = new Common.UI.Button({ - id : 'id-toolbar-btn-closeview', - cls : 'btn-toolbar', - iconCls : 'toolbar__icon btn-closeview', - caption : this.textClose, - lock : [_set.coAuth, _set.lostConnect] - }); - this.lockedControls.push(this.btnCloseView); - Common.Utils.injectComponent($host.find('#slot-closeview'), this.btnCloseView); + this.btnCloseView = new Common.UI.Button({ + id : 'id-toolbar-btn-closeview', + cls : 'btn-toolbar', + iconCls : 'toolbar__icon btn-closeview', + caption : this.textClose, + lock : [_set.coAuth, _set.lostConnect] + }); + this.lockedControls.push(this.btnCloseView); + Common.Utils.injectComponent($host.find('#slot-closeview'), this.btnCloseView); + } this.btnFreezePanes = new Common.UI.Button({ parentEl: $host.find('#slot-btn-freeze'), @@ -180,11 +186,16 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ - me.btnSheetView.updateHint( me.tipSheetView ); - me.setButtonMenu(me.btnSheetView); + if (!config.canFeatureViews) { + me.toolbar && me.toolbar.$el.find('.group.sheet-views').hide(); + me.toolbar && me.toolbar.$el.find('.separator.sheet-views').hide(); + } else { + me.btnSheetView.updateHint( me.tipSheetView ); + me.setButtonMenu(me.btnSheetView); - me.btnCreateView.updateHint(me.tipCreate); - me.btnCloseView.updateHint(me.tipClose); + me.btnCreateView.updateHint(me.tipCreate); + me.btnCloseView.updateHint(me.tipClose); + } me.btnFreezePanes.updateHint(me.tipFreeze); setEvents.call(me);