{include file="$blogtemplate/header.template"}
<div id="content" class="narrowcolumn">
{assign var="postDate" value=$album->getTimestamp()}
<div class="blog">
 <h2><a href="{$url->parentAlbumLink($album)}">&lt;&lt;</a> {$album->getName()}</h2>
 <div class="post">
  <div class="entry">
     <p><a href="{$url->albumLink($album)}">
     {$locale->tr("resources")} ({$album->getNumResources()})
    </a> | {$locale->tr("created")} {$locale->formatDate($postDate,"%d %b, %Y")}<br/>
    {$album->getDescription()}</p>
  </div>
 </div>
 
 
{** 
    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 -->
   {assign var="counter" value=1}
  {assign var=children value=$album->getChildren()}
    {foreach from=$children item=childalbum}
<div class="post">
 <h2 class="date">{$childalbum->getName()}</h2>
  <div class="entry">
   <a href="{$url->albumLink($childalbum)}">
     {$locale->tr("resources")} ({$childalbum->getNumResources()})
    </a>
  </div>
{$childalbum->getDescription()|strip_tags|truncate:255:"..."|escape}
</div> 
{/foreach}


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

 <table style="border:0px;width:100%;" summary="Album Resources">
 <tr>
 {foreach from=$resources item=resource}
  <td style="width:25%;" align="center" >
  {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()}" style="border:0px;" src="{$url->resourcePreviewLink($resource)}" />
    <br/>{$resource->getFileName()}
   </a>
  {else}
   <a href="{$url->resourceLink($resource)}">
   {if $resource->isSound()}
    <img alt="Sound" src="{$url->getUrl("/imgs/sound.gif")}" height="64" width="64" style="border:0px;" />
   {elseif $resource->isVideo()}
    <img alt="Video" src="{$url->getUrl("/imgs/video.gif")}" height="64" width="64" style="border:0px;" />
   {elseif $resource->isZip()}
    <img alt="Zip" src="{$url->getUrl("/imgs/compressed.gif")}" height="64" width="64" style="border:0px;" />   
   {else}
    <img alt="File" src="{$url->getUrl("/imgs/file.gif")}" height="64" width="64" style="border:0px;" />    
   {/if}
   <br/>{$resource->getFileName()}
   </a>
  {/if}
  <br/>
  {assign var=metadata value=$resource->getMetadataReader()}
  {$metadata->getRoundedSize()}<br/>
  {if $resource->isImage()}
   {$metadata->getWidth()} x {$metadata->getHeight()}<br/>
  {elseif $resource->isSound()}
   {$metadata->getFormat()|upper} {$metadata->getSampleRate()} bps<br/>
  {elseif $resource->isVideo()}
   {$metadata->getFormat()|upper}
   {$metadata->getWidth()} x {$metadata->getHeight()}, 
   {$metadata->getLengthString()}<br/>
  {elseif $resource->isZip()}
   {$metadata->getTotalFiles()} {$locale->tr("files")}<br/>
  {/if}
  {assign var="counter" value="`$counter+1`"}
  </td>
  {if $counter%3 == 0}
   </tr>
   <tr>
  {/if}
 {/foreach}
 <td></td></tr>
</table>
<div>{pager style="links"}</div>
 <!-- end of album contents -->
 
 </div>
</div>
{include file="$blogtemplate/panel.template"}
{include file="$blogtemplate/footer.template"}

