<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>字段管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">字段管理</a></li>
			<li><a href="?file=membermodel&action=add_fields&modelid=<?php echo $modelid;?>">添加字段</a></li>			
		</ul>
	</div>
	<div class="main">
		<fieldset>
		<legend>字段调用方法</legend>
		1：假如在调用标记里调用字段用 {{mydc:字段名}} ；2：假如用在店铺页调用字段用 {{$字段名}}
		</fieldset>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="51" class="firstcol">排序</th>
			<th width="102">字段名</th>
			<th width="95">别名</th>
			<th width="75">是否禁用</th>
			<th width="70">基本选项</th>
			<th width="95">CSS样式名</th>
			<th width="60">管理</th>
		</tr>
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<input type="hidden" name="modelid" value="<?php echo $modelid;?>" />
		<?php if($result){foreach($result as $val){?>
		<tr>
			<td width="51" align="center"><input type="hidden" name="id[]" value="<?php echo $val['id'];?>" /><input type="text" name="orderby[]" size="2" value="<?php echo $val['orderby'];?>" /></td>
			<td width="102" align="left"><?php echo $val['name'];?></td>
			<td width="95" align="center"><input type="text" name="fieldsname[]" size="15" value="<?php echo $val['fieldname'];?>" /></td>
			<td width="75" align="center"><?php echo $val['disabled']?'<font color="#999999">已禁用</font> <a href="'.ADMIN_FILE.'?file=membermodel&action=disable_fields&modelid='.$modelid.'&disable=0&id='.$val['id'].'"><u>启用</u></a>':'已启用 <a href="'.ADMIN_FILE.'?file=membermodel&action=disable_fields&modelid='.$modelid.'&disable=1&id='.$val['id'].'"><u>禁用</u></a>';?></td>
			<td width="70" align="center"><?php echo $val['isbase']?'√ <a href="'.ADMIN_FILE.'?file=membermodel&action=setbase_fields&modelid='.$modelid.'&isbase=0&id='.$val['id'].'"><u>取消</u></a>':'×  <a href="'.ADMIN_FILE.'?file=membermodel&action=setbase_fields&modelid='.$modelid.'&isbase=1&id='.$val['id'].'"><u>设置</u></a>';?></td>
			<td width="95" align="center"><input type="text" name="css[]" size="15" value="<?php echo $val['css'];?>" /></td>
			<td width="60" align="center"><a href="?file=membermodel&action=edit_fields&id=<?php echo $val['id'];?>">修改</a> <?php if(!$val['issystem']){?><a href="javascript:confirmUrl('您确实要删除字段【<?php echo $val['fieldname'];?>】吗？','<?php echo ADMIN_FILE;?>?file=membermodel&action=delete_fields&id=<?php echo $val['id'];?>&name=<?php echo $val['name'];?>&modelid=<?php echo $modelid;?>')">删除</a><?php }else{echo '<font color="#999999">删除</font>';}?></td>
		</tr>
		<?php }?>
		<tr>
			<td colspan="8" align="left">
			<input type="button" onclick="this.form.submit();" class="submit" value="批量修改" />
			<input type="button" onclick="window.open('<?php echo ADMIN_FILE;?>?file=membermodel&action=preview&modelid=<?php echo $modelid;?>');" class="submit" value="预览模型" />
			</td>
		</tr>
		</form>
		<?php }else{?>
		<tr><td colspan="8">该模型目前尚未添加任何字段...</td></tr>	
		<?php }?>
		</table>
	</div>
</div>
</body>
</html>