<!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=form}-->
<!--{include file=elements/header.js.html type=blockui}-->
<!--{include file=elements/header.js.html type=valid}-->
</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;缓存设置
				</div>
			</div>
			<div class="tabcontent">
				<a href="index.php?r=Cache.cacheset&menu_id=14" class="nolink">缓存设置</a>
				<a href="index.php?r=Cache.clearCache&menu_id=14" class="link">清理缓存</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent">
					<form action="index.php?r=Cache.cacheset"   method="post" id="setForm">
						<table class="tbl_edit" width="100%">
							<tr>
								<td class="td_name">是否开启缓存</td>
								<td class="td_content"><label><input type="radio" name="data[WebsiteAttribute][CACHE_OPEN_STATUS]" id="CACHE_OPEN_STATUS" value="1" <!--{if $CACHE_OPEN_STATUS == '1'}-->checked<!--{/if}-->/>&nbsp;开启</label>&nbsp;&nbsp;<label><input type="radio" name="data[WebsiteAttribute][CACHE_OPEN_STATUS]" id="CACHE_OPEN_STATUS" value="0" <!--{if $CACHE_OPEN_STATUS != '1'}-->checked<!--{/if}-->/>&nbsp;关闭</label></td>
							</tr>
							<tr>
								<td class="td_name">默认缓存时间(秒)<span class="red">*</span></td>
								<td class="td_content"><input type="text" class="number" name="data[WebsiteAttribute][CACHE_DEFAULT_TIME]" id="CACHE_DEFAULT_TIME" value="<!--{if $CACHE_DEFAULT_TIME==''}-->180<!--{else}--><!--{$CACHE_DEFAULT_TIME}--><!--{/if}-->" maxlength='2000'/>&nbsp;秒<span id="span_CACHE_DEFAULT_TIME"></span></td>
							</tr>
							<tbody style="display:none;">
							<tr>
								<td class="td_name">缓存类型</td>
								<td class="td_content"><select name="data[WebsiteAttribute][CACHE_ENGINE_TYPE]" id="CACHE_ENGINE_TYPE">
									<option value="FileCache" <!--{if $CACHE_ENGINE_TYPE == 'FileCache'}-->selected="selected"<!--{/if}-->>文件缓存</option>
								</select><span id="span_CACHE_ENGINE_TYPE"></span></td>
							</tr>
							<tr>
								<td class="td_name">缓存级别</td>
								<td class="td_content"><select name="data[WebsiteAttribute][CACHE_ENGINE_LEVEL]" id="CACHE_ENGINE_LEVEL">
									<option value="1" <!--{if $CACHE_ENGINE_LEVEL == 1}-->selected="selected"<!--{/if}-->>1</option>
									<option value="2" <!--{if $CACHE_ENGINE_LEVEL == 2}-->selected="selected"<!--{/if}-->>2</option>
									<option value="3" <!--{if $CACHE_ENGINE_LEVEL == 3}-->selected="selected"<!--{/if}-->>3</option>
								</select></td>
							</tr>
							
							<tr>
								<td class="td_name">Memcache服务器地址</td>
								<td class="td_content">
									多个用“,”号分开。如：127.0.0.1:11211,192.168.1.1:11211<br>
									<textarea name="data[WebsiteAttribute][CACHE_MEMCACHE_SERVERS]" id="CACHE_MEMCACHE_SERVERS" class="textarea"><!--{$CACHE_MEMCACHE_SERVERS}--></textarea>
									<span id="span_CACHE_MEMCACHE_SERVERS"></span>
								</td>
							</tr>
							</tbody>
							<tr>
								<td class="noborder"></td>
								<td class="noborder"><button type="submit" class="butsubmit">提交</button></td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<script>

$(document).ready(function(){
	$("#setForm").submit(function(){
		var contentExist = false;
		var regExp = false;
		if($("#CACHE_DEFAULT_TIME").val()){
			contentExist = true;
		}
		if((/^\+?[1-9][0-9]*$/.test($("#CACHE_DEFAULT_TIME").val()))&&$("#CACHE_DEFAULT_TIME").val()>0){
			regExp = true;
		}
		if(!contentExist)
		{
			$.errorUI({
				message:"默认缓存时间不能为空！",
				showOverlay:true,
				autoHide:false,
				confirm:function(){}
			});
			return false;
		}
		
		if(!regExp){
			$.errorUI({
				message:"默认缓存时间必须为正整数！",
				showOverlay:true,
				autoHide:false,
				confirm:function(){}
			});
			return false;
		}
		
		$(this).ajaxSubmit({
			success:function(data){
				var o = eval("("+data+")");
				if(o.status){
					
					$.successUI({
						message:"设置成功！",
						showOverlay:true,
						autoHide:false,
						confirm:function(){setTimeout($.unblockUI, 300);}
					});
				}else{
					$.errorUI({
						message:"无法保存configs.php文件，请到网站前台publics/configs.php，查看文件权限！",
						showOverlay:true,
						autoHide:false
					});
				}
				
			}
		});
		return false;
	});
});
</script>

</body>
</html>