diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index b8da7c4e19..986ee19d51 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -70,7 +70,8 @@ define([ me.toolbar = toolbar; toolbar.addTab(tab, me.$toolbarPanelPlugins, Common.UI.LayoutManager.lastTabIdx); // TODO: clear plugins list in left panel } - } + }, + 'tab:active': this.onActiveTab }, 'Common.Views.Plugins': { 'plugin:select': function(guid, type, isRun, closePanel) { @@ -116,12 +117,15 @@ define([ this.autostart = []; this.customPluginsDlg = []; + this.newInstalledBackgroundPlugins = []; + Common.Gateway.on('init', this.loadConfig.bind(this)); Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this)); Common.NotificationCenter.on('uitheme:changed', this.updatePluginsButtons.bind(this)); Common.NotificationCenter.on('window:resize', this.updatePluginsButtons.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('doc:mode-changed', this.onChangeDocMode.bind(this)); + Common.NotificationCenter.on('modal:close', this.onModalClose.bind(this)); }, loadConfig: function(data) { @@ -776,9 +780,9 @@ define([ Common.NotificationCenter.trigger('frame:mousemove', { pageX: x*Common.Utils.zoom()+this._moveOffset.x, pageY: y*Common.Utils.zoom()+this._moveOffset.y }); }, - onPluginsInit: function(pluginsdata) { + onPluginsInit: function(pluginsdata, fromManager) { !(pluginsdata instanceof Array) && (pluginsdata = pluginsdata["pluginsData"]); - this.parsePlugins(pluginsdata, false, true) + this.parsePlugins(pluginsdata, false, true, fromManager); }, onPluginShowButton: function(id, toRight) { @@ -816,7 +820,8 @@ define([ }); }, - parsePlugins: function(pluginsdata, uiCustomize, forceUpdate) { + parsePlugins: function(pluginsdata, uiCustomize, forceUpdate, fromManager) { + this.newInstalledBackgroundPlugins.length = 0; var me = this; var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), isEdit = me.appOptions.isEdit && !me.isPDFEditor, @@ -916,6 +921,12 @@ define([ tab: item.tab ? {action: item.tab.id, caption: ((typeof item.tab.text == 'object') ? item.tab.text[lang] || item.tab.text['en'] : item.tab.text) || ''} : undefined }; updatedItem ? updatedItem.set(props) : arr.push(new Common.Models.Plugin(props)); + if (fromManager && !updatedItem && props.isBackgroundPlugin) { + me.newInstalledBackgroundPlugins.push({ + name: name, + guid: item.guid + }); + } } }); @@ -1259,7 +1270,50 @@ define([ if (!this.viewPlugins.customPluginPanels[frameId].openInsideMode(description, variation.url, frameId, guid)) this.api.asc_pluginButtonClick(-1, guid, frameId); - } + }, + + onModalClose: function () { + var plugins = this.newInstalledBackgroundPlugins; + if (plugins && plugins.length > 0) { + var text = plugins.length > 1 ? this.textPluginsSuccessfullyInstalled : + Common.Utils.String.format(this.textPluginSuccessfullyInstalled, plugins[0].name); + this.backgroundPluginsTip = new Common.UI.SynchronizeTip({ + extCls: 'colored', + placement: 'bottom', + target: this.viewPlugins.backgroundBtn.$el, + text: text, + showLink: true, + textLink: plugins.length > 1 ? this.textRunInstalledPlugins : this.textRunPlugin + }); + this.backgroundPluginsTip.on('dontshowclick', function() { + this.backgroundPluginsTip.close(); + this.backgroundPluginsTip = undefined; + this.newInstalledBackgroundPlugins.forEach(_.bind(function (item) { + this.api.asc_pluginRun(item.guid, 0, ''); + }, this)); + this.newInstalledBackgroundPlugins.length = 0; + }, this); + this.backgroundPluginsTip.on('closeclick', function () { + this.backgroundPluginsTip.close(); + this.backgroundPluginsTip = undefined; + this.newInstalledBackgroundPlugins.length = 0; + }, this); + this.backgroundPluginsTip.show(); + } + }, + + onActiveTab: function (tab) { + if (tab !== 'plugins' && this.backgroundPluginsTip) { + this.backgroundPluginsTip.close(); + this.backgroundPluginsTip = undefined; + this.newInstalledBackgroundPlugins.length = 0; + } + }, + + textRunPlugin: 'Run plugin', + textRunInstalledPlugins: 'Run installed plugins', + textPluginSuccessfullyInstalled: '{0} is successfully installed. You can access all background plugins here.', + textPluginsSuccessfullyInstalled: 'Plugins are successfully installed. You can access all background plugins here.' }, Common.Controllers.Plugins || {})); }); diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 8e39f57c32..b3edb679d7 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -1085,13 +1085,13 @@ section .field-styles { align-items: center; } .plugin-settings { - width: 20px; - height: 20px; - .margin-left-8(); .btn-toolbar.dropdown-toggle { min-width: 20px; } .btn-group { + width: 20px; + height: 20px; + .margin-left-8(); &:active, &.active { &:not(.disabled) .icon { background-position-x: @button-small-active-icon-offset-x !important; diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 1e6f6eb99b..3d15f86a09 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -85,6 +85,10 @@ "Common.Controllers.ReviewChanges.textUrl": "Paste a document URL", "Common.Controllers.ReviewChanges.textWidow": "Widow control", "Common.Controllers.ReviewChanges.textWord": "Word level", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area", diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 19badbd0f9..407e7f00fe 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -11,6 +11,10 @@ "Common.Controllers.ExternalOleEditor.textClose": "Close", "Common.Controllers.ExternalOleEditor.warningText": "The object is disabled because it is being edited by another user.", "Common.Controllers.ExternalOleEditor.warningTitle": "Warning", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area", diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 449e770e35..55e6d84beb 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -5,6 +5,10 @@ "Common.Controllers.Desktop.hintBtnHome": "Show Main window", "Common.Controllers.Desktop.itemCreateFromTemplate": "Create from template", "Common.Controllers.History.notcriticalErrorTitle": "Warning", + "Common.Controllers.Plugins.textRunPlugin": "Run plugin", + "Common.Controllers.Plugins.textRunInstalledPlugins": "Run installed plugins", + "Common.Controllers.Plugins.textPluginSuccessfullyInstalled": "{0} is successfully installed. You can access all background plugins here.", + "Common.Controllers.Plugins.textPluginsSuccessfullyInstalled": "Plugins are successfully installed. You can access all background plugins here.", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", "Common.define.chartData.textAreaStackedPer": "100% Stacked area",