{include file="$incpath/forums/user_panel_forums.tpl"}
<div class="box_innerhead"><strong>{$top_title|default:$smarty.request.top_title|koobispecialchars}</strong></div>
<div>
{include file="$incpath/forums/tree.tpl"} 
</div>

{if count($errors)}
<div class="error_box">
    <ul>
    {foreach from=$errors item=error}
        <li>{$error}</li>
    {/foreach}
    </ul>
</div>
{/if}
{if $smarty.request.preview==1}

<table width="100%" border="0" cellpadding="4" cellspacing="1" class="forum_tableborder">
<tr>
  <td class="forum_header">{#Forums_postpreview#}</td>
</tr>
<tr>
<td class="forum_post_first">{$preview_text}
</td>
</tr>
</table>
<br />
{/if}


<script language="javascript" src="{$jspath}/jvalidate.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!-- //
{include file="$incpath/other/validate_conf.tpl"}
$(document).ready(function() {ldelim}
	var validator = $("#f").validate(
	{ldelim}
		rules: 
		{ldelim}
		{if $smarty.request.p=="newtopic" || $smarty.request.p=="addtopic" || ($smarty.request.p=="newpost" && $smarty.request.action=="edit")}
			topic: {ldelim}required: true{rdelim},
		{/if}
			text: {ldelim}required: true,maxLength:{$maxlength_post|default:$smarty.post.maxl|koobispecialchars}{rdelim}
		},
		messages: 
		{ldelim}
			//scode: {ldelim}remote:'{#Validate_wrong#}'{rdelim}
		{rdelim},
			
		submitHandler: function() 
		{ldelim}
			document.forms['f'].submit();
		{rdelim},
		
		success: function(label) 
		{ldelim}
			label.html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;").addClass("checked");
		{rdelim}
	});
});


function beitrag(theform) {ldelim}
	var postmaxchars = {$maxlength_post|default:$smarty.post.maxl|koobispecialchars};
	if (postmaxchars != 0) message = " {#Forums_max_Forums_post_length_t#} "+postmaxchars+"";
	else message = "";
	alert("{#Forums_post_length_t#} "+theform.text.value.length+" "+message);
{rdelim}
//-->
</script>
<script language="JavaScript" type="text/javascript">
{include file="$incpath/other/koobicode.js"}
</script>

<form action="{$action}" enctype="multipart/form-data" method="post" name="f" id="f">
	<input type="hidden" name="maxl" value="{$maxlength_post|default:$smarty.post.maxl|koobispecialchars}" />
    <input type="hidden" name="forum_id" value="{$forum_id}" />
    <input type="hidden" name="toid" value="{$topic_id}" />
	<input type="hidden" name="top_title" value="{$top_title|default:$smarty.request.top_title}" />
    <input name="s" type="hidden" id="s" value="{$smarty.request.s}" />
	
    {$topicform}
    {$threadform}
	<input name="f_id" type="hidden" id="f_id" value="{$f_id}">
	<div class="forum_container">
    
    {if ($permissions.19 == 1) || ($permissions.13 == 1)  || ($permissions.18 == 1)}
    <fieldset>
    <legend>{#Forums_AdminOptionsSelections#}</legend>
    {if ($permissions.18 != 1) && ($ugroup != 1) }
		{if ($permissions.13==1) && ($aid == $userid) }
		{assign var="close" value="1"}
		{/if}
		{else}
		{assign var="close" value="1"}
		{/if}
		<select class="input" id="sa" name="subaction">
		<option value=""></option>
		{if $close == 1}
		<option value="close">{#Forums_close_topic_after#}</option>
		{/if}
		{if $permissions.19 == 1}
		<option value="announce">{#Forums_announce_topic_after#}</option>
		<option value="attention">{#Forums_attention_topic_after#}</option>
		{/if}
		</select>
    </fieldset>
    {/if}
    <br />
    <input onclick="koobi_style(-1); document.getElementById('preview').value=0;" class="button" id="submits" type="submit" value="{#Forums_ButtonSend#}" />&nbsp;
    <input onclick="koobi_style(-1); document.getElementById('preview').value=1;" type="submit" class="button" value="{#Forums_postpreview#}" />
      <input name="preview" type="hidden" id="preview" value="" />
    <input onclick="koobi_style(-1); beitrag(document.f);" class="button" type="button"  value="{#Forums_checklength#}" />
</div>
</form>



<br />
<br />

{if $smarty.request.p != "newtopic" && $smarty.request.action != "edit"}
<table width="100%"  border="0" cellpadding="4" cellspacing="1" class="forum_tableborder">
  <tr>
    <td colspan="2" class="forum_header_bolder"><strong>{#Forums_TheLastPostings#}</strong></td>
  </tr>
  {foreach from=$items item="lp"}
  <tr class="{cycle name="lastposts" values="forum_post_first,forum_post_second"}">
    <td width="20%" valign="top">
	<strong>{$lp->user}</strong><br />
	{#newspost_last_postst_date#} {$lp->datum|date_format:$config_vars.DateFomat}
	</td>
    <td>
	{if $lp->title}<strong>{$lp->title|escape}</strong><br />
	<br />{/if}
	{$lp->message}</td>
  </tr>
  {/foreach}
</table>
{/if}
{include file="$incpath/forums/forums_footer.tpl"}