<%template _header%>
<%set (int){loopi}=1%>
<%if page_err==0%>
<script type="text/javascript" src="editor/common.js"></script>
<script type="text/javascript" src="templates/{templatepath}/ajax.js"></script>
<script type="text/javascript" src="templates/{templatepath}/showtopic.js"></script>
<script type="text/javascript">
var postminchars = parseInt({config.minpostsize});
var postmaxchars = parseInt({config.maxpostsize});
var disablepostctrl = parseInt({disablepostctrl});
var forumpath = "{forumpath}";
function validate(theform, previewpost, switcheditormode) {
	var message = !theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value;

	if (theform.title.value == "" || message == "") {
		alert("请完成标题和内容栏。");
		$("postsubmit").disabled = false;
		return false;
	} else if (theform.title.value.length > 60) {
		alert("您的标题超过 60 个字符的限制。");
		theform.title.focus();
		$("postsubmit").disabled = false;
		return false;
	}

	if(!disablepostctrl && ((postminchars != 0 && mb_strlen(message) < postminchars) || (postmaxchars != 0 && mb_strlen(message) > postmaxchars))) {
		alert("您的帖子长度不符合要求。\n\n当前长度: " + mb_strlen(message) + " 字节\n系统限制: " + postminchars + " 到 " + postmaxchars + " 字节");
		return false;
	}

	if (!switcheditormode && !previewpost) {
		$("postsubmit").disabled = true;
	}

	theform.message.value = message;
	return true;
}

function ShowFormatBytesStr(bytes)
{
	if(bytes > 1073741824)
	{
		document.write((Math.round((bytes/1073741824)*100)/100).toString()+' G');
	}
	else if(bytes > 1048576)
	{
		document.write((Math.round((bytes/1048576)*100)/100).toString()+' M');
	}
	else if(bytes > 1024)
	{
		document.write((Math.round((bytes/1024)*100)/100).toString()+' K');
	}
	else
	{
		document.write(bytes.toString()+' Bytes');
	}
}

function ShowStars(n, t) {
	var s = '';
	for(var i=3; i>0; i--) {
		level = parseInt(n / Math.pow(t, i-1));
		n = n % Math.pow(t, i-1);
		for(var j=0; j<level; j++) {
			s += '<img src="templates/{templatepath}/images/star_level'+i+'.gif" />';
		}
	}
	document.write(s);
}

function imgzoom(o)
{
	if(event.ctrlKey)
	{
		var zoom = parseInt(o.style.zoom, 10) || 100;
		zoom -= event.wheelDelta / 12;
		if(zoom > 0)
		{
			o.style.zoom = zoom + '%';
		}
		return false;
	}
	else
	{
		return true;
	}
}

</script>
<div id="foruminfo">
	<div class="userinfo">
		<h2><a href="{config.forumurl}">{config.forumtitle}</a><span> {forumnav}</span><strong>{topictitle}</strong></h2>
	</div>
	<div class="forumstats">
		<div id="search">
				<%if {usergroupinfo.allowsearch}>0%>
					<%template _quicksearch%>
				<%/if%>
		</div>
	</div>
</div>
<%template _pagewordadlist%>
<%template _newpmmsgbox%>
<%template _poll%>
<div class="forumpages">
  <div class="pagesothers">
		<%if {canposttopic}%>
			<a href="posttopic.aspx?forumid={forumid}"><img src="templates/{templatepath}/images/write-bbs.gif" alt="发表新主题" /></a>
		<%/if%>
		<%if {topic.closed}==0%>
			<a href="postreply.aspx?topicid={topicid}"><img src="templates/{templatepath}/images/hf-bbs.jpg" alt="回复该主题" /></a>
		<%/if%>
	</div>
