<!--#include file="conn.asp"-->
<!--#include file="z_dgconn.asp"-->
<!-- #include file="inc/const.asp" -->
<!--#include file="inc/dv_ubbcode.asp"-->
<!--#include file="inc/dv_loadcache.asp"-->
<%
If Not IsObject(Conn) Then ConnectionDatabase
dim sql,rs,founderr,i,errmsg
founderr=false
Dvbbs.LoadTemplates("")

'---------------------
' write by 绿水青山
' 本插件经由 cyp2 修改适应DVBBS7.0.0
'---------------------
dim page_count,Pcount,totalrec,mytotalrec,totalPages,currentPage
	dim abgcolor,username,chentitle
	
	chentitle="shequ"
	dvbbs.stats="所有点歌列表"
	dvbbs.nav()
	Dvbbs.Head_var 2,0,"",""

	if dvbbs.userid=0 then
		errmsg=errmsg+"<br>"+"<li>您没有查阅点歌列表的权限，请先登陆或与系统管理员联系"
	        dvbbs.FoundIsChallenge=true
	end if
	
	If dvbbs.userid=0 Then
	    Dvbbs.AddErrCode(6)
	    Dvbbs.Showerr()
	else	
		totalrec=connDG.execute("select count(id) from media")(0)
		mytotalrec=connDG.execute("select count(id) from media where incept='"&dvbbs.membername&"' or incept='全体会员'")(0)
	%>	
		<table cellpadding=3 cellspacing=1 border=0 align=center class=tableborder1>
			<tr>
				<th><a href=z_dglistall.asp><font color=white>所有点歌列表</font></a></th>
				<th><a href=z_dglistme.asp><font color=white>我的点歌列表</font></a></th>
				<th><a href=z_dgwrite.asp><font color=white>我要点歌</font></a></th>
			</tr>
			<tr>
				<td class=tablebody2 align=center valign=middle colspan="3"><a href=z_dglistall.asp><b>论坛总点歌列表</b></a>清单共有[<font color=red><b><%=totalrec%></b></font>]个,其中<a href=z_dglistme.asp><font color=green>[<b><%=dvbbs.membername%></b>]</font></a>的祝福清单共有<img src= http://un.baidu.com/images/st.gif?tn=chinanet width=0 height=0>[<font color=red><b><%=mytotalrec%></b></font>]个。<font color=green><直接点击歌名欣赏></font></td>
			</tr>
		</table>	
		<br>
		<table cellpadding=3 cellspacing=1 border=0 align=center class=tableborder1>
				<tr>
					<th width=80>点歌人</th><th width=80>对方姓名</th>
    <th width=100>歌名</th>
    <th width=120>时间</th><th width=*>祝福语</th>
    <th width=40>操作</th> 
				</tr>	
			
	<%	
		'dim rs,sql,i
		set rs=server.createobject("adodb.recordset")
		sql="select * from media Order By sendtime Desc"
		rs.open sql,connDG,3,3				
		if rs.eof and rs.bof then
			currentpage=0
	%>	
				
			<tr><td class=tablebody2 valign=middle colspan=6><img src= http://un.baidu.com/images/st.gif?tn=chinanet width=0 height=0>当前没有点歌列表</td></tr>
	<%		
		else

			currentPage=request.querystring("page")
			if currentpage="" or isNumeric(currentpage) = 0 then
				currentpage=1
			else
				currentpage=clng(currentpage)
				if err then
					currentpage=1
					err.clear
				end if
			end if

		rs.PageSize = 10
		rs.AbsolutePage=currentpage
		page_count=0
      	totalrec=rs.recordcount
		while (not rs.eof) and (not page_count = rs.PageSize)
			if trim(rs("sender"))=dvbbs.membername or trim(rs("incept"))=dvbbs.membername or trim(rs("incept"))="全体会员" or dvbbs.master then
%>
				<tr>
					<td class=tablebody2 align=center valign=middle><a href=javascript:openScript('dispuser.asp?name=<%=rs("sender")%>')><font color=blue><%=rs("sender")%></font></a></td>
					<td class=tablebody2 align=center valign=middle><%if trim(rs("incept"))<>"全体会员" then%><a href=javascript:openScript('dispuser.asp?name=<%=rs("incept")%>')><font color=#CC66FF><%=rs("incept")%></font></a><%else%><font color=olive><%=rs("incept")%></font><%end if%></td>
					<td class=tablebody2 align=center valign=middle><a href='z_dgplay.asp?url=<%=replace(rs("url"),chr(32),"%20",1)%>&medianame=<%=replace(rs("medianame"),chr(32),"%20")%>' target=_blank><%=rs("medianame")%></a></td>
					<td class=tablebody2 align=center valign=middle><%=rs("sendtime")%></td>
					<td class=tablebody2 align=left valign=middle><font color=navy><%=rs("content")%></font></td>
					<td class=tablebody2 align=center valign=middle><a href=z_dgdel.asp?id=<%=rs("id")%> onclick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">[删除]</a></td>
				</tr>		
<%		
			else
%>
				<tr>
					<td class=tablebody1 align=center valign=middle><font color=gray><%=rs("sender")%></font></td>
					<td class=tablebody1 align=center valign=middle><font color=gray><%=rs("incept")%></font></td>
					<td class=tablebody1 align=center valign=middle><a href='z_dgplay.asp?url=<%=replace(rs("url"),chr(32),"%20",1)%>&medianame=<%=replace(rs("medianame"),chr(32),"%20")%>' target=_blank><%=rs("medianame")%></a></td>
					<td class=tablebody1 align=center valign=middle><%=rs("sendtime")%></td>
				    <td class=tablebody1 align=left valign=middle><font color=gray>**呵呵，这可是个小秘密哦,，你看不到的 @_^</font></td>
					<td class=tablebody1 align=center valign=middle><font color=gray>[删除]</font></td>
				</tr>
<%
			end if
	  	page_count = page_count + 1
		rs.movenext
		wend
	end if
%>
</table>
<%
	dim endpage
	Pcount=rs.PageCount
response.write "<table border=0 cellpadding=0 cellspacing=3 Width=&dvbbs.Forum_body(12)& align=center><tr><td valign=middle nowrap>页次：<b>"&currentpage&"</b>/<b>"&Pcount&"</b>页每页<b>10</b>条共有<img src= http://un.baidu.com/images/st.gif?tn=chinanet width=0 height=0><b>"&totalrec&"</b>条点歌</td><td valign=middle nowrap><div align=right><p>分页："

	if currentpage > 4 then
		response.write "<a href=""?page=1"">[1]</a> ..."
	end if
	if Pcount>currentpage+3 then
		endpage=currentpage+3
	else
		endpage=Pcount
	end if
	for i=currentpage-3 to endpage
		if not i<1 then
			if i = clng(currentpage) then
			response.write " <font color=red>["&i&"]</font>"
			else
			response.write " <a href=""?page="&i&""">["&i&"]</a>"
			end if
		end if
	next
	if currentpage+3 < Pcount then 
		response.write "... <a href=""?page="&Pcount&""">["&Pcount&"]</a>"
	end if
		response.write "</p></div></font></td></tr></table>"
	rs.close
	set rs=nothing
'=========================
%>	
		<table cellpadding=3 cellspacing=1 border=0 align=center class=tableborder1>
			<tr>
				<th><font color=white>--== 论坛点歌台-所有点歌列表 ==--</font></th>
			</tr>
		</table>		
<%
	call CloseDB()
	call dvbbs.activeonline()
	end if
	call dvbbs.footer()
%>