diff --git a/api/js/etemplate/et2_widget_tabs.js b/api/js/etemplate/et2_widget_tabs.js index 76e176df4b..eccfcd6a0a 100644 --- a/api/js/etemplate/et2_widget_tabs.js +++ b/api/js/etemplate/et2_widget_tabs.js @@ -21,7 +21,7 @@ * * @augments et2_valueWidget */ -var et2_tabbox = (function(){ "use strict"; return et2_valueWidget.extend([et2_IInput,et2_IResizeable], +var et2_tabbox = (function(){ "use strict"; return et2_valueWidget.extend([et2_IInput,et2_IResizeable,et2_IPrint], { attributes: { 'tabs': { @@ -451,7 +451,7 @@ var et2_tabbox = (function(){ "use strict"; return et2_valueWidget.extend([et2_I }, getDOMNode: function(_sender) { - if (_sender == this) + if (_sender === this || typeof _sender === 'undefined') { return this.container[0]; } @@ -518,6 +518,43 @@ var et2_tabbox = (function(){ "use strict"; return et2_valueWidget.extend([et2_I { this.set_height(this.tabContainer.height()); } + }, + + /** + * Set up for printing + * + * @return {undefined|Deferred} Return a jQuery Deferred object if not done setting up + * (waiting for data) + */ + beforePrint: function() + { + // Remove the "active" flag from all tabs-flags + jQuery(".et2_tabflag", this.flagContainer).removeClass("active"); + + // Remove height limit + this.tabContainer.css("height", ''); + + // Show all enabled tabs + for (var i = 0; i < this.tabData.length; i++) + { + var entry = this.tabData[i]; + if(entry.hidden) continue; + entry.flagDiv.insertBefore(entry.contentDiv); + entry.contentDiv.show(); + } + }, + + /** + * Reset after printing + */ + afterPrint: function() + { + for (var i = 0; i < this.tabData.length; i++) + { + var entry = this.tabData[i]; + entry.flagDiv.appendTo(this.flagContainer); + } + this.setActiveTab(this.get_active_tab()); } });}).call(this); et2_register_widget(et2_tabbox, ["tabbox"]); diff --git a/api/js/framework/fw_base.js b/api/js/framework/fw_base.js index e48d4f5bbc..38f4ea6e09 100644 --- a/api/js/framework/fw_base.js +++ b/api/js/framework/fw_base.js @@ -1090,13 +1090,15 @@ var fw_base = (function(){ "use strict"; return Class.extend( }, /** - * Print function prints the active window + * Print function prints the active window, or the provided window */ - print: function() + print: function(_window) { - if (this.activeApp && this.activeApp.appName != 'manual') + if (_window || this.activeApp && this.activeApp.appName != 'manual') { - var appWindow = this.egw_appWindow(this.activeApp.appName); + var appWindow = _window || this.egw_appWindow(this.activeApp.appName); + var content = (_window && appWindow === _window) ? + _window.document : this.activeApp.tab.contentDiv; if (appWindow) { appWindow.focus(); @@ -1104,8 +1106,8 @@ var fw_base = (function(){ "use strict"; return Class.extend( // et2 available, let its widgets prepare var deferred = []; var et2_list = []; - jQuery('.et2_container',this.activeApp.tab.contentDiv).each(function() { - var et2 = etemplate2.getById(this.id); + jQuery('.et2_container',content).each(function() { + var et2 = appWindow.etemplate2.getById(this.id); if(et2 && jQuery(et2.DOMContainer).filter(':visible').length) { deferred = deferred.concat(et2.print()); @@ -1124,12 +1126,12 @@ var fw_base = (function(){ "use strict"; return Class.extend( egw.loading_prompt(app.appName,true,egw.lang('please wait...'),app.browser.baseDiv, egwIsMobile()?'horizental':'spinner'); // Give framework a chance to deal, then reset the etemplates - window.setTimeout(function() { + appWindow.setTimeout(function() { for(var i = 0; i < et2_list.length; i++) { et2_list[i].widgetContainer.iterateOver(function(_widget) { _widget.afterPrint(); - },et2_list[i],et2_IPrint); + },et2_list[i],appWindow.et2_IPrint); } egw.loading_prompt(app.appName,false); },100); diff --git a/api/templates/default/etemplate2.css b/api/templates/default/etemplate2.css index ec0cc1993c..61209e4e2b 100644 --- a/api/templates/default/etemplate2.css +++ b/api/templates/default/etemplate2.css @@ -1833,6 +1833,15 @@ ul[id$='favorites_popup_state'] span.filter_value { height: auto !important; width: auto !important; } + /** Show tab labels full width, with a little extra space */ + .et2_tabbox .et2_tabflag { + width: 100%; + padding-top: 1em; + margin-bottom: 0.5em; + } + .et2_tabs { + overflow: visible; + } } /** * Grid / nextmatch Hierarchy