⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_userclass.asp

📁 本息统基于中国网站技术人员最熟悉WindowsNT环境和Asp语言
💻 ASP
📖 第 1 页 / 共 4 页
字号:
<!--#include file="inc/inc_sys.asp"-->
<%
dim Action,ParentID,i,FoundErr,ErrMsg
dim SkinCount,LayoutCount
Action=trim(Request("Action"))
ParentID=trim(request("ParentID"))
if ParentID="" then
	ParentID=0
else
	ParentID=CLng(ParentID)
end if
%>
<html>
<head>
<title>用户分类管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/admin/Admin_Style.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
.style1 {color: #FF6600}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table cellpadding="0" cellspacing="1" border="0" width="98%" class="border" align=center>
  <tr>
	<td colspan="2" align="center" class="title"><strong>用 户 分 类 管 理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="80" height="30"><strong>管理导航:</strong></td>
    <td height="30"><a href="admin_userclass.asp">用户分类管理首页</a> | <a href="admin_userclass.asp?Action=Add">添加用户分类</a>&nbsp;|&nbsp;<a href="admin_userclass.asp?Action=Order">一级分类排序</a>&nbsp;|&nbsp;<a href="admin_userclass.asp?Action=OrderN">N级分类排序</a>&nbsp;|&nbsp;<a href="admin_userclass.asp?Action=Reset">复位所有用户分类</a>&nbsp;|&nbsp;<a href="admin_userclass.asp?Action=Unite">用户分类合并</a></td>
  </tr>
</table><br>

<%
if not IsObject(conn) then link_database
if Action="Add" then
	call AddClass()
elseif Action="SaveAdd" then
	call SaveAdd()
elseif Action="Modify" then
	call Modify()
elseif Action="SaveModify" then
	call SaveModify()
elseif Action="Move" then
	call MoveClass()
elseif Action="SaveMove" then
	call SaveMove()
elseif Action="Del" then
	call DeleteClass()
elseif Action="UpOrder" then 
	call UpOrder() 
elseif Action="DownOrder" then 
	call DownOrder() 
elseif Action="Order" then
	call Order()
elseif Action="UpOrderN" then 
	call UpOrderN() 
elseif Action="DownOrderN" then 
	call DownOrderN() 
elseif Action="OrderN" then
	call OrderN()
elseif Action="Reset" then
	call Reset()
elseif Action="SaveReset" then
	call SaveReset()
elseif Action="Unite" then
	call Unite()
elseif Action="SaveUnite" then
	call SaveUnite()
else
	call main()
end if
if FoundErr=True then
	call oblog.sys_err(errmsg)
end if
''call CloseConn() 'shiyu


sub main()
	dim arrShowLine(10)
	for i=0 to ubound(arrShowLine)
		arrShowLine(i)=False
	next
	dim sqlClass,rsClass,i,iDepth
	sqlClass="select * From oblog_userclass order by RootID,OrderID"
	set rsClass=server.CreateObject("adodb.recordset")
	rsClass.open sqlClass,conn,1,1
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" align="center"><strong>分类名称</strong></td>
    <td width="300" height="22" align="center"><strong>操作选项</strong></td>
  </tr>
  <% 
do while not rsClass.eof 
%>
  <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#cccccc'" style="padding: 0px 2px;"> 
    <td> 
      <% 
	iDepth=rsClass("Depth")
	if rsClass("NextID")>0 then
		arrShowLine(iDepth)=True
	else
		arrShowLine(iDepth)=False
	end if
	if iDepth>0 then
	  	for i=1 to iDepth 
			if i=iDepth then 
				if rsClass("NextID")>0 then 
					response.write "<img src='images/tree_line1.gif' width='17' height='16' valign='abvmiddle'>" 
				else 
					'response.Write "&nbsp;&nbsp;├ "
					response.write "<img src='images/tree_line2.gif' width='17' height='16' valign='abvmiddle'>" 
				end if 
			else 
				if arrShowLine(i)=True then
					response.write "<img src='images/tree_line3.gif' width='17' height='16' valign='abvmiddle'>" 
				else
					'response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
					response.write "<img src='images/tree_line4.gif' width='17' height='16' valign='abvmiddle'>" 
				end if
			end if 
	  	next 
	  end if 
	  if rsClass("Child")>0 then 
	  	'response.write "<img src='Images/tree_folder4.gif' width='15' height='15' valign='abvmiddle'>" 
	  else 
	  	'response.write "<img src='Images/tree_folder3.gif' width='15' height='15' valign='abvmiddle'>" 
	  end if 
	  if rsClass("Depth")=0 then 
	  	response.write "<b>" 
	  end if 
	  response.write "<a href='admin_userclass.asp?Action=Modify&id=" & rsClass("id") & "' title='" & rsClass("ReadMe") & "'>" & rsClass("classname") & "</a>"
	  if rsClass("Child")>0 then 
	  	response.write "(" & rsClass("Child") & ")" 
	  end if
	  
	  
	  'response.write "&nbsp;&nbsp;" & rsClass("id") & "," & rsClass("PrevID") & "," & rsClass("NextID") & "," & rsClass("ParentID") & "," & rsClass("RootID")
	  %>
    </td>
    <td align="center"><a href="admin_userclass.asp?Action=Add&ParentID=<%=rsClass("id")%>">添加子分类</a> | <a href="admin_userclass.asp?Action=Modify&id=<%=rsClass("id")%>">修改设置</a> | 
      <a href="admin_userclass.asp?Action=Move&id=<%=rsClass("id")%>">移动分类</a> | <a href="admin_userclass.asp?Action=Del&id=<%=rsClass("id")%>" onClick="<%if rsClass("Child")>0 then%>return ConfirmDel1();<%else%>return ConfirmDel2();<%end if%>">删除</a></td>
  </tr>
  <% 
	rsClass.movenext 
loop 
%>
</table> 
<script language="JavaScript" type="text/JavaScript">
function ConfirmDel1()
{
   alert("此分类下还有子分类,必须先删除下属子分类后才能删除此分类!");
   return false;
}

function ConfirmDel2()
{
   if(confirm("删除分类将不能恢复!确定要删除此分类吗?"))
     return true;
   else
     return false;
	 
}
</script>
<%
end sub

sub AddClass()
%>
<table cellpadding="0" cellspacing="1" border="0" width="98%" class="border" align=center>
  <form name="form1" method="post" action="admin_userclass.asp" onsubmit="return check()">
    <tr> 
      <td colspan="3" align="center" class="title"><strong>添 加 分 类</strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>所属分类:</strong><br>
        不能指定为外部分类 </td>
      <td> <select name="ParentID">
          <%call Admin_ShowClass_Option(0,ParentID)%>
        </select></td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>分类名称:</strong></td>
      <td><input name="classname" type="text" size="37" maxlength="20"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>分类说明:<br>
        </strong> 鼠标移至分类名称上时将显示设定的说明文字(不支持HTML)</td>
      <td><textarea name="Readme" cols="37" rows="4" id="Readme"></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td height="40" colspan="2" align="center"><input name="Action" type="hidden" id="Action" value="SaveAdd"> <input name="Add" type="submit" value=" 添&nbsp;&nbsp;加 " > 
        &nbsp; <input name="Cancel" type="button" id="Cancel" value=" 取 消 " onClick="window.location.href='admin_userclass.asp'" style="cursor: hand;background-color: #cccccc;"> 
      </td>
    </tr>
  </form>
</table>
<script language="JavaScript" type="text/JavaScript">
function check()
{
  if (document.form1.classname.value=="")
  {
    alert("分类名称不能为空!");
	document.form1.classname.focus();
	return false;
  }
}
</script>
<%
end sub

sub Modify()
	dim id,sql,rsClass,i
	id=trim(request("id"))
	if id="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
		exit sub
	else
		id=CLng(id)
	end if
	sql="select * From oblog_userclass where id=" & id
	set rsClass=server.CreateObject ("Adodb.recordset")
	rsClass.open sql,conn,1,3
	if rsClass.bof and rsClass.eof then
		response.Write "<br><li>找不到指定的分类!</li>"
		response.End()
	else
%>
<table cellpadding="0" cellspacing="1" border="0" width="98%" class="border" align=center>
  <form name="form1" method="post" action="admin_userclass.asp" onsubmit="return check()">
    <tr> 
      <td colspan="3" align="center" class="title"><strong>修 改 分 类</strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>所属分类:</strong><br>
        如果你想改变所属分类,请<a href='admin_userclass.asp?Action=Move&id=<%=id%>'>点此移动分类</a></td>
      <td> 
        <%
	if rsClass("ParentID")<=0 then
	  	response.write "无(作为一级分类)"
	else
    	dim rsParentClass,sqlParentClass
		sqlParentClass="Select * From oblog_userclass where id in (" & rsClass("ParentPath") & ") order by Depth"
		set rsParentClass=server.CreateObject("adodb.recordset")
		rsParentClass.open sqlParentClass,conn,1,1
		do while not rsParentClass.eof
			for i=1 to rsParentClass("Depth")
				response.write "&nbsp;&nbsp;&nbsp;"
			next
			if rsParentClass("Depth")>0 then
				response.write "└"
			end if
			response.write "&nbsp;" & rsParentClass("classname") & "<br>"
			rsParentClass.movenext
		loop
		rsParentClass.close
		set rsParentClass=nothing
	end if
	%></select>
        </td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>分类名称:</strong></td>
      <td><input name="classname" type="text" value="<%=rsClass("classname")%>" size="37" maxlength="20"> <input name="id" type="hidden" id="id" value="<%=rsClass("id")%>"></td>
    </tr>
    <tr class="tdbg"> 
      <td width="350"><strong>分类说明:<br>
        </strong> 鼠标移至分类名称上时将显示设定的说明文字(不支持HTML)</td>
      <td><textarea name="Readme" cols="37" rows="4" id="Readme"><%=rsClass("ReadMe")%></textarea></td>
    </tr>
    <tr class="tdbg"> 
      <td height="40" colspan="2" align="center"><input name="Action" type="hidden" id="Action" value="SaveModify"> <input name="Submit" type="submit" value=" &nbsp;保存修改结果&nbsp; " > 
        &nbsp; <input name="Cancel" type="button" id="Cancel" value=" 取&nbsp;&nbsp;消 " onClick="window.location.href='admin_userclass.asp'" style="cursor: hand;background-color: #cccccc;"> 
      </td>
    </tr>
  </form>
</table>
<script language="JavaScript" type="text/JavaScript">
function check()
{
  if (document.form1.classname.value=="")
  {
    alert("分类名称不能为空!");
	document.form1.classname.focus();
	return false;
  }
}
</script>
<%
	end if
	rsClass.close
	set rsClass=nothing
end sub

sub MoveClass()
	dim id,sql,rsClass,i
	id=trim(request("id"))
	if id="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
		exit sub
	else
		id=CLng(id)
	end if
	
	sql="select * From oblog_userclass where id=" & id
	set rsClass=server.CreateObject ("Adodb.recordset")
	rsClass.open sql,conn,1,3
	if rsClass.bof and rsClass.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>找不到指定的分类!</li>"
	else
%>
<table cellpadding="0" cellspacing="1" border="0" width="98%" class="border" align=center>
<form name="form1" method="post" action="admin_userclass.asp">
	<tr>
	  <td colspan="3" align="center" class="title"><strong>移 动 分 类</strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="200"><strong>分类名称:</strong></td>
      <td><%=rsClass("classname")%> <input name="id" type="hidden" id="id" value="<%=rsClass("id")%>"></td>
    </tr>
    <tr class="tdbg">
      <td width="200"><strong>当前所属分类:</strong></td>
      <td>
        <%
	if rsClass("ParentID")<=0 then
	  	response.write "无(作为一级分类)"
	else
    	dim rsParent,sqlParent
		sqlParent="Select * From oblog_userclass where id in (" & rsClass("ParentPath") & ") order by Depth"
		set rsParent=server.CreateObject("adodb.recordset")
		rsParent.open sqlParent,conn,1,1
		do while not rsParent.eof
			for i=1 to rsParent("Depth")
				response.write "&nbsp;&nbsp;&nbsp;"
			next
			if rsParent("Depth")>0 then
				response.write "└"
			end if
			response.write "&nbsp;" & rsParent("classname") & "<br>"
			rsParent.movenext
		loop
		rsParent.close
		set rsParent=nothing
	end if
	%>
      </td>
    </tr>
    <tr class="tdbg"> 
      <td width="200"><strong>移动到:</strong><br>
        不能指定为当前分类的下属子分类<br>
        不能指定为外部分类</td>
      <td><select name="ParentID" size="2" style="height:300px;width:500px;"><%call Admin_ShowClass_Option(0,rsClass("ParentID"))%></select></td>
    </tr>
    <tr class="tdbg"> 
      <td height="40" colspan="2" align="center"><input name="Action" type="hidden" id="Action" value="SaveMove"> 
        <input name="Submit" type="submit" value=" &nbsp;保存移动结果&nbsp; " style="cursor: hand;background-color: #cccccc;">
        &nbsp; 
        <input name="Cancel" type="button" id="Cancel" value=" 取&nbsp;&nbsp;消 " onClick="window.location.href='admin_userclass.asp'" style="cursor: hand;background-color: #cccccc;">
	 </td>
   </tr>
</form>  
</table>
<%
	end if
	rsClass.close
	set rsClass=nothing
end sub

sub Order() 
	dim sqlClass,rsClass,i,iCount,j 
	sqlClass="select * From oblog_userclass where ParentID=0 order by RootID" 
	set rsClass=server.CreateObject("adodb.recordset") 
	rsClass.open sqlClass,conn,1,1 
	iCount=rsClass.recordcount 
%>
<table cellpadding="0" cellspacing="1" border="0" width="98%" class="border" align=center>
	<tr>
	  <td colspan="4" align="center" class="title"><strong>一 级 分 类 排 序</strong></td> 
  </tr> 
  <% 
j=1 
do while not rsClass.eof 
%> 
  <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#cccccc'" style="padding: 0px 2px;"> 
      <td width="200">&nbsp;<%=rsClass("classname")%></td> 
<% 
	if j>1 then 
  		response.write "<form action='admin_userclass.asp?Action=UpOrder' method='post'><td width='150'>" 
		response.write "<select name=MoveNum size=1><option value=0>向上移动</option>" 
		for i=1 to j-1 
			response.write "<option value="&i&">"&i&"</option>" 
		next 
		response.write "</select>" 
		response.write "<input type=hidden name=id value="&rsClass("id")&">"
		response.write "<input type=hidden name=cRootID value="&rsClass("RootID")&">&nbsp;<input type=submit name=Submit value=修&nbsp;改 style='cursor: hand;background-color: #cccccc;'>" 
		response.write "</td></form>" 
	else 
		response.write "<td width='150'>&nbsp;</td>" 
	end if 
	if iCount>j then 
  		response.write "<form action='admin_userclass.asp?Action=DownOrder' method='post'><td width='150'>" 
		response.write "<select name=MoveNum size=1><option value=0>向下移动</option>" 
		for i=1 to iCount-j 
			response.write "<option value="&i&">"&i&"</option>" 
		next 
		response.write "</select>" 
		response.write "<input type=hidden name=id value="&rsClass("id")&">"
		response.write "<input type=hidden name=cRootID value="&rsClass("RootID")&">&nbsp;<input type=submit name=Submit value=修&nbsp;改 style='cursor: hand;background-color: #cccccc;'>" 
		response.write "</td></form>" 
	else 
		response.write "<td width='150'>&nbsp;</td>" 
	end if 
%> 
      <td>&nbsp;</td>
  </tr> 
  <% 
	j=j+1 
	rsClass.movenext 
loop 
%> 
</table> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -