<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%call chksunzom()
if requestA("id")="" then Response.Write "<script language='javascript'>alert('请选择管理选项！');history.back();</script>":Response.end

chk=requestA("chk")
mxid=requestA("mxid")
isdel=chk0(requestA("del"))

zdid=replace(requestA("id")," ","")
id=split(zdid,",")
Dim FieldRS,ColumnType

mxbiao=cdatx("mxdat","SZ_mx","where id="&mxid&"")
zdhz=replace(requestA("zdhz")," ","")
zwzd1=replace(requestA("zuzw1")," ","")

if chk="editok" then
mxbiao=cdatx("mxdat","SZ_mx","where id="&mxid&"")
for i=0 to UBound(id)
if isdel=1 then

			Dim RSObj:Set RSObj=Server.CreateObject("ADODB.RECORDSET")
			RSObj.Open "Select FieldName,FieldType,ShowUnit From SZ_zd Where id="&id(i)&"",Conn,1,3
			if Not RSObj.Eof then
			  'If left(Lcase(RSObj(0)),3)="ZD_" Then
			  if CheckFields (""&mxbiao&"",""&RSObj(0)&"")=1 then
			      Conn.Execute("Alter Table "& mxbiao &" Drop "& RSObj(0) &"")
				  If RSObj("ShowUnit")="1" Then Conn.Execute("Alter Table "& mxbiao &" Drop "& RSObj(0) &"_Unit")
			  end if
			  'End If
			end if
			RSObj.Close:Set RSObj=Nothing
sql="delete from SZ_zd where id=" & id(i)
conn.execute(sql)
czxxs="删除"

else
Set FieldRS = Server.CreateObject("ADODB.RECORDSET")
 FieldSql = "Select top 1 * From [SZ_zd] Where id="&id(i)
 FieldRS.Open FieldSql, conn, 1, 3
 
FieldRS("ShowOnForm") = chk0(requestA("ShowOnForm"))
FieldRS("zdbbxs")=chk0(requestA("zdbbxs"))
FieldRS("zdkd")=chk0(requestA("zdkd"))
FieldRS("MustFillTF")=chk0(requestA("MustFillTF"))
'FieldRS("zdhz")=zdhz
FieldRS("zwzd1")=zwzd1
if requestA("Width")<>"" then  FieldRS("Width")=requestA("Width")
if requestA("MaxLength")<>"" then  FieldRS("MaxLength")=requestA("MaxLength")
FieldRS.Update
FieldRS.Close
czxxs="修改"
end if
rznr=rznr&","&id(i)
next
conn.execute("insert into rizi(username,class,address,rznr) values('"&nowuser&"','字段批量修改','"&userip&"','"&rznr&"')")
Response.Write ("<Script> if (confirm('批量["&czxxs&"]成功！')) {window.history.go(-2);} else{window.location.href='"&request.ServerVariables("HTTP_REFERER")&"';}</script>"):Response.end
end if
%> 
<html>
<head>
<title><%=dianming%> - 字段管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/sunzom.css" rel="stylesheet" type="text/css">
<script language='JavaScript' src='../inc/jquery.js'></script>
</HEAD>
<BODY>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr> 
    <td>&nbsp;<input onclick="location.href='zd.asp?chk=ziduan&id=<%=mxid%>'" value="返回上页"  type=button name="moren">  <input onclick="location.href='mx.asp'" value="模型首页"  type=button name="moren">
   </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td> &nbsp;字段批量管理</td>
	  <td align="right"></td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<%
if chk="add" or chk="edit" then
if chk="edit" then
chklx="editok"
else
chklx="addok"
end if
%>
<div align="center">
<table cellpadding="4" cellspacing="1" class="toptable grid" border="1" width="1325">
  <form  action='xx_pi.asp?chk=<%=chklx%>&mxid=<%=mxid%>&id=<%=zdid%>' method='post' name='OrigArticlerm' onsubmit='return(CheckForm())'>    <input type="hidden" name="FieldType" size="1" value="<%=FieldType%>"><input type="hidden" name="FieldName" size="1" value="<%=mrzd%>">    <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      <td height='30' align='right' class='clefttitle'><strong>所属模型：</strong></td>      
		<td> &nbsp;&nbsp;<font color=#ff0000><%=cdatx("mxname","SZ_mx","where id="&mxid&"")%>(<%=mxbiao%>)</font><input type='hidden' value='<%=mxid%>' name='ChannelID'></td>    </tr><tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      
		<td align='right' class='clefttitle'><strong>字段ID：</strong></td>
		<td>&nbsp;&nbsp;<input name='zdid' type="hidden" value="<%=zdid%>"><%=zdid%>    
		<input type="checkbox" name="del" value="1">全部删除</td>    </tr><tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      
		<td height='30' align='right' class='clefttitle'>字段属性(选中有效)：</td>      
		<td height='45'>
		<input type="checkbox" name="ShowOnForm" value="1" checked >开启 
		<input type="checkbox" name="zdkd" value="1">不可编辑&nbsp;<input type="checkbox" name="MustFillTF" value="1">必填&nbsp;</td>    </tr>        <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      <td height='30' align='right'' class='clefttitle'>
		表单操作权限：</td>      
		<td><%=zwxuan(zwzd1,"zuzw1","duo")%><br>全空或默认为全部职位可操作(添加、删除)</td>    </tr>        <tbody id='editorarea'>    </tbody><tbody id="extarea">    </tbody>    <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      <td height='30' align='right' ' class='clefttitle'><strong>显示设置：</strong> </td>      
		<td>&nbsp;&nbsp;宽度<input name='Width' type='text' site='10' class='textbox' style='width:40px' id='Width' size="10">px <font color=red>例如：200px</font>  长度<input name='MaxLength' type='text' site='10' class='textbox' style='width:40px' id='MaxLength' size="10">个字符 不限制请输入0       </td>    </tr>    <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      <td height='30' align='right' ' class='clefttitle'>
		数据汇总属性：</td>      
		<td><input type="radio" name="zdhz" value="">空
		<input type="radio" name="zdhz" value="j1xx">+小项   
		<input type="radio" name="zdhz" value="j2xx" >-小项
		<input type="radio" name="zdhz" value="hhj">行合计
 		<input type="checkbox" name="zdhz" value="ltj">列统计  
</td>    </tr>   <input type='hidden' value='' name='id'>    <input type='hidden' value='' name='page'>    <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">      <td height='30' align='right' ' class='clefttitle'>　</td>      
		<td><input name="submit" type="submit" value=" 确 认 " onClick="return check()"  class="button"></td>    </tr>   </form></table>
</div>
<%end if%>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</body>
</html>