• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

The attachment table rendering code assumes the order of attachments in the meta-data. But AFAICT that order is random with the change to the indexing scheme in meta. As a result attachments are rendered in no particular order. Because Cairo always added to the end of the attachment table, the order should be increasing date (most recent at bottom).

Index: lib/TWiki/Attach.pm
===================================================================
--- lib/TWiki/Attach.pm     (revision 8890)
+++ lib/TWiki/Attach.pm     (working copy)
@@ -79,7 +79,7 @@

     my $showAll = $attrs->{all};
     my $showAttr = $showAll ? 'h' : '';
-       my $a = ( $showAttr ) ? ':A' : '';
+       my $at = ( $showAttr ) ? ':A' : '';
     my $title = $attrs->{title} || '';

        my @attachments = $meta->find( 'FILEATTACHMENT' );
@@ -89,8 +89,8 @@
     $templates->readTemplate('attachtables');

        my $rows = '';
-    my $row = $templates->expandTemplate('ATTACH:files:row'.$a);
-    foreach my $attachment ( @attachments ) {
+    my $row = $templates->expandTemplate('ATTACH:files:row'.$at);
+    foreach my $attachment ( sort { $a->{date} <=> $b->{date} } @attachments ) {
         my $attrAttr = $attachment->{attr};

         if( ! $attrAttr || ( $showAttr && $attrAttr =~ /^[$showAttr]*$/ )) {
@@ -101,8 +101,8 @@
     my $text = '';

     if( $showAll || $rows ne '' ) {
-        my $header = $templates->expandTemplate('ATTACH:files:header'.$a);
-        my $footer = $templates->expandTemplate('ATTACH:files:footer'.$a);
+        my $header = $templates->expandTemplate('ATTACH:files:header'.$at);
+        my $footer = $templates->expandTemplate('ATTACH:files:footer'.$at);

         $text = $header.$rows.$footer;
     }
fixes it.

SVN 8967 (already merged to TWiki4)

CC

SVN 9012 is also noted on this item, but is not merged to TWiki4 (perl 5.6 stuff + meta.pm sorting). Any reason?

-- SP

All the required merges are complete.

CC

Closed with the release of 4.0.2

KJL

ItemTemplate
Summary Attachment sort order is cockeyed
ReportedBy TWiki:Main.CrawfordCurrie
Codebase

SVN Range Sun, 26 Feb 2006 build 8945
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins 8966 8967 8968 9007 9012
TargetRelease patch
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2006-04-01 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback