write.vm

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

VM
94
字号
##
##  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.
##
##  write a diary
##
###############################################################################
#parse("/wml/_sub/_global.vm")
#set($PAGE_SIZE = 10)
#set($page_title=$text.wml("new_diary"))
#set($catalog_id = $dlog.param("cat_id",-1))
#set($log = $form.getBean())
#set($catalogs = $DIARY_tool.catalogs($g_site, $g_user, true))
<p>
#if(!$g_user)
    用户尚未登录,点击<a href='$dlog.root()/wml/login.vm?sid=$g_site_id'>这里</a>登录。
#elseif($catalogs.size()==0)
	#if($dlog.is_owner($g_site, $g_user))
    您还没有添加日记分类,请选择:<br/>
	<a href='$dlog.root()/wml/diary.do?sid=$g_site_id&amp;eventSubmit_AutoCreateCatalogAndWrite&amp;catalog=$link.encodeURL("我的日记")'>自动创建分类并开始写日记</a>
	<a href='$dlog.root()/wml/diary/catalog_add.vm?sid=$g_site_id'>手工添加日记分类</a><br/>
	#else
    您没有在<b>[${g_site.friendlyName}]</b>写日记的权限!
	#end
#else
	网站:<a href="$dlog.root()/wml/?sid=$g_site_id">$text.html(${g_site.friendlyName})</a>&nbsp;<a href="$dlog.root()/wml/diary/?sid=$g_site_id">$text.diary($g_site)</a><br/>
	分类:<select name="catalogId" ivalue="0">
		#if($catalogs.size()==0)
			<option value="-1">我的日记</option>
		#end
        #foreach($cat in $catalogs)
            <option value="${cat.id}">$text.html(${cat.name})</option>
		#end
		</select><br/>
	##显示已上传得附件
	#set($files = $DIARY_tool.attachments($g_user, $dlog.dlog_session_id($request)))
	#if($files.size()>0)
	已上传附件:<br/>==========<br/>
	#foreach($file in $files)
		${velocityCount}.<a href="$dlog.root()/wml/showimg.vm?sid=$g_site_id&amp;uri=$link.encodeURL(${file.uri})">$dlog.file_name(${file.savePath})</a>&nbsp;<a href="$link.setAction("wml/diary")?sid=$g_site_id&amp;file_id=${file.id}&amp;eventSubmit_DeleteAttachement=${file.id}">删除</a><br/>
	#end
	#else
		请先插入图片再编辑文字,否则会导致文字丢失.<br/>
	#end
	<a href="$dlog.root()/wml/diary/upload.vm?sid=$g_site_id">&lt;插入图片&gt;</a><br/>
	#if($messages.exist())<b>$!messages.getAll()</b><br/>#end
	标题:<input type="text" name="title" value="$!{log.title}"/><br/>
	作者:<input type="text" name="author" value="#if($log.author)${log.author}#else$text.html(${g_user.nickname})#end"/><br/>
	内容:<input type="text" name="content" value="$!{log.content}"/><br/>	
	#set($weathers = ["sunny","ptcloudy","cloudy","showers","rain","storms","snow","flurries","ice","dark"])
	天气:<select name="weather">
        #foreach($w in $weathers)
            <option value="$w">$w</option>
        #end
        </select><br/>
	<anchor>提交日记
        <go href="$link.setAction("wml/diary")" method="post">
            <postfield name="sid" value="$g_site_id"/>
            <postfield name="catalogId" value="$(catalogId)"/>
            <postfield name="cat_id" value="$(catalogId)"/>
            <postfield name="title" value="$(title)"/>
            <postfield name="author" value="$(author)"/>
            <postfield name="content" value="$(content)"/>
            <postfield name="weather" value="$(weather)"/>
            <postfield name="__ClientId" value="$dlog.gen_client_id()"/>
            <postfield name="eventSubmit_PublishLog" value="WML"/>
        </go>
    </anchor>
	<anchor>存为草稿
        <go href="$link.setAction("wml/diary")" method="post">
            <postfield name="sid" value="$g_site_id"/>
            <postfield name="catalogId" value="$(catalogId)"/>
            <postfield name="cat_id" value="$(catalogId)"/>
            <postfield name="title" value="$(title)"/>
            <postfield name="author" value="$(author)"/>
            <postfield name="content" value="$(content)"/>
            <postfield name="weather" value="$(weather)"/>
            <postfield name="__ClientId" value="$dlog.gen_client_id()"/>
            <postfield name="eventSubmit_SaveAsDraft" value="WML"/>
        </go>
    </anchor>
#end
</p>

⌨️ 快捷键说明

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