<% userPageRights="{info}" %>
<!--#include file="check.asp"-->
<%
	'提升排序
if request("action")="add_index" then
  f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 
 mSql="update Info_Smallclass set f_index=f_index+1 where f_id="&f_ArticleID
  conn.execute mSql
  response.redirect "Admin_infoclass.asp"
end if

'降低排序
if request("action")="div_index" then
 f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 
mSql="update Info_Smallclass set f_index=f_index-1 where f_id="&f_ArticleID
  conn.execute mSql
  response.redirect "Admin_infoclass.asp"
end if

	'开启显示
if request("action")="add_off" then
  f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 
 mSql="update Info_Smallclass set f_off=1 where f_id="&f_ArticleID
  conn.execute mSql
  response.redirect "Admin_infoclass.asp"
end if

'关闭显示
if request("action")="div_off" then
 f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 
mSql="update Info_Smallclass set f_off=0 where f_id="&f_ArticleID
  conn.execute mSql
  response.redirect "Admin_infoclass.asp"
end if
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<%
if request("ctype")="bigdel" then
f_id=trim(Request("f_id"))
if f_id<>"" then
	sql="delete from info_BigClass where f_id="& f_id 
	conn.Execute sql
	sql="delete from info_SmallClass where f_bigclassid="& f_id
	conn.Execute sql
end if
conn.close
set conn=nothing     
response.redirect "admin_infoclass.asp"
end if
if request("ctype")="smalldel" then
SmallClassID=trim(Request("SmallClassID"))
if SmallClassID<>"" then
	sql="delete from info_SmallClass where f_ID="&Cint(SmallClassID)&""
	conn.Execute sql
end if
conn.close
set conn=nothing   
response.redirect "admin_infoclass.asp"
end if

dim sql,rsBigClass,rsSmallClass,ErrMsg
set rsBigClass=server.CreateObject("adodb.recordset")
rsBigClass.open "Select * From info_BigClass",conn,1,3
%>
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.BigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.form1.BigClassName.focus();
    return false;
  }
}
function checkSmall()
{
  if (document.form2.BigClassName.value=="")
  {
    alert("请先添加大类名称！");
	document.form1.BigClassName.focus();
	return false;
  }

  if (document.form2.SmallClassName.value=="")
  {
    alert("小类名称不能为空！");
	document.form2.SmallClassName.focus();
	return false;
  }
}
function ConfirmDelBig()
{
   if(confirm("确定要删除此大类吗？删除此大类同时将删除所包含的小类，并且不能恢复！"))
     return true;
   else
     return false;
	 
}

function ConfirmDelSmall()
{
   if(confirm("确定要删除此小类吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body text="#000000" >
<div align="center"><br>
  <strong> 类 别 设 置</strong> <br>
  <br>
  管理选项：<a href="ClassAddBig.asp">添加信息大类</a><br>
  <br>
  <br>
</div>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2" class="border">
  <tr bgcolor="#CCCCCC" class="title"> 
    <td width="191" height="26" align="center"><strong>栏目名称</strong></td>
    <td width="218" align="center">显示关开（1为显示，0为不显示）</td>
    <td width="165" align="center"><font color="#FF0000">(前台排序越大越前)</font></td>
    <td width="339" height="26" align="center"><strong>操作选项</strong></td>
  </tr>
  <%
	do while not rsBigClass.eof
%>
  <tr bgcolor="#f2f2f2" class="tdbg"> 
    <td width="191" height="22"><img src="Images/tree_folder4.gif" width="15" height="15"><%=rsBigClass("F_value")%></td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
    <td align="center"><a href="ClassAddSmall.asp?BigClassName=<%=rsBigClass("f_value")%>">添加子栏目</a> 
      | <a href="classmodifybig.asp?BigClassID=<%=rsBigClass("f_ID")%>">修改</a> 
      | <a href="admin_infoclass.asp?ctype=bigdel&f_id=<%=rsBigClass("f_id")%>" onClick="return ConfirmDelBig();">删除</a></td>
  </tr>
  <%
	  set rsSmallClass=server.CreateObject("adodb.recordset")
	  rsSmallClass.open "Select * From info_SmallClass Where f_bigclassid=" & rsBigClass("f_id") ,conn,1,3
	  if not(rsSmallClass.bof and rsSmallClass.eof) then
		do while not rsSmallClass.eof
	%>
  <tr bgcolor="#E3E3E3" class="tdbg"> 
    <td width="191" height="22">&nbsp;&nbsp;<img src="Images/tree_folder3.gif" width="15" height="15"><%=rsSmallClass("f_value")%> </td>
    <td align="center">[<%=rsSmallClass("f_off")%>] <span class="forumRow"><a title="开启" href="Admin_infoclass.asp?action=add_off&ArticleID=<%=rsSmallClass("f_id")%>">[开]</a> <a  title="关闭" href="Admin_infoclass.asp?action=div_off&ArticleID=<%=rsSmallClass("f_id")%>">[关]</a></span></td>
    <td align="center">[<%=rsSmallClass("f_index")%>] <span class="forumRow"><a title="上升" href="Admin_infoclass.asp?action=add_index&ArticleID=<%=rsSmallClass("f_id")%>">[+]</a> <a  title="降低" href="Admin_infoclass.asp?action=div_index&ArticleID=<%=rsSmallClass("f_id")%>">[-]</a></span></td>
    <td align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      <a href="ClassModifySmall.asp?SmallClassID=<%=rsSmallClass("f_ID")%>">修改</a> 
      | <a href="admin_infoclass.asp?ctype=smalldel&SmallClassID=<%=rsSmallClass("f_ID")%>" onClick="return ConfirmDelSmall();">删除</a></td>
  </tr>
  <%
			rsSmallClass.movenext
		loop
	  end if
	  rsSmallClass.close
	  set rsSmallClass=nothing	
	  rsBigClass.movenext
	loop
%>
</table>
</body>
</html>
