<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件编辑</title>
<link rel="stylesheet" type="text/css" href="img/base.css">
<style type="text/css">
.selbt {
	width:120px;
	float:left;
	margin:2px 0px 2px 3px;
	text-align:center;
}
.helpdiv {
 	display:none;
	border: 1px dashed #749F4D;
  	background-color: #F0FAEB;
	width:500px;
	padding:5px;
	position:absolute;
}
</style>
<script  language="javascript">
function Post()
{
	if (document.form1.filename.value=="")
	{
		alert("文件名不能为空。");
		document.form1.filename.focus();
		return false;
	}
}
function showdiv(id)
{
	hideobj = GETNAMES("help111");
	for(i=0;i<hideobj.length;i++)
	{
		hideobj[i].style.display="none";
	}
	if(id != '')
	{
		 document.getElementById(id).style.display="block";
	}
}
function GETNAMES(name)
{
	var returns = document.getElementsByName(name);
	 if(returns.length > 0) return returns;
	 returns = new Array();
	 var e = document.getElementsByTagName('div');
	 for(i = 0; i < e.length; i++)
	{
		 if(e[i].getAttribute("name") == name)
		 {
			 returns[returns.length] = e[i];
		}
	 }
	 return returns;
}
</script>
</head>
<body bgcolor="#F2F4F3" leftmargin="8" topmargin="8">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ECFAD3" style="margin-bottom:8px;">
  <tr>
    <td height="28" style="border:1px dotted #BFD67C" background='img/wbg.gif'>
		&nbsp;◇<a href='templets_main.php?acdir=<?php echo $acdir; ?>'><b>模板管理</b></a> &gt;&gt; <b>修改/新建模板</b>
	  </td>
  </tr>
</table>
<form method="POST" action="tpl.php" name=form1 onSubmit="return Post()">
<input type="hidden" name="action" value="saveedit" />
<input type="hidden" name="acdir" value="<?php echo $acdir; ?>" /><table width='98%'  border='0' cellpadding='3' cellspacing='1' bgcolor='#CBD8AC' align="center">
		<tr bgcolor='#EEF4EA'>
			<td colspan='2' background='img/wbg.gif' height='26'>
					<font color='#666600'><b>修改/新建模板：</b></font>
			</td>
		</tr>
		<tr bgcolor='#FFFFFF'>
  		<td>文件名称</td>
  		<td>
  			<input name=filename size=40 value="<?php echo $filename; ?>" />
    		（不允许用 “..” 形式的路径）
  		</td>
		</tr>
	<tr  bgcolor='#f7ffdb'>
  		<td colspan='2' ><b>参考标签：</b></td>
	</tr>   <tr  bgcolor='#FFFFFF'>
      <td colspan='2' >
<?php
//foreach($dtags as $tag)
//{
	//echo '<div class="coolbg np selbt" title="'.$key.'"><a href="javascript:;" onclick="showdiv(\''.$tag.'\');"> '.$tag.' </a></div>';
//}
//echo '<a href="javascript:;" onclick="showdiv(\'\');"> 隐藏全部 </a><br />';
foreach ($helps as $key => $help)
{
	echo '<div class="coolbg np selbt" title="'.trim($help[0]).'"><a href="javascript:;" onclick="showdiv(\''.$key.'\');"> '.$key.' </a></div>'."\r\n";
	echo '<div name="help111" id="'.$key.'" class="helpdiv" ><b>标签名称：</b>'.$key.'<br /><b>功能说明：</b><br />'.trim($help[0]).'<br /><b>使用实例：</b><br /><textarea rows="5" cols="50" style="width:90%">'.trim($help[1]).'</textarea><br /><b>参数说明：</b><br />'."\r\n";
	$parameters = explode("\n", $help[2]);
	foreach($parameters as $parameter)
	{
		$parameter = trim($parameter);
		if($parameter == '') continue;
		else echo $parameter,'<br />';
	}
	echo '<div style="position:absolute; right:4px; top:4px;"><a href="###" onclick="showdiv(\'\')">关闭</a></div></div>'."\r\n";
}
?>
	  </td>
    </tr>
    <tr bgcolor='#FFFFFF'>
      <td colspan='2' >
	  <textarea name="content" cols="150" rows="24" style="width:100%;height:450px"><?php echo $content; ?></textarea>
	  </td>
    </tr>
    <tr>
      <td height="42" colspan='2'  bgcolor='#f7ffdb'>
          <input type="submit" value="  保 存  " name='B1' class="coolbg np" />
          &nbsp;
          <input type="reset" value="取消修改" name='B2' class="coolbg np" />
          &nbsp;
          <input type="button" value="不理返回" name='B4' class="coolbg np" onClick="javascript:history.go(-1);" />
      </td>
    </tr>
</table>
 </form>
</body>
</html>
