{assign var="postPageTitle" value=" - Gallery"}
{include file="$blogtemplate/header.template"}
<div id="content" class="narrowcolumn">
{assign var="postDate" value=$album->getTimestamp()}
<div class="blog">
<h2>{$album->getName()}</h2>
<div class="post">
<div class="entry">
<a href="{$url->albumLink($album)}">
{$locale->tr("resources")} ({$album->getNumResources()})
</a> | {$locale->tr("created")} {$locale->formatDate($postDate,"%d %b, %Y")}
</div>
</div>
<p>{$album->getDescription()}</p><br/>

{**
smarty template gets a bit complicated here since we want to show the contents of the album in a nicely
arranged table, and that needs some very basic maths... we also need to check after every iteration
wether we have to close the current row or start a new one, and so on...
**}

<!-- album contents go here -->


<div class="album">
	<a href="{$url->parentAlbumLink($album)}">
  	<img src="{$url->getUrl("/imgs/folder.gif")}" alt="{$locale->tr("parent")}" /></a>
  	<p>{$locale->tr("parent")}</p>
</div>

{if $pager->getCurrentPage() == 1}
	{assign var="counter" value=1}
 	{assign var=children value=$album->getChildren()}
 	{foreach from=$children item=childalbum}
	<div class="album">
 	<a href="{$url->albumLink($childalbum)}">
 	<img src="{$url->getUrl("/imgs/folder.gif")}" alt="{$childalbum->getName()}" /></a>
 	<p>{$childalbum->getName()} ({$childalbum->getNumResources()})</p>
 		{assign var="counter" value="`$counter+1`"}
 		{if $counter%3 == 0}
 		{/if}
	</div>
 	{/foreach}
{/if}


<!--- show the resources here -->


{foreach from=$resources item=resource}
	<div class="album">
  		{if $resource->hasPreview()}
  		{*<a target="_blank" href="resserver.php?blogId={$blog->getId()}&amp;resource={$resource->getFileName()}">*}
  	<a href="{$url->resourceLink($resource)}">
   	<img alt="{$resource->getDescription()}" src="{$url->resourcePreviewLink($resource)}" /></a>
   	<p>{$resource->getFileName()}</p>
  		{else}
  	<a href="{$url->resourceLink($resource)}">
  		{if $resource->isSound()}
   	<img alt="Sound" src="{$url->getUrl("/imgs/sound.gif")}" /></a>
  		{elseif $resource->isVideo()}
   	<img alt="Video" src="{$url->getUrl("/imgs/video.gif")}" /></a>
  		{elseif $resource->isZip()}
   	<img alt="Zip" src="{$url->getUrl("/imgs/compressed.gif")}" /></a>
  		{else}
  	<img alt="File" src="{$url->getUrl("/imgs/file.gif")}" /></a>
  		{/if}  
  	<p>{$resource->getFileName()}</p>
  		{/if}
  		{assign var=metadata value=$resource->getMetadataReader()}
 	<p>{$metadata->getRoundedSize()}</p>
  		{if $resource->isImage()}
 	<p>{$metadata->getWidth()} x {$metadata->getHeight()}</p>
  		{elseif $resource->isSound()}
 	<p>{$metadata->getFormat()|upper} {$metadata->getSampleRate()} bps</p>
  		{elseif $resource->isVideo()}
 	<p>{$metadata->getFormat()|upper} {$metadata->getWidth()} x {$metadata->getHeight()}, {$metadata->getLengthString()}</p>
  		{elseif $resource->isZip()}
  	<p>{$metadata->getTotalFiles()} {$locale->tr("files")}</p>
  		{/if}
  		{assign var="counter" value="`$counter+1`"}
  		{if $counter%3 == 0}
  		{/if}
 	</div>
{/foreach}
<div style="clear:both">&nbsp;</div>

{pager style="links"}  

<!-- end of album contents -->

</div>
</div>
{include file="$blogtemplate/footer.template"}