<?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 src="images/js/check.func.js"></script>
<script language="javascript" type="text/javascript">
function insertText(text)
{	
	document.getElementById("content").focus();
    var str = document.selection.createRange();
	str.text = text;
}
</script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="?file=yellowpages&action=template">黄页模板</a></li>
			<li><a href="javascript:void(0);" class="on">编辑模板</a></li>			
		</ul>
	</div>
	<div class="main">
	<form action="" method="post" name="myform">
	<input type="hidden" name="do_submit" value="1" />
	<input type="hidden" name="path" value="<?php echo $path;?>" />
	<input type="hidden" name="tlp" value="<?php echo $tlp;?>" />
	<table cellspacing="0" class="sub">
		<tr>
			<td width="10%" align="right">文件名称：</td>
			<td width="90%">
			<?php echo $tlp;?>.html （上次修改于：<?php echo date('Y-m-d H:i:s',filemtime(TPL_ROOT.'comtmp/'.$path.'/'.$tlp.'.html'));?>）
				<input type="button" value="可视化布局" onclick="window.location.href='?file=yellowpages&action=template_view&path=vip01&tlp=<?php echo $tlp;?>';" class="button" />
			</td>
		</tr>
		<tr>
			<td colspan="2">
			<p style="margin:8px">
				<input type="button" value="loop循环" class="button" onClick="javascript:if(this.value != '') insertText('{{loop $data $key $val}}\n{{$key}}:{{$val}}\n{{/loop}}\n')" />
				<input type="button" value="if 分支" class="button" onClick="javascript:if(this.value != '') insertText('{{if $var1 == $var2}}\n\n{{/if}}\n')" />
				<input type="button" value="elseif" class="button" onClick="javascript:if(this.value != '') insertText('{{elseif $a == $b}}\n')" />
				<input type="button" value="else" class="button" onClick="javascript:if(this.value != '') insertText('{{else}}\n')" />
				<input type="button" value="template" class="button" onClick="javascript:if(this.value != '') insertText('{{tlp \'模板文件名\'}}\n')" />
				<input type="button" value="include" class="button" onClick="javascript:if(this.value != '') insertText('{{include DIRCMS_ROOT.\'php文件名\'}}\n')" />
			</p>
			<textarea name='info[content]' id="content" style="width:98%;height:450px; margin:8px; font-family:'宋体'"><?php echo htmlspecialchars($r['content']);?></textarea>
			</td>
		</tr>
		<tr class="bg2"><td colspan="2" align="center"><input type="button" class="button" onclick="this.form.submit();" value="保存模板" /> <input type="button" class="button" onclick="self.history.back();" value="取消返回" /></td></tr>
	</table>
	</form>

	</div>
</div>
</body>
</html>