[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.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 : '')

View file

@ -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});
}
}

View file

@ -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': {

View file

@ -226,10 +226,10 @@
<!--</div>-->
</section>
<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>
</div>
<div class="group" style="padding-left: 5px;">
<div class="group sheet-views" style="padding-left: 5px;">
<div class="elset">
<span class="btn-slot text" id="slot-createview"></span>
</div>
@ -237,7 +237,7 @@
<span class="btn-slot text" id="slot-closeview"></span>
</div>
</div>
<div class="separator long"></div>
<div class="separator long sheet-views"></div>
<div class="group">
<div class="elset" style="display: flex;">
<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(){
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);