edit_topic.vm

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

VM
126
字号
##
##  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.
##
##  Home page of discussion channel
##
###############################################################################
#parse("/html/_sub/_global.vm")
#select_layout("p_bbs.vm")
#set($page_title="修改发帖")
###############################################################################
#if(!$g_user)
    #show_msg_box("用户尚未登录,点击<a href='$dlog.root()/dlog/login.vm?sid=$g_site_id'>这里</a>登录")
#else
#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))
#if($topic.user.id != $g_user.id)
	#show_msg_box("对不起,你没有编辑该帖子的权限。")
#else
<form action="$link.setAction("html/bbs/topic")" onsubmit="return validateTopicForm(this)" method="post" name="topicForm">
<input type="hidden" name="sid" value="$g_site_id" />
<input type="hidden" name="__ClientId" value="$dlog.gen_client_id()" />
<input type="hidden" name="forum" value="$forum_id" />
<input type="hidden" name="id" value="$topic_id" />
<input type="hidden" name="tid" value="$topic_id" />
<input type="hidden" name="clientType" value="0" />
<div class="page_top">
	<div class="pagecontent">
		<div class="pagecontent_left fleft">
			<b>修改发帖</b>
		</div>
		<div class="pagecontent_right fright">
			今天是: $date.get("MMMMM d, yyyy  EEEEE")
		</div>
	</div>
	<div class="spacer_1"></div>
</div>
#show_error_msg()
<div class="page_content">
	<div class="form">
		<div class="form_row">
    		<div class="form_row_title fleft">
				标题
    		</div>
    		<div class="form_row_content">
				<input type="text" name="title" maxlength="100" size="59" value="$!{topic.title}" />&nbsp;&nbsp;{必须填写}
			</div>
    	</div>
		<div class="spacer_1"></div>
		<div class="form_row">
    		<div class="form_row_title fleft">
				关键字
    		</div>
    		<div class="form_row_content">
				<input type="text" name="searchKey" maxlength="40" size="40" value="$!{topic.keyword}" />&nbsp;&nbsp;{多个关键字请用空格隔开}
			</div>
    	</div>
		<div class="spacer_1"></div>
		<div class="form_row">
			<div class="form_row_content">
				<div class="spacer_5"></div>
        		<textarea name="content" style="width:100%;height:400px">$!{topic.content}</textarea>
    			<div class="spacer_5"></div>
			</div>
    	</div>
		#if($dlog.is_owner($g_site,$g_user))
		<div class="form_row">
			<div class="form_row_content">
				<input type="checkbox" name="top" value="1" #if($topic.top)checked#end/>置顶&nbsp;&nbsp;
				<input type="checkbox" name="elite" value="1" #if($topic.elite)checked#end/>设为精华
			</div>
    	</div>
		#end
		<div class="form_row">
			<div class="form_row_submit">
				<input type="submit" name="eventSubmit_EditTopic" value="更新" />
                <input type="reset" value="重置" onclick="topicForm.title.focus();" />
                <input type="button" value="返回" onclick="history.go(-1)" />
			</div>
    	</div>
	</div>
	<div class="spacer_1"></div>
</div>
<div class="page_bottom"></div>
</form>
<script type="text/javascript">
    window.onload = function()
    {
        var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('html')) ;    
        var oFCKeditor = new FCKeditor( 'content' ) ;
        oFCKeditor.BasePath    = sBasePath ;
        oFCKeditor.Height = 400;
        oFCKeditor.ReplaceTextarea() ;
    }
    
    function validateTopicForm(theForm)
    {
        with(theForm){
            if(is_empty(title.value)){
                alert("title is required.");
                title.focus();
                return false;
            }
            if(is_empty(author.value)){
                alert("author is required.");
                author.focus();
                return false;
            }
        }
        return true;
    }
</script>
#end
#end

⌨️ 快捷键说明

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