<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Conn/conn.asp"-->
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" href="../css/indexTwo.css" type="text/css">
<title>网站后台</title>
</head>
<body>
<script type="text/javascript">
function CheckForm1()
{
			if(document.form1.name.value=="")
			{
				alert("请输入属性名称！");
				document.form1.name.focus();
				return false;
			}
			if(document.form1.order.value == "")
			{
				alert("请输入属性序号！");
				document.form1.order.focus();
				return false;
			}
			if(isNaN(document.form1.order.value))
			{   
				  alert("序号必须输入整数");
				  return false;
			}
}
</script>
<%
Tag=request("tag")
SortID=request("SortID")

sql="select top 1 * from TbNewsSort where id="&SortID
rs.open sql,conn,1,1
if not rs.eof then
	SortName=rs("name")
end if
rs.close
if request("action")="add" then
	select case Tag
  		case "AddText"
			Name1=request.Form("name")
			order=request.Form("order")
			sql="select * from TbNewsProperty"
			rs.open sql,conn,1,3
			rs.addnew
			rs("name")=Name1
			rs("order")=order
			rs("mode")=1
			rs("sortId")=SortID
			rs.update
			rs.close
			response.write "<script> alert('添加成功');window.document.location.href='News_Sort_Set.asp?SortID="&SortID&"';   </script>"
			response.End
		case "AddCheckBox"
			Name1=request.Form("name")
			order=request.Form("order")
			sql="select * from TbNewsProperty"
			rs.open sql,conn,1,3
			rs.addnew
			rs("name")=Name1
			rs("order")=order
			rs("mode")=2
			rs("sortId")=SortID
			rs.update
			rs.close
			response.write "<script> alert('添加成功');window.document.location.href='News_Sort_Set.asp?SortID="&SortID&"';   </script>"
			response.End
		case "AddFile"
			Name1=request.Form("name")
			order=request.Form("order")
			sql="select * from TbNewsProperty"
			rs.open sql,conn,1,3
			rs.addnew
			rs("name")=Name1
			rs("order")=order
			rs("mode")=3
			rs("sortId")=SortID
			rs.update
			rs.close
			response.write "<script> alert('添加成功');window.document.location.href='News_Sort_Set.asp?SortID="&SortID&"';   </script>"
	end select
end if
%>
<table width="100%" border="0" cellspacing="1" class="Navi2">
  <tr>
    <th colspan="2"><%=SortName&"——"%>添加信息类别属性</th>
    <th><a href="News_Sort_Set.asp?SortID=<%=SortID%>" class="link2">返回</a></th>
  </tr>
</table>
  <table width="100%" border="0" cellspacing="1" class="Navi2">
  <%
  select case Tag
  	case "AddText"
		call AddText(SortID)
	case "AddCheckBox"
		call AddCheckBox(SortID)
	case "AddFile"
		call AddFile(SortID)
  end select
  %>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
  </table>
</body>
</html>
<!--#include file="../Conn/conn_close.asp"-->
<%
sub AddText(SortID)
	response.Write("<form name='form1' method='post' action='?tag="&Tag&"&SortID="&SortID&"' onsubmit='return CheckForm1(this);'>")
	response.Write("<tr>")
    response.Write("  <th colspan='3'>文本框属性</th>")
    response.Write("</tr>")
	response.Write("<tr>")
	response.Write("<td style='width:150px;'>")
	response.Write("属性名称")
	response.Write("<input type='hidden' name='action' value='add' />")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='name' value='' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td>")
	response.Write("属性序号")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='order' value='1' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td colspan='2' style='padding-left:158px;'>")
	response.Write("<input type='submit' name='submit' value='提交' />")
	response.Write("</td>")
	response.Write("</tr>")
	response.Write("</form>")
end sub
sub AddCheckBox(SortID)
	response.Write("<form name='form1' method='post' action='?tag="&Tag&"&SortID="&SortID&"' onsubmit='return CheckForm1(this);'>")
	response.Write("<tr>")
    response.Write("  <th colspan='3'>复选框属性</th>")
    response.Write("</tr>")
	response.Write("<tr>")
	response.Write("<td style='width:150px;'>")
	response.Write("属性名称")
	response.Write("<input type='hidden' name='action' value='add' />")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='name' value='' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td>")
	response.Write("属性序号")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='order' value='1' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td colspan='2' style='padding-left:158px;'>")
	response.Write("<input type='submit' name='submit' value='提交' />")
	response.Write("</td>")
	response.Write("</tr>")
	response.Write("</form>")
end sub
sub AddFile(SortID)
	response.Write("<form name='form1' method='post' action='?tag="&Tag&"&SortID="&SortID&"' onsubmit='return CheckForm1(this);'>")
	response.Write("<tr>")
    response.Write("  <th colspan='3'>上传文件属性</th>")
    response.Write("</tr>")
	response.Write("<tr>")
	response.Write("<td style='width:150px;'>")
	response.Write("属性名称")
	response.Write("<input type='hidden' name='action' value='add' />")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='name' value='' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td>")
	response.Write("属性序号")
	response.Write("</td>")
	response.Write("<td style='padding-left:8px;'>")
	response.Write("<input type='text' name='order' value='1' />")
	response.Write("</td>")
	response.Write("</tr>")
	
	response.Write("<tr>")
	response.Write("<td colspan='2' style='padding-left:158px;'>")
	response.Write("<input type='submit' name='submit' value='提交' />")
	response.Write("</td>")
	response.Write("</tr>")
	response.Write("</form>")
end sub
%>