</div>
<div class="ntforumbox">
	<div class="titlebar">
		<h2>
		<%if {forum.applytopictype}==1 && {forum.topictypeprefix}==1%>
			{topictypes} 
		<%/if%>
		标题: {topictitle}
		<%if {topic.price}>0 && {topic.posterid}!={userid}%>
				  <a href="buytopic.aspx?topicid={topicid}&showpayments=1">浏览需支付 {userextcreditsinfo.name} {topic.price} {userextcreditsinfo.unit}</a>
		<%/if%>
		</h2>
	</div>
	<div class="viewthread">
	<table cellpadding="0" cellspacing="0" border="0">
		<tbody>
		<tr>
	    <td class="postauthor" id="{post.pid}">
		<!--register user-->
		<%if {post.posterid}!=-1%>
				<div id="memberinfo_{loopi}" class="popmenubutton-new-out cursor" onmouseover="showMenu(this.id,false)">
					<div class="normalname" onmouseover="this.className='normalnameon'" onmouseout="this.className='normalname'">
				<%if {post.onlinestate}==1%>					
					<img src="templates/{templatepath}/images/friend_dot.gif" title="在线" alt="在线"/>
					<%else%>
					<img src="templates/{templatepath}/images/friend_dot2.gif" title="离线" alt="离线"/>
					<%/if%>
					{post.poster}
				</div>
			</div>
				<div class="avatarphoto">
				<%if {config.showavatars}==1 && {post.avatar}!=""%>
					<img class="avatar" src="{post.avatar}"
						<%if {post.avatarwidth}>0%>
							width="{post.avatarwidth}"
							height="{post.avatarheight}"
						<%/if%> alt="头像"
					/>			
				<%/if%>
				</div>
				<%if {post.nickname}!=""%>
					<div class="nickname">{post.nickname}</div>
				<%/if%>
					<p>
				<script language="javascript" type="text/javascript">
					ShowStars({post.stars}, {config.starthreshold});
				</script>
					</p>
				<div class="profile">
					<ul>
					<%if {config.enablespace}==1 || {config.enablealbum}==1%>
						<li class="otherproduct">
						 <%/if%> 
									<%if {config.enablespace}==1%><strong><%if {post.spaceid}>0%><a href="{spaceurl}space/?uid={post.posterid}">个人空间</a><%else%><a href="###" onclick="nospace('{post.poster}');">个人空间</a><%/if%></strong><%/if%> <%if {config.enablealbum}==1%><em><a href="showalbumlist.aspx?uid={post.posterid}">相册</a></em><%/if%>
									<%if {config.enablespace}==1 || {config.enablealbum}==1%>
						</li>
					<%/if%>
					<%if {config.userstatusby}==1%><li>组别:<span>{post.status}</span></li><%/if%>
									<li>性别:<span><script type="text/javascript">document.write(displayGender({post.gender}));</script></span></li>
									<%if {post.bday}!=""%>
										<li>生日:<span>{post.bday}</span></li>
									<%/if%>
						<li>来自:<span>{post.location}</span></li>
						<li>积分:<span>{post.credits}</span></li>
						<li>帖子:<span>{post.posts}</span></li>
						<li>注册:<span><%if {post.joindate}!=""%><%datetostr({post.joindate},"yyyy-MM-dd")%><%/if%></span></li>
					</ul>
				</div>
				<%if {post.medals}!=""%>
				<div class="medals">{post.medals}</div>
				<%/if%>
		<%else%>
			<div class="noregediter"><strong>{post.poster}</strong>  {post.ip}
				<%if {useradminid}>0 && {admininfo.allowviewip}==1%>
					<a href="getip.aspx?pid={post.pid}&topicid={topicid}" title="查看IP"><img src="templates/{templatepath}/images/ip.gif" alt="查看IP" /></a>
				<%/if%>
			</div>
			<!--guest-->
			<div class="noregediter">
					未注册
			</div>
		<%/if%>	
		</td>
		<td class="postcontent">
			<div class="navpostinfo">
				<div class="postinfoleft"><span><%datetostr({post.postdatetime},"yyyy-MM-dd HH:mm")%></span></div>
				<div class="postinfoitem">
					<%if {userid}!=-1%>
						<%template _report%>|
					<%/if%>
					    <%set {aspxrewriteurl} = this.ShowTopicAspxRewrite({topicid},0)%>
						<a href="{aspxrewriteurl}">平板</a>|
						<a href="favorites.aspx?topicid={topicid}">收藏</a>|
						<%if {ismoder}==1%>
							<a href="editpost.aspx?topicid={topicid}&postid={post.pid}">编辑</a>|
							<a href="delpost.aspx?topicid={topicid}&postid={post.pid}" onclick="return confirm('确定要删除吗?');">删除</a>|
							<%if {post.posterid}!=-1%>
								<a href="###" onclick="action_onchange('rate',$('moderate'),'{post.pid}');">评分</a>|
								<%if {post.ratetimes}>0%>
								<a href="###" onclick="action_onchange('cancelrate',$('moderate'),'{post.pid}');">撤销评分</a>&nbsp;
								<%/if%>
							<%/if%>
							<input name="postid" id="postid" value="{post.pid}" type="checkbox" />
						<%else%>
							<%if {post.posterid}!=-1 && {userid}=={post.posterid}%>
								<%if {topic.closed}==0%>
									<a href="editpost.aspx?topicid={topicid}&postid={post.pid}">编辑</a>|
								<%/if%>
								<a href="delpost.aspx?topicid={topicid}&postid={post.pid}" onclick="return confirm('确定要删除吗?');">删除</a>|
							<%/if%>
							<%if {usergroupinfo.raterange}!="" && {post.posterid}!=-1%><a href="###" onclick="action_onchange('rate',$('moderate'),'{post.pid}');">评分</a>
							<%/if%>
						<%/if%>
						<a href="###" class="t_number" onclick="$('message{post.pid}').className='t_smallfont'">小</a>			
						<a href="###" class="t_number" onclick="$('message{post.pid}').className='t_msgfont'">中</a>
						<a href="###" class="t_number" onclick="$('message{post.pid}').className='t_bigfont'">大</a>
				</div>
			</div>
				<div id="ad_thread2_1"></div>
			<div class="defaultcontent">
					<%if {topic.identify}>0%>
						<div class="ntprint" onclick="this.style.display='none';"><img src="images/identify/{topicidentify.filename}" alt="点击关闭鉴定图章" title="点击关闭鉴定图章" /></div>
					<%/if%>
				  <div class="forumarticle">
				  <h3>{post.title}</h3>
				  <div id="message{post.pid}" class="t_msgfont">
					<div id="ad_thread3_1"></div>
					{post.message}
				  </div>
				  </div>
					<%if {post.ratetimes}>0%>
						<%template _ratelog%>
					<%/if%>
					<%loop (ShowtopicPageAttachmentInfo) attachment attachmentlist%>
						<%if {attachment.pid}=={post.pid}%>
					<!--附件开始-->
					<div class="quote" id="attachment_{attachment.aid}">
					<div class="text"><h1><img src="templates/{templatepath}/images/attachment.gif" alt="附件" />附件:</h1>
						<h2>
							<%if {attachment.getattachperm}==1%>
									<%if {attachment.allowread}==1%>
									<%template _attachmentinfo%>
									<%else%>
									<span class="notdown">你的下载权限 {usergroupinfo.readaccess} 低于此附件所需权限 {attachment.readperm}, 你无权查看此附件</span>
									<%/if%>
							<%else%>
									<img src="images/attachicons/attachment.gif" alt="附件">&nbsp;附件: <span class="attachnotdown">您所在的用户组无法下载或查看附件</span>
							<%/if%>
						
						</h2>
						</div>
						</div>
					<!--附件结束-->
						<%/if%>
					<%/loop%>
					<%if {post.lastedit}!=""%>
					<!--最后编辑开始-->
					<div class="lastediter">
						<img src="templates/{templatepath}/images/lastedit.gif" alt="最后编辑"/>{post.lastedit}
					</div>
					<!--最后编辑结束-->
					<%/if%>
				</div>
					<%if {config.showsignatures}==1%>
					<%if {post.usesig}==1%>
						<%if {post.signature}!=""%>
					<!--签名开始-->
				<div class="postertext">
							<%if {config.maxsigrows}>0%>
								<%set (int){ieheight} = {config.maxsigrows}*12%>
								<div class="t_signature" style="overflow: hidden; max-height: {config.maxsigrows}em;maxHeightIE:{ieheight}px">{post.signature}</div>
							<%else%>
								{post.signature}
							<%/if%>
						</div>
					<!--签名结束-->
						<%/if%>
					<%/if%>
				<%/if%>
	</td>
	</tr>
	</tbody>
	<tbody>
	<tr>
	<!--用户信息结束-->
		<td class="postauthor threadfoot">
			<a href="#top">
			<img src="templates/{templatepath}/images/gototop.gif" alt="gototop"/>
			</a>
		</td>
		<td class="threadfootright threadfoot">
			<div class="ForumContentAd"><div id="ad_thread1_1"></div></div> 
			<div class="forumanswer">
				<%if {topic.closed}==0%>
				<a href="postreply.aspx?topicid={topicid}&postid={post.pid}&quote=yes"><img src="templates/{templatepath}/images/button_use.gif" alt="引用"/></a>
				<a href="postreply.aspx?topicid={topicid}&postid={post.pid}"><img src="templates/{templatepath}/images/dot_replay.gif" alt="回复"/></a>
				<%/if%>
			</div>
		</td>
	</tr>
	</tbody>
