<%
option explicit
response.buffer=true
%>
<!--#include file="inc/setup.asp"-->
<!--#include file="inc/cj_cls.asp"-->
<%
Dim Rs,Sql,action
dim ChannelID,channelname,channelshortname,id,i,ParentID,depth,classID,Colleclx,href
Colleclx=request("Colleclx")
if Colleclx="" then Colleclx=0
sk.Collec_lx
select case Colleclx
   case 1
	 href="w163_GetArticle.asp"
   case 2
 	 href="w163_GetFlash.asp"
   case 3
 	 href="w163_Getphoto.asp"
   case 4
   	 href="w163_GetMusic.asp"		 
   case 5
   	 href="w163_Getsoft.asp"		 
   case 6
 	 href="自定"
end select

%>

<html>
<head>
<title>w163采集系统</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/Admin_Style.css">
<style type="text/css">
.ButtonList {
	BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #ffffff 2px solid; BORDER-LEFT: #ffffff 2px solid; CURSOR: default; BORDER-BOTTOM: #999999 2px solid; BACKGROUND-COLOR: #e6e6e6
}
</style>
<SCRIPT language=javascript>
    function unselectall(thisform){
        if(thisform.chkAll.checked){
            thisform.chkAll.checked = thisform.chkAll.checked&0;
        }   
    }
    function CheckAll(thisform){
        for (var i=0;i<thisform.elements.length-6;i++){
            var e = thisform.elements[i];
            if (e.Name !="chkAll"&&e.disabled!=true)
                e.checked = thisform.chkAll.checked;
        }
    }
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder">
  <tr class='topbg'> 
    <th height="22" colspan="2" align="center" ><strong>本 地 数 据 分 类 管 理</strong></th>
  </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder">
  <tr class="tdbg"> 
    <td width="65" height="30"><strong>管理导航：</strong></td>
    <td height="30"><a href="<% =href %>"><% =ErrMsg_lx %>采集管理</a> 
	| <a href="w163_class.asp?action=add&Colleclx=<%=Colleclx%>">添加新栏目</a></td>
  </tr>
