diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index ba115f40d0..b17280eab3 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -162,6 +162,8 @@ define([ this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this)); this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this)); + this.api.asc_registerCallback('asc_onPluginShowButton', _.bind(this.onPluginShowButton, this)); + this.api.asc_registerCallback('asc_onPluginHideButton', _.bind(this.onPluginHideButton, this)); this.loadPlugins(); } @@ -381,6 +383,7 @@ define([ buttons: isCustomWindow ? undefined : newBtns, toolcallback: _.bind(this.onToolClose, this), help: !!help, + loader: plugin.get_Loader(), modal: isModal!==undefined ? isModal : true }); me.pluginDlg.on({ @@ -399,6 +402,9 @@ define([ }, 'help': function(){ help && window.open(help, '_blank'); + }, + 'header:click': function(type){ + me.api.asc_pluginButtonClick(type); } }); @@ -458,6 +464,14 @@ define([ this.parsePlugins(pluginsdata) }, + onPluginShowButton: function(id) { + this.pluginDlg && this.pluginDlg.showButton(id); + }, + + onPluginHideButton: function(id) { + this.pluginDlg && this.pluginDlg.hideButton(id); + }, + runAutoStartPlugins: function() { if (this.autostart && this.autostart.length > 0) { this.api.asc_pluginRun(this.autostart.shift(), 0, ''); diff --git a/apps/common/main/lib/view/PluginDlg.js b/apps/common/main/lib/view/PluginDlg.js index 81a5e0ce55..3fc614de03 100644 --- a/apps/common/main/lib/view/PluginDlg.js +++ b/apps/common/main/lib/view/PluginDlg.js @@ -77,6 +77,7 @@ define([ _options.tpl = _.template(this.template)(_options); this.url = options.url || ''; + this.loader = (options.loader!==undefined) ? options.loader : true; this.frameId = options.frameId || 'plugin_iframe'; Common.UI.Window.prototype.initialize.call(this, _options); }, @@ -90,6 +91,8 @@ define([ if (!this.options.header) this._headerFooterHeight -= 34; this._headerFooterHeight += ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width')))); + this.$window.find('.header').prepend($('
')); + var iframe = document.createElement("iframe"); iframe.id = this.frameId; iframe.name = 'pluginFrameEditor'; @@ -102,13 +105,15 @@ define([ iframe.onload = _.bind(this._onLoad,this); var me = this; - setTimeout(function(){ - if (me.isLoaded) return; - me.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')}); - me.loadMask.setTitle(me.textLoading); - me.loadMask.show(); - if (me.isLoaded) me.loadMask.hide(); - }, 500); + if (this.loader) { + setTimeout(function(){ + if (me.isLoaded) return; + me.loadMask = new Common.UI.LoadMask({owner: $('#id-plugin-placeholder')}); + me.loadMask.setTitle(me.textLoading); + me.loadMask.show(); + if (me.isLoaded) me.loadMask.hide(); + }, 500); + } iframe.src = this.url; $('#id-plugin-placeholder').append(iframe); @@ -180,6 +185,32 @@ define([ } }, + showButton: function(id) { + var header = this.$window.find('.header .tools.left'); + if (id=='back') { + var btn = header.find('#id-plugindlg-' + id); + if (btn.length<1) { + btn = $('