Bug: The attchements table in view is not good
After I've uploaded some files I noticed that the table in which the attachments are shown, is not properly rendered/filled.
- The action column only shows the word "Action"
- see the attached screenprint to see what I mean
- the url is using the attach script, but without the script suffix as set in wikicfg (attach.pm needs patch, see below)
- The filename url is using the viewfile script, but again without the script suffix as set in wikicfg (attach.pm needs patch, see below)
Test case
- Set the scriptsuffix to ".pl"
Environment
| TWiki version: |
Beta Aug 3 2001 |
| TWiki plugins: |
as distributed |
| Server OS: |
NT 4 SP6 |
| Web server: |
Apache |
| Perl version: |
5.6.1 |
| Client OS: |
NT 4 SP6 |
| Web Browser: |
IE 5 |
--
HansDonner - 12 Aug 2001
Investigation
Rendering
I did some browsing on the CVS tree. The rendering issue (only "action" is shown) seems to be connected to the moving of attachtable.tmpl into the attach.pm code. (file removed Jul 18th 2001)
In attach.pm v1.2 the format table shows up first, with the different rendering!
Solution?
Incorrect URL's
Regarding the viewfile, I've patched the following sub in attach.pm (note that i've added
nop to the variables).
sub formatAttachments
{
my ( $theWeb, $theTopic, $showAttr, %attachment ) = @_;
my $row = "";
my ( $file, $attrVersion, $attrPath, $attrSize, $attrDate, $attrUser, $attrComment, $attrAttr ) =
TWiki::Attach::extractFileAttachmentArgs( %attachment );
$attachmentCount++;
if ( ! $attrAttr || ( $showAttr && $attrAttr =~ /^[$showAttr]*$/ ) ) {
$viewableAttachmentCount++;
my $fileIcon = TWiki::Attach::filenameToIcon( $file );
$attrComment = $attrComment || " ";
# HD fix - %<nop>SCRIPTSUFFIX% was missing
$row .= "| $fileIcon <a href=\"%<nop>SCRIPTURLPATH%/viewfile%<nop>SCRIPTSUFFIX%/$theWeb/$theTopic?rev=$attrVersion&filename=$file\">$file</a> \\\n";
# HD fix - %<nop>SCRIPTSUFFIX% is missing
$row .= " | <a href=\"%<nop>SCRIPTURL%/attach%<nop>SCRIPTSUFFIX%/$theWeb/$theTopic?filename=$file&revInfo=1\">action</a> \\\n";
$row .= " | $attrSize | $attrDate | $attrUser | $attrComment |";
if ( $showAttr ) {
$attrAttr = $attrAttr || " ";
$row .= " $attrAttr |";
}
$row .= "\n";
} else {
$noviewableAttachmentCount++;
}
return $row;
}
--
HansDonner - 19 Aug 2001
It is correct behaviour to only show action.
Thanks for pointing out the lack of SCRITPTSUFFIX, that's been added to CVS now.
--
JohnTalintyre - 23 Aug 2001
Is it also correct that the table is hardcoded instead of rendered using a template?
--
HansDonner - 31 Aug 2001
There was some discussion about this and we decided for hard coding for now. As it is the TWiki table formatting is used, the formatting of which is also hard coded. If there's demand than templating this would make sense.
--
JohnTalintyre - 03 Sep 2001