2016-04-01 13:17:09 +00:00
|
|
|
/*
|
|
|
|
*
|
2019-01-17 13:05:03 +00:00
|
|
|
* (c) Copyright Ascensio System SIA 2010-2019
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* This program is a free software product. You can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
|
|
|
* version 3 as published by the Free Software Foundation. In accordance with
|
|
|
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
|
|
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
|
|
|
* of any third-party rights.
|
|
|
|
*
|
|
|
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
|
|
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
*
|
2019-01-17 13:00:34 +00:00
|
|
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
|
|
|
* street, Riga, Latvia, EU, LV-1050.
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* The interactive user interfaces in modified source and object code versions
|
|
|
|
* of the Program must display Appropriate Legal Notices, as required under
|
|
|
|
* Section 5 of the GNU AGPL version 3.
|
|
|
|
*
|
|
|
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
|
|
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
|
|
|
* grant you any rights under trademark law for use of our trademarks.
|
|
|
|
*
|
|
|
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
|
|
|
* well as technical writing content are licensed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
|
|
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
|
|
*
|
|
|
|
*/
|
2016-03-11 00:48:53 +00:00
|
|
|
/**
|
|
|
|
* LeftMenu.js
|
|
|
|
*
|
|
|
|
* Created by Maxim Kadushkin on 13 February 2014
|
2018-03-01 12:16:38 +00:00
|
|
|
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
2016-03-11 00:48:53 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
define([
|
|
|
|
'text!documenteditor/main/app/template/LeftMenu.template',
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
|
|
|
'common/main/lib/component/Button',
|
|
|
|
'common/main/lib/view/About',
|
|
|
|
/** coauthoring begin **/
|
|
|
|
'common/main/lib/view/Comments',
|
|
|
|
'common/main/lib/view/Chat',
|
|
|
|
/** coauthoring end **/
|
|
|
|
'common/main/lib/view/History',
|
2016-05-17 15:38:54 +00:00
|
|
|
'common/main/lib/view/Plugins',
|
2016-03-11 00:48:53 +00:00
|
|
|
'common/main/lib/view/About',
|
|
|
|
'common/main/lib/view/SearchDialog',
|
2017-12-19 13:30:58 +00:00
|
|
|
'documenteditor/main/app/view/FileMenu',
|
|
|
|
'documenteditor/main/app/view/Navigation'
|
2016-03-11 00:48:53 +00:00
|
|
|
], function (menuTemplate, $, _, Backbone) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var SCALE_MIN = 40;
|
|
|
|
var MENU_SCALE_PART = 300;
|
|
|
|
|
|
|
|
DE.Views.LeftMenu = Backbone.View.extend(_.extend({
|
|
|
|
el: '#left-menu',
|
|
|
|
|
|
|
|
template: _.template(menuTemplate),
|
|
|
|
|
|
|
|
// Delegated events for creating new items, and clearing completed ones.
|
|
|
|
events: function() {
|
|
|
|
return {
|
|
|
|
/** coauthoring begin **/
|
|
|
|
'click #left-btn-comments': _.bind(this.onCoauthOptions, this),
|
|
|
|
'click #left-btn-chat': _.bind(this.onCoauthOptions, this),
|
|
|
|
/** coauthoring end **/
|
2016-05-17 15:38:54 +00:00
|
|
|
'click #left-btn-plugins': _.bind(this.onCoauthOptions, this),
|
2017-12-19 13:30:58 +00:00
|
|
|
'click #left-btn-navigation': _.bind(this.onCoauthOptions, this),
|
2021-08-24 11:34:10 +00:00
|
|
|
'click #left-btn-thumbnails': _.bind(this.onCoauthOptions, this),
|
2016-03-11 00:48:53 +00:00
|
|
|
'click #left-btn-support': function() {
|
|
|
|
var config = this.mode.customization;
|
|
|
|
config && !!config.feedback && !!config.feedback.url ?
|
|
|
|
window.open(config.feedback.url) :
|
2019-02-22 12:52:33 +00:00
|
|
|
window.open('{{SUPPORT_URL}}');
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
this.minimizedMode = true;
|
2021-06-29 21:31:55 +00:00
|
|
|
this._state = {disabled: false};
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
render: function () {
|
2019-07-29 13:56:47 +00:00
|
|
|
var $markup = $(this.template({}));
|
2016-03-11 00:48:53 +00:00
|
|
|
|
|
|
|
this.btnSearch = new Common.UI.Button({
|
|
|
|
action: 'search',
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-search'),
|
2016-03-11 00:48:53 +00:00
|
|
|
hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'),
|
|
|
|
disabled: true,
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
|
|
|
|
this.btnAbout = new Common.UI.Button({
|
|
|
|
action: 'about',
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-about'),
|
2016-03-11 00:48:53 +00:00
|
|
|
hint: this.tipAbout,
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
|
|
|
|
|
|
|
this.btnSupport = new Common.UI.Button({
|
|
|
|
action: 'support',
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-support'),
|
2016-03-11 00:48:53 +00:00
|
|
|
hint: this.tipSupport,
|
|
|
|
disabled: true
|
|
|
|
});
|
|
|
|
|
|
|
|
/** coauthoring begin **/
|
|
|
|
this.btnComments = new Common.UI.Button({
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-comments'),
|
2016-03-11 00:48:53 +00:00
|
|
|
hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'),
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
|
|
|
|
|
|
|
this.btnChat = new Common.UI.Button({
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-chat'),
|
2016-03-11 00:48:53 +00:00
|
|
|
hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'),
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
|
|
|
|
2016-07-05 12:21:26 +00:00
|
|
|
this.btnComments.hide();
|
|
|
|
this.btnChat.hide();
|
|
|
|
|
2019-07-29 13:56:47 +00:00
|
|
|
this.btnComments.on('click', this.onBtnMenuClick.bind(this));
|
|
|
|
this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this));
|
|
|
|
this.btnChat.on('click', this.onBtnMenuClick.bind(this));
|
2016-07-05 12:21:26 +00:00
|
|
|
/** coauthoring end **/
|
|
|
|
|
2016-05-17 15:38:54 +00:00
|
|
|
this.btnPlugins = new Common.UI.Button({
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-plugins'),
|
2016-05-17 15:38:54 +00:00
|
|
|
hint: this.tipPlugins,
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
2016-05-18 11:41:30 +00:00
|
|
|
this.btnPlugins.hide();
|
2019-07-29 13:56:47 +00:00
|
|
|
this.btnPlugins.on('click', this.onBtnMenuClick.bind(this));
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-12-19 13:30:58 +00:00
|
|
|
this.btnNavigation = new Common.UI.Button({
|
2019-07-29 13:56:47 +00:00
|
|
|
el: $markup.elementById('#left-btn-navigation'),
|
2017-12-19 13:30:58 +00:00
|
|
|
hint: this.tipNavigation,
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
2019-07-29 13:56:47 +00:00
|
|
|
this.btnNavigation.on('click', this.onBtnMenuClick.bind(this));
|
2017-12-19 13:30:58 +00:00
|
|
|
|
2019-07-29 13:56:47 +00:00
|
|
|
this.btnSearch.on('click', this.onBtnMenuClick.bind(this));
|
|
|
|
this.btnAbout.on('toggle', this.onBtnMenuToggle.bind(this));
|
|
|
|
|
2017-02-20 14:54:12 +00:00
|
|
|
this.menuFile = new DE.Views.FileMenu();
|
2019-07-29 14:00:21 +00:00
|
|
|
this.btnAbout.panel = new Common.Views.About({el: '#about-menu-panel', appName: 'Document Editor'});
|
|
|
|
|
2021-08-24 11:34:10 +00:00
|
|
|
this.btnThumbnails = new Common.UI.Button({
|
|
|
|
el: $markup.elementById('#left-btn-thumbnails'),
|
|
|
|
hint: this.tipPageThumbnails,
|
|
|
|
enableToggle: true,
|
|
|
|
disabled: true,
|
|
|
|
toggleGroup: 'leftMenuGroup'
|
|
|
|
});
|
2021-08-27 11:50:02 +00:00
|
|
|
this.btnThumbnails.hide();
|
2021-08-24 11:34:10 +00:00
|
|
|
|
|
|
|
this.btnThumbnails.on('click', this.onBtnMenuClick.bind(this));
|
|
|
|
|
2019-07-29 14:00:21 +00:00
|
|
|
this.$el.html($markup);
|
2016-03-11 00:48:53 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
onBtnMenuToggle: function(btn, state) {
|
|
|
|
if (state) {
|
|
|
|
btn.panel['show']();
|
2017-08-18 14:08:45 +00:00
|
|
|
if (!this._state.pluginIsRunning)
|
|
|
|
this.$el.width(SCALE_MIN);
|
2016-03-11 00:48:53 +00:00
|
|
|
|
|
|
|
if (this.btnSearch.isActive())
|
|
|
|
this.btnSearch.toggle(false);
|
|
|
|
} else {
|
|
|
|
btn.panel['hide']();
|
|
|
|
}
|
2018-05-15 12:37:26 +00:00
|
|
|
DE.getController('Toolbar').DisableToolbar(state==true);
|
2016-03-11 00:48:53 +00:00
|
|
|
if (!this.supressEvents)
|
|
|
|
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
|
|
|
},
|
|
|
|
|
2017-06-20 09:54:01 +00:00
|
|
|
onBtnCommentsToggle: function(btn, state) {
|
|
|
|
if (!state)
|
|
|
|
this.fireEvent('comments:hide', this);
|
|
|
|
},
|
|
|
|
|
2016-03-11 00:48:53 +00:00
|
|
|
onBtnMenuClick: function(btn, e) {
|
|
|
|
this.supressEvents = true;
|
|
|
|
this.btnAbout.toggle(false);
|
|
|
|
|
|
|
|
if (btn.options.action == 'search') {
|
|
|
|
} else {
|
|
|
|
if (btn.pressed) {
|
|
|
|
if (!(this.$el.width() > SCALE_MIN)) {
|
|
|
|
this.$el.width(parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART);
|
|
|
|
}
|
2017-08-18 14:08:45 +00:00
|
|
|
} else if (!this._state.pluginIsRunning) {
|
2016-03-11 00:48:53 +00:00
|
|
|
Common.localStorage.setItem('de-mainmenu-width',this.$el.width());
|
|
|
|
this.$el.width(SCALE_MIN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.supressEvents = false;
|
|
|
|
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
|
|
|
},
|
|
|
|
|
|
|
|
onCoauthOptions: function(e) {
|
|
|
|
/** coauthoring begin **/
|
|
|
|
if (this.mode.canCoAuthoring) {
|
2018-12-17 08:37:43 +00:00
|
|
|
if (this.mode.canViewComments) {
|
2016-03-11 00:48:53 +00:00
|
|
|
if (this.btnComments.pressed && this.btnComments.$el.hasClass('notify'))
|
|
|
|
this.btnComments.$el.removeClass('notify');
|
|
|
|
this.panelComments[this.btnComments.pressed?'show':'hide']();
|
|
|
|
this.fireEvent((this.btnComments.pressed) ? 'comments:show' : 'comments:hide', this);
|
|
|
|
}
|
|
|
|
if (this.mode.canChat) {
|
|
|
|
if (this.btnChat.pressed) {
|
|
|
|
if (this.btnChat.$el.hasClass('notify'))
|
|
|
|
this.btnChat.$el.removeClass('notify');
|
|
|
|
|
|
|
|
this.panelChat.show();
|
|
|
|
this.panelChat.focus();
|
|
|
|
} else
|
|
|
|
this.panelChat['hide']();
|
|
|
|
}
|
|
|
|
}
|
2017-12-19 13:30:58 +00:00
|
|
|
if (this.panelNavigation) {
|
|
|
|
if (this.btnNavigation.pressed) {
|
|
|
|
this.panelNavigation.show();
|
|
|
|
} else
|
|
|
|
this.panelNavigation['hide']();
|
|
|
|
}
|
2021-08-24 11:34:10 +00:00
|
|
|
if (this.panelThumbnails) {
|
|
|
|
if (this.btnThumbnails.pressed) {
|
|
|
|
this.panelThumbnails.show();
|
|
|
|
} else {
|
|
|
|
this.panelThumbnails.hide();
|
|
|
|
}
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
/** coauthoring end **/
|
2017-08-18 14:08:45 +00:00
|
|
|
// if (this.mode.canPlugins && this.panelPlugins) {
|
|
|
|
// if (this.btnPlugins.pressed) {
|
|
|
|
// this.panelPlugins.show();
|
|
|
|
// } else
|
|
|
|
// this.panelPlugins['hide']();
|
|
|
|
// }
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setOptionsPanel: function(name, panel) {
|
|
|
|
/** coauthoring begin **/
|
|
|
|
if (name == 'chat') {
|
|
|
|
this.panelChat = panel.render('#left-panel-chat');
|
|
|
|
} else if (name == 'comment') {
|
|
|
|
this.panelComments = panel;
|
|
|
|
} else /** coauthoring end **/
|
|
|
|
if (name == 'history') {
|
|
|
|
this.panelHistory = panel.render('#left-panel-history');
|
2016-05-17 15:38:54 +00:00
|
|
|
} else
|
2016-05-19 09:46:21 +00:00
|
|
|
if (name == 'plugins' && !this.panelPlugins) {
|
2017-09-04 14:20:46 +00:00
|
|
|
this.panelPlugins = panel.render(/*'#left-panel-plugins'*/);
|
2017-12-19 13:30:58 +00:00
|
|
|
} else
|
|
|
|
if (name == 'navigation' && !this.panelNavigation) {
|
|
|
|
this.panelNavigation = panel.render('#left-panel-navigation');
|
2021-08-24 11:34:10 +00:00
|
|
|
} else
|
|
|
|
if (name == 'thumbnails') {
|
|
|
|
this.panelThumbnails = panel.render('#left-panel-thumbnails');
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/** coauthoring begin **/
|
|
|
|
markCoauthOptions: function(opt, ignoreDisabled) {
|
|
|
|
if (opt=='chat' && this.btnChat.isVisible() &&
|
|
|
|
!this.btnChat.isDisabled() && !this.btnChat.pressed) {
|
|
|
|
this.btnChat.$el.addClass('notify');
|
|
|
|
}
|
|
|
|
if (opt=='comments' && this.btnComments.isVisible() && !this.btnComments.pressed &&
|
|
|
|
(!this.btnComments.isDisabled() || ignoreDisabled) ) {
|
|
|
|
this.btnComments.$el.addClass('notify');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/** coauthoring end **/
|
|
|
|
|
|
|
|
close: function(menu) {
|
2017-02-27 12:02:37 +00:00
|
|
|
if ( this.menuFile.isVisible() ) {
|
2017-02-20 14:54:12 +00:00
|
|
|
this.menuFile.hide();
|
|
|
|
} else {
|
|
|
|
this.btnAbout.toggle(false);
|
2017-08-18 14:08:45 +00:00
|
|
|
if (!this._state.pluginIsRunning)
|
|
|
|
this.$el.width(SCALE_MIN);
|
2017-02-20 14:54:12 +00:00
|
|
|
/** coauthoring begin **/
|
|
|
|
if (this.mode.canCoAuthoring) {
|
2018-12-17 08:37:43 +00:00
|
|
|
if (this.mode.canViewComments) {
|
2017-02-20 14:54:12 +00:00
|
|
|
this.panelComments['hide']();
|
|
|
|
if (this.btnComments.pressed)
|
|
|
|
this.fireEvent('comments:hide', this);
|
|
|
|
this.btnComments.toggle(false, true);
|
|
|
|
}
|
|
|
|
if (this.mode.canChat) {
|
|
|
|
this.panelChat['hide']();
|
2017-10-10 12:14:27 +00:00
|
|
|
this.btnChat.toggle(false);
|
2017-02-20 14:54:12 +00:00
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:54:12 +00:00
|
|
|
/** coauthoring end **/
|
2017-08-18 14:08:45 +00:00
|
|
|
if (this.mode.canPlugins && this.panelPlugins && !this._state.pluginIsRunning) {
|
2017-02-20 14:54:12 +00:00
|
|
|
this.panelPlugins['hide']();
|
|
|
|
this.btnPlugins.toggle(false, true);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-12-19 13:30:58 +00:00
|
|
|
if (this.panelNavigation) {
|
|
|
|
this.panelNavigation['hide']();
|
|
|
|
this.btnNavigation.toggle(false, true);
|
|
|
|
}
|
2022-02-07 12:28:37 +00:00
|
|
|
if (this.panelThumbnails) {
|
|
|
|
this.panelThumbnails['hide']();
|
|
|
|
this.btnThumbnails.toggle(false, true);
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
isOpened: function() {
|
2017-02-20 14:54:12 +00:00
|
|
|
var isopened = this.btnSearch.pressed;
|
2016-03-11 00:48:53 +00:00
|
|
|
/** coauthoring begin **/
|
|
|
|
!isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed);
|
|
|
|
/** coauthoring end **/
|
|
|
|
return isopened;
|
|
|
|
},
|
|
|
|
|
|
|
|
disableMenu: function(menu, disable) {
|
|
|
|
this.btnSearch.setDisabled(false);
|
|
|
|
this.btnAbout.setDisabled(false);
|
|
|
|
this.btnSupport.setDisabled(false);
|
|
|
|
/** coauthoring begin **/
|
|
|
|
this.btnComments.setDisabled(false);
|
|
|
|
this.btnChat.setDisabled(false);
|
|
|
|
/** coauthoring end **/
|
2016-05-17 15:38:54 +00:00
|
|
|
this.btnPlugins.setDisabled(false);
|
2017-12-19 13:30:58 +00:00
|
|
|
this.btnNavigation.setDisabled(false);
|
2021-08-24 11:34:10 +00:00
|
|
|
this.btnThumbnails.setDisabled(false);
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
showMenu: function(menu, opts) {
|
|
|
|
var re = /^(\w+):?(\w*)$/.exec(menu);
|
2017-02-20 14:54:12 +00:00
|
|
|
if ( re[1] == 'file' ) {
|
|
|
|
if ( !this.menuFile.isVisible() ) {
|
|
|
|
// this.btnFile.toggle(true);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:54:12 +00:00
|
|
|
this.menuFile.show(re[2].length ? re[2] : undefined, opts);
|
2016-03-11 00:48:53 +00:00
|
|
|
} else {
|
|
|
|
/** coauthoring begin **/
|
|
|
|
if (menu == 'chat') {
|
|
|
|
if (this.btnChat.isVisible() &&
|
|
|
|
!this.btnChat.isDisabled() && !this.btnChat.pressed) {
|
|
|
|
this.btnChat.toggle(true);
|
|
|
|
this.onBtnMenuClick(this.btnChat);
|
|
|
|
this.onCoauthOptions();
|
|
|
|
this.panelChat.focus();
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
if (menu == 'comments') {
|
|
|
|
if (this.btnComments.isVisible() &&
|
|
|
|
!this.btnComments.isDisabled() && !this.btnComments.pressed) {
|
|
|
|
this.btnComments.toggle(true);
|
|
|
|
this.onBtnMenuClick(this.btnComments);
|
|
|
|
this.onCoauthOptions();
|
|
|
|
}
|
2021-12-08 15:01:00 +00:00
|
|
|
} else if (menu == 'navigation') {
|
|
|
|
if (this.btnNavigation.isVisible() &&
|
|
|
|
!this.btnNavigation.isDisabled() && !this.btnNavigation.pressed) {
|
|
|
|
this.btnNavigation.toggle(true);
|
|
|
|
this.onBtnMenuClick(this.btnNavigation);
|
|
|
|
this.onCoauthOptions();
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
/** coauthoring end **/
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getMenu: function(type) {
|
|
|
|
switch (type) {
|
|
|
|
default: return null;
|
2017-02-20 14:54:12 +00:00
|
|
|
case 'file': return this.menuFile;
|
2016-03-11 00:48:53 +00:00
|
|
|
case 'about': return this.btnAbout.panel;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setMode: function(mode) {
|
|
|
|
this.mode = mode;
|
2016-07-08 12:53:41 +00:00
|
|
|
this.btnAbout.panel.setMode(mode);
|
2016-03-11 00:48:53 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
showHistory: function() {
|
2017-12-01 11:48:41 +00:00
|
|
|
this._state.pluginIsRunning = false;
|
2016-03-11 00:48:53 +00:00
|
|
|
this.panelHistory.show();
|
|
|
|
this.panelHistory.$el.width((parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART) - SCALE_MIN);
|
|
|
|
Common.NotificationCenter.trigger('layout:changed', 'history');
|
|
|
|
},
|
|
|
|
|
2020-11-02 20:26:17 +00:00
|
|
|
setDeveloperMode: function(mode, beta, version) {
|
2017-04-12 07:54:47 +00:00
|
|
|
if ( !this.$el.is(':visible') ) return;
|
|
|
|
|
2020-11-09 11:52:21 +00:00
|
|
|
if ((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)) {
|
2020-11-02 20:26:17 +00:00
|
|
|
if (!this.developerHint) {
|
2020-11-09 11:52:21 +00:00
|
|
|
var str = '';
|
|
|
|
if ((mode & Asc.c_oLicenseMode.Trial) && (mode & Asc.c_oLicenseMode.Developer))
|
|
|
|
str = this.txtTrialDev;
|
|
|
|
else if ((mode & Asc.c_oLicenseMode.Trial)!==0)
|
|
|
|
str = this.txtTrial;
|
|
|
|
else if ((mode & Asc.c_oLicenseMode.Developer)!==0)
|
|
|
|
str = this.txtDeveloper;
|
|
|
|
str = str.toUpperCase();
|
2020-11-03 10:41:26 +00:00
|
|
|
this.developerHint = $('<div id="developer-hint">' + str + '</div>').appendTo(this.$el);
|
2020-11-02 20:26:17 +00:00
|
|
|
this.devHeight = this.developerHint.outerHeight();
|
2020-11-09 11:52:21 +00:00
|
|
|
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
|
|
|
|
this.devHintInited = true;
|
2020-11-02 20:26:17 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-09 11:52:21 +00:00
|
|
|
this.developerHint && this.developerHint.toggleClass('hidden', !((mode & Asc.c_oLicenseMode.Trial) || (mode & Asc.c_oLicenseMode.Developer)));
|
|
|
|
|
2020-11-02 20:26:17 +00:00
|
|
|
if (beta) {
|
|
|
|
if (!this.betaHint) {
|
|
|
|
var style = (mode) ? 'style="margin-top: 4px;"' : '',
|
|
|
|
arr = (version || '').split('.'),
|
|
|
|
ver = '';
|
|
|
|
(arr.length>0) && (ver += ('v. ' + arr[0]));
|
2021-02-18 14:55:53 +00:00
|
|
|
(arr.length>1) && (ver += ('.' + arr[1]));
|
2020-11-02 20:26:17 +00:00
|
|
|
this.betaHint = $('<div id="beta-hint"' + style + '>' + (ver + ' (beta)' ) + '</div>').appendTo(this.$el);
|
|
|
|
this.betaHeight = this.betaHint.outerHeight();
|
2020-11-19 20:36:48 +00:00
|
|
|
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
|
|
|
|
this.devHintInited = true;
|
2020-11-02 20:26:17 +00:00
|
|
|
}
|
2017-04-12 07:54:47 +00:00
|
|
|
}
|
2020-11-19 20:36:48 +00:00
|
|
|
this.betaHint && this.betaHint.toggleClass('hidden', !beta);
|
|
|
|
|
2020-11-09 11:52:21 +00:00
|
|
|
var btns = this.$el.find('button.btn-category:visible'),
|
|
|
|
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
|
|
|
|
this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20;
|
|
|
|
this.onWindowResize();
|
|
|
|
},
|
|
|
|
|
|
|
|
setLimitMode: function() {
|
|
|
|
if ( !this.$el.is(':visible') ) return;
|
|
|
|
|
|
|
|
if (!this.limitHint) {
|
|
|
|
var str = this.txtLimit.toUpperCase();
|
|
|
|
this.limitHint = $('<div id="limit-hint" style="margin-top: 4px;">' + str + '</div>').appendTo(this.$el);
|
|
|
|
this.limitHeight = this.limitHint.outerHeight();
|
|
|
|
!this.devHintInited && $(window).on('resize', _.bind(this.onWindowResize, this));
|
|
|
|
this.devHintInited = true;
|
2017-04-12 07:54:47 +00:00
|
|
|
}
|
2020-11-09 11:52:21 +00:00
|
|
|
this.limitHint && this.limitHint.toggleClass('hidden', false);
|
2017-04-12 07:54:47 +00:00
|
|
|
|
2017-12-06 17:52:24 +00:00
|
|
|
var btns = this.$el.find('button.btn-category:visible'),
|
|
|
|
lastbtn = (btns.length>0) ? $(btns[btns.length-1]) : null;
|
|
|
|
this.minDevPosition = (lastbtn) ? (lastbtn.offset().top - lastbtn.offsetParent().offset().top + lastbtn.height() + 20) : 20;
|
2017-04-12 07:54:47 +00:00
|
|
|
this.onWindowResize();
|
|
|
|
},
|
|
|
|
|
|
|
|
onWindowResize: function() {
|
2020-11-19 20:36:48 +00:00
|
|
|
var height = (this.devHeight || 0) + (this.betaHeight || 0) + (this.limitHeight || 0);
|
2020-11-02 20:26:17 +00:00
|
|
|
var top = Math.max((this.$el.height()-height)/2, this.minDevPosition);
|
|
|
|
if (this.developerHint) {
|
|
|
|
this.developerHint.css('top', top);
|
|
|
|
top += this.devHeight;
|
|
|
|
}
|
2020-11-19 20:36:48 +00:00
|
|
|
if (this.betaHint) {
|
|
|
|
this.betaHint.css('top', top);
|
|
|
|
top += (this.betaHeight + 4);
|
|
|
|
}
|
2020-11-09 11:52:21 +00:00
|
|
|
this.limitHint && this.limitHint.css('top', top);
|
2017-04-12 07:54:47 +00:00
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
/** coauthoring begin **/
|
|
|
|
tipComments : 'Comments',
|
|
|
|
tipChat : 'Chat',
|
|
|
|
/** coauthoring end **/
|
|
|
|
tipAbout : 'About',
|
|
|
|
tipSupport : 'Feedback & Support',
|
2016-05-17 15:38:54 +00:00
|
|
|
tipSearch : 'Search',
|
2017-04-12 07:54:47 +00:00
|
|
|
tipPlugins : 'Plugins',
|
2021-08-24 11:34:10 +00:00
|
|
|
tipPageThumbnails: 'Page Thumbnails',
|
2017-10-25 14:36:59 +00:00
|
|
|
txtDeveloper: 'DEVELOPER MODE',
|
2017-12-19 13:30:58 +00:00
|
|
|
txtTrial: 'TRIAL MODE',
|
2020-11-09 11:52:21 +00:00
|
|
|
txtTrialDev: 'Trial Developer Mode',
|
|
|
|
tipNavigation: 'Navigation',
|
|
|
|
txtLimit: 'Limit Access'
|
2016-03-11 00:48:53 +00:00
|
|
|
}, DE.Views.LeftMenu || {}));
|
|
|
|
});
|