<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->

<!--#include file="conn.asp"-->

<%
'---------------------
' write by 绿水青山 for 动网6.0
' 本插件经由 gafc 修改适应leadbbs3.14
'---------------------
DEF_BBS_HomeUrl = "../../"


dim stats
stats="<a href=listall.asp>所有点歌列表</a>"
BBS_SiteHead DEF_SiteNameString & " " & DEF_BBS_Name,GBL_board_ID," >> "&stats

dim page_count,Pcount,totalrec,mytotalrec,totalPages,currentPage
dim abgcolor,username,chentitle
	
chentitle="shequ"

'头部信息
If GBL_TableHeadString <> "" Then 
   response.write "<table width="&DEF_BBS_ScreenWidth&" border=0 cellspacing=0 cellpadding=0 align=center><tr><td>"& GBL_TableHeadString &"</td></tr></table>"
End If

dim rs,sql,Errmsg,i
  Errmsg=""

if GBL_CHK_User="" then
   errmsg=errmsg&"<li>客人不可以查阅点歌列表。</li>"
   errmsg=errmsg&"<li>请先<a href="&DEF_BBS_HomeUrl&"user/userjoin.asp>注册</a>或<a href="&DEF_BBS_HomeUrl&"user/login.asp>登录</a>。</li>"
   call Errormsg()
else	
		totalrec=connDG.execute("select count(id) from media")(0)
		mytotalrec=connDG.execute("select count(id) from media where incept='"&GBL_CHK_User&"' or incept='全体会员'")(0)
	%>	
<table width="<%=DEF_BBS_ScreenWidth%>" border=0 cellspacing=1 cellpadding=5 align=center bgcolor=<%=DEF_BBS_DarkColor%> class=TBone>
  <tr bgcolor=<%=DEF_BBS_LightDarkColor%> align=center class=tbhead2>
	<td><a href=listall.asp><b><font class=headfont>所有点歌列表</font></b></a></td>
	<td><a href=listme.asp><b><font class=headfont>我的点歌列表</font></b></a></td>
	<td><a href=write.asp><b><font class=headfont>我要点歌</font></b></a></td>
<%if CheckSupervisorUserName = 1 or instr(DEF_SupervisorUserName,","&GBL_CHK_User&",")>0 then%>
     <td><a href=admin_dg.asp><font class=headfont><b>本地歌曲管理</b></font></a></td>
<%end if%>
  </tr>
  <tr class=tbbg1>
	<td align=center valign=middle colspan="4"><a href=listall.asp><b>论坛总点歌列表</b></a>清单共有[<font color=red><b><%=totalrec%></b></font>]个,其中<a href=listme.asp>[<b><%=GBL_CHK_User%></b>]</a>的祝福清单共有[<font color=red><b><%=mytotalrec%></b></font>]个。<点击歌名欣赏></td>
  </tr>
</table>	

<table width="<%=DEF_BBS_ScreenWidth%>" border=0 cellspacing=1 cellpadding=5 align=center bgcolor=<%=DEF_BBS_DarkColor%> class=TBone>
 <%
                set rs=server.createobject("adodb.recordset")
		sql="select * from media Order By sendtime Desc"
		rs.open sql,connDG,3,3	
                               
 %>

  <tr bgcolor=<%=DEF_BBS_LightDarkColor%> align=center class=tbhead2>
	<td width=80>点歌人</td>
        <td width=80>对方姓名</td>
        <td width=100>歌名</td>
        <td width=120>时间</td>
        <td width=*>祝福语</td>
        <td width=40>反馈</td>
        <td width=40>操作</td>
  </tr>	
			
	<%						
		if rs.eof and rs.bof then
			currentpage=0
	%>	
				
  <tr class=tbbg1>
        <td valign=middle colspan=7>当前没有点歌列表</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)

                   dim acceptuser,acceptuser1,acceptuser2
                          acceptuser1=rs("acceptuser")
                         if instr(acceptuser1,"|")>0 then  
                            acceptuser2=split(acceptuser1,"|")
                            acceptuser=ubound(acceptuser2)-1
                         else 
                            acceptuser=0
                         end if   

			if trim(rs("sender"))=GBL_CHK_User or trim(rs("incept"))=GBL_CHK_User or trim(rs("incept"))="全体会员" or CheckSupervisorUserName = 1 then
