<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%call chksunzom()
id=chk0(requestA("id"))
chk=requestA("chk")
zdok=int(chk0(requestA("zdok")))
mxname1=requestA("mxname")
xmname1=requestA("xmname")
mxbiao=""&bqz&""&requestA("mxdat1")&""
bid1=requestA("mxid1")

if chk="cok" then
if CheckTable(mxbiao)=0 and len(mxbiao)>3 then '判断表是否存在
Conn.Execute("insert into [SZ_mx] (mxname,mxdat,mxzt,xmname,mxdw,mxms,mxcd,cdlx,bdys,bid,bzd,bbal,glqx,bbxian) select '"&mxname1&"','"&mxbiao&"',mxzt,'"&xmname1&"',mxdw,mxms,mxcd,cdlx,bdys,"&bid1&",bzd,bbal,glqx,bbxian from [SZ_mx] where id="&id&"" )

mxbiaoy=cdatx("mxdat","SZ_mx","where id="&id&"")
conn.execute("select * into "&mxbiao&" from "&mxbiaoy&"")
conn.execute("delete * from "&mxbiao&"")

if zdok=1 then
mxid1=cdatx("id","SZ_mx","where mxdat='"&mxbiao&"'")
sql="select * from SZ_zd where ChannelID="&id&" order by id asc"
set rsb2=conn.execute(sql)
if not rsb2.bof then
do while not rsb2.eof
zid=rsb2("id")
Conn.Execute("insert into [SZ_zd] (ChannelID,FieldName,Title,Tips,FieldType,DefaultValue,Options,MustFillTF,ShowOnForm,ShowOnUserForm,OrderID,AllowFileExt,Width,Height,MaxFileSize,EditorType,ShowUnit,UnitOptions,ParentFieldName,MaxLength,zdkd,zdbbxs,zdhz,zwzd1,zwzd2,zdlx,fuzhi,gongs) select "&mxid1&",FieldName,Title,Tips,FieldType,DefaultValue,Options,MustFillTF,ShowOnForm,ShowOnUserForm,OrderID,AllowFileExt,Width,Height,MaxFileSize,EditorType,ShowUnit,UnitOptions,ParentFieldName,MaxLength,zdkd,zdbbxs,zdhz,zwzd1,zwzd2,zdlx,fuzhi,gongs from [SZ_zd] where id="&zid&"" )
rsb2.movenext
loop
end if
rsb2.close:set rsb2=nothing

end if
else
Response.Write "<script language='javascript'>alert('"&mxbiao&"数据库表已经存在请重设1！');history.back();</script>" 
response.end
end if
Response.Write ("<Script> if (confirm('复制成功,继续复制吗?')) { location.href='fz.asp?chk=mx&id="&id&"';} else{location.href='mx.asp';}</script>")

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 type="text/javascript" src="/inc/ctoe.js"></script>
<script language="javascript">
function check()
{
if (document.form1.mxname.value==""||document.form1.mxml.value==""||document.form1.mxdat.value==""||document.form1.xmname.value=="")
{
alert("有*号的必须填写！");
return false;
}
}

function gbcount(message)
{
document.all("xmname").value = message;
document.all("mxdat1").value = getPinyin(message);
}
</script>
</HEAD>
<BODY>
<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 bgcolor="#FFFFFF" style="padding: 10px" align="center">
<form method="POST" action="?chk=cok&id=<%=id%>" name="form1" style="text-align: left; padding-left: 300px">
<b><font size="4">将ID为[<%=id%>]模型复制到</font></b><br>
模型分类：<%=mxxuan(bid,"")%> 不选择为顶级模型&nbsp; 
<p> <input type="checkbox" name="zdok" value="1" checked>附加原模型字段 <br>新模型名称：<input type="text" onkeydown=gbcount(this.value); onkeyup=gbcount(this.value); name="mxname" size="20">&nbsp;*&nbsp;
</p>新项目名称：<input type="text" name="xmname"  size="20"> *
<p>新数据库表：<%=bqz%><input type="text" name="mxdat1" style="width:80; height:24" size="30" title="创建数据表后无法修改，并且用户创建的数据表以"MX_"开头">* 
创建数据表后无法修改</p>
<p><br><input name="submit" type="submit" value="确认复制" onClick="return check()"></p>
</form></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>