<!DOCTYPE html>
<html>
<head>
  <meta charset="<?php echo $cfg_soft_lang; ?>">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <title><?php echo $diy->name; ?></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">
</head>
<body>
	<form action="diy_list.php" method="post">
		<input type="hidden" name="diyid" value="<?php echo $diyid; ?>">
		<table width="98%" cellpadding="1" cellspacing="1" align="center" class="table maintable mt-3 mb-3">
			<tr>
				<td colspan="3" height="26" background="../static/web/img/tbg.gif">
					<div style="float:left"><a href="diy_main.php">自定义表单管理</a> &gt; <?php echo $diy->name; ?></div>
					<div style="float:right;padding-right:10px"><a href="/apps/diy.php?action=list&diyid=<?php echo $diy->diyid; ?>" target="_blank"><i class="fa fa-globe" title="前台预览"></i> 前台预览</a></div>
				</td>
			</tr>
			{dede:datalist}
			<?php 
			if(!empty($fields))
			{
				$allowhtml = array('htmltext');
				$fields['sta'] = $fields['ifcheck'] == 1 ? '已审核':'未审核';
				echo '<tr bgcolor="#F8FCF1" height="26"><td width="18%"><input type="checkbox" name="id[]" value="'.$fields['id'].'" class="np"></td><td><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'">'.$fields['id'].'</a> '.$fields['sta'].'</td><td width="12%" align="center"><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'"><i class="btn btn-sm fa fa-pencil-square-o" title="修改"></i></a></td></tr>';
				foreach($fieldlist as $field=>$fielddata)
				{
					if($fields[$field]=='') continue;
					if($fielddata[1]=='img'){
					$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><i class='fa fa-picture-o'></i> 图片附件</a>";
					}
					else if($fielddata[1]=='addon'){
					$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><i class='fa fa-file-text-o'></i> 其它附件</a>";
					} else {
						if(!in_array($fielddata[1],$allowhtml)){
							$fields[$field] = dede_htmlspecialchars($fields[$field]);
						}
					}
					echo '<tr><td bgcolor="#fff">'.$fielddata[0].'</td><td bgcolor="#fff" colspan="2">'.$fields[$field].'</td></tr>';
				}
			} else {
				echo '<tr><td bgcolor="#fff">暂无记录</td></tr>';
			}
			?>
			{/dede:datalist}
			<tr>
				<td colspan="3" height="26" bgcolor="#fff">{dede:pagelist listsize='6'/}</td>
			</tr>
			<tr>
				<td bgcolor="#f8f8f8" colspan="3" class="py-3">
					<input type="button" name="select" onClick="selAll()" class="btn btn-success btn-sm" value="全选">
					<input type="button" name="select" onClick="noSelAll()" class="btn btn-success btn-sm" value="取消">&nbsp;
					<label><input type="radio" name="action" value="check">&nbsp;审核</label>
					<label><input type="radio" name="action" value="delete">&nbsp;删除</label>
					<input type="submit" name="submit" class="btn btn-success btn-sm" value="提交">
				</td>
			</tr>
		</table>
	</form>
	<script>
	function selAll(){
    	var a = document.getElementsByTagName("input");
    	for (var i = 0; i < a.length; i++){
        	if (a[i].type == "checkbox") a[i].checked = true;
    	}
	}
	function noSelAll(){
    	var a = document.getElementsByTagName("input");
    	for (var i = 0; i < a.length; i++){
        	if (a[i].type == "checkbox") a[i].checked = false;
    	}
	}
	</script>
</body>
</html>