<?php if (!defined('APP_PATH')) exit;?><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://127.0.0.5/Magic/Data/Public/js/jquery.js"></script>
<style type="text/css">
a{color:#417EB7}
body{background:#f1f1f1;}
table{font-size:13px;}	
table{width:100%;}
table  td{padding:4px 0;border-bottom:1px dotted #ccc;color:#666;}
table  td a{background:url(../images/files.png) 5px left no-repeat;padding:5px 0;color:#000}
</style>
<body>
<table border="0" cellspacing="0" cellpadding="0"  align="center">
<tr><th align="center">文件名</th><th align="center" width="100">描述</th><th align="center" width="80">作者</th></tr><tr>
<?php if(!empty($dirs['superior'])){ ?>
	<tr>
		<td align="left"><img src="http://127.0.0.5/Magic/Data/Public/images/dir2.gif"><a href="?r=gettpl&path=<?php echo $dirs['superior']['name'];?>&type=<?php echo Q('get.type');?>">上级目录</a></td>
		<td align="center"></td>
		<td align="center"></td>
	</tr>
<?php }?>
<?php foreach ($dirs['list'] as $vo){?>
	<tr>
		<td align="left">
			<img src="http://127.0.0.5/Magic/Data/Public/images/dir.gif" style="margin-left:15px"> 
			<a href="?r=gettpl&path=<?php echo $vo['fullpath'];?>&type=<?php echo Q('get.type');?>"><?php echo $vo['name'];?></a>
		</td>
		<td align="left"></td>
		<td align="center"></td>
	</tr>
<?php }?>
<?php if(empty($files) && empty($dirs['list'])){ ?>
<tr><td colspan="3" align="center" height="40">无可用模板文件</td></tr>
<?php }else{ ?>
<?php foreach ($files as $vo2){?>
	<tr>
		<td height="30" align="left">
			<img src="http://127.0.0.5/Magic/Data/Public/images/<?php echo $vo2['ext'];?>.gif" style="margin-left:15px">
			<a href="javascript:void(0)" onclick="settpl('#<?php echo Q('get.type');?>','<?php echo $vo2['path'];?>')"><?php echo $vo2['name'];?></a>
		</td>
		<td align="left"><?php echo $vo2['exp']['name'];?>&nbsp;</td>
		<td align="center"><?php echo $vo2['exp']['author'];?>&nbsp;</td>
	</tr>
<?php }?>
<?php }?>
</table>
</body>
<script type="text/javascript">
	function settpl(node,val){
		$('iframe', window.top.document).contents().each(function(i){
			if ($(this).find(node).length==0){
				findiframe(this,node,val);
			}else{
				$(this).find(node).val(val);
			}
		})
		var index = parent.layer.getFrameIndex(window.name);
		parent.parent.layer.close(index);
	}

	function findiframe(obj,node,val){
		$(obj).find("iframe").contents().each(function(j){
			if ($(this).find(node).length==0){
				findiframe(this,node,val);
			}else{
				$(this).find(node).val(val);
			}
		});
	}
</script>