user_articlemanage.asp

来自「利用C++编写的网络跟踪代码」· ASP 代码 · 共 453 行 · 第 1/2 页

ASP
453
字号
sql="select A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,"
sql=sql & "A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint from Article A"
sql=sql & " inner join ArticleClass C on A.ClassID=C.ClassID where A.Deleted=False and A.Editor='" & UserName & "' "
if ClassID>0 then
	if Child>0 then
		ChildID=""
		if Depth<=0 then
			set tClass=conn.execute("select ClassID from ArticleClass where ParentID=" & ClassID  & " or ParentPath like '" & ClassID & ",%'")
		else
			set tClass=conn.execute("select ClassID from ArticleClass where ParentID=" & ClassID & " or ParentPath like '" & ParentPath & "," & ClassID & ",%'")
		end if
		do while not tClass.eof
			if ChildID="" then
				ChildID=tClass(0)
			else
				ChildID=ChildID & "," & tClass(0)
			end if
			tClass.movenext
		loop
		sql=sql & " and A.ClassID in (" & ChildID & ")"
	else
		sql=sql & " and A.ClassID=" & ClassID
	end if
end if

if keyword<>"" then
	select case strField
		case "Title"
			sql=sql & " and A.Title like '%" & keyword & "%' "
		case "Content"
			sql=sql & " and A.Content like '%" & keyword & "%' "
		case "Author"
			sql=sql & " and A.Author like '%" & keyword & "%' "
		case else
			sql=sql & " and A.Title like '%" & keyword & "%' "
	end select
end if
sql=sql & " order by A.ArticleID desc"

Set rsArticleList= Server.CreateObject("ADODB.Recordset")
rsArticleList.open sql,conn,1,1
Set rsArticleList= Server.CreateObject("ADODB.Recordset")
rsArticleList.open sql,conn,1,1
if rsArticleList.eof and rsArticleList.bof then
	totalPut=0
	if Child=0 then
		response.write "<p align='center'><br>没有任何文章!<br><br><br></p>"
	else
		response.write "<p align='center'><br>此栏目的下一级子栏目中没有任何文章!<br><br><br></p>"
	end if
else
   	totalPut=rsArticleList.recordcount
	if currentpage<1 then
   		currentpage=1
   	end if
   	if (currentpage-1)*MaxPerPage>totalput then
   		if (totalPut mod MaxPerPage)=0 then
     		currentpage= totalPut \ MaxPerPage
	  	else
	      	currentpage= totalPut \ MaxPerPage + 1
   		end if
   	end if
    if currentPage=1 then
       	showContent
       	showpage strFileName,totalput,MaxPerPage,true,true,"篇文章"
 	else
     	if (currentPage-1)*MaxPerPage<totalPut then
       	   	rsArticleList.move  (currentPage-1)*MaxPerPage
       		dim bookmark
           	bookmark=rsArticleList.bookmark
            showContent
            showpage strFileName,totalput,MaxPerPage,true,true,"篇文章"
       	else
	        currentPage=1
           	showContent
          	showpage strFileName,totalput,MaxPerPage,true,true,"篇文章"
	    end if
	end if
end if
rsArticleList.close
set rsArticleList=nothing  


sub showContent
   	dim ArticleNum
    ArticleNum=0
