Skip to content

Commit

Permalink
Item10357: only emit inline css when there's a foswikiTable on the cu…
Browse files Browse the repository at this point in the history
…rrent page

git-svn-id: http://svn.foswiki.org/branches/Release01x01@10711 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Feb 17, 2011
1 parent e5249d9 commit c4a2cb9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion TablePlugin/data/System/TablePlugin.txt
Expand Up @@ -173,11 +173,12 @@ Sort icons in the header are read from System.DocumentGraphics.
---++ Plugin Info

%TABLE{columnwidths="10%,90%"}%
| Copyright: | Copyright (C) 2001-2008 TWiki:Main/JohnTalintyre, Peter Thoeny, peter@thoeny.org and TWiki Contributors; © 2008-2010 Foswiki Contributors |
| Copyright: | Copyright (C) 2001-2008 TWiki:Main/JohnTalintyre, Peter Thoeny, peter@thoeny.org and TWiki Contributors; © 2008-2011 Foswiki Contributors |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- specify latest version first -->&nbsp; |
| 16 Feb 2011 | 1.127: Michael Daum: Foswikitask:Item10357: only emit inline css when there's a foswikiTable on the current page |
| 18 Aug 2010 | 1.126: Paul harvey: Foswikitask:Item9415: minor documentation changes |
| 09 Aug 2010 | 1.125: Crawford Currie: Foswikitask:Item8303: fixed sorting with multiple headers |
| 31 Jul 2010 | 1.124: Arthur Clemens: Added attribute =inlinemarkup= to optionally add HTML markup for better copy/pasting. |
Expand Down
4 changes: 2 additions & 2 deletions TablePlugin/lib/Foswiki/Plugins/TablePlugin.pm
Expand Up @@ -9,7 +9,7 @@ use strict;
use warnings;

our $VERSION = '$Rev$';
our $RELEASE = '1.126';
our $RELEASE = '1.127';
our $SHORTDESCRIPTION =
'Control attributes of tables and sorting of table columns';
our $NO_PREFS_IN_TOPIC = 1;
Expand Down Expand Up @@ -208,7 +208,7 @@ sub debugData {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2011 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down
12 changes: 11 additions & 1 deletion TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
Expand Up @@ -18,6 +18,7 @@ my $defaultAttrs; # to write generic table CSS
my $tableSpecificAttrs; # to write table specific table CSS
my $combinedTableAttrs; # default and specific table attributes
my $styles = {}; # hash of default and specific styles
my $doneDefaults = 0;

# not yet refactored:
my $tableCount;
Expand Down Expand Up @@ -119,6 +120,7 @@ $TABLE_FRAME->{border} = 'border-style:solid';

BEGIN {
$translationToken = "\0";
$doneDefaults = 0;

# the maximum number of columns we will handle
$MAX_SORT_COLS = 10000;
Expand All @@ -142,6 +144,12 @@ sub _initDefaults {
%{Foswiki::Plugins::TablePlugin::pluginAttributes} );

$combinedTableAttrs = _mergeHashes( {}, $defaultAttrs );
}

sub _addDefaultStyles {

return if $doneDefaults;
$doneDefaults = 1;

# create CSS styles tables in general
my ( $id, @styles ) = _createCssStyles( 1, $defaultAttrs );
Expand Down Expand Up @@ -1310,6 +1318,8 @@ sub addDefaultSizeUnit {

sub emitTable {

_addDefaultStyles();

_debug('emitTable');

#Validate headerrows/footerrows and modify if out of range
Expand Down Expand Up @@ -1875,7 +1885,7 @@ sub _debugData {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2011 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down

0 comments on commit c4a2cb9

Please sign in to comment.