</table>
</div>
<%if {post.posterid}!=-1%>
	<!-- member menu -->
	<div class="menuwindow" id="memberinfo_{loopi}_menu" style="display:none; width:176px;">
		<div class="popupmenu">
			<div class="popupmenuitem" style="border-top:0px;">
				<p class="recivemessage"><a href="usercppostpm.aspx?msgtoid={post.posterid}" target="_blank">发送短消息</a></p>
				<%if {useradminid}>0%>
					<%if {admininfo.allowviewip}==1%>
						<p  class="seeip"><a href="getip.aspx?pid={post.pid}&topicid={topicid}" title="查看IP">查看IP</a></p>
					<%/if%>
					<%if {admininfo.allowbanuser}==1%>
						<p><a href="useradmin.aspx?action=banuser&uid={post.posterid}" title="禁止用户">禁止用户</a></p>
					<%/if%>
				<%/if%>
			</div>
			<div class="popupmenuitem">
				<p>
				<%set {aspxrewriteurl} = this.UserInfoAspxRewrite({topic.posterid})%>
				<a href="{aspxrewriteurl}" target="_blank">查看公共资料</a></p>
				<p><a href="search.aspx?posterid={post.posterid}">查找该会员全部帖子</a></p>
			</div>
			<div class="popupmenuitem">
				<ul>
				<li>UID:<span>{post.posterid}</span></li>
				<li>精华:<span><%if {post.digestposts}>0%><a href="search.aspx?posterid={post.posterid}&type=digest">{post.digestposts}</a><%else%>{post.digestposts}<%/if%></span></li>
				<%if {score[1]}!=""%>
					<li>{score[1]}:<span>{post.extcredits1} {scoreunit[1]}</span></li>
				<%/if%>
				<%if {score[2]}!=""%>
					<li>{score[2]}:<span>{post.extcredits2} {scoreunit[2]}</span></li>
				<%/if%>
				<%if {score[3]}!=""%>
					<li>{score[3]}:<span>{post.extcredits3} {scoreunit[3]}</span></li>
				<%/if%>
				<%if {score[4]}!=""%>
					<li>{score[4]}:<span>{post.extcredits4} {scoreunit[4]}</span></li>
				<%/if%>
				<%if {score[5]}!=""%>
					<li>{score[5]}:<span>{post.extcredits5} {scoreunit[5]}</span></li>
				<%/if%>
				<%if {score[6]}!=""%>
					<li>{score[6]}:<span>{post.extcredits6} {scoreunit[6]}</span></li>
				<%/if%>
				<%if {score[7]}!=""%>
					<li>{score[7]}:<span>{post.extcredits7} {scoreunit[7]}</span></li>
				<%/if%>
				<%if {score[8]}!=""%>
					<li>{score[8]}:<span>{post.extcredits8} {scoreunit[8]}</span></li>
				<%/if%>
				</ul>
			</div>
			<div class="popupmenuitem">
				<p>状态:<span><%if {post.onlinestate}==1%>
					在线
				<%else%>
					离线
				<%/if%></span>
				</p>
				<ul class="tools">
					<%if {post.msn}!=""%>
							<li>
						<img src="templates/{templatepath}/images/tools-msn.gif" title="MSN Messenger: {post.msn}" alt="MSN Messenger: {post.msn}" />
						<a href="mailto:{post.msn}" target="_blank">{post.msn}</a>
							</li>
					<%/if%>
					<%if {post.skype}!=""%>
							<li>
						<img src="templates/{templatepath}/images/tools-skype.gif" title="Skype: {post.skype}" alt="Skype: {post.skype}" />
						<a href="skype:{post.skype}" target="_blank">{post.skype}</a>
							</li>
					<%/if%>
					<%if {post.icq}!=""%>
							<li>
						<img src="templates/{templatepath}/images/tools-icq.gif" alt="ICQ: {post.icq}" alt="ICQ: {post.icq}" />
						<a href="http://wwp.icq.com/scripts/search.dll?to={post.icq}" target="_blank">{post.icq}</a>
							</li>
					<%/if%>
					<%if {post.qq}!=""%>
							<li>
						<img src="templates/{templatepath}/images/tools-qq.gif" alt="QQ: {post.qq}" alt="QQ: {post.qq}" />
						<a href="http://wpa.qq.com/msgrd?V=1&Uin={post.qq}&Site={config.forumtitle}&Menu=yes" target="_blank">{post.qq}</a>
							</li>
					<%/if%>
					<%if {post.yahoo}!=""%>
							<li>
						<img src="templates/{templatepath}/images/tools-yahoo.gif" width="16" alt="Yahoo Messenger: {post.yahoo}"/>
						<a href="http://edit.yahoo.com/config/send_webmesg?.target={post.yahoo}&.src=pg" target="_blank">{post.yahoo}</a>
							</li>
					<%/if%>
				</ul>
			</div>
		</div>
	</div>
	<!-- member menu -->
