<!DOCTYPE html>
<html>
	<head>
		<meta charset="<?php echo $cfg_soft_lang; ?>">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>标签源码碎片管理</title>
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
		<link rel="stylesheet" href="css/codemirror.css">
		<script language="javascript" src="../static/web/js/jquery.min.js"></script>
		<script src="../static/web/js/bootstrap.bundle.min.js"></script>
		<script language="javascript" src="js/main.js"></script>
		<style>
			.selbt {
				float: left;
				display: inline-block;
				margin: 0 6px 6px 0;
				padding: 8px;
				text-align: center;
				border-radius: .2rem
			}
			.helpdiv {
				float: left;
				display: none;
				padding: 10px;
				width: 100%;
				background: #f8f8f8;
				border: 1px solid #28a745;
				border-radius: .2rem
			}
		</style>
		<script language="javascript">
			function Post() {
				if (document.form1.filename.value == "") {
					ShowMsg("文件名不能为空");
					document.form1.filename.focus();
					return false;
				}
			}
		</script>
		<script type="text/javascript" src="js/codemirror.js"></script>
		<script type="text/javascript" src="js/mode/xml/xml.js"></script>
		<script type="text/javascript" src="js/mode/javascript/javascript.js"></script>
		<script type="text/javascript" src="js/mode/css/css.js"></script>
		<script type="text/javascript" src="js/mode/php/php.js"></script>
		<script type="text/javascript" src="js/mode/clike/clike.js"></script>
		<script type="text/javascript" src="js/mode/htmlmixed/htmlmixed.js"></script>
	</head>
	<body>
		<form method="POST" action="tpl.php" name=form1 onSubmit="return Post()">
			<input type="hidden" name="actiondo" value="<?php echo $action; ?>">
			<input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
			<input type="hidden" name="action" value="savetagfile">
			<table width='98%' cellpadding='3' cellspacing='1' align="center" class="table maintable mt-3 mb-3">
				<tr bgcolor='#EEF4EA'>
					<td colspan="2" height="26" background="../static/web/img/wbg.gif" style="padding-left:10px">
						<span><?php echo $title; ?>（修改源码如果出现语法错误，可能导致标签无法使用，请修改前先作好数据备份）</span>
					</td>
				</tr>
				<tr>
					<td>文件名称</td>
					<td><input name=filename size=40 value="<?php echo $filename; ?>" />（不允许用 “..” 形式的路径）</td>
				</tr>
				<tr>
					<td>标签格式说明 </td>
					<td>
						标签文件名为：标签名.lib.php <br>
						接口函数定义为：function lib_标签名(&$ctag,&$refObj)，返回值是结果字符串<br>
						修改标签时为了防止出错，您也可以修改它的名称(同时修改文件名和函数名)，这样等同继承了原来标签的代码建立一个新的标签
					</td>
				</tr>
				<tr>
					<td colspan='2'><textarea id="content" name="content" cols="150" rows="24" style="width:98%;height:450px"><?php echo $democode; ?></textarea></td>
				</tr>
				<tr>
					<td bgcolor="#f8f8f8" colspan="2" class="py-3">
						<button type="submit" name='B1' class="btn btn-success btn-sm">保存</button>
						<button type="reset" name='B2' class="btn btn-success btn-sm">重置</button>
						<button type="button" name='B4' class="btn btn-success btn-sm" onClick="javascript:history.go(-1);">返回</button>
					</td>
				</tr>
			</table>
		</form>
		<script type="text/javascript">
			var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
				lineNumbers: true,
				lineWrapping: true,
				mode: 'text/x-php'
			});
		</script>
	</body>
</html>