<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>自定义宏标记向导</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
		<link rel="stylesheet" href="/static/web/css/codemirror.css">
		<script src="/static/web/js/jquery.min.js"></script>
		<script src="/static/web/js/codemirror.js"></script>
		<script src="/static/web/js/mode/xml/xml.js"></script>
		<script src="/static/web/js/mode/javascript/javascript.js"></script>
		<script src="/static/web/js/mode/css/css.js"></script>
		<script src="/static/web/js/mode/htmlmixed/htmlmixed.js"></script>
		<script src="/static/web/js/admin.main.js"></script>
	</head>
	<body>
		<div class="container-fluid">
			<ol class="breadcrumb">
				<li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
				<li class="breadcrumb-item"><a href="mytag_main.php">自定义宏标记</a></li>
				<li class="breadcrumb-item active">自定义宏标记向导</li>
			</ol>
			<div class="card shadow-sm">
				<div class="card-header">自定义宏标记向导</div>
				<div class="card-body">
					<span id="list1" style="display:none">[field:textlink/]（[field:pubdate function=MyDate('m-d',@me)/]）</span>
					<span id="list2" style="display:none">[field:typelink/] [field:textlink/]</span>
					<div id="list3" style="display:none"><p>[field:imglink/]</p><p>[field:textlink/]</p></div>
					<div id="list4" style="display:none"><p>[field:imglink/] - <a href="[field:filename/]">[field:title/]</a></p><p>[field:info/]</p></div>
					<form name="form1" action="mytag_tag_guide_ok.php" method="post" target="stafrm">
						<input type="hidden" name="dopost" value="gettag">
						<div class="table-responsive">
							<table class="table table-borderless">
								<tbody>
									<tr>
										<td colspan="4">
											<label><input type="radio" name="liststyle" onclick="ChangeListStyle();" value="1" checked><img src="/static/web/img/g_t2.jpg"></label>
											<label><input type="radio" name="liststyle" onclick="ChangeListStyle();" value="2"><img src="/static/web/img/g_t1.jpg"></label>
											<label><input type="radio" name="liststyle" onclick="ChangeListStyle();" value="3"><img src="/static/web/img/g_t3.jpg"></label>
											<label><input type="radio" name="liststyle" onclick="ChangeListStyle();" value="4"><img src="/static/web/img/g_t4.jpg"></label>
										</td>
									</tr>
									<tr>
										<td width="160">调用栏目</td>
										<td width="550">
											<?php
											$tl = new TypeLink(0);
											$typeOptions = $tl->GetOptionArray(0,$admin_catalogs,0,1);
											echo "<select name='typeid' class='admin-input-sm'>";
											echo "<option value='0' selected>不限栏目</option>";
											echo $typeOptions;
											echo "</select>";
											?>
										</td>
										<td width="160">限定模型</td>
										<td>
											<?php
											echo "<select name='channel' class='admin-input-sm'>";
											echo "<option value='0' selected>不限模型</option>";
											$tl->dsql->SetQuery("SELECT id,typename FROM `#@__channeltype` WHERE id > 0");
											$tl->dsql->Execute();
											while($row = $tl->dsql->GetObject())
											{
												echo "<option value='{$row->id}'>{$row->typename}</option>";
											}
											echo "</select>";
											?>
										</td>
									</tr>
									<tr>
										<td>附加属性</td>
										<td>
											<?php
											echo "<select name='att' class='admin-input-sm'>";
											echo "<option value='0' selected>不限</option>";
											$tl->dsql->SetQuery("SELECT * FROM `#@__arcatt`");
											$tl->dsql->Execute();
											while($row = $tl->dsql->GetObject())
											{
												echo "<option value='{$row->att}'>{$row->attname}</option>";
											}
											echo "</select>";
											?>
										</td>
										<td>调用记录条数</td>
										<td><input type="text" name="row" id="row" value="10" class="admin-input-sm"></td>
									</tr>
									<tr>
										<td>显示列数</td>
										<td><input type="text" name="col" id="col" value="1" class="admin-input-sm"></td>
										<td>标题长度</td>
										<td><input type="text" name="titlelen" id="titlelen" value="24" class="admin-input-sm">（1字节=0.5个中文字）</td>
									</tr>
									<tr>
										<td>关键词</td>
										<td><input type="text" name="keyword" id="keyword" class="admin-input-sm">（英文逗号隔开）</td>
										<td>高级筛选</td>
										<td>
											<label><input type="checkbox" name="types[]" value="image"> 带缩略图</label>
											<label><input type="checkbox" name="types[]" value="commend"> 推荐</label>
											<label><input type="checkbox" name="types[]" value="spec"> 专题</label>
										</td>
									</tr>
									<tr>
										<td>文档发布时间</td>
										<td><input type="text" name="subday" value="0" id="subday" class="admin-input-sm">（天以内，0表示不限）</td>
										<td>排列顺序</td>
										<td>
											<select name="orderby" id="orderby" class="admin-input-sm">
												<option value="sortrank">置顶权限值</option>
												<option value="pubdate" selected>发布时间</option>
												<option value="senddate">录入时间</option>
												<option value="click">点击量</option>
												<option value="id">文档id</option>
												<option value="lastpost">最后评论时间</option>
												<option value="scores">评论积分</option>
												<option value="rand">随机获取</option>
											</select>
											<label><input type="radio" name="order" value="desc" checked> 由高到低</label>
											<label><input type="radio" name="order" value="asc"> 由低到高</label>
										</td>
									</tr>
									<tr>
										<td>提取特定文档</td>
										<td colspan="3">
											<textarea name="arcid" class="admin-textarea-sm"></textarea>
											<button type="button" id="selarc" class="btn btn-success btn-sm" onclick="SelectArcList('form1.arcid');">选择节点文档</button>
										</td>
									</tr>
									<tr>
										<td colspan="4"><textarea name="innertext" id="myinnertext" class="admin-textarea-xl">[field:textlink/]（[field:pubdate function=MyDate('m-d',@me)/]）<br></textarea></td>
									</tr>
									<tr>
										<td colspan="4" align="center">
											<a href="javascript:DoSubmit('gettag');" class="btn btn-success btn-sm">模板调用标记</a>
											<a href="javascript:DoSubmit('savetag');" class="btn btn-success btn-sm">模板调用标签</a>
										</td>
									</tr>
									<tr>
										<td colspan="4">
											<div class="admin-win-iframe"><iframe name="stafrm" frameborder="0" width="100%" height="100%" id="stafrm"></iframe></div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</form>
				</div>
			</div>
		</div>
		<script>
			function ChangeListStyle() {
				var itxt = document.getElementById("myinnertext");
				var myems = document.getElementsByName("liststyle");
				if (myems[0].checked) editor.setValue(document.getElementById("list1").innerHTML);
				else if (myems[1].checked) editor.setValue(document.getElementById("list2").innerHTML);
				else if (myems[2].checked) editor.setValue(document.getElementById("list3").innerHTML);
				else if (myems[3].checked) editor.setValue(document.getElementById("list4").innerHTML);
				itxt.value = itxt.value.replace("<br>", "<br>");
				itxt.value = itxt.value.toLowerCase();
			}
			function DoSubmit(j) {
				document.form1.dopost.value = j;
				document.form1.submit();
			}
			function SelectArcList(fname) {
				var pos = GetWinPos(800,600);
				window.open("content_select_list.php?f=" + fname, "selArcList", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + pos.left + ", top=" + pos.top);
			}
			var editor = CodeMirror.fromTextArea(document.getElementById("myinnertext"), {
				lineNumbers: true,
				lineWrapping: true,
				mode: 'text/html',
			});
		</script>
	</body>
</html>