<%/if%>
</div>
<!--ntforumbox end-->
<div class="forumpages">
  <div class="pagesothers">
		<%if {canposttopic}%>
			<a href="posttopic.aspx?forumid={forumid}"><img src="templates/{templatepath}/images/write-bbs2.gif" alt="发表新主题" /></a>
		<%/if%>
		<%if {topic.closed}==0%>
			<a href="postreply.aspx?topicid={topicid}"><img src="templates/{templatepath}/images/hf-bbs.gif" alt="回复该主题" /></a>
		<%/if%>
	</div>
</div>
<%if {canreply}%>
<!--quickreply-->
	<%template _quickreply%>
<!--quickreply-->
<%/if%>
<!--replay-->
<div class="ntforumbox">
	<div class="titlebar">
		<h2>标题: {topictitle}</h2>
	</div>
	<ul id="replaycontent">
		<%loop posttreeitem posttree%>
		<li>
			<span>{posttreeitem[spaces]}·<a href="showtree.aspx?topicid={topicid}&postid={posttreeitem[pid]}">
				<%if {strtoint({posttreeitem[pid]})}=={postid}%>
					{posttreeitem[title]}
				<%else%>
					{posttreeitem[title]}
				<%/if%>
				</a>
			</span>
			<span>
			<%if {strtoint({posttreeitem[posterid]})}==-1%>
					&nbsp; &nbsp; (游客
				<%else%>
					&nbsp; &nbsp; (<%set {aspxrewriteurl} = this.UserInfoAspxRewrite({posttreeitem[posterid]})%><a href="{aspxrewriteurl}">{posttreeitem[poster]}</a>
				<%/if%>
			</span>
			<span>发表于 {posttreeitem[postdatetime]})</span>
			</li>
		<%/loop%>
	</ul>
</div>
<!--reply-->
<!--forumjumping-->
<div id="forumjumping">
	<div class="manageritem">
	<%if {useradminid}>0%>
		<script type="text/javascript">
			function action_onchange(value,objfrm,postid){
				if (value != ''){
					objfrm.operat.value = value;
					objfrm.postid.value = postid;
					if(value != 'delpost'){
						objfrm.submit();
					}
					else{
						document.delpost.submit();
					}
				}
			}
		</script>
		<form id="moderate" name="moderate" method="post" action="topicadmin.aspx?action=moderate&forumid={forumid}">
			<input name="forumid" type="hidden" value="{forumid}" />
			<input name="topicid" type="hidden" value="{topicid}" />
			<input name="postid" type="hidden" value="" />
			<input name="operat" type="hidden" value="" />
			
			<select id="operatSel" onchange="action_onchange(this.options[this.selectedIndex].value,this.form,0);"
				name="operatSel">
				<option value="" selected="selected">管理选项</option>
				<option value="delete">删除主题</option>
				<option value="delpost">批量删帖</option>
				<option value="close">关闭主题</option>
				<option value="move">移动主题</option>
				<option value="copy">复制主题</option>
				<option value="highlight">高亮显示</option>
				<option value="digest">设置精华</option>
				<option value="displayorder">主题置顶</option>
				<option value="split">分割主题</option>
				<option value="merge">合并主题</option>
				<option value="repair">修复主题</option>
			</select>
		</form>
	<%else if {usergroupinfo.raterange}!=""%>
		<script type="text/javascript">
			function action_onchange(value,objfrm,postid){
				if (value != ''){
					objfrm.operat.value = value;
					objfrm.postid.value = postid;
					if(value != 'delpost'){
						objfrm.submit();
					}
					else{
						$('delpost').submit();
					}
				}
			}
		</script>
		<form id="moderate" name="moderate" method="post" action="topicadmin.aspx?action=moderate&forumid={forumid}">
			<input name="forumid" type="hidden" value="{forumid}" />
			<input name="topicid" type="hidden" value="{topicid}" />
			<input name="postid" type="hidden" value="" />
			<input name="operat" type="hidden" value="" />

		</form>
	<%/if%>
	</div>
</div>
<!--forumjumping-->
</div>
<%else%>
	<%if {needlogin}%>
		<%template _login%>
	<%else%>
		<%template _errmsgbox%>
	<%/if%>
<%/if%>
{inpostad}
<%template _copyright%>
<%template _adlist%>
<%template _footer%>
