',
'
1) ? 1 : 0) + (variations[currentVariation].get("icons").length>2 ? 2 : 0)] %>);">
',
'<% if (variations.length>1) { %>',
'
',
@@ -147,25 +147,27 @@ define([
var me = this;
var _group = $('
');
this.storePlugins.each(function (model) {
- var modes = model.get('variations'),
- guid = model.get('guid'),
- icons = modes[model.get('currentVariation')].get('icons'),
- _icon_url = model.get('baseUrl') + icons[((window.devicePixelRatio > 1) ? 1 : 0) + (icons.length>2 ? 2 : 0)],
- btn = new Common.UI.Button({
- cls: 'btn-toolbar x-huge icon-top',
- iconImg: _icon_url,
- caption: model.get('name'),
- menu: modes && modes.length > 1,
- split: modes && modes.length > 1,
- value: guid,
- hint: model.get('name')
- });
+ if (model.get('visible')) {
+ var modes = model.get('variations'),
+ guid = model.get('guid'),
+ icons = modes[model.get('currentVariation')].get('icons'),
+ _icon_url = model.get('baseUrl') + icons[((window.devicePixelRatio > 1) ? 1 : 0) + (icons.length>2 ? 2 : 0)],
+ btn = new Common.UI.Button({
+ cls: 'btn-toolbar x-huge icon-top',
+ iconImg: _icon_url,
+ caption: model.get('name'),
+ menu: modes && modes.length > 1,
+ split: modes && modes.length > 1,
+ value: guid,
+ hint: model.get('name')
+ });
- var $slot = $('
').appendTo(_group);
- btn.render($slot);
+ var $slot = $('
').appendTo(_group);
+ btn.render($slot);
- model.set('button', btn);
- me.lockedControls.push(btn);
+ model.set('button', btn);
+ me.lockedControls.push(btn);
+ }
});
parent.html(_group);
@@ -260,9 +262,11 @@ define([
var model = this.storePlugins.findWhere({guid: guid});
if ( model ) {
var _btn = model.get('button');
- _btn.toggle(false);
- if (_btn.menu && _btn.menu.items.length>0) {
- _btn.menu.items[0].setCaption(this.textStart);
+ if (_btn) {
+ _btn.toggle(false);
+ if (_btn.menu && _btn.menu.items.length>0) {
+ _btn.menu.items[0].setCaption(this.textStart);
+ }
}
}
},
@@ -276,31 +280,36 @@ define([
},
createPluginButton: function (model) {
+ if (!model.get('visible'))
+ return null;
+
var me = this;
var modes = model.get('variations'),
guid = model.get('guid'),
icons = modes[model.get('currentVariation')].get('icons'),
icon_url = model.get('baseUrl') + icons[((window.devicePixelRatio > 1) ? 1 : 0) + (icons.length > 2 ? 2 : 0)];
+
+ var _menu_items = [];
+ _.each(model.get('variations'), function(variation, index) {
+ if (variation.get('visible'))
+ _menu_items.push({
+ caption : index > 0 ? variation.get('description') : me.textStart,
+ value : parseInt(variation.get('index'))
+ });
+ });
+
var btn = new Common.UI.Button({
- cls: 'btn-toolbar x-huge icon-top',
- iconImg: icon_url,
- caption: model.get('name'),
- menu: modes && modes.length > 1,
- split: modes && modes.length > 1,
- value: guid,
- hint: model.get('name')
- });
+ cls: 'btn-toolbar x-huge icon-top',
+ iconImg: icon_url,
+ caption: model.get('name'),
+ menu: _menu_items.length > 1,
+ split: _menu_items.length > 1,
+ value: guid,
+ hint: model.get('name')
+ });
if ( btn.split ) {
- var _menu_items = [];
- _.each(model.get('variations'), function(version, index) {
- _menu_items.push({
- caption : index > 0 ? version.get('description') : me.textStart,
- value : parseInt(version.get('index'))
- });
- });
-
btn.setMenu(
new Common.UI.Menu({
items: _menu_items,
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 9bc9fe0f8..42efad3e4 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -1909,32 +1909,33 @@ define([
if (plugins) {
var arr = [], arrUI = [];
plugins.pluginsData.forEach(function(item){
- var variationsArr = [];
+ var variationsArr = [],
+ pluginVisible = false;
item.variations.forEach(function(itemVar){
- if ( (isEdit || itemVar.isViewer) &&
- _.contains(itemVar.EditorsSupport, 'word') )
- {
- var icons = itemVar.icons;
- if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
- icons = [];
- itemVar.icons.forEach(function(icon){
- icons.push(icon.substring(icon.lastIndexOf("\/")+1));
- });
- }
+ var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'word');
+ if ( visible ) pluginVisible = true;
- if (item.isUICustomizer ) {
- arrUI.push(item.baseUrl + itemVar.url)
- } else {
- var model = new Common.Models.PluginVariation(itemVar);
+ var icons = itemVar.icons;
+ if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
+ icons = [];
+ itemVar.icons.forEach(function(icon){
+ icons.push(icon.substring(icon.lastIndexOf("\/")+1));
+ });
+ }
- model.set({
- index: variationsArr.length,
- url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
- icons: icons
- });
+ if (item.isUICustomizer ) {
+ visible && arrUI.push(item.baseUrl + itemVar.url);
+ } else {
+ var model = new Common.Models.PluginVariation(itemVar);
- variationsArr.push(model);
- }
+ model.set({
+ index: variationsArr.length,
+ url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
+ icons: icons,
+ visible: visible
+ });
+
+ variationsArr.push(model);
}
});
@@ -1944,7 +1945,8 @@ define([
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
- currentVariation: 0
+ currentVariation: 0,
+ visible: pluginVisible
}));
});
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index f632f88ba..d7f280581 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -1684,32 +1684,34 @@ define([
if (uiCustomize!==undefined && (pluginStore.findWhere({baseUrl : item.baseUrl}) || pluginStore.findWhere({guid : item.guid}))) return;
var variations = item.variations,
- variationsArr = [];
+ variationsArr = [],
+ pluginVisible = false;
variations.forEach(function(itemVar){
- var isSupported = itemVar.EditorsSupport.includes('slide');
+ var isSupported = itemVar.EditorsSupport.includes('slide'),
+ visible = isSupported && (isEdit || itemVar.isViewer);
+ if ( visible ) pluginVisible = true;
- if ( isSupported && (isEdit || itemVar.isViewer) ){
- var icons = itemVar.icons;
- if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
- icons = [];
- itemVar.icons.forEach(function(icon){
- icons.push(icon.substring(icon.lastIndexOf("\/")+1));
- });
- }
+ var icons = itemVar.icons;
+ if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
+ icons = [];
+ itemVar.icons.forEach(function(icon){
+ icons.push(icon.substring(icon.lastIndexOf("\/")+1));
+ });
+ }
- if ( item.isUICustomizer ) {
- arrUI.push(item.baseUrl + itemVar.url);
- } else {
- var model = new Common.Models.PluginVariation(itemVar);
+ if ( item.isUICustomizer ) {
+ visible && arrUI.push(item.baseUrl + itemVar.url);
+ } else {
+ var model = new Common.Models.PluginVariation(itemVar);
- model.set({
- index: variationsArr.length,
- url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
- icons: icons
- });
+ model.set({
+ index: variationsArr.length,
+ url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1) ) : itemVar.url,
+ icons: icons,
+ visible: visible
+ });
- variationsArr.push(model);
- }
+ variationsArr.push(model);
}
});
if (variationsArr.length>0 && !item.isUICustomizer)
@@ -1718,7 +1720,8 @@ define([
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
- currentVariation: 0
+ currentVariation: 0,
+ visible: pluginVisible
}));
});
diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js
index f8d89e97b..350385ee9 100644
--- a/apps/spreadsheeteditor/main/app/controller/Main.js
+++ b/apps/spreadsheeteditor/main/app/controller/Main.js
@@ -1864,32 +1864,33 @@ define([
if (uiCustomize!==undefined && (pluginStore.findWhere({baseUrl : item.baseUrl}) || pluginStore.findWhere({guid : item.guid}))) return;
var variations = item.variations,
- variationsArr = [];
+ variationsArr = [],
+ pluginVisible = false;
variations.forEach(function(itemVar){
- if ((isEdit || itemVar.isViewer) &&
- itemVar.EditorsSupport.includes('cell') )
- {
- var icons = itemVar.icons;
- if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
- icons = [];
- itemVar.icons.forEach(function(icon){
- icons.push(icon.substring(icon.lastIndexOf("\/")+1));
- });
- }
+ var visible = (isEdit || itemVar.isViewer) && itemVar.EditorsSupport.includes('cell');
+ if ( visible ) pluginVisible = true;
- if ( item.isUICustomizer ) {
- arrUI.push(item.baseUrl + itemVar.url);
- } else {
- var model = new Common.Models.PluginVariation(itemVar);
+ var icons = itemVar.icons;
+ if (item.oldVersion) { // for compatibility with previouse version of server, where plugins.url is used.
+ icons = [];
+ itemVar.icons.forEach(function(icon){
+ icons.push(icon.substring(icon.lastIndexOf("\/")+1));
+ });
+ }
- model.set({
- index: variationsArr.length,
- url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1)) : itemVar.url,
- icons: icons
- });
+ if ( item.isUICustomizer ) {
+ visible && arrUI.push(item.baseUrl + itemVar.url);
+ } else {
+ var model = new Common.Models.PluginVariation(itemVar);
- variationsArr.push(model);
- }
+ model.set({
+ index: variationsArr.length,
+ url: (item.oldVersion) ? (itemVar.url.substring(itemVar.url.lastIndexOf("\/") + 1)) : itemVar.url,
+ icons: icons,
+ visible: visible
+ });
+
+ variationsArr.push(model);
}
});
if (variationsArr.length>0 && !item.isUICustomizer)
@@ -1898,7 +1899,8 @@ define([
guid: item.guid,
baseUrl : item.baseUrl,
variations: variationsArr,
- currentVariation: 0
+ currentVariation: 0,
+ visible: pluginVisible
}));
});