<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{include file=elements/header.css.html}-->
<!--{include file=elements/header.js.html type=common}-->
<!--{include file=elements/header.js.html type=ubb}-->
<!--{include file=elements/header.js.html type=valid}-->
<style>
.anchorbutton{
	font-size:12px;
	color:#00f;
	text-align:center;
	float:left;
	margin-left:5px;
	cursor:pointer;
}

.anchorbuttonon{
	color:#f00;
}
</style>
</head>
<body>
<div id="outside">
	<!--{include file=frame/top.html}-->
	<div id="mainareaContent">
		<!--{include file=frame/left.html}-->
		<div id="rightContent">
			<div id="topContent">
				<div class="sitmap">
					<span class="r"><!--{include file="elements/uuadvad.html"}--></span>模块管理&nbsp;&gt;&nbsp;文章模块&nbsp;&gt;&nbsp;内容管理&nbsp;&gt;&nbsp;修改文章
				</div>
			</div>
			<div class="tabcontent">
				<a href="index.php?r=Article.index" class="nolink">内管管理</a>
				<a href="index.php?r=SiteSet.articleset" class="link">属性设置</a>
				<a href="index.php?r=Article.articleListLayout" class="link">列表页布局</a>
					<a href="index.php?r=Article.articlePageLayout" class="link">内容页布局</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent">
					<form id="editForm" action="index.php?r=Article.edit" method="post">
						<input type="hidden" name="returnParams" value="<!--{$returnParams}-->"/>
						<input type="hidden" name="data[Article][id]" value="<!--{$data.id}-->"/>
						<table class="tbl_edit" width="100%">
							<tr>
								<td class="td_name">文章标题<span class="red">*</span></td>
								<td class="td_content"><input type="text" class="text" id="title" name="data[Article][title]" value="<!--{$data.title}-->" maxlength='256'/><span id="span_title"></span></td>
							</tr>
							<tr>
								<td class="td_name">发布频道</td>
								<td class="td_content">
								<!--{if !empty($channel)}-->
									<!--{foreach from=$channel item=channel name=foo}-->
										<input type="checkbox" name="data[Channel][id][]" value="<!--{$channel.id}-->" <!--{if $channel.channel_id == $channel.id}-->checked<!--{/if}-->/>[<!--{$channel.id}-->]<!--{$channel.channel_text}-->&nbsp;
										<!--{if ($smarty.foreach.foo.index+1) % 4 == 0}--><br/><!--{/if}-->
									<!--{/foreach}-->
								<!--{else}-->
									无
								<!--{/if}-->
								</td>
							</tr>
							<tr>
								<td class="td_name">文章来源</td>
								<td class="td_content"><input type="text" class="text" name="data[Article][source]" value="<!--{$data.source}-->" maxlength='256'/></td>
							</tr>
							<tr>
								<td class="td_name">创建时间</td>
								<td class="td_content">
									<div style="float:left;"><input type="text" class="text" id="create_date" name="data[Article][create_date]" value="<!--{$data.create_date}-->"/></div>
									<div class="anchorbutton" style="margin-left:5px;line-height:25px;" onClick="currentTime('create_date')" onMouseOver="overanchor(this)" onMouseOut="outanchor(this)">当前时间</div>
									<div style="margin-left:5px;line-height:25px;"><span id="span_create_date"></span></div>
								</td>
							</tr>
							<tr>
								<td class="td_name">人气</td>
								<td class="td_content"><input type="text" class="number" name="data[Article][click_count]" value="<!--{$data.click_count}-->" id="click_count" maxlength='11'/><span id="span_click_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">是否开启评论</td>
								<td class="td_content"><input type="radio" name="data[Article][comment_flag]" value="1" <!--{if $data.comment_flag == 1}-->checked<!--{/if}-->/>开启&nbsp;<input type="radio" name="data[Article][comment_flag]" value="0" <!--{if $data.comment_flag == 0}-->checked<!--{/if}-->/>关闭</td>
							</tr>
							<tr>
								<td class="td_name">文章内容<span class="red">*</span></td>
								<td class="td_content">
									<textarea id="content" name="data[ArticleContent][content]"><!--{$data.content}--></textarea>
									<span id="span_content"></span>
								</td>
							</tr>
							<tr>
								<td class="noborder"></td>
								<td class="noborder"><button type="submit" class="butsubmit">提交</button>&nbsp;&nbsp;<button type="button" class="but2font" onClick="window.location.href='index.php?<!--{$returnParams}-->'">返回</button></td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
$(document).ready(function(){
	$("#content").addClass("cleditorTextarea").cleditor({
		width: "80%",
		height: 120,
		controls: "bold italic underline break | undo redo | " +
			" image link file | basic-function advertising-system access-statistics"
	});
	
	$.validator.addMethod("datetimeCN", function(value, element){
		return strDateTime(value);
	}, "日期格式有误，正确格式为：YYYY-MM-DD HH:MM:SS");
	
	$("#editForm").validate({
		rules: {
			"data[Article][title]": {
				required: true,
				maxlength: 200
			},
			"data[Article][create_date]": {
				required: true,
				datetimeCN: true
			},
			"data[Article][click_count]": {
				number: true,
				digits : true
			}, 
			"data[ArticleContent][content]": "required"
		},
		messages: {
			"data[Article][title]": {
				required: "请输入标题",
				maxlength: "不能超过200个字符"
			},
			"data[Article][create_date]": {
				required: "日期不能为空"
			},
			"data[Article][click_count]": {
				number: "人气必须为正整数",
				digits : "人气必须为正整数"
			},
			"data[ArticleContent][content]": "请输入内容"
		},
		errorPlacement: function(error, element){
			$("#span_" + element.attr("id")).html(error).attr("class", "error");
		},
		submitHandler: function(form){
			form.submit();
		},
		errorClass: "invalid",
		success: function(label){
			label.parent().html("&nbsp;").attr("class", "valid");
		},
		onkeyup:false
	});
});

function overanchor(button){
	$(button).addClass("anchorbuttonon");
}

function outanchor(button){
	$(button).removeClass("anchorbuttonon");
}
</script>
</html>