<!--#include file="../fy.Function.asp"-->
<!--#include file="../include/fy.F.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>栏目排序</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body>
<%
 Dim Action,obj_news_rs,ShowErr,ModeID
 ModeID = ChkNumeric(Request("ModeID"))
 if ModeID=0 or ModeID="" Then ModeID=1
 Action = Request("Action")
 Select Case Action
		Case "one"
			Call OrderOne()
		Case "Order_one"
			Call UpdateOrderID()
 End Select 
 Sub OrderOne()
%><div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 模型管理</div>
    <div class="opers">
		<a href="fy.Class.asp" class="btn ">管理首页</a>
		<a href="fy.ClassAdd.asp?Action=add" class="btn">添加根栏目</a>
		<a href="fy.ClassAddall.asp?Action=add" class="btn">批量添加栏目</a>
		<a href="fy.Classfy.asp?Action=one" class="btn btn_primary">栏目排序</a>
		<a href="fy.m.asp" class="btn">栏目自定义字段</a>
		<a href="fy.Setclass.asp" class="btn">栏目批量设置</a>
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>栏目名称</th>
	  <th>ID</th>
	  <th>操作</th>
	  </tr>
    </thead>
  <form name="ClassForm" method="post" action="fy.Classfy.asp?Action=Order_one">
   <%
	Set obj_news_rs = server.CreateObject("Adodb.Recordset")
	Dim Classid:Classid=request("classid")
	If Classid = "" then
	obj_news_rs.Open "Select Orderid,id,ClassID,rootid,ClassName from Class_fy where rootid=0    Order by Orderid asc,ID asc",Conn,1,3
	Else
	obj_news_rs.Open "Select Orderid,id,ClassID,rootid,ClassName from Class_fy where     rootid = "&ClassID&" Order by Orderid asc,ID asc",Conn,1,3
	End if
	Do while Not obj_news_rs.eof 
	%>
	
	<tr> 
      <td class="tl"><img src="../Images/-.gif" width="15" height="15" /> 
      <a href= "?Action=one&ModeID=<%=ModeID%>&classid=<% = obj_news_rs("Classid") %>"> <b><% = obj_news_rs("ClassName") %></b></a> </td>
      <td width="21%" class="td_bg"><div align="center"> 
          <% = obj_news_rs("ID") %>
      </div></td>
      <td>
          <input name="OrderID" type="text" class="Ainput" id="OrderID" value="<%=obj_news_rs("OrderID")%>" size="4" maxlength="3">
 		  <input name="ID" type="hidden" id="ID" value="<%=obj_news_rs("ID")%>">	
 		  <input name="Action" type="hidden" id="ClassID" value="Order_one">
     </td>
    </tr>

 <%
		obj_news_rs.MoveNext
	loop
%>
 <tr >
    <td colspan="3"  class="tl"><input type="submit" class="btn btn_primary" name="Submit" value=" 批量更新排序 "></td>
  </tr>

	</table>
  
</div>
<%
obj_news_rs.close
set obj_news_rs =nothing
End Sub
Sub  UpdateOrderID()
		 	Dim ID,OrderID
 			Dim i
			ID = Split(fycms.s("ID"),","):OrderID = Split(fycms.s("OrderID"),",")
			 For I = LBound(ID) To UBound(ID)
					Conn.execute("Update Class_fy set OrderID="&ChkNumeric(OrderID(I))&" where   ID = "&ChkNumeric(ID(I))&"")
			Next 
			set conn=Nothing

 
		Response.Redirect "fy.Classfy.asp?Action=one&ModeID="&ModeID
End sub
%>

</body>
</html>
