<h3>Forumas: {$topic.title} ({$topic.count})</h3>
<br>
<table>
{foreach from=$posts item="post"}
{_forum->countClientPosts client_id=$post.author_id assign="count"}
<tr>
<td><b>{$post.title}</b> Messages: {$count}</td>
{if $permissions.delete}
<td align="right"><a href="/?cid={$data.page.item_id}&action=forum1.del_post&post_del_id={$post.id}&topic_id={$topic.id}&post_id={$post_id}">Istrinti</a></td>
{elseif $permissions.edit}
<td align="right"><a href="/?cid={$data.page.item_id}&action=forum1.edit_post&post_edit_id={$post.id}&topic_id={$topic.id}&post_id={$post_id}">Redaguoti</a></td>
{/if}
{if $client_id && $client_id==$post.author_id}
<td align="right"><a href="/?cid={$data.page.item_id}&action=forum1.del_post&post_del_id={$post.id}&topic_id={$topic.id}&post_id={$post_id}">Istrinti</a></td>
{elseif $client_id && $client_id==$post.author_id}
<td align="right"><a href="/?cid={$data.page.item_id}&action=forum1.edit_post&post_edit_id={$post.id}&topic_id={$topic.id}&post_id={$post_id}">Redaguoti</a></td>
{/if}
</tr>
<tr>
<td colspan="2">{$post.post}</td>
</tr>
{/foreach}
</table>
{if $can_post}
{if $smarty.get.post_edit_id}
{foreach from=$posts item="post"}
{if $post.id == $smarty.get.post_edit_id}
{assign var=editinamas value=$post}
{/if}
{/foreach}
{/if}
<table>
<form method="post" action="/?cid={$data.page.item_id}&topic_id={$topic_id}">
<input type="hidden" name="action" value="{if $smarty.get.post_edit_id}forum1.edit_post{else}forum1.add_post{/if}">
<input type="hidden" name="post_id" value="{$post_id}">
{if $smarty.get.post_edit_id}
<input type="hidden" name="post_edit_id" value="{$smarty.get.post_edit_id}">
{/if}
<tr>
<td>Pavadinimas</td>
<td><input type=text name="message_title" value="{$editinamas.title}"></td>
</tr>
{if !$client_id}
<tr>
<td>Autoriaus vardas</td>
<td><input type=text name="author_name"></td>
</tr>
<tr>
<td>Autoriaus e-mail</td>
<td><input type=text name="author_mail"></td>
</tr>
{/if}
<tr>
<td>Tekstas</td>
<td><textarea name="message_text"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Gerai"></td>
</tr>
</form>
</table>
{/if}
<br>
<h4><a href="/?cid={$data.page.item_id}&topic_id={$topic_id}">Atgal i sarasa</a></h4>