<!--#include file="../siteconfig/conn.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录，或者超时了！请重新登录');this.location.href='login.asp';</script>")
Response.End
End if
%>
<!--#include file="Admin_ClassFunction.asp"-->
<HTML>
<HEAD>
<TITLE>分类管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</HEAD>
<script language="JavaScript" type="text/javascript" src="js.js"></script>
<BODY>
<%dim Menu,Class_Id,Class_Name,Class_Memo,Class_TopClassId,Class_Html,Class_BottomHtml,Class_SkinId
Class_Id=Request("Class_Id")
Class_Name=Trim(Request("Class_Name"))
Class_Memo=Request("Class_Memo")
Class_TopClassId=Request("Class_TopClassId")
Class_Html=LCase(Trim(Request("Class_Html")))
Class_BottomHtml=Request("Class_BottomHtml")
Class_SkinId=Request("Class_SkinId")
Menu=Request("Menu")
redim ClassArray(0,6)
if Menu="UpClass" then

   rs.open"select Class_Id,Class_Html from Class where Class_Html='"&Class_Html&"'",conn,1,3
   if not rs.eof and not rs.bof then
      if rs("Class_Id")<>int(Class_Id) then
          Response.Write("<script language=javascript>alert('后缀名已存在');javascript:history.go(-1)</script>")
	      Response.End()
	  end if
   end if
   rs.close
   rs.open"select Class_Id,Class_Name,Class_Memo,Class_TopClassId,Class_Html,Class_BottomHtml,Class_SkinId from Class where Class_Id="&Class_Id,conn,1,3
   if not rs.eof then
      rs("Class_Name")=Class_Name
	  rs("Class_Memo")=Class_Memo
	  if Class_TopClassId<>Class_Id then rs("Class_TopClassId")=Class_TopClassId
	  rs("Class_Html")=Class_Html
	  rs("Class_BottomHtml")=Class_BottomHtml
	  rs("Class_SkinId")=Class_SkinId
   rs.update
   rs.close
   Response.Write("<script language=javascript>alert('分类修改成功');parent.window.location.reload();DivOpenClose('',2,0,0);</script>")
   Response.End()
   else
       Response.Write("<script language=javascript>alert('没有找在记录');DivOpenClose('',2,0,0);</script>")
   end if
end if
rs.open"select Class_Id,Class_Name,Class_Memo,Class_TopClassId,Class_Html,Class_BottomHtml,Class_SkinId from Class where Class_Id="&Class_Id,conn,1,3
   ClassArray(j,0)=rs("Class_Id")
   ClassArray(j,1)=rs("Class_Name")
   ClassArray(j,2)=rs("Class_Memo")
   ClassArray(j,3)=rs("Class_TopClassId")
   ClassArray(j,4)=rs("Class_Html")
   ClassArray(j,5)=rs("Class_BottomHtml")
   ClassArray(j,6)=rs("Class_SkinId")
rs.close%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr>
    <td width="45%">修改分类</td>
    <td width="55%" align="right"><a href="#" onClick="javascript:DivOpenClose('',2,0,0);return false">关闭</a></td>
  </tr>
</table>
<form name="ClassFrom" method="post" action="?Menu=UpClass" id="ClassFrom" onSubmit="return ClassCheck();">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr bgcolor="#FFFFFF">
    <td>分类ID</td>
    <td><%=ClassArray(i,0)%><input name="Class_Id" type="hidden" value="<%=ClassArray(i,0)%>"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>分类名称</td>
    <td><input name="Class_Name" type="text" class="inputcss" id="Class_Name" value="<%=ClassArray(i,1)%>" size="15"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>描术</td>
    <td><input name="Class_Memo" type="text" class="inputcss" id="Class_Memo" value="<%=ClassArray(i,2)%>" size="15"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>上级分类</td>
    <td><select name="Class_TopClassId" class="inputcss" id="Class_TopClassId">
      <option value="0" selected>-无上级分类-</option>
<%
set RsClass(0)=server.createobject("adodb.recordset")
RsClass(0).open "select Class_Id,Class_Name from Class where Class_TopClassId=0",conn,1,3
while not RsClass(0).eof
    if RsClass(0)("Class_Id")=ClassArray(j,0) then
	    response.write "<option value='"&RsClass(0)("Class_Id")&"' selected>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
	else
		response.write "<option value='"&RsClass(0)("Class_Id")&"'>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
	end if
	call listunder(1)
	RsClass(0).movenext
wend
%>
    </select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>分类后缀名</td>
    <td><input name="Class_Html" type="text" class="inputcss" id="Class_Html" value="<%=ClassArray(i,4)%>" size="10"> 
    生成静态页的后缀名</td>
  </tr>
  
  <tr bgcolor="#FFFFFF">
    <td>底部HTML</td>
    <td><textarea name="Class_BottomHtml" cols="30" rows="5" class="inputcss" id="Class_BottomHtml"><%=ClassArray(i,5)%></textarea> 支持HTML和JS</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>样式</td>
    <td><input name="Class_SkinId" type="text" class="inputcss" id="Class_SkinId" value="<%=ClassArray(i,6)%>" size="3"> 
    默让样式：0</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td><input name="Submit" type="submit" class="SubmitCss" value="修改分类"></td>
  </tr>
</table>
</form>
</BODY>
</HTML>