%>
                                      <table width='100%' border="0" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <form name="myform" method="Post" action="User_ArticleDel.asp" onsubmit="return ConfirmDel();">
                                            <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="f9f9f9" class="border" style="word-break:break-all">
                                                <tr class="title"> 
                                                  <td width="30" height="22" align="center">&nbsp;</td>
                                                  <td width="25" align="center"  height="22"><strong>ID</strong></td>
                                                  <td height="22" align="center" ><strong>文章标题</strong></td>
                                                  <td width="60" height="22" align="center" ><strong>作者</strong></td>
                                                  <td width="40" height="22" align="center" ><strong>已审核</strong></td>
                                                  <td width="60" height="22" align="center" ><strong>操作</strong></td>
                                                </tr>
                                                <%do while not rsArticleList.eof%>
                                                <tr class="tdbg"> 
                                                  <td width="30" align="center"><input name='ArticleID' type='checkbox' onclick="unselectall()" id="ArticleID2" value='<%=cstr(rsArticleList("articleID"))%>' <%if rsArticleList("Passed")=True then response.write "disabled" %>></td>
                                                  <td width="25" align="center"><%=rsArticleList("articleid")%></td>
                                                  <td> 
                                                    <%
			if rsArticleList("ClassID")<>ClassID then
				response.write "<a href='" & FileName & "?ClassID=" & rsArticleList("ClassID") & "'>[" & rsArticleList("ClassName") & "]</a>&nbsp;"
			end if
			if rsArticleList("IncludePic")=true then
				response.write "<font color=blue>[图文]</font>"
			end if
			response.write "<a href='User_ArticleShow.asp?ArticleID=" & rsArticleList("articleid") & "'"
			response.write " title='标    题:" & rsArticleList("Title") & vbcrlf & "作    者:" & rsArticleList("Author") & vbcrlf & "转 贴 自:" & rsArticleList("CopyFrom") & vbcrlf & "更新时间:" & rsArticleList("UpdateTime") & vbcrlf
			response.write "点 击 数:" & rsArticleList("Hits") & vbcrlf & "关 键 字:" & mid(rsArticleList("Key"),2,len(rsArticleList("Key"))-2) & vbcrlf & "推荐等级:"
			if rsArticleList("Stars")=0 then
				response.write "无"
			else
				response.write string(rsArticleList("Stars"),"★")
			end if			
			response.write vbcrlf & "分页方式:"
			if rsArticleList("PaginationType")=0 then
				response.write "不分页"
			elseif rsArticleList("PaginationType")=1 then
				response.write "自动分页"
			elseif rsArticleList("PaginationType")=2 then
				response.write "手动分页"
			end if
			response.write vbcrlf & "阅读等级:"	
			if rsArticleList("ReadLevel")=9999 then
				response.write "游客"
			elseif  rsArticleList("ReadLevel")=999 then
				response.write "注册用户"
			elseif  rsArticleList("ReadLevel")=99 then
				response.write "收费用户"
			elseif  rsArticleList("ReadLevel")=9 then
				response.write "VIP用户"
			elseif  rsArticleList("ReadLevel")=5 then
				response.write "管理员"
			end if
			response.write vbcrlf & "阅读点数:" & rsArticleList("ReadPoint")
			response.write "' target=_blank>" & rsArticleList("title") & "</a>"
			%>
                                                  </td>
                                                  <td width="60" align="center"><%= rsArticleList("Author") %></td>
                                                  <td width="40" align="center"> 
                                                    <%if rsArticleList("Passed")=true then response.write "是" else response.write "否" end if%>
                                                  </td>
                                                  <td width="60" align="center"> 
                                                    <%if rsArticleList("Passed")=False then%>
                                                    <a href="User_ArticleModify.asp?ArticleID=<%=rsArticleList("articleid")%>">修改</a> 
                                                    <a href="User_ArticleDel.asp?ArticleID=<%=rsArticleList("ArticleID")%>&Action=Del" onclick="return ConfirmDel();">删除</a> 
                                                    <%end if%>
                                                  </td>
                                                </tr>
                                                <%
		ArticleNum=ArticleNum+1
	    if ArticleNum>=MaxPerPage then exit do
	    rsArticleList.movenext
	loop
%>
                                              </table>
                                              <table width="98%" border="0" align="right" cellpadding="0" cellspacing="2">
                                                <tr> 
                                                  <td width="300" height="30"><input name="chkAll" type="checkbox" id="chkAll2" onclick=CheckAll(this.form) value="checkbox">
                                                    选中本页显示的所有文章 </td>
                                                  <td><div align="right"> 
                                                      <input name="submit" type='submit' value='-删除选定的文章-' class="input2">
                                                      <input name="Action" type="hidden" id="Action2" value="Del">
                                                      &nbsp; </div></td>
                                                </tr>
                                              </table></td>
                                          </form>
                                        </tr>
                                      </table>
                                      <%
end sub

if ClassID>0 and Child>0 then
%>
                                      <table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <td></td>
                                        </tr>
                                      </table>
                                      <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#E4E4E4" class='border'>
                                        <tr height="20" class='tdbg'> 
                                          <td width='172' align="right"><div align="left">【 
                                              <%response.write "<a href='" & strFileName & "'>" & ClassName & "</a>"%>
                                              】子栏目导航:</div></td>
                                          <td width="285"> 
                                            <%call Admin_ShowChild()%>
                                          </td>
                                        </tr>
                                      </table>
                                      <%
end if
%>
                                      <table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <td height="10" ></td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="860" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="10"><img src="new/dbb.gif" width="860" height="18"></td>
  </tr>
</table>
<!--#include file="end.asp"-->
</body>
</html>
<%
call CloseConn()
%>

⌨️ 快捷键说明

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