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

'----------------------------------------------------------------------
if session("aleave")="check" then
response.write"<script language=javascript>alert('对不起，你没有这个权限！');"
response.write"javascript:history.go(-1)</script>"
response.end
end if

dim bigclassid,action,rs,newbigclassname,oldbigclassname,founderr,errmsg
bigclassid=trim(request("bigclassid"))
newbigclassid=trim(request("newbigclassid"))
action=trim(request("action"))
newbigclassname=trim(request("newbigclassname"))
oldbigclassname=trim(request("oldbigclassname"))
hide=request("hide")
url=trim(request("url"))
if bigclassid="" then
  response.redirect("classmanage2.asp")
end if
set rs=server.createobject("adodb.recordset")
rs.open "select * from bigclass2 where bigclassid=" & clng(bigclassid),conn,1,3
if rs.bof and rs.eof then
	founderr=true
	errmsg=errmsg & "<br><li>大类不存在！</li>"
else
	if action="modify" then
	if request("newbigclassid")<>request("bigclassid") then
		dim classid
		set rs2 = server.CreateObject ("adodb.recordset")
		sql="select bigclassid from bigclass2 where bigclassid="+cstr(request("newbigclassid"))
 		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
		end if
		if newbigclassname="" then
			founderr=true
			errmsg=errmsg & "<br><li>名称不能为空！</li>"
		end if
		if founderr<>true then
			rs("bigclassname")=newbigclassname
			rs("bigclassid")=newbigclassid
			rs("admin")=admin
			if hide="yes" then
			rs("hide")=true
			else
			rs("hide")=false
			end if
			rs("url")=url
			if url<>"" then
			rs("urlok")=true
			else
			rs("urlok")=false
			end if
    	 	rs.update
			rs.close
	     	set rs=nothing
			if newbigclassname<>oldbigclassname then
				conn.execute "update smallclass2 set bigclassname='" & newbigclassname & "' where bigclassname='" & oldbigclassname & "'"
				conn.execute "update news2 set bigclassname='" & newbigclassname & "' where bigclassname='" & oldbigclassname & "'"
     		end if		
			call closeconn()
     		response.redirect "classmanage2.asp" 
		end if
	end if
	if founderr=true then
		call writeerrmsg()
	else
%>
<script language="javascript" type="text/javascript">
function checkbig()
{
  if (document.form1.bigclassname.value=="")
  {
    alert("名称不能为空！");
    document.form1.bigclassname.focus();
    return false;
  }
}
</script>
<link href="../include/css.css" type=text/css rel=stylesheet>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"><br> <a href="classmanage2.asp"><strong>栏 目 设 置</strong></a> <br> 
    <br> <form name="form1" method="post" action="classmodifybig2.asp">
        <table width="80%" border="0" align="center" cellpadding="0" cellspacing="2" class="border">
          <tr class="title"> 
            <td height="25" colspan="2" align="center" bgcolor="#999999"><strong>修改大类名称</strong></td>
          </tr>
          <tr class="tdbg"> 
            <td width="126" bgcolor="#c0c0c0"><strong>大类序号：</strong></td>
            <td width="204" bgcolor="#e3e3e3"> 
			<input name="newbigclassid" type="text" id="newbigclassid" value="<%=rs("bigclassid")%>" size="20" maxlength="20">
			<input name="bigclassid" type="hidden" id="bigclassid" value="<%=rs("bigclassid")%>" size="20" maxlength="20"> 
              <input name="oldbigclassname" type="hidden" id="oldbigclassname" value="<%=rs("bigclassname")%>"></td>
          </tr>
          <tr class="tdbg"> 
            <td width="126" bgcolor="#c0c0c0"><strong>大类名称：</strong></td>
            <td bgcolor="#e3e3e3"> <input name="newbigclassname" type="text" id="newbigclassname" value="<%=rs("bigclassname")%>" size="20" maxlength="30"  /></td>
          </tr>
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td height="22" bgcolor="#c0c0c0"> <strong>外链接地址：</strong></td>
            <td bgcolor="#e3e3e3"> <input name="url" type="text" id="url" value="<%=rs("url")%>" size="20" maxlength="50"> 
            不需要请留空            </td>
          </tr>
		   <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td height="22" align="left" bgcolor="#c0c0c0"><strong>首页显示：</strong></td>
            <td width="218" bgcolor="#e3e3e3"><label>
              <input name="hide" type="checkbox" id="hide" value="yes" <%if rs("hide")=true then%>checked<%end if%> />
            （指首页版块）</label></td>
          </tr>
          <tr class="tdbg"> 
            <td align="center" bgcolor="#c0c0c0">&nbsp;</td>
            <td align="center" bgcolor="#e3e3e3"> <div align="left"> 
                <input name="action" type="hidden" id="action" value="modify">
                <input name="save" type="submit" id="save" value=" 修 改 ">
              </div></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<%
end if
end if
rs.close
set rs=nothing
%>


                                                              
                                                              
                                                              