<a href="{$config.url}admin/galleries/edit/{$link[2]}"><h2 class="cufon">Files in category: {$gt}</h2></a>

{if $link[3] == 'del'}

	<form action="" method="POST">
		<input type="checkbox" name="confirm"> &nbsp; Remove this...<br><br>
		<input type="hidden" name="action" value="del" />
		<input type="submit" value="Remove" />
	</form>

{elseif $link[3] == 'edit'}    
    
        <form id="file" action="{$config.url}admin/files/{$link[2]}/edit/{$link[4]}" method="POST" enctype="multipart/form-data">
		<input type="hidden" name="action" value="edit" />                
		File description<br><input style="width: 300px;" type="text" class="poletxt" name="filetitle" value="{$smarty.post.filetitle}" />
                <br><br><input type="submit" value="Zapisz" />
	</form><br>
    
{else}

	<form id="file" action="{$config.url}admin/files/{$link[2]}/add" method="POST" enctype="multipart/form-data">
		<input type="hidden" name="action" value="add" />                
		New file description: <input style="width: 300px;" type="text" class="poletxt" name="filetitle" value="{$smarty.post.filetitle}" />
                <input onChange="$('#file').submit();" type="file" name="file" />
	</form><br>
	
	{if $list}

                <table class="t1">			
                <tr>
                        <th>No</th>
                        <th>File description</th>
                        <th>Type</th>
                        <th>Options</th>
                </tr>

                {assign var='i' value=1}
                {foreach from=$list key=k item=v}

                        <tr>
                                <td style="text-align: center;">
                                        {$i}
                                </td><td>
                                        <a href="{$config.url}getfile/{$v.id}" title="Download the file">
                                                {$v.filetitle}
                                        </a>
                                </td><td style="text-align: center;">
                                        {$v.ext}
                                </td>
                                <td style="text-align: center;">
                                        <a href="{$config.url}admin/files/{$link.2}/edit/{$k}" title="edit"><img src="{$config.templateImagesDir}admin/edit.png" alt="edit" /></a>                                        
                                        <a href="{$config.url}admin/files/{$link.2}/del/{$k}" title="remove"><img src="{$config.templateImagesDir}admin/remove.png" alt="remove" /></a>
                                        {if $v.prev}
                                                <a href="{$config.url}admin/files/{$link.2}/swap/{$v.order}/{$v.prev}" title="up"><img src="{$config.templateImagesDir}admin/up.png" alt="up" /></a>
                                        {/if}
                                        {if $v.next}
                                                <a href="{$config.url}admin/files/{$link.2}/swap/{$v.order}/{$v.next}" title="down"><img src="{$config.templateImagesDir}admin/down.png" alt="down" /></a>
                                        {/if}				
                                </td>
                        </tr>
                        {assign var='i' value=$i+1}

                {/foreach}

                </table>            
            
	{else}
	
		No files.<br>
	
	{/if}
	
{/if}