<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true	
Const PurviewLevel=2    '操作权限
%>
<!--#include file="Admin_ChkPurview.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
sub ResetClass()
	dim i,sql,rs,SuccessMsg,iCount,PrevID,NextID
	sql="select ClassID From ArticleClass order by RootID,OrderID"
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,1
	iCount=rs.recordcount
	i=1
	PrevID=0
	do while not rs.eof
		rs.movenext
		if rs.eof then
			NextID=0
		else
			NextID=rs(0)
		end if
		rs.moveprevious
		conn.execute("update ArticleClass set RootID=" & i & ",OrderID=0,ParentID=0,Child=0,ParentPath='0',Depth=0,PrevID=" & PrevID & ",NextID=" & NextID & " where ClassID=" & rs(0))
		PrevID=rs(0)
		i=i+1
		rs.movenext
	loop
	rs.close
	set rs=nothing	
	
	SuccessMsg="复位成功！请返回<a href='Admin_ClassManage.asp'>栏目管理首页</a>做栏目的归属设置。"
	call WriteSuccessMsg(SuccessMsg)
end sub
%>
<html>
<head>
<title>一级栏目重新排序</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>栏 目 管 理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="70" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="Admin_ClassManage.asp">栏目管理首页</a> | <a href="Admin_ClassAdd.asp">添加一级栏目</a>&nbsp;|&nbsp;<a href="Admin_ClassOrder.asp">一级栏目排序</a>&nbsp;|&nbsp;<a href="Admin_ClassOrderN.asp">N级栏目排序</a>&nbsp;|&nbsp;<a href="Admin_ClassReset.asp">复位所有栏目</a>&nbsp;|&nbsp;<a href="Admin_ClassUnite.asp">栏目合并</a></td>
  </tr>
</table>
<br> 
<% 
dim Action,FoundErr,ErrMsg 
Action=trim(request("Action")) 
if Action="Reset" then 
	call ResetClass() 
else 
	call main() 
end if 
call CloseConn() 
 
sub main() 
%> 
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border"> 
  <tr class="title">  
    <td height="22" colspan="3" align="center"><strong>复位所有栏目</strong></td> 
  </tr> 
    <tr class="tdbg">  
    <td align="center">  
      <form name="form1" method="post" action="Admin_ClassReset.asp?Action=Reset"> 
        <table width="80%" border="0" cellspacing="0" cellpadding="0"> 
          <tr>  
            <td height="150"><font color="#FF0000"><strong>注意：</strong></font><br> 
              &nbsp;&nbsp;&nbsp;&nbsp;如果选择复位所有栏目，则所有栏目都将作为一级栏目，这时您需要重新对各个栏目进行归属的基本设置。不要轻易使用该功能，仅在做出了错误的设置而无法复原栏目之间的关系和排序的时候使用。  
            </td> 
          </tr> 
        </table> 
        <input type="submit" name="Submit" value="复位所有栏目"> &nbsp; <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='Admin_ClassManage.asp'" style="cursor:hand;">
      </form></td>
    </tr>
</table>
</body>
</html>
<%
end sub
%>
