• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7700 for generic doc work for TWiki-6.0.2. Use View topic Item7703 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.

My use case: create a custom view template with a customized list of attachments (pictures only, in fact). I want to achieve this without TWiki:Plugins/FileListPlugin.

This does not work: only the default attachment table is displayed, and writing TMPL:DEFs to override the defs in attachtables does not work. Attach.pm reads (hard-coded) template attachtables.

I have a solution that involves 2 changes:

1. Pass a template attribute to META
For instance:

%META{"attachments" template="%TEMPLATE%"}%

This would need 2 lines changed in Attach.pm:

@@ -81,12 +81,13 @@
     my $showAttr = $showAll ? 'h' : '';
        my $A = ( $showAttr ) ? ':A' : '';
     my $title = $attrs->{title} || '';
+       my $tmplname = $attrs->{template} || 'attachtables';
 
        my @attachments = $meta->find( 'FILEATTACHMENT' );
     return '' unless @attachments;
 
     my $templates = $this->{session}->{templates};
-    $templates->readTemplate('attachtables');
+    $templates->readTemplate($tmplname);
 
        my $rows = '';
     my $row = $templates->expandTemplate('ATTACH:files:row'.$A);

Actually it would be easy to implement the functionality of FileListPlugin by allowing to pass topic, web, filter and format parameters to %META{"attachments"}%. Plus the view permissions check of course. But we can save that for later, but it will be important for TWiki:Codev/ImproveAttachmentHandling.

2. Make sure that attachtables are in its own file
My wrong. I have put in attachtables:

%TMPL:INCLUDE{"attach"}%
and this now causes the complete attach template to get included in the view template. Changing back is a minor change, but translation files need to be updated as well.

#: twikiplugins/PatternSkin/templates/attach.pattern.tmpl:91
Would change to
#: twikiplugins/PatternSkin/templates/attachtables.pattern.tmpl:25

Because only the references to the string locations would change, all translations would still work. But I propose that I update those references on 28 Dec.

This may sound like a feature request, but it is important to have the underlaying template structure right.

AC

4.1.0 released

KJL

ItemTemplate
Summary Attachment table cannot be overridden in view template
ReportedBy TWiki:Main.ArthurClemens
Codebase

SVN Range TWiki-4.1, Thu, 14 Dec 2006, build 12269
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins 12293
TargetRelease minor
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2007-01-16 - 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