</table>
<br>
<% 
'----是否登陆
Call Admin()
If IsAdmin=false then
	ErrMsg="<li> 您没有登陆或不是管理员。请<a href='w163_login.asp' target='_top'>登陆</a>。"
	response.Redirect("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
	response.End()
end if
'-----
action =request("action")
select case action
case "del"
		classID=request("classID")
	if classid <> "" then
		sql = "delete from w163_Class where classID=" & classID 
		ConnItem.execute(sql)
		response.redirect("w163_class.asp?Colleclx="&Colleclx)
		response.end
	end if	
case "edit"
	if request("edit_ok")<>"" and request("edit_ok")<>0 then
		ErrMsg=w163_Class_Channel_edit(request.form("className"),request.form("ParentPath"),request.form("classID"))
		call edit()
	else
		call edit()
	end if
case "add"
	if request("add_ok")<>"" and request("add_ok")<>0 then
		ErrMsg=w163_Class_Channel_add(request.form("className"),request.form("ParentPath"))

		call add()

	else

		call add()
	end if
case "classadd"
	if request("classadd_ok")<>"" and request("classadd_ok")<>0 then
		ErrMsg=w163_Class_small_add(request.form("className"),request.form("ParentPath"),Trim(Request.Form("ParentID")))
		call classadd()
	else
		call classadd()
	end if
case else
	call main()
end select

sub main()
 %>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder" >
    <tr> 
      <th height="22" colspan="2" class="title"> <div align="center"><b><% =ErrMsg_lx %>分类&nbsp;管&nbsp;理</b></div></th>
    </tr>
    <tr>
      <td height="22" colspan="2" ><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
        <TR>
          <TD width="20%" height=22  align=center bgcolor="#CAD7F7"> 编号
            </DIV></TD>
          <TD width="26%" height=22  align=center bgcolor="#CAD7F7"> 栏目分类名称</TD>
          <TD width="23%" height=22  align=center bgcolor="#CAD7F7">管理选项</TD>
          <TD width="10%" height=22  align=center bgcolor="#CAD7F7">生成</TD>
          <TD width="5%" height=22  align=center bgcolor="#CAD7F7">生成分类</TD>
          <TD width="5%" height=22  align=center bgcolor="#CAD7F7">文件</TD>
          <TD width="10%" height=22  align=center bgcolor="#CAD7F7"> 操作</TD>
        </TR>
        <%
select case Colleclx
case 1
	Sql="select * from w163_class where ChannelID=1 order by OrderID" 
case 3
	Sql="select * from w163_class where ChannelID=3 order by OrderID"  
case 5
	Sql="select * from w163_class where ChannelID=5 order by OrderID"  
case 0
	Call CloseConnItem
	Response.end
end select

set Rs=server.createobject("adodb.recordset")         
Rs.open Sql,ConnItem,1,1
do while not rs.eof
%>
        <TR class="tdbg">
          <TD width="20%" height=22  align=center bgcolor="#F2F2F2" class=tdbg><%=rs("classID")%>
          </DIV></TD>
          <TD width="26%" height=22  align=left bgcolor="#F2F2F2" class=tdbg>
		    <%
		  If Rs("depth") = 1 Then Response.Write "&nbsp;&nbsp;<font color=""#666666"">├</font>"
		  If Rs("depth") > 1 Then
			For i = 2 To Rs("depth")
				Response.Write "&nbsp;&nbsp;<font color=""#666666"">│</font>"
			Next
			Response.Write "&nbsp;&nbsp;<font color=""#666666"">├</font> "
		  End If
		  If Rs("depth") = 0 Then Response.Write ("<b>")
		  Response.Write rs("className")
		  If Rs("depth")  = 0 Then Response.Write ("</b>")
		  %>
          </DIV></TD>
          <TD width="23%" height=22  align=center bgcolor="#F2F2F2" class=tdbg><a  href=w163_class.asp?action=classadd&classID=<%=rs("classID")%>&Colleclx=<% =Colleclx %>>添加下级栏目</a></TD>
          <TD width="10%" height=22  align=center bgcolor="#F2F2F2" class=tdbg><a href=makenews.asp?mingcheng=<%=rs("ParentPath")%>&classID=<%=rs("classID")%>&demoid=52>生成</a></TD>
          <TD width="5%" height=22  align=center bgcolor="#F2F2F2" class=tdbg><a href=maketejiapro.asp?path=<%=rs("ParentPath")%>&classID=<%=rs("classID")%>&demoid=45>生成分类</a>　</TD>
          <TD width="5%" height=22  align=center bgcolor="#F2F2F2" class=tdbg>
          <% dim myw163 
          myw163=Replace(rs("ParentPath"), "/", "\")
          %>
			<a href="234"><a href=make.asp?mingcheng="E:\公司文件\w163cj\admin\<%=myw163%>"&classID=<%=rs("classID")%>&demoid=51>文件</a></TD>
          <TD width="10%" height=22  align=center bgcolor="#F2F2F2" class=tdbg><a href=w163_class.asp?action=edit&classID=<%=rs("classID")%>&Colleclx=<% =Colleclx %>>修改</a> <a href=w163_class.asp?action=del&classID=<%=rs("classID")%>&Colleclx=<% =Colleclx %>>删除</a></TD>
        </TR>
        <%
rs.movenext
loop
rs.close
set rs=nothing
%>
      </TABLE></td>
    </tr>
</table>
<% end sub %>
<% sub add() %>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><b></b></div></td>
    </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
    <TR> 
      <TD height=22  align=center >请输入以下项目</TD>
    </TR>
</TABLE>
  <form name="myform" method="POST" action="?action=add&add_ok=1&Colleclx=<%=Colleclx%>">
<div align="center"> <%=ErrMsg%>
  <p>栏目名称：<strong>
    <input name="className" type="text" size="50" maxlength="50">
    </strong></p>
  <p>栏目目录： 
    <input name="ParentPath" type="text" size="50" maxlength="250">
  </p>
  <p> 
    <input name="action" type="submit" id="action" value="添加">&nbsp;&nbsp;
    <input name="action" type="reset" id="action" onClick="location.href='w163_class.asp?Colleclx=<%=Colleclx%>'" value="返回">
  </p>
</div>
  </form>
<% end sub %>
<% sub edit
		set Rs=server.createobject("adodb.recordset")         
		Sql="select * from w163_class where classID=" & request("classID") 
		Rs.open Sql,ConnItem,1,1
		ChannelID= request("classID")  
		channelname=rs("className")
		channelshortname=rs("ParentPath")
		rs.close
		set rs=nothing
%>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><b></b></div></td>
    </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
    <TR> 
      <TD height=22  align=center>请修改以下项目</TD>
    </TR>
</TABLE>
  <form name="myform" method="POST" action="?action=edit&edit_ok=1&Colleclx=<%=Colleclx%>">
<div align="center"> <%=ErrMsg%>
	<input name="classID" type="hidden" size="50" maxlength="50" value="<%=ChannelID%>">
  <p>栏目名称：<strong>
    <input name="className" type="text" size="50" maxlength="50" value="<%=channelname%>">
    </strong></p>
  <p>栏目目录： 
    <input name="ParentPath" type="text" size="50" maxlength="250" value="<%=channelshortname%>">
  </p>
  <p> 
    <input name="action" type="submit" id="action" value="确认修改">&nbsp;&nbsp;
    <input name="action" type="submit" id="action" onClick="location.href='w163_class.asp?Colleclx=<%=Colleclx%>'" value="返回">
  </p>
</div>
  </form>
<% end sub %>
<% sub classadd() 
 ParentID=request("classid")
 %>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border" >
    <tr> 
      <td height="22" colspan="2" class="title"> <div align="center"><b></b></div></td>
    </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
    <TR> 
      <TD height=22  align=center >请输入以下项目</TD>
    </TR>
</TABLE>
  <form name="myform" method="POST" action="?action=classadd&classadd_ok=1&Colleclx=<%=Colleclx%>">
<div align="center"> <%=ErrMsg%>
  <p>栏目名称：<strong>
    <input name="className" type="text" size="50" maxlength="50">
    </strong></p>
  <p>栏目目录： 
    <input name="ParentPath" type="text" size="50" maxlength="250">
	<input name="ParentID" type="hidden" id="Action" value="<%= ParentID %>">
	
  </p>
  <p> 
    <input name="action" type="submit" id="action" value="添加">&nbsp;&nbsp;
    <input name="action" type="reset" id="action" onClick="location.href='w163_class.asp?Colleclx=<%=Colleclx%>'" value="返回">
  </p>
</div>
  </form>
<% end sub %>


<!--#include file="Admin_ItemFoot.asp"-->
</body>
</html>
<%
Call CloseConnItem()
%>