<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>模板管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="?file=templateproject&action=manage">模板方案</a></li>
			<li><a href="javascript:void(0);" class="on">模板管理</a></li>
			<li><a href="?file=template&action=add">添加模板</a></li>		
		</ul>
	</div>
	<div class="main">
		<div class="search">
			<form action="?" method="get" name="search">
				<input type="hidden" name="file" value="<?php echo $file;?>"> 
				<input type="hidden" name="action" value="<?php echo $action;?>">
				<fieldset>
				<legend>搜索模板</legend>
				模板名称：
				<input type="text" name="k" size="35" value="<?php echo $k?htmlspecialchars(stripslashes($k)):'';?>" />
				<input type="submit" class="button" value="开始查找" />
				</fieldset>
			</form>
		</div>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="18%" class="firstcol">模板名称</th>
			<th width="24%" >文件名</th>
			<th width="31%" >模板嵌套代码</th>
			<th width="27%" >管理</th>
		</tr>
		<?php if($r){foreach($r as $val){?>
		<tr>
			<td width="18%">&nbsp;<?php echo $val['name'];?></td>
			<td width="24%"><a href="<?php echo ADMIN_FILE;?>?file=<?php echo $file;?>&action=edit&id=<?php echo $val['template'];?>"><?php echo $val['template'];?>.html</a></td>
			<td width="31%" align="center"><input type="text" readonly="1" title="双击复制到剪切板" ondblclick="javascript:copy('<?php echo '{{tlp '.$val['template'].'}}';?>');" size="35" value="<?php echo '{{tlp '.$val['template'].'}}';?>" /></td>
			<td width="27%" align="center">
			<?php if(substr($val['template'],0,4)!='tag_' && substr($val['template'],0,4)!='ads_'){?><a href="<?php echo ADMIN_FILE;?>?file=<?php echo $file;?>&action=view&id=<?php echo $val['template'];?>" target="_blank">可视化布局</a><?php }else{echo '<font color="gray">可视化布局</font>';}?>	
			&nbsp;
			<a href="<?php echo ADMIN_FILE;?>?file=<?php echo $file;?>&action=edit&id=<?php echo $val['template'];?>">HTML编辑</a>&nbsp;
			&nbsp;
			<a href="javascript:confirmUrl('您确定要删除模板【<?php echo $val['template'].'.html';?>】吗?','<?php echo ADMIN_FILE;?>?file=<?php echo $file;?>&action=delete&id=<?php echo $val['template'];?>')">删除</a></td>
		</tr>
		<?php }?>
		<?php }else{?>
		<tr><td colspan="4">该模板方案下尚未添加任何模板...</td></tr>	
		<?php }?>
		<tr>
			<td colspan="4" style="text-align:right; padding-right:8px" height="50">共<?php echo ($total+1);?>条记录，当前第<?php echo ($offset+1).'/'.(1+$total);?>页 <a href="?file=template&action=manage&k=<?php echo $k;?>&offset=0">首页</a> <a href="?file=template&action=manage&k=<?php echo $k;?>&offset=<?php echo max(0,($offset-1));?>">上一页</a> <a href="?file=template&action=manage&k=<?php echo $k;?>&offset=<?php echo ($offset+1);?>">下一页</a> <a href="?file=template&action=manage&k=<?php echo $k;?>&offset=<?php echo $total;?>">尾页</a></td>
		</tr>
		</table>
	</div>
</div>
</body>
</html>