Item11063: Fix attachments table
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: NatSkin
Branches:
Although I understand the deprecated
%ATTACHMENTS%
tag will live again in a yet-to-be-released, there are easier short-term work-arounds then requiring users to use an older version of
DBCachePlugin. Specifically, just substitute a different mechanism to generate the attachments table.
I needed this for a site I was upgrading and found that it worked pretty well just substituting the ATTACHMENTS tag with ATTACHMENTLIST (from
AttachmentListPlugin) in
view.nat.tmpl
. See revised code below. It's not a complete substitute (it lacks the display of past attachment versions), but it's better than the default attachment table.
%TMPL:DEF{"attachments"}%%TMPL:P{context="AttachmentListPluginEnabled" then="attachments::attachmentlist" else="attachments::default"}%%TMPL:END%
%TMPL:DEF{"attachments::default"}%%META{"attachments"}%%TMPL:END%
%TMPL:DEF{"attachments::attachmentlist"}%<!-- attachments::attachmentlist -->%ATTACHMENTLIST{
hidenull="on"
hide="on"
header="<div class='foswikiFormSteps natTopicAttachments' id='natTopicAttachments'>
<a class='natTopicAction natAttachTopicAction' title='%MAKETEXT{"Manage existing attachments"}%' href='%SCRIPTURLPATH{"attach"}%/%WEB%/%TOPIC%?tab=2' rel='nofollow'>
<span>Attach</span>
</a>
$percntTWISTY{
mode=\"div\"
start=\"show\"
remember=\"off\"
prefix=\"<h2>\"
suffix=\"</h2>\"
link=\"%MAKETEXT{"Attachments"}% \"
showimg=\"%TMPL:P{"iconpath:toggle"}%\"
hideimg=\"%TMPL:P{"iconpath:toggleopen"}%\"
}$percnt"
format="<div class='foswikiFormStep'>
<table cellspacing='0' cellpadding='0'>
<tr>
<td class='natAttachmentIcon'>$fileIcon</td>
<td class='natAttachmentInfo'>
<div class='natAttachmentName'><a href='$fileUrl' class=\"jqImageTooltip { web:'%WEB%', topic:'%TOPIC%', image:'$fileName' }\">$fileName</a> ($fileSize)</div>
<div class='natAttachmentComment'><noautolink>$fileComment</noautolink></div>
%MAKETEXT{"Uploaded by [_1] on [_2]" args="$fileUser,$fileDate"}%
</td>
</tr>
</table>
</div>"
footer="$percntENDTWISTY$percnt </div>"
}%<!-- //attachments::attachmentlist -->%TMPL:END%
--
LynnwoodBrown - 24 Aug 2011
No more action required given the current landscape of plugins.
--
MichaelDaum - 24 May 2013