topic.vm

来自「一个简单的blog系统」· VM 代码 · 共 91 行

VM
91
字号
##
##  This program is free software; you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation; either version 2 of the License, or
##  (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU Library General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program; if not, write to the Free Software
##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
##  showing a topic
##
###############################################################################
#parse("/wml/_sub/_global.vm")
#set($WORD_COUNT = 500)
#set($p_page = $dlog.param("p", 1))
#set($forum_id = $dlog.param("fid",-1))
#set($topic_id = $dlog.param("tid",-1))
#set($topic = $BBS_tool.topic($g_site, $g_user, $topic_id))
<p>
#if(!$topic)
	话题不存在!
#elseif(${topic.forum.status}==3 && ${topic.site.owner.id} != ${g_user.id})
	论坛已被站长关闭,暂时不可用!
#else
	#set($page_title=${topic.forum.name})
    标题:$text.html(${topic.title})<br/>    
    #set($content = $dlog.plain_text(${topic.content}))
    #set($page_count = $dlog.page_count($content.length(), $WORD_COUNT))
    #if($page_count > 1)
    	#set($pre_page = $p_page - 1)
    	#set($next_page = $p_page + 1)
    	第${p_page}页,共${page_count}页.<br/>
    	#if($p_page>1)
    		<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=$topic_id">首页</a>
    		<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=$topic_id&amp;p=$pre_page">上页</a>
    	#end
    	#if($p_page < $page_count)
    		<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=$topic_id&amp;p=$next_page">下页</a>
    		<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=$topic_id&amp;p=$page_count">尾页</a>
    	#end
    	<br/>
	#end	
    文本内容:<br/>$text.html($dlog.split($content,$p_page,$WORD_COUNT))
</p>
<p>
	作者:<a href="$dlog.root()/wml/viewuser.vm?sid=$g_site_id&amp;uid=${topic.owner.id}">$text.html($topic.owner.nickname)</a><br/>
	时间:$date.format("yy-MM-dd HH:mm", ${topic.createTime})<br/>
	讨论区:<a href="forum.vm?sid=$g_site_id&amp;fid=${topic.forum.id}">$text.html(${topic.forum.name})</a><br/>
	评论:<a href="topic_rpls.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=${topic.id}">${topic.replyCount}</a>&nbsp;<a href="reply.vm?sid=$g_site_id&amp;tid=${topic.id}">[我要评论]</a><br/>
</p>
<p>
	----------<br/>
	#if(${topic.owner.id}==${g_user_id} || $dlog.is_owner($g_site, $g_user))
	(<a href="edit_topic.vm?sid=$g_site_id&amp;tid=$topic_id">编辑</a>/<a href="$link.setAction("wml/topic")?sid=$g_site_id&amp;id=$topic_id&amp;eventSubmit_Delete=$topic_id">删除</a>)<br/>
	#end
#set($prev_topic = $BBS_tool.prev_topic($topic))
#set($next_topic = $BBS_tool.next_topic($topic))
#if($prev_topic)
	上一篇:<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=${prev_topic.id}">$text.html(${prev_topic.title})</a><br/>
#end
#if($next_topic)
	下一篇:<a href="topic.vm?sid=$g_site_id&amp;fid=$forum_id&amp;tid=${next_topic.id}">$text.html(${next_topic.title})</a><br/>
#end

#if(${topic.replyCount}>0)	
	<b>+最新评论</b><br/>
	#set($rpls = $BBS_tool.replies($topic, 1, 3))
	#foreach($rpl in $rpls)
	#set($content = $dlog.plain_text(${rpl.content}))
	#set($rc = $dlog.abbreviate($content, 50))
	#if($dlog.is_empty($rc))#set($rc="[无文本内容]")#end
	${velocityCount}.${rc}
	#if($rc.length() < $content.length())
		<a href="rpl.vm?sid=$g_site_id&amp;tid=$topic_id&amp;rpl_id=${rpl.id}">[详细内容]</a>
	#end($text.html(${rpl.user.nickname}),$date.format("MM-dd HH:mm",${rpl.replyTime}))<br/>
	#end
	#if($rpls.size()<${topic.replyCount})
	<a href="topic_rpls.vm?sid=$g_site_id&amp;tid=$topic_id">$text.wml("more")</a>
	#end
#end
#if(${topic.status}==0)
	$BBS_tool.visit_topic($g_site, $topic)
#end
#end
</p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?