diff --git a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm index 4d008da941..908705cc86 100644 --- a/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm +++ b/TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm @@ -278,6 +278,13 @@ sub _parseAttributes { if $inParams->{initdirection} =~ /^up$/i; } + # Don't allow sort requests when rendering for static use. + # Force sort=off but allow initsort / initdirection + my $context = Foswiki::Func::getContext(); + if ( $context->{static} ) { + delete $inCollection->{sortAllTables}; + } + # If EditTablePlugin is installed and we are editing a table, # the CGI parameter 'sort' is defined as "off" to disable all # header sorting ((Item5135) diff --git a/TablePlugin/test/unit/TablePlugin/TablePluginTests.pm b/TablePlugin/test/unit/TablePlugin/TablePluginTests.pm index bd1bf71de9..808d93e991 100755 --- a/TablePlugin/test/unit/TablePlugin/TablePluginTests.pm +++ b/TablePlugin/test/unit/TablePlugin/TablePluginTests.pm @@ -1008,6 +1008,68 @@ EXPECTED $this->do_test( $expected, $actual ); } +=pod + +Item12233: Rendering for static targets (like PDF) should honor initial sort, but never generate sort links.. + +=cut + +sub test_sort_static_context { + my $this = shift; + + my $cgi = $this->{request}; + my $url = $cgi->url( -absolute => 1 ); + my $pubUrlSystemWeb = Foswiki::Func::getPubUrlPath() . '/System'; + $this->{session}->enterContext('static'); + + my $actual = < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title Date Size Span date
ABC 26 May 2007 - 22:36
def 07 Feb 2006 - 13:23
GHI 26 Jul 2007 - 13:23
jkl 16 Sep 2008 - 09:48
+EXPECTED + + $this->do_test( $expected, $actual ); +} + sub test_sort_off { my $this = shift;