[SSE] Move views to paid features

This commit is contained in:
Julia Radzhabova 2020-07-10 15:42:39 +03:00
parent 54a589a29b
commit ce19f6f1fc
5 changed files with 55 additions and 42 deletions

View file

@ -356,6 +356,7 @@ define([
this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false)); this.appOptions.mentionShare = !((typeof (this.appOptions.customization) == 'object') && (this.appOptions.customization.mentionShare==false));
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
this.appOptions.canFeaturePivot = !!this.api.asc_isSupportFeature("pivot-tables"); 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 = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -3306,7 +3306,7 @@ define([
} }
var viewtab = me.getApplication().getController('ViewTab'); var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me}); viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
} }
} }

View file

@ -77,7 +77,8 @@ define([
setConfig: function(config) { setConfig: function(config) {
this.toolbar = config.toolbar; this.toolbar = config.toolbar;
this.view = this.createView('ViewTab', { this.view = this.createView('ViewTab', {
toolbar: this.toolbar.toolbar toolbar: this.toolbar.toolbar,
mode: config.mode
}); });
this.addListeners({ this.addListeners({
'ViewTab': { 'ViewTab': {

View file

@ -226,10 +226,10 @@
<!--</div>--> <!--</div>-->
</section> </section>
<section class="panel" data-tab="view"> <section class="panel" data-tab="view">
<div class="group"> <div class="group sheet-views">
<span class="btn-slot text x-huge" id="slot-btn-sheet-view"></span> <span class="btn-slot text x-huge" id="slot-btn-sheet-view"></span>
</div> </div>
<div class="group" style="padding-left: 5px;"> <div class="group sheet-views" style="padding-left: 5px;">
<div class="elset"> <div class="elset">
<span class="btn-slot text" id="slot-createview"></span> <span class="btn-slot text" id="slot-createview"></span>
</div> </div>
@ -237,7 +237,7 @@
<span class="btn-slot text" id="slot-closeview"></span> <span class="btn-slot text" id="slot-closeview"></span>
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long sheet-views"></div>
<div class="group"> <div class="group">
<div class="elset" style="display: flex;"> <div class="elset" style="display: flex;">
<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span> <span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>

View file

@ -48,15 +48,18 @@ define([
SSE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ SSE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
function setEvents() { function setEvents() {
var me = this; 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.btnFreezePanes.on('click', function (btn, e) {
me.fireEvent('viewtab:freeze', [btn.pressed]); 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) { this.chFormula.on('change', function (field, value) {
me.fireEvent('viewtab:formula', [0, value]); me.fireEvent('viewtab:formula', [0, value]);
}); });
@ -77,6 +80,7 @@ define([
initialize: function (options) { initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this); Common.UI.BaseView.prototype.initialize.call(this);
this.toolbar = options.toolbar; this.toolbar = options.toolbar;
this.appConfig = options.mode;
this.lockedControls = []; this.lockedControls = [];
@ -84,35 +88,37 @@ define([
$host = me.toolbar.$el, $host = me.toolbar.$el,
_set = SSE.enumLock; _set = SSE.enumLock;
this.btnSheetView = new Common.UI.Button({ if ( me.appConfig.canFeatureViews ) {
parentEl: $host.find('#slot-btn-sheet-view'), this.btnSheetView = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', parentEl: $host.find('#slot-btn-sheet-view'),
iconCls: 'toolbar__icon btn-sheetview', cls: 'btn-toolbar x-huge icon-top',
caption: me.capBtnSheetView, iconCls: 'toolbar__icon btn-sheetview',
lock : [_set.lostConnect, _set.coAuth], caption: me.capBtnSheetView,
menu: true lock : [_set.lostConnect, _set.coAuth],
}); menu: true
this.lockedControls.push(this.btnSheetView); });
this.lockedControls.push(this.btnSheetView);
this.btnCreateView = new Common.UI.Button({ this.btnCreateView = new Common.UI.Button({
id : 'id-toolbar-btn-createview', id : 'id-toolbar-btn-createview',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-createview', iconCls : 'toolbar__icon btn-createview',
caption : this.textCreate, caption : this.textCreate,
lock : [_set.coAuth, _set.lostConnect] lock : [_set.coAuth, _set.lostConnect]
}); });
this.lockedControls.push(this.btnCreateView); this.lockedControls.push(this.btnCreateView);
Common.Utils.injectComponent($host.find('#slot-createview'), this.btnCreateView); Common.Utils.injectComponent($host.find('#slot-createview'), this.btnCreateView);
this.btnCloseView = new Common.UI.Button({ this.btnCloseView = new Common.UI.Button({
id : 'id-toolbar-btn-closeview', id : 'id-toolbar-btn-closeview',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-closeview', iconCls : 'toolbar__icon btn-closeview',
caption : this.textClose, caption : this.textClose,
lock : [_set.coAuth, _set.lostConnect] lock : [_set.coAuth, _set.lostConnect]
}); });
this.lockedControls.push(this.btnCloseView); this.lockedControls.push(this.btnCloseView);
Common.Utils.injectComponent($host.find('#slot-closeview'), this.btnCloseView); Common.Utils.injectComponent($host.find('#slot-closeview'), this.btnCloseView);
}
this.btnFreezePanes = new Common.UI.Button({ this.btnFreezePanes = new Common.UI.Button({
parentEl: $host.find('#slot-btn-freeze'), parentEl: $host.find('#slot-btn-freeze'),
@ -180,11 +186,16 @@ define([
(new Promise(function (accept, reject) { (new Promise(function (accept, reject) {
accept(); accept();
})).then(function(){ })).then(function(){
me.btnSheetView.updateHint( me.tipSheetView ); if (!config.canFeatureViews) {
me.setButtonMenu(me.btnSheetView); 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.btnCreateView.updateHint(me.tipCreate);
me.btnCloseView.updateHint(me.tipClose); me.btnCloseView.updateHint(me.tipClose);
}
me.btnFreezePanes.updateHint(me.tipFreeze); me.btnFreezePanes.updateHint(me.tipFreeze);
setEvents.call(me); setEvents.call(me);