<{include file="index/header.html"}> 
<div class="nav"><span>分类列表</span></div> 
<div class="filter">
	<a href="?m=category&a=edit" class="add">添加分类</a>
	<{if $smarty.get.cid}>
		<a href="javascript:;" onclick="javascript:history.back(-1);" class="button">返回上一级</a>
	<{/if}>
</div>
<div class="main"> 
	<table class="ltable">
		<thead>
			<tr> 
				<th width="280">分类名</th> 
				<th width="80">排序</th>
				<th width="60" class="center">首页</th>
				<th width="60" class="center">热门</th>
				<th width="60" class="center">推荐</th>
				<th width="60">状态</th>
				<th width="138">操作</th>
				<th width="150">创建时间</th>
				<th></th>
			</tr>
		</thead>
		<tbody>
	<{if $data}> 
		<{foreach item=i from=$data}>
			<tr> 
				<td><a href="?m=category&a=index&cid=<{$i.cid}>&from_cid=<{$i.pcid}>" class="down"><{$i.name}></a></td> 
				<td><div id="px_<{$i.cid}>" class="pxdo" pxid="<{$i.cid}>"><{$i.px_asc}></div></td>
				<td class="center"><a href="javascript:status('<{$i.cid}>','px_index')" id="px_index_<{$i.cid}>"><img src="<{$__APP__}>public/images/status_<{$i.px_index}>.png"></a></td>
				<td class="center"><a href="javascript:status('<{$i.cid}>','px_hot')" id="px_hot_<{$i.cid}>"><img src="<{$__APP__}>public/images/status_<{$i.px_hot}>.png"></a></td>
				<td class="center"><a href="javascript:status('<{$i.cid}>','px_recommend')" id="px_recommend_<{$i.cid}>"><img src="<{$__APP__}>public/images/status_<{$i.px_recommend}>.png"></a></td>
				<td><{if $i.status == '1'}>正常<{else}>关闭<{/if}></td> 
				<td>
					<a href="?m=category&a=edit&cid=<{$i.cid}>" class="edit">编辑</a> 
					<a href="?m=category&a=del&cid=<{$i.cid}>" class="del">删除</a>
				</td>
				<td><{$i.addtime|date_format:'%Y-%m-%d %H:%M'}>'</td>
				<td></td>
			</tr> 
		<{/foreach}>
	<{else}>
	  <tr><td colspan="9">还没有数据，赶快添加吧！</td></tr>
	<{/if}>
	</tbody>
</table> 
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript">
ajaxEdit(".pxdo","pxid",'?m=category&a=px_update', 'cid', 'px');
function del() {
	if (!confirm("确认要删除？")) {
		window.event.returnValue = false;
	}
}
function status(cid,type){
	$.post("?m=category&a=px_status",{cid:cid, type:type},function(data){
 		if(data == '0' || data == '1'){
			$("#"+type+"_"+cid+" img").attr('src','<{$__APP__}>public/images/status_'+data+'.png');
		}else{ 
			alert('更新失败'); 
		} 
	});	
}  
</script> 