<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><% Option Explicit %><!--#include file="Includes/Admin_Start.asp" --><!--#include file="Includes/Admin_Chklogin.asp" --><!--#include file="Includes/Admin_Conn.asp" --><!--#include file="Includes/Admin_Subs.asp" --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>MyCommonSiteTitle</title><link href="CSS/PTypes.css" rel="stylesheet" type="text/css"><SCRIPT language=javascript>function unselectall(){ if(document.myform.chkAll.checked){ document.myform.chkAll.checked = document.myform.chkAll.checked&0; } }
function CheckAll(form) { for (var i=0;i<form.elements.length;i++) { var e = form.elements[i]; if (e.Name != "chkAll"&&e.disabled==false) e.checked = form.chkAll.checked; } }function ConfirmDel(){ if(document.myform.Action.value=="Del") { document.myform.action="Admin_ArticleDel.asp"; if(confirm("确定要删除选中的文章吗?本操作将把选中的文章移到回收站中。必要时您可从回收站中恢复!")) return true; else return false; } else { document.myform.action="Admin_ArticleMove.asp"; if(document.myform.TargetClassID.value=="") { alert("不能将文章移动到含有子栏目的栏目或外部栏目中!"); return false; } if(confirm("确定要将选中的文章移动到指定的栏目吗?")) return true; else return false; }}
function DoDisCheck(){document.myform.action = "Admin_DisCheck.asp"document.myform.submit()}</SCRIPT><style type="text/css"><!--.style1 {color: #FF0000}--></style></head><body><% 'ShowWhat: 1=显示所有 2=显示未审核 3=显示当前作者的文章 4=显示某一类别的文章dim ssql, condition, sShowWhat, sTypesShowWhat = Trim(Request("ShowWhat"))IF sShowWhat = "" THEN sShowWhat =1 ELSE IF not Isnumeric(sShowWhat) THEN response.Write("错!showwhat不是数值型!") response.End() END IFEND IF%>
<form <% IF sShowWhat=2 THEN %>action="Admin_Check.asp" <% ELSE %> action="Admin_DeleteArticle.asp" <% END IF %> method="post" name="myform" id="myform"><%
SELECT CASE sShowWhatCASE 1condition = "order by d_id desc"CASE 2condition = "WHERE D_Checked=false order by d_id desc"CASE 3condition = "WHERE D_Author='" & Name_Cookies &"' order by d_id desc"CASE 4sType = GetSafeStr(Request("Type"))condition = "WHERE D_Type='" & sType &"'order by d_id desc"CASE ELSEcondition = "order by d_id desc"END SELECT
dim rstSet rst = Server.CreateObject("adodb.Recordset")ssql = "SELECT * FROM Article " & conditionrst.open ssql,cnn,1,1IF rst.eof THEN Response.Write("错!没有符合条件的记录!")response.End()END IF
'初始化分页变量DIM MaxPerpage, CurrentPage, TotalRecord, TotalPage, StartPositionMaxPerpage = 15TotalRecord = rst.recordcount '总记录数'============================================================='获得总页数TOTALPAGE'=============================================================IF (TotalRecord mod MaxPerpage)<>0 then TotalPage = fix(TotalRecord / MaxPerpage) + 1 ELSE TotalPage = TotalRecord / MaxPerpageEND IF'=============================================================
CurrentPage = Trim(request("page")) '获取当前页码'============================================================='开始判断CurrentPage是不是可用1、是数字,2、在页码范围内'=============================================================
IF CurrentPage="" THEN CurrentPage = 1END IF
IF not isNumeric(CurrentPage) then Response.Write("出错了!PAGE应是数值<br>")Response.End()ELSE IF getPosition(CurrentPage,TotalPage) = "error" THEN Response.Write("错!page的值超出页码范围!") Response.End() ELSE IF CurrentPage < 1 THEN CurrentPage = 1 ELSE CurrentPage = Cint(CurrentPage) END IF END IF END IF'=============================================================
StartPosition = (CurrentPage - 1) * MaxPerpage '当前应显示的第一条记录在记录中的位置
rst.move StartPosition,0 '移动到当前应显示的第一条记录在记录中的位置
%><table border="0"> <tr> <td bgcolor="#EEEEEE"><div align="center">选中</div></td> <td bgcolor="#EEEEEE">ID</td> <td bgcolor="#EEEEEE"><div align="center">文章标题</div></td> <td bgcolor="#EEEEEE"><div align="center">录入</div></td> <td bgcolor="#EEEEEE"><div align="center">类别</div></td> <td colspan="2" nowrap bgcolor="#EEEEEE"><div align="center">文章属性</div></td> <td nowrap bgcolor="#EEEEEE"><div align="center">已审核</div></td> <td bgcolor="#EEEEEE"><div align="center">操作</div></td> </tr> <!-- 开始循环显示标题 --> <% Dim TotalPrint '记录一共已显示了多少条 TotalPrint = 0 WHILE not rst.eof and TotalPrint < MaxPerpage %> <tr bgcolor="#F3F3F3"> <td><input type="checkbox" name="ArticleID" οnclick="unselectall()" id="ArticleID" value=<%= rst("D_ID") %>></td> <td><%= rst("D_ID") %></td> <td><a href="admin_showArticle.asp?ID=<%= rst("D_ID") %>" target="_blank"><%= rst("D_Title") %></a></td> <td nowrap><div align="center"><%= rst("D_Author") %></div></td> <td nowrap><%= rst("D_Type") %></td> <td><div align="center"> <% if rst("D_OnTop") = true then %> <font color="#FF0000">顶</font> <% end if %>
</div></td> <td><div align="center"> <% if rst("D_Recommended") = true then %> <font color="#FF0000">荐</font> <% end if %> </div></td> <td><div align="center"> <% if rst("D_Checked") = true then %> 是 <% else %> <span class="style1">否</span> <% end if %> </div></td> <td><div align="center"><a href="Admin_ModifyArticle.asp?ID=<%= rst("D_ID") %>">修改</a> <a href="Admin_DeleteArticle.asp?ID=<%= rst("D_ID") %>">删除</a> <% if rst("D_Ontop") = false then %> <a href="Admin_Property.asp?ID=<%= rst("D_ID")%>&action=setTop">置顶</a> <% else %> <a href="Admin_Property.asp?ID=<%= rst("D_ID")%>&action=setDistop">解置</a> <% end if %> <% if rst("D_Recommended") = false then %> <a href="Admin_Property.asp?ID=<%= rst("D_ID")%>&action=setRecommended">推荐</a> <% else %> <a href="Admin_Property.asp?ID=<%= rst("D_ID")%>&action=setDisRecommended">解荐</a> <% end if %> </div></td> </tr> <% rst.movenext TotalPrint = TotalPrint + 1 WEND %> <tr> <td bgcolor="#EEEEEE"><input name="chkAll" type="checkbox" id="chkAll" οnclick=CheckAll(this.form) value="checkbox"></td> <td colspan="8"><table border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#EEEEEE"> <td>选中所有文章</td> <td><input type="submit" name="Submit" value="<% IF sShowWhat = 2 THEN Response.Write("审核") ELSE Response.Write("删除") END IF %>选中的文章"><% IF sShowWhat <> 2 and Right_Cookies <> 1 THEN %><input name="DisCheck" type="button" onClick="DoDisCheck()" value="解除对选中文章的审核"><% END IF %></td> <td> <% IF getPosition(CurrentPage,TotalPage) = "begin" then %> 首页 <%ELSE %> <a href="?Type=<%= sType %>&ShowWhat=<%= sShowWhat %>&page=1">首页</a> <% END IF %> </td> <td> <% IF getPosition(CurrentPage,TotalPage) = "begin" then %> 上一页 <%ELSE %> <a href="?Type=<%= sType %>&ShowWhat=<%= sShowWhat %>&page=<%=CurrentPage - 1 %>">上一页</a> <% END IF %> </td> <td> <% IF getPosition(CurrentPage,TotalPage) = "end" OR TotalPage = 1 THEN %> 下一页 <%ELSE %> <a href="?Type=<%= sType %>&ShowWhat=<%= sShowWhat %>&page=<%=CurrentPage + 1 %>">下一页</a> <% END IF %> </td> <td> <% IF getPosition(CurrentPage,TotalPage) = "end" OR TotalPage = 1 THEN %> 末页 <%ELSE %> <a href="?Type=<%= sType %>&ShowWhat=<%= sShowWhat %>&page=<%=TotalPage %>">末页</a> <% END IF %> </td> <td>转到</td> <td><% call CreateSelection(CurrentPage,TotalPage,"Type="&sType,"ShowWhat="&sShowWhat,"") %> </td> </tr> </table></td> </tr>
<!-- 循环结束 --></table></form>
</body></html><!--#include file="Includes/Admin_ConnCLS.asp" --><!--#include file="Includes/Admin_End.asp" -->
======================================================================
效果图:
