<!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">
	</head>
	<body>
		<form name="form1" action="mychannel_add.php" method="post">
			<input type="hidden" name="action" value="add">
			<table class="table shadow-sm my-3">
				<tr>
					<td colspan="2"><a href="mychannel_main.php">文档模型管理</a> - 新增文档模型</td>
				</tr>
				<tr>
					<td width="260">模型性质：</td>
					<td>
						<label><input type="radio" name="issystem" id="is1" value="0" onclick="PublicDefault();" checked> 自动模型</label>
						<label><input type="radio" name="issystem" id="is2" value="1" onclick="PublicDefault();"> 系统模型</label>
						<label><input type="radio" name="issystem" id="is3" value="-1" onclick="PublicDefault();"> 独立模型</label>
						<span>（系统模型禁止删除，独立模型具有单独主表，自动创建字段aid、栏目id、文档标题等，文档必须点击栏目进入列表管理）</span>
					</td>
				</tr>
				<tr>
					<td>模型id：</td>
					<td>
						<input type="text" name="id" id="id" class="admin-input-xs" value="<?php echo $newid;?>">
						<span>（创建后不可修改，具有唯一性）</span>
					</td>
				</tr>
				<tr>
					<td>模型标识：</td>
					<td>
						<input type="text" name="nid" id="nid" class="admin-input-sm" value="model<?php echo $newid;?>">
						<span>（建议由英文、数字或下划线组成，示例article_名字标识.htm，列表和封面模板类推）</span>
					</td>
				</tr>
				<tr>
					<td>模型名称：</td>
					<td><input type="text" name="typename" id="typename" class="admin-input-sm" value="模型<?php echo $newid;?>">（后台管理和会员发布显示名称）</td>
				</tr>
				<tr>
					<td>附加表：</td>
					<td>
						<input type="text" name="addtable" id="addtable" class="admin-input-sm" value="<?php echo $cfg_dbprefix,'new',$newid;?>">
						<label><input type="checkbox" name="isdel" id="isdel" value="1"> 删除已有表</label>
						<span>（#@__表示数据表前缀，文档模型主表外其它数据存放附加表）</span>
					</td>
				</tr>
				<tr>
					<td>是否支持会员投稿：</td>
					<td>
						<label><input type="radio" name="issend" value="0" checked> 不支持</label>
						<label><input type="radio" name="issend" value="1"> 支持</label>
					</td>
				</tr>
				<tr>
					<td>会员投稿级别：</td>
					<td>
						<select name="sendrank" id="sendrank" class="admin-input-sm">
							<option value="0">游客</option>
							<?php
							$urank = $cuserLogin->getUserRank();
							$dsql->SetQuery("SELECT * FROM `#@__arcrank` where adminrank<='$urank' And `rank` >= 10");
							$dsql->Execute();
							while($row2 = $dsql->GetObject())
							{
								echo "<option value='".$row2->rank."'>".$row2->membername."</option>";
							}
							?>
						</select>
						<span>（为了系统安全，游客投稿已禁止，开启游客投稿功能，到会员发布文件删除禁止游客操作）</span>
					</td>
				</tr>
				<tr>
					<td>会员投稿组：</td>
					<td>
						<?php
						$dsql->SetQuery("SELECT * FROM `#@__member_model`");
						$dsql->Execute();
						while($row3 = $dsql->GetObject())
						{
							echo "<label><input type='radio' name='usertype' value=".$row3->name."> ".$row3->name."</label>";
						}
						?>
						<label><input type="radio" name="usertype" checked> 不限</label>
					</td>
				</tr>
				<tr>
					<td>会员投稿默认状态：</td>
					<td>
						<label><input type="radio" name="arcsta" value="-1" checked> 待审核</label>
						<label><input type="radio" name="arcsta" value="0"> 已审核（更新静态页）</label>
						<label><input type="radio" name="arcsta" value="1"> 已审核（使用动态页）</label>
					</td>
				</tr>
				<tr>
					<td>投稿标题使用名称：</td>
					<td><input type="text" name="titlename" id="titlename" class="admin-input-sm" value="标题"></td>
				</tr>
				<tr>
					<td>投稿是否使用摘要：</td>
					<td>
						<label><input type="radio" name="needdes" value="1" checked> 使用</label>
						<label><input type="radio" name="needdes" value="0"> 不使用</label>
					</td>
				</tr>
				<tr>
					<td>投稿是否使用缩图：</td>
					<td>
						<label><input type="radio" name="needpic" value="1" checked> 使用</label>
						<label><input type="radio" name="needpic" value="0"> 不使用</label>
					</td>
				</tr>
				<tr>
					<td>默认栏目id：</td>
					<td><input type="text" name="dfcid" id="dfcid" class="admin-input-xs" value="0">（与投稿唯一性结合可以用自定义模型）</td>
				</tr>
				<tr>
					<td>投稿具有唯一性：</td>
					<td>
						<label><input type="radio" name="onlyone" value="1"> 是</label>
						<label><input type="radio" name="onlyone" value="0" checked> 不是</label>
						<span>（与投稿唯一会员只能在该模型对应栏目中发布文档，其作用相当于自定义表单）</span>
					</td>
				</tr>
				<tr>
					<td>文档发布程序：</td>
					<td><input type="text" name="addcon" id="addcon" class="admin-input-sm" value="archives_add.php"></td>
				</tr>
				<tr>
					<td>文档修改程序：</td>
					<td><input type="text" name="editcon" id="editcon" class="admin-input-sm" value="archives_edit.php"></td>
				</tr>
				<tr>
					<td>文档管理程序：</td>
					<td><input type="text" name="mancon" id="mancon" class="admin-input-sm" value="content_list.php"></td>
				</tr>
				<tr>
					<td>前台会员发布程序：</td>
					<td><input type="text" name="useraddcon" id="useraddcon" class="admin-input-sm" value="archives_add.php"></td>
				</tr>
				<tr>
					<td>前台会员修改程序：</td>
					<td><input type="text" name="usereditcon" id="usereditcon" class="admin-input-sm" value="archives_edit.php"></td>
				</tr>
				<tr>
					<td>前台会员管理程序：</td>
					<td><input type="text" name="usermancon" id="usermancon" class="admin-input-sm" value="content_list.php"></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button type="submit" class="btn btn-success btn-sm">保存</button>
						<button type="button" class="btn btn-outline-success btn-sm" onclick="location='mychannel_main.php';">返回</button>
					</td>
				</tr>
			</table>
		</form>
		<script>
			function $Obj(objname) {
				return document.getElementById(objname);
			}
			function ShowHide2(objname) {
				var obj = $Obj(objname);
				if (obj.style.display != 'block') { obj.style.display = 'block' }
				else { obj.style.display = 'none'; }
			}
			function PublicDefault() {
				if ($Obj('is1').checked || $Obj('is2').checked) {
					$Obj("addcon").value = "archives_add.php";
					$Obj("editcon").value = "archives_edit.php";
					$Obj("mancon").value = "content_list.php";
					$Obj("useraddcon").value = "archives_add.php";
					$Obj("usereditcon").value = "archives_edit.php";
					$Obj("usermancon").value = "content_list.php";
				} else {
					$Obj("addcon").value = "archives_sg_add.php";
					$Obj("editcon").value = "archives_sg_edit.php";
					$Obj("mancon").value = "content_sg_list.php";
					$Obj("useraddcon").value = "archives_sg_add.php";
					$Obj("usereditcon").value = "archives_sg_edit.php";
					$Obj("usermancon").value = "content_sg_list.php";
				}
			}
		</script>
	</body>
</html>