Location: PHPKode > projects > Saurus CMS > extensions/saurus4/object_templates/forum_topic.html
{**
 * Simple threaded forum, topic list, object template
 * Date: 31.03.07
 *
 * @package saurus4
 * 
 * @author Saurus <hide@address.com>
 *
 *}

{custom_conf_load id=$id name="tpl_conf"}

<div id="ForumTopicContainer">

{* for FAQ mode notice *}
{if $tpl_conf && $smarty.get.lisa_alert == 1}
<script type="text/javascript">
	alert('{sysword word="Forum alert: Your question has been sent" type="editor"}');
	window.location.href = '?id={$id}';
</script>
{/if}
{* /for FAQ mode notice *}

{* for CAPTCHA failure notice *}
{if $smarty.get.lisa_alert == 2}
<script type="text/javascript">
	alert('{sysword word="CAPTCHA failed" type="saurus4"}');
	var href = window.location.href + '#add_message';
	window.location.href = href.replace('&lisa_alert=2', '');
</script>
{/if}
{* /for CAPTCHA failure notice *}

<h1>
	<a href="#add_message" class="JumpLink float">{sysword word="new topic" type="saurus4"}</a>
	{$current_obj->pealkiri}
</h1>

<table cellpadding="0" cellspacing="0" class="DataTable">
	<thead>
		<tr>
			<col width="100%">
			<td>{sysword word="topics" type="saurus4"}</td>
			<td>{sysword word="author" type="saurus4"}</td>
			<td>{sysword word="replies" type="saurus4"}</td>
			<td>{sysword word="last reply" type="saurus4"}</td>
		</tr>
	</thead>
	<tbody>
		{init_messages name="messages" sort="objekt_id asc"}
		{foreach from=$messages item="message"}
		<tr class="{cycle values="dark, light"}">
			<td class="DataTableWrap">{$message->buttons}<a href="?id={$message->id}">{$message->title}</a></td>
			<td>{if ($message->author_email	&& $message->hide_email != '1')}<a href="mailto:{$message->author_email}">{/if}{$message->author}{if $message->author_email && !$message->hide_email}</a>{/if}</td>
			<td>{$message->message_replies}</td>
			<td><span class="Date">{$message->last_message}</span></td>
		</tr>
		{/foreach}	 
	</tbody>
</table>

{literal}
<script type="text/javascript">
<!--
function checkForumFields(form_id)
{
	var submit_form = document.getElementById(form_id);
	var len = 2;
	
	if(submit_form)
	{
		if (submit_form.nimi.value.length < len){
			alert('{/literal}{sysword word="please fill in" type="saurus4"}{literal}: '+document.getElementById('for_'+submit_form.nimi.id).innerHTML);
			submit_form.nimi.focus();
			return false;
		}
		if (submit_form.pealkiri.value.length < len){
			alert('{/literal}{sysword word="please fill in" type="saurus4"}{literal}: '+document.getElementById('for_'+submit_form.pealkiri.id).innerHTML);
			submit_form.pealkiri.focus();
			return false;
		}
		if (submit_form.text.value.length < len){
			alert('{/literal}{sysword word="please fill in" type="saurus4"}{literal}: '+document.getElementById('for_'+submit_form.text.id).innerHTML);
			submit_form.text.focus();
			return false;
		}
		
		{/literal}{if $conf.check_for_captcha}{literal}
		
		if (submit_form.captcha_default.value.length < len){
			alert('{/literal}{sysword word="please fill in" type="saurus4"}{literal}: '+document.getElementById('for_'+submit_form.captcha_default.id).innerHTML);
			submit_form.captcha_default.focus();
			return false;
		}
		
		{/literal}{/if}{literal}
		
		submit_form.submit();
	}
}
//-->
</script>
{/literal}

<a name="add_message"></a>

<form action="add_comment.php" method="POST" name="forumPostForm" id="forumPostForm">
	<p class="separator">{sysword word="new topic" type="saurus4"}</p>
	<table cellpadding="0" cellspacing="0" class="FormTable">
		<col class="FormTableLabels">
		<tr> 
			<td><label for="nimi" id="for_nimi">{sysword word="name" type="saurus4"}</label></td>
			<td><input type="text" name="nimi" id="nimi" value="{if $smarty.session.scms_last_comment.nimi}{$smarty.session.scms_last_comment.nimi|xss_clean}{else}{$userdata->name}{/if}" class="FormText">*</td>
		</tr>
		<tr> 
			<td><label for="email" id="for_email">{sysword word="e-mail" type="saurus4"}</label></td>
			<td><input type="text" name="email" id="email" value="{if $smarty.session.scms_last_comment.email}{$smarty.session.scms_last_comment.email|xss_clean}{else}{$userdata->all.email}{/if}" class="FormText"></td>
		</tr>
		<tr> 
			<td><label for="pealkiri" id="for_pealkiri">{sysword word="title" type="saurus4"}</label></td>
			<td><input type="text" name="pealkiri" id="pealkiri" value="{if $smarty.session.scms_last_comment.pealkiri}{$smarty.session.scms_last_comment.pealkiri|xss_clean}{else}Re: {$message->title}{/if}" class="FormText">*</td>
		</tr>
		<tr> 
			<td><label for="text" id="for_text">{sysword word="comment" type="saurus4"}</label></td>
			<td><textarea name="text" id="text" class="FormTextArea">{if $smarty.session.scms_last_comment.text}{$smarty.session.scms_last_comment.text|xss_clean}{/if}</textarea></td>
		</tr>
		<tr> 
			<td></td>
			<td><input type="checkbox" name="on_peida_email" id="on_peida_email" value="1"{if $smarty.session.scms_last_comment.on_peida_email} checked="checked"{/if}> <label for="on_peida_email" id="for_on_peida_email">{sysword word="hide e-mail" type="saurus4"}</label></td>
		</tr>
		<tr> 
			<td></td>
			<td><input type="checkbox" name="on_saada_email" id="on_saada_email" value="1"{if $smarty.session.scms_last_comment.on_saada_email} checked="checked"{/if}> <label for="on_saada_email" id="for_on_saada_email">{sysword word="send replies" type="saurus4"}</label></td>
		</tr>
		{*** CAPTCHA ***}
		{if $conf.check_for_captcha}
		<tr> 
			<td></td>
			<td><img src="{$wwwroot}/extensions/saurus4/captcha_image.php?name=default" width="{$saurus4.captchas.default.image_width}" height="{$saurus4.captchas.default.image_height}" alt="" title=""></td>
		</tr>
		<tr> 
			<td><label for="captcha_default" id="for_captcha_default">{sysword word="enter the text on the image" type="saurus4"}</label></td>
			<td><input type="text" name="captcha_default" id="captcha_default" class="FormText"></td>
		</tr>
		{/if}
		{*** / CAPTCHA ***}
		<tr> 
			<td></td>
			<td><input type="button" onclick="checkForumFields('forumPostForm');" value="{sysword word="send" type="saurus4"}"></td>
		</tr>
	</table>

	<input type="hidden" name="id" value="{$id}">
	<input type="hidden" name="c_tpl" value="{$c_tpl}">
</form>

{if !$smarty.get.lisa_alert && session_unregister('scms_last_comment')}{/if}

</div><!-- / ForumTopicContainer -->
Return current item: Saurus CMS