%>
  <tr class=tbbg1>
	<td align=center valign=middle><a href=<%=DEF_BBS_HomeUrl%>user/lookuserinfo.asp?name=<%=rs("sender")%> target=blank><%=rs("sender")%></a></td>
	<td align=center valign=middle><%if trim(rs("incept"))<>"全体会员" then%><a href=<%=DEF_BBS_HomeUrl%>user/lookuserinfo.asp?name=<%=rs("incept")%> target=blank><%=rs("incept")%></a><%else%><%=rs("incept")%><%end if%></td>
	<td align=center valign=middle><a href=javascript:openScript('play.asp?url=<%=replace(rs("url"),chr(32),"%20",1)%>&medianame=<%=replace(rs("medianame"),chr(32),"%20")%>&id=<%=replace(rs("id"),chr(32),"%20")%>',400,270,20,20) onMouseOver="window.status='欢迎<%=rs("incept")%>收听歌曲。';return true" onMouseOut="window.status='<%=DEF_SiteNameString%> 祝你开心每一天';return true"><%=rs("medianame")%></a></td>
	<td align=center valign=middle><%=rs("sendtime")%></td>
	<td align=left valign=middle><%=rs("content")%></td>
<%if trim(rs("incept"))<>"全体会员" then%>	
        <td width=40>
            <%if rs("isaccept")="0" then 
                 response.write "未收听"
              else
                 response.write "已收听"
              end if
            %>
        </td>
<%else%>
        <td width=40 align=center><%if acceptuser<>0 then%><a href=javascript:openScript('disuser.asp?id=<%=rs("id")%>',400,250,20,20,1) title="点击查看收听人员名单"><%=acceptuser%></a><%else response.write acceptuser  end if%></td>
<%end if%>
        <td align=center valign=middle><%if trim(rs("sender"))=GBL_CHK_User or trim(rs("incept"))=GBL_CHK_User or CheckSupervisorUserName = 1 then%><a href=del.asp?id=<%=rs("id")%> onclick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">[删除]</a><%else%>[删除]<%end if%></td>
  </tr>		
<%		
			else
%>
  <tr class=tbbg1>
	<td align=center valign=middle><%=rs("sender")%></td>
	<td align=center valign=middle><%=rs("incept")%></td>
	<td align=center valign=middle><%=rs("medianame")%></td>
	<td align=center valign=middle><%=rs("sendtime")%></td>
	<td align=left valign=middle>小秘密哦，你看不到的 @_^</td>
	<td></td>
        <td align=center valign=middle>[删除]</td>
  </tr>
<%
			end if
	  	page_count = page_count + 1
		rs.movenext
		wend
	end if

	dim endpage
	Pcount=rs.PageCount
        response.write "<tr class=tbbg1><td colspan=7 valign=middle nowrap>页次：<b>"&currentpage&"</b>/<b>"&Pcount&"</b>页 每页<b>10</b>条 共有<b>"&totalrec&"</b>条点歌 分页："

	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 "</font></td></tr>"
	rs.close
	set rs=nothing
'=========================
%>	

  <tr bgcolor=<%=DEF_BBS_LightDarkColor%> align=center class=tbhead2>
	<td colspan=7><font class=headfont>--== 论坛点歌台-所有点歌列表 ==--</font></td>
  </tr>
</table>	
<%
	call CloseDB()
	
end if
'尾部信息
If GBL_TableBottomString <> "" Then %>
 <table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center>
   <tr><td><%=GBL_TableBottomString%></td></tr>
 </table>
<% End If 
  SiteBottom 
   If GBL_SiteBottomString <> "" Then Response.Write GBL_SiteBottomString
%>