<%@language=vbscript codepage=936 %>
<!--#include file="Admin.asp" -->
<!--#include file="cf.asp" -->
<!--#include file="adminconn.asp" -->
<!--#include file="../include/safe.asp"-->


<%
dim action,bigclassname,rs,founderr,errmsg
action=trim(request("action"))
bigclassid=trim(request("bigclassid"))
bigclassname=trim(request("bigclassname"))
url=trim(request("url"))
hide=request("hide")
if action="add" then
		dim classid
		set rs2 = server.CreateObject ("adodb.recordset")
		sql="select bigclassid from bigclass2 where bigclassid="+cstr(request("bigclassid"))
 		rs2.open sql,conn,1,1
		if not rs2.eof and not rs2.bof then
		rs2.close
		set rs2=nothing%>
		<script language=javascript>  
			alert( "错误：总类ID号有重复"  );
			location.href = "javascript:history.back()"  
		</script>
		<%
		response.End()
		end if
	if bigclassname="" then
		founderr=true
		errmsg=errmsg & "<br><li>文章大类名不能为空！</li>"
	end if
	if bigclassid="" then
		founderr=true
		errmsg=errmsg & "<br><li>文章大类名不能为空！</li>"
	end if
	if founderr<>true then
		set rs=server.createobject("adodb.recordset")
		rs.open "select * from bigclass2 where bigclassname='" & bigclassname & "'",conn,1,3
		if not (rs.bof and rs.eof) then
			founderr=true
			errmsg=errmsg & "<br><li>文章大类“" & bigclassname & "”已经存在！</li>"
		else
    	 	rs.addnew
     		rs("bigclassid")=bigclassid
			rs("bigclassname")=bigclassname
			if hide="yse" then
			rs("hide")=true
			else
			rs("hide")=false
			end if
			rs("url")=url
			if url<>"" then
			rs("urlok")=true
			end if
    	 	rs.update
     		rs.close
	     	set rs=nothing
    	 	call closeconn()
			response.redirect "classmanage2.asp"  
		end if
	end if
end if
if founderr=true then
	response.Write ""&errmsg&""
else
%>

<link href="../include/css.css" type=text/css rel=stylesheet>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"> <br>
      <a href="classmanage.asp"><strong> 栏  目 设 置</strong></a> <br>
      <form name="form1" method="post" action="classaddbig2.asp" onsubmit="return checkbig()">
        <table width="89%" border="0" align="center" cellpadding="0" cellspacing="2" class="border">
          <tr bgcolor="#999999" class="title"> 
            <td height="25" colspan="3" align="center"><strong>添加栏目</strong></td>
          </tr>
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>栏目序号：</strong></div></td>
            <td bgcolor="#e3e3e3" > <input name="bigclassid" type="text" size="20" maxlength="30">
            （请填写数字） 
          </td>
          </tr>
          <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>栏目名称：</strong></div></td>
            <td bgcolor="#e3e3e3"> <label><input name="bigclassname" type="text" size="20" maxlength="20"  /></label>
            </td>
          </tr> 

   
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>外链接地址：</strong></div></td>
            <td bgcolor="#e3e3e3" > <input name="url" type="text" id="url" size="20" maxlength="50"> 
            不需要请留空            </td>
          </tr>
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>首页显示：</strong></div></td>
            <td width="517" bgcolor="#e3e3e3" ><label>
              <input name="hide" type="checkbox" id="hide" value="yes" checked="checked" />
            （指首页版块）</label></td>
          </tr>
		  
          <tr bgcolor="#c0c0c0" class="tdbg"> 
            <td height="22" align="center" bgcolor="#c0c0c0">&nbsp; </td>
            <td height="22" align="center" bgcolor="#e3e3e3" > <div align="left"> 
                <input name="action" type="hidden" id="action" value="add">
                <input name="add" type="submit" value=" 添 加 ">
              </div></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<%
end if
%>