📄 resource_list.asp
字号:
<%
Option Explicit
'----------------------------------------------------------------------------------
'本页:
' 资源列表页面
'说明:
'
'----------------------------------------------------------------------------------
%>
<!--#include file="inc/Config.class.asp"-->
<!--#include file="inc/DBControl.class.asp"-->
<!--#include file="inc/FunctionLib.class.asp"-->
<!--#include file="inc/Manager.class.asp"-->
<%
Dim Cfg, Db, FLib, Admin
Set Cfg = New Config
Set Db = New DBControl
Set FLib = New FunctionLib
Set Admin = New Manager
If Not Admin.Logined Then
FLib.Alert "对不起,你已经超时或未登录","./",1
Response.End
End If
Db.Open()
Dim Parent, ClassTitle, sType, sKey, ResStatus, ResStatus_Title
Dim CurrPage, PageSize, TotalNum, PageCount, UrlInfo
Dim Rs, Sql
Parent = FLib.SafeSql(Request("Parent"))
ClassTitle = Trim(Request("ClassTitle"))
sType = FLib.SafeSql(Request("sType"))
sKey = FLib.SafeSql(Request("sKey"))
ResStatus = FLib.SafeSql(Request("ResStatus"))
CurrPage = FLib.SafeSql(Request("CurrPage"))
PageSize = 20
If Not IsNumeric(Parent) OR Parent = "" Then
Parent = 0
End If
If Not IsNumeric(CurrPage) OR CurrPage = "" Then
CurrPage = 1
End If
If Not IsNumeric(ResStatus) OR ResStatus = "" Then
ResStatus = 1
End If
If Not FLib.chkPope_AboutTheClass(Parent, "view") Then
FLib.Alert "你无法在此频道进行浏览操作", "BACK", 0
Response.End
End If
Select Case ResStatus
Case 1 :
ResStatus_Title = "常规资源"
Case 2 :
ResStatus_Title = "未审资源"
Case 3:
ResStatus_Title = "回收资源"
End Select
Sql = ExeSql(0)
Set Rs = Db.ExeCute(Sql)
TotalNum = Rs(0)
Rs.Close()
PageCount = CInt(TotalNum / PageSize)
If TotalNum Mod PageSize <> 0 Then
PageCount = PageCount + 1
End If
Sql = ExeSql(1)
Set Rs = Db.CreateRS()
Rs.PageSize = PageSize
Rs.CacheSize = Rs.PageSize
Rs.Open Sql, Db.Conn, 1, 1
If Not(Rs.Eof And Rs.Bof) Then
Rs.AbsolutePage = CurrPage
End If
UrlInfo = "&Parent=" & Parent &"&sKey=" & sKey &"&sType=" & sType & "&ResStatus=" & ResStatus & "&ClassTitle=" & ClassTitle
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="inc/style.css" rel="stylesheet" type="text/css">
<script src="inc/Tkl_PageList.js"></script>
<SCRIPT LANGUAGE="JavaScript" src="inc/FunctionLib.js"></script>
<!-- 右键菜单 开始-->
<link href="lib/ContextMenu/css/WebFX-ContextMenu.css" rel="stylesheet" type="text/css">
<script src="lib/ContextMenu/js/ieemu.js"></script>
<script src="lib/ContextMenu/js/ContextMenu.js"></script>
<!-- 右键菜单 结束-->
<script>
if (moz) {
extendEventObject();
emulateEventHandlers(["click", "mouseover", "mouseout"]);
extendElementModel();
// needed to attach keydown
emulateAttachEvent();
}
var ClassId = <%=Parent%>;
var ClassTitle = "<%=Server.UrlEncode(ClassTitle)%>";
function contextForResItem(ResId, ResUrl)
{
var eobj,popupoptions
var ResStatus = <%=ResStatus%>
switch(ResStatus)
{
case 1:
popupoptions = [
new ContextItem(" 浏 览 ",function(){if(ResUrl!=""){window.open(ResUrl);}}),
new ContextSeperator(),
new ContextItem(" 编 辑 ",function(){MdyReco(ResId);}),
new ContextItem(" 审 核 ",function(){CheckReco(ResId);}),
new ContextItem(" 生 成 ",function(){CreateReco(ResId);}),
new ContextSeperator(),
new ContextItem(" 删 除 ",function(){DeleteReco(ResId);})
]
break;
case 2:
popupoptions = [
new ContextItem(" 浏 览 ",function(){if(ResUrl!=""){window.open(ResUrl);}}),
new ContextSeperator(),
new ContextItem(" 编 辑 ",function(){MdyReco(ResId);}),
new ContextItem(" 审 核 ",function(){CheckReco(ResId);}),
new ContextItem(" 生 成 ",function(){CreateReco(ResId);}),
new ContextSeperator(),
new ContextItem(" 删 除 ",function(){DeleteReco(ResId);})
]
break;
case 3:
popupoptions = [
new ContextItem(" 浏 览 ",function(){if(ResUrl!=""){window.open(ResUrl);}}),
new ContextSeperator(),
new ContextItem(" 编 辑 ",function(){MdyReco(ResId);}),
new ContextItem(" 审 核 ",function(){CheckReco(ResId);}),
new ContextItem(" 生 成 ",null, true),
new ContextSeperator(),
new ContextItem("恢复资源",function(){CallBackReco(ResId);}),
new ContextItem("彻底删除",function(){DeleteReco(ResId);})
]
break;
}
ContextMenu.display(popupoptions)
}
function contextForBody()
{
var eobj,popupoptions
popupoptions = [
new ContextItem("添加资源",function(){AddReco()}),
new ContextSeperator(),
new ContextItem("刷新",function(){window.location.reload()}),
new ContextItem("源码",function(){window.location = 'view-source:' + window.location.href})
]
ContextMenu.display(popupoptions)
}
function AddReco()
{
self.location.href = "Resource_Mdy.asp?Work=AddReco&ClassId=" + ClassId + "&ClassTitle=" + ClassTitle;
}
function DeleteReco(IdList)
{
if(IdList == "") return false;
if(confirm("是否确定要删除选中项?"))
{
self.location.href = "Resource_Process.asp?Work=DeleteReco&IdList=" + IdList;
}else{
return false;
}
}
function CheckReco(IdList)
{
if(IdList == "") return false;
self.location.href = "Resource_Process.asp?Work=CheckReco&IdList=" + IdList;
}
function CallBackReco(IdList)
{
if(IdList == "") return false;
self.location.href = "Resource_Process.asp?Work=CallBackReco&IdList=" + IdList;
}
function CreateReco(IdList)
{
if(IdList == "") return false;
self.location.href = "Res_Create_Process.asp?Work=CreateSpecifyResource&IdList=" + IdList;
}
function MdyReco(Id)
{
if(Id == "") return false;
self.location.href = "Resource_Mdy.asp?Work=MdyReco&Id=" + Id;
}
function UnCreated()
{
alert("此资源尚未生成!");
return false;
}
//-->
</SCRIPT>
</head>
<body onLoad="ContextMenu.intializeContextMenu()" oncontextmenu="contextForBody()">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabTitleBar">
<tr>
<td>内容管理 > <%=ResStatus_Title & " > " & ClassTitle%></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>
<% If Flib.ChildenList(Parent)="" Then %>
[<a href="javascript:AddReco();void(0);">添加内容</a>]
<% Else %>
<span class="txtNote">[添加内容]</span>
<% End If %>
[<a href="javascript:location.reload();void(0);">刷新</a>]</td>
<td align="right"><table border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="?">
<tr>
<td align="right"> <input name="sKey" type="text" class="input_text" id="sKey" value="<%=sKey%>" size="16">
<select name="sType" class="select_list" id="sType">
<option></option>
<option value="1">内容标题</option>
<option value="2">简 介</option>
<option value="3">内 容 ID</option>
<option value="4">创 建 人</option>
<option value="5">审 核 人</option>
<option value="6">来 源</option>
</select> <input name="Submit" type="submit" class="input_button" value="搜索">
<input name="Parent" type="hidden" id="Parent" value="<%=Parent%>">
<input name="ResStatus" type="hidden" id="ResStatus" value="<%=ResStatus%>">
<input name="ClassTitle" type="hidden" id="ClassTitle" value="<%=ClassTitle%>">
</td>
</tr>
</form>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td valign="bottom"> </td>
<td align="center" valign="bottom"><font color="#006699"><a href="?Parent=<%=Parent%>&ResStatus=1&ClassTitle=<%=ClassTitle%>">常规内容</a>
| <a href="?Parent=<%=Parent%>&ResStatus=2&ClassTitle=<%=ClassTitle%>">未审内容</a>
| <a href="?Parent=<%=Parent%>&ResStatus=3&ClassTitle=<%=ClassTitle%>">回 收 站</a></font></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tabBgColor">
<tr class="tabHead">
<td width="20"><strong></strong></td>
<td align="center">内容标题</td>
<td width="20" align="center">审</td>
<td width="20" align="center">创</td>
<td width="100" align="center">分类</td>
<td width="80" align="center">创建</td>
<td width="80" align="center">审核</td>
<td width="120" align="center">创建时间</td>
</tr>
<%
Dim bgColor
bgColor = "#F6F6F6"
While Not Rs.Eof
If bgColor = "#F6F6F6" Then
bgColor = "#FFFFFF"
Else
bgColor = "#F6F6F6"
End If
%>
<tr bgcolor="<%=bgColor%>">
<td height="24" align="center"><input name="IdList" type="checkbox" class="input_checkbox" value="<%=Rs("id")%>"></td>
<td><span oncontextmenu="contextForResItem('<%=Rs("id")%>', '<%=Rs("visit_url")%>')" id="tr<%=Rs("id")%>"><%=ShowTitle(Rs)%></span></td>
<td align="center"><font color="#333333">
<a href="Resource_Process.asp?Work=CheckReco&IdList=<%=Rs("id")%>"><%If Rs("checked") Then Response.Write "是" Else Response.Write "否" End If%></a>
</font></td>
<td align="center"><font color="#333333">
<a href="Res_Create_Process.asp?Work=CreateSpecifyResource&IdList=<%=Rs("id")%>"><%If Rs("created")=1 Then Response.Write "是" Else Response.Write "否" End If%></a> </font></td>
<td align="center"><%=Rs("class_title")%></td>
<td align="center"><%=Rs("creator")%></td>
<td align="center"><%=Rs("author")%></td>
<td align="center"><%=FLib.FormatMyDate(Rs("addtime"), "{Y}-{m}-{d} {h}:{mi}:{s}")%></td>
</tr>
<%
Rs.MoveNext
Wend
If Rs.Eof And Rs.Bof Then
%>
<tr>
<td colspan="8" align="center">暂无相关资源</td>
</tr>
<%
End If
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="34%">
<%
Response.Write "[<a href=""javascript:SelectAllCheckBox('IdList');void(0);"">返选</a>]"
Response.Write "[<a href=""javascript:CreateReco(GetCheckBoxList('IdList'));void(0);"">生成</a>]"
Response.Write "[<a href=""javascript:CheckReco(GetCheckBoxList('IdList'));void(0);"">审核</a>]"
If ResStatus=3 Then
Response.Write "[<a href=""javascript:DeleteReco(GetCheckBoxList('IdList'));void(0);"" title=""完全被删除,将不可恢复"">彻底删除</a>]"
Response.Write "[<a href=""javascript:CallBackReco(GetCheckBoxList('IdList'));void(0);"" title=""还原当前回收站内选中的资源"">恢复资源</a>]"
Else
Response.Write "[<a href=""javascript:DeleteReco(GetCheckBoxList('IdList'));void(0);"" title=""丢入回收站内,仍可回收"">删除</a>]"
End If
%>
</td>
<td width="66%" align="right">
<script language="JavaScript">
<!--
var plb = new PageListBar('plb', <%=PageCount%>, <%=CurrPage%>, '<%=UrlInfo%>', 20);
document.write(plb);
//-->
</script>
</td>
</tr>
</table>
</body>
</html>
<%
Function ExeSql(m)
Dim Sql
If m = 1 Then
Sql = "SELECT TOP " & (CurrPage * PageSize) & " id, title, class_title, class_id, checked, deleted, created, addtime, creator, author, visit_url FROM view_resource_all WHERE {WHERE} ORDER BY id DESC"
Else
Sql = "SELECT COUNT(*) FROM view_resource_all WHERE {WHERE}"
End If
Sql = Replace(Sql, "{WHERE}", ExeSql_WHERE())
ExeSql = Sql
End Function
Function ExeSql_WHERE()
Dim Sql
Sql = ""
If sKey <> "" Then
Select Case sType
Case "1" :
Sql = "title LIKE '%" & sKey & "%'"
Case "2" :
Sql = "short_content LIKE '%" & sKey & "%'"
Case "3" :
Sql = "id IN (" & sKey & ")"
Case "4" :
Sql = "creator LIKE '%" & sKey & "%'"
Case "5" :
Sql = "author LIKE '%" & sKey & "%'"
Case "6" :
Sql = "resfrom LIKE '%" & sKey & "%'"
Case Else :
Sql = "title LIKE '%" & sKey & "%'"
End Select
End If
If Parent <> 0 Then
If Sql <> "" Then
Sql = Sql & " AND "
End If
Dim ChildList
ChildList = FLib.ChildenList(Parent)
If ChildList <> "" Then
ChildList = Parent & "," & ChildList
Else
ChildList = Parent
End If
Sql = Sql & "class_id IN (" & ChildList & ")"
Else
Sql = " 1=2"
End If
Select Case ResStatus
Case 1 :
Sql = Sql & " AND Deleted=0"
Case 2 :
Sql = Sql & " AND Checked=0 AND Deleted=0"
Case 3 :
Sql = Sql & " AND Deleted=1"
End Select
ExeSql_WHERE = Sql
End Function
Function ShowTitle(Rs)
If Rs("visit_url")<>"" Then
ShowTitle = "<a href=""javascript:window.open('" & Rs("visit_url") & "');void(0);"" title=""资源编号:" & Rs("id") &""">" & Rs("title") & "</a>"
Else
ShowTitle = "<a href=""javascript:UnCreated();void(0);"" title=""资源编号:" & Rs("id") &""">" & Rs("title") & "</a>"
End If
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -