<!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=upload}-->
<!--{include file=elements/header.js.html type=valid}-->
<style type="text/css">
div.button {
	font-size:12px;
	color:#00f;
	line-height:25px;
	text-align:center;
	float:left;
	margin-left:5px;
}
div.button.hover{
	color:#f00;
}
.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=Theme.themelist" class="nolink">内管管理</a>
				<a href="index.php?r=SiteSet.themeset" class="link">属性设置</a>
				<a href="index.php?r=Theme.themeListLayout" class="link">列表页布局</a>
					<a href="index.php?r=Theme.themePageLayout" class="link">内容页布局</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent">
					<form id="editForm" action="index.php?r=Theme.edit" method="post">
						<input type="hidden" name="returnParams" value="<!--{$returnParams}-->"/>
						<input type="hidden" name="data[Theme][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[Theme][title]" value="<!--{$data.title}-->" maxlength='256'/><span id="span_title"></span></td>
							</tr>
							<tr>
								<td class="td_name">图片</td>
								<td class="td_content">
									<div style="float:left;"><input type="text" class="text" id="image_url" name="data[Theme][image_url]" value="<!--{$data.image_url}-->" maxlength='256'/></div>
									<div style="float:left;" class="button" id="uploadclick">上传图片</div>
									<div style="float:left;line-height:25px;">&nbsp;<span id="main_img"></span></div>
									<input type="hidden" name="data[Theme][thumb_image_url]" id="thumb_image_url" value="<!--{$data.thumb_image_url}-->"/>
								</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[Theme][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"><select name="data[Theme][recommend_level]">
									<option value="">推荐等级</option>
									<option value="1" <!--{if $data.recommend_level eq 1}-->selected<!--{/if}-->>1</option>
									<option value="2" <!--{if $data.recommend_level eq 2}-->selected<!--{/if}-->>2</option>
									<option value="3" <!--{if $data.recommend_level eq 3}-->selected<!--{/if}-->>3</option>
									<option value="4" <!--{if $data.recommend_level eq 4}-->selected<!--{/if}-->>4</option>
									<option value="5" <!--{if $data.recommend_level eq 5}-->selected<!--{/if}-->>5</option>
								</select></td>
							</tr>
							<tr>
								<td class="td_name">好评数</td>
								<td class="td_content"><input type="text" id="good_count" class="number" name="data[Theme][good_count]" value="<!--{$data.good_count}-->"/><span id="span_good_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">中评数</td>
								<td class="td_content"><input type="text" id="normal_count" class="number" name="data[Theme][normal_count]" value="<!--{$data.normal_count}-->"/><span id="span_normal_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">差评数</td>
								<td class="td_content"><input type="text" id="bad_count" class="number" name="data[Theme][bad_count]" value="<!--{$data.bad_count}-->"/><span id="span_bad_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">人气</td>
								<td class="td_content"><input type="text" id="click_count" class="number" name="data[Theme][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[Theme][down_count]" value="<!--{$data.down_count}-->"/><span id="span_down_count"></span></td>
							</tr>
							<tr>
								<td class="td_name">收费类型</td>
								<td class="td_content"><select name="data[Theme][fee_type]">
									<option value="">资费</option>
									<option value="1" <!--{if $data.fee_type eq 1}-->selected<!--{/if}-->>免费</option>
									<option value="2" <!--{if $data.fee_type eq 2}-->selected<!--{/if}-->>收费</option>
									<option value="3" <!--{if $data.fee_type eq 3}-->selected<!--{/if}-->>其他</option>
								</select></td>
							</tr>
							<tr>
								<td class="td_name">收费说明</td>
								<td class="td_content"><input type="text" class="text" name="data[Theme][fee_detail]" value="<!--{$data.fee_detail}-->" maxlength='64'/></td>
							</tr>
							<tr>
								<td class="td_name">厂商</td>
								<td class="td_content"><input type="text" class="text" name="data[Theme][manufacturer]" value="<!--{$data.manufacturer}-->" maxlength='64'/></td>
							</tr>
							<tr>
								<td class="td_name">是否重命名上传包</td>
								<td class="td_content">
									<input type="radio" name="data[Theme][rename_flag]" value="1" <!--{if $data.rename_flag == 1}-->checked<!--{/if}-->/>是&nbsp;&nbsp;
									<input type="radio" name="data[Theme][rename_flag]" value="0" <!--{if $data.rename_flag == 0}-->checked<!--{/if}-->/>否
								</td>
							</tr>
							<tr>
								<td class="td_name">是否开启评论</td>
								<td class="td_content">
									<input type="radio" name="data[Theme][comment_flag]" value="1" <!--{if $data.comment_flag == 1}-->checked<!--{/if}-->/>是&nbsp;&nbsp;
									<input type="radio" name="data[Theme][comment_flag]" value="0" <!--{if $data.comment_flag == 0}-->checked<!--{/if}-->/>否
								</td>
							</tr>
							<tr>
								<td class="td_name">简介</td>
								<td class="td_content"><textarea id="introduction" name="data[Theme][introduction]"><!--{$data.introduction}--></textarea></td>
							</tr>
							<tr>
								<td class="td_name">安装教程</td>
								<td class="td_content"><textarea id="install_tutorial" name="data[Theme][install_tutorial]"><!--{$data.install_tutorial}--></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"
});
$("#install_tutorial").addClass("cleditorTextarea").cleditor({
	width: "80%",
	height: 120,
	controls: "bold italic underline break | undo redo | " +
		" image link file | basic-function advertising-system access-statistics"
});

