<!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=Picture.picturelist" class="nolink">内管管理</a>
				<a href="index.php?r=SiteSet.pictureset" class="link">属性设置</a>
				<a href="index.php?r=Picture.pictureListLayout" class="link">列表页布局</a>
					<a href="index.php?r=Picture.picturePageLayout" class="link">内容页布局</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent">
					<form id="editForm" action="index.php?r=Picture.edit" method="post">
						<input type="hidden" name="returnParams" value="<!--{$returnParams}-->"/>
						<input type="hidden" name="data[Picture][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 class="text" id="title" name="data[Picture][title]" value="<!--{$data.title}-->" maxlength='128'/><span id="span_title"></span></td>
							</tr>
							<tr>
								<td class="td_name">发布频道</td>
								<td class="td_content">
								<!--{if !empty($channel)}-->
									<!--{foreach from=$channel item=item name=channellist}-->
										<input type="checkbox" name="channel_id[]" value="<!--{$item.id}-->" <!--{if $item.channel_id != null}-->checked<!--{/if}-->/>[<!--{$item.id}-->]<!--{$item.channel_text}-->&nbsp;
										<!--{if ($smarty.foreach.channellist.index+1) % 4 == 0}--><br/><!--{/if}-->
									<!--{/foreach}-->
								<!--{else}-->
									无
								<!--{/if}-->	
								</td>
							</tr>
							<tr>
								<td class="td_name">创建时间</td>
								<td class="td_content">
									<div style="float:left;"><input class="text" name="data[Picture][create_date]" id="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" id="click_count" class="number" name="data[Picture][click_count]" value="<!--{$data.click_count}-->"/><span id="span_click_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">下载数</td>
								<td class="td_content"><input type="text" id="down_count" class="number" name="data[Picture][down_count]" value="<!--{$data.down_count}-->"/><span id="span_down_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">简介</td>
								<td class="td_content"><textarea id="introduction" name="data[Picture][introduction]" maxlength='1000'><!--{$data.introduction}--></textarea></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>
$("#introduction").addClass("cleditorTextarea").cleditor({
	width : "80%",
	height: 120,
	controls: "bold italic underline break | undo redo | " +
		" image link file | basic-function advertising-system access-statistics"
});

$(document).ready(function(){
	$.validator.addMethod("datetimeCN", function(value, element){
		return strDateTime(value);
	}, "日期格式有误，正确格式为：YYYY-MM-DD HH:MM:SS");
});

$("#editForm").validate({
	rules: {
		'data[Picture][click_count]':{
			'number': true,
			'digits' : true
		},
		'data[Picture][down_count]':{
			'number': true,
			'digits' : true
		},
		"data[Picture][title]": "required",
		"data[Picture][create_date]": {
			required: true,
			datetimeCN: true
		}
	},
	messages: {
		'data[Picture][click_count]':{
			'number': '人气值必须为正整数',
			'digits':'人气值必须为正整数'
		},
		'data[Picture][down_count]':{
			'number': '下载次数必须为正整数',
			'digits':'下载次数必须为正整数'
		},
		"data[Picture][title]": "标题不能为空",
		"data[Picture][create_date]": {
			required: "日期不能为空"
		}
	},
	errorPlacement: function(error, element){
		$("#span_" + element.attr("id")).html(error).attr("class", "error");
	},
	submitHandler: function(form){
		setDisabled("button", window.document);
		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>