<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>David Simpson &#187; user macro</title>
	<atom:link href="http://davidsimpson.me/tag/user-macro/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidsimpson.me</link>
	<description>Developing the web, one page at a time.</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:02:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>A simpler way to view attachments in Confluence</title>
		<link>http://davidsimpson.me/2009/10/16/a-simpler-way-to-view-attachments-in-confluence/</link>
		<comments>http://davidsimpson.me/2009/10/16/a-simpler-way-to-view-attachments-in-confluence/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 14:37:14 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorised]]></category>
		<category><![CDATA[confluence]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[user macro]]></category>

		<guid isPermaLink="false">http://davidsimpson.me/?p=367</guid>
		<description><![CDATA[&#8230;or how to display attachments in an unordered list. Something that bugs me in Confluence is the way that attachments are shown. The default view is a big table with just about all the information related to each attachment. This is great if you want all this detail, but I&#8217;m a simple soul with simple [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton367" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fdavidsimpson.me%2F2009%2F10%2F16%2Fa-simpler-way-to-view-attachments-in-confluence%2F&amp;text=A%20simpler%20way%20to%20view%20attachments%20in%20Confluence&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fdavidsimpson.me%2F2009%2F10%2F16%2Fa-simpler-way-to-view-attachments-in-confluence%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://davidsimpson.me/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;"></a></div><p>&#8230;or how to display attachments in an unordered list.</p>
<p>Something that bugs me in <a href="http://www.atlassian.com/software/confluence/">Confluence</a> is the way that attachments are shown.  The default view is a big table with just about all the information related to each attachment.</p>
<p>This is great if you want all this detail, but I&#8217;m a simple soul with simple needs.</p>
<p><a href="http://www.sensible.com/buythebook.html">Krug suggested</a> &#8220;Omit <span style="text-decoration: line-through;">needless</span> words&#8221;.  In this case, it&#8217;s more of &#8220;Omit <span style="text-decoration: line-through;">needless</span> metadata&#8221;.</p>
<h3>Less is more</h3>
<p>Enter {list-attachments} &#8211; a user macro that dispenses with the excess.  It displays an unordered list with the filename, file size and last modified date.  If there&#8217;s a comment for the attachment, this is displayed in the link text rather than the filename.</p>
<p>This is a really straightforward view of the attachments on the page.<br />
<span id="more-367"></span></p>
<h3>How do I install {list-attachments} ?</h3>
<p>It&#8217;s pretty easy.  As a Confluence administrator, go to <strong>Confluence Admin | User Macros</strong> and click on <strong>Create a User Macro</strong>.</p>
<p>Macro name: <strong>list-attachments</strong></p>
<p>Template:</p>
<pre class="brush: plain; title: ;">
## MACRO: list-attachments
## Updated: 2011-03-15
## View page attachments in a simple list
## USAGE: {list-attachments}

##applyDecorator(&quot;page&quot;)
	#set ($attachmentsList = $content.getLatestVersionsOfAttachments())
    ##&lt;div class=&quot;listAttachmentsDiv&quot;&gt;
        #if ($attachmentsList.size() &gt; 0)
			&lt;ul&gt;
		        #foreach( $attachment in $attachmentsList )
			        #set ($currentAttachmentId = $attachment.id)
					#if ($attachment.comment &amp;&amp; $attachment.comment.trim().length() &gt; 0)
						## Display the comment as the link text instead of the filename
						&lt;li&gt;&lt;a href=&quot;$generalUtil.htmlEncode(&quot;${req.contextPath}${attachment.downloadPathWithoutVersion}&quot;)&quot;&gt;$generalUtil.htmlEncode($attachment.comment)&lt;/a&gt;&lt;/li&gt;
					#else
						## Display the filename as the link text
						&lt;li&gt;&lt;a href=&quot;$generalUtil.htmlEncode(&quot;${req.contextPath}${attachment.downloadPathWithoutVersion}&quot;)&quot;&gt;$generalUtil.htmlEncode($attachment.fileName)&lt;/a&gt;&lt;/li&gt;
					#end
			    #end
			&lt;/ul&gt;
		#end
	##&lt;/div&gt;
##end
</pre>
<p>Accept the defaults for the other fields, then click on <strong>Save</strong></p>
<p>To call the macro in the page type: <strong>{list-attachments}</strong></p>
<p>The result:<br />
<img src="/wp-content/uploads/2009/10/list-attachments-example1.png" alt="" title="list-attachments-example" /></p>
<p>Now you&#8217;re left with a simple list of links &mdash; much purer than a big fat table of metadata.</p>
<h3>For extra points (Updated 2011-03-15)</h3>
<p>If you&#8217;ve got a might great slab of files attached to the Confluence page,  why not wrap this usermacro in the <a href="https://plugins.atlassian.com/plugin/details/31712">azList macro</a>:</p>
<pre>{azlist}{list-attachments}{azlist}</pre>
<p>The result:<br />
<img src="/wp-content/uploads/2009/10/list-attachments-extra-points.png" alt="" title="list-attachments-extra-points" /></p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://davidsimpson.me/2009/10/16/a-simpler-way-to-view-attachments-in-confluence/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