new AjaxUpload($("#uploadclick"), {
	action: "index.php?r=Theme.uploadimage",
	name: "image_file",
	onSubmit: function(file, ext){
		$("#main_img").html("<img src=\"images/ajax.gif\"/>");
		this.disable();
	},
	onComplete: function(file, response){
		this.enable();
		var data = eval("("+response+")");
		if (data.flag == 1) {
			$("#image_url").val(data.name);
			$("#thumb_image_url").val(data.thumb_name);
			$("#main_img").html(file);
		} else if (data.flag == -1) {
			$("#main_img").html("");
			alert("不能上传" + data.fileext + "文件!");
		} else if (data.flag == -2) {
			$("#main_img").html("");
			alert("文件大小超出指定范围!");
		} else if (data.flag == -10) {
			$("#main_img").html("");
			//if (data.compress_error_code == 7) {
				alert("水印文字过长,压缩文件失败!请调整游戏属性设置中图片压缩和水印设置后，重新上传!");
			//}
		} else {
			$("#main_img").html("");
			alert("文件上传失败!");
		}
	}
});

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

$("#editForm").validate({
	rules: {
		'data[Theme][good_count]':{
			'number': true,
			'digits' : true
		},
		'data[Theme][normal_count]':{
			'number': true,
			'digits' : true
		},
		'data[Theme][bad_count]':{
			'number': true,
			'digits' : true
		},
		'data[Theme][click_count]':{
			'number': true,
			'digits' : true
		},
		'data[Theme][down_count]':{
			'number': true,
			'digits' : true
		},
		"data[Theme][title]": "required",
		"data[Theme][create_date]": {
			required: true,
			datetimeCN: true
		}
	},
	messages: {
		'data[Theme][good_count]':{
			'number': '好评数必须为正整数',
			'digits':'好评数必须为正整数'
		},
		'data[Theme][normal_count]':{
			'number': '中评数必须为正整数',
			'digits':'中评数必须为正整数'
		},
		'data[Theme][bad_count]':{
			'number': '差评数必须为正整数',
			'digits':'差评数必须为正整数'
		},
		'data[Theme][click_count]':{
			'number': '人气值必须为正整数',
			'digits':'人气值必须为正整数'
		},
		'data[Theme][down_count]':{
			'number': '下载次数必须为正整数',
			'digits':'下载次数必须为正整数'
		},
		"data[Theme][title]": "标题不能为空",
		"data[Theme][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>