<!-- #include file="include/con_music.asp" -->
<!-- #include file="include/jk_em.asp" -->
<!-- #include file="include/jk_emoney.asp" -->
<!-- #include file="include/jk_convert.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================
tit_fir="音乐频道"
tit=login_username&"的点歌机"

dim max_num
max_num=web_dim(35)
dim nummer,nums,rssum,page,viewpage,thepages,pageurl
dim temp1,word,action_temp,action_temp2,name_temp,read_pic,actions
actions=trim(request.querystring("actions"))
id=trim(request.querystring("id"))
if not isnumeric(id) then id=0
if action="send_in" or action="msg_view" or action="" then
  sql_add=" where r_user='"&login_username&"'"
  action_temp="收歌箱"
end if
if action="send_out" then
  sql_add=" where s_user='"&login_username&"'"
  action_temp="点歌箱"
end if
call web_head(2,0,0,0,0)
call convert_load(login_mode)
max_num=format_convert(max_num,"+")
call music_load()
'------------------------------------left----------------------------------
call music_mail()
call music_top(10,10)
call disk_top(10,10)
call music_tool()
'----------------------------------left end--------------------------------
call web_center(0)
'-----------------------------------center---------------------------------
response.write Cls.js_put("/style/joekoe_select.js",0)
call music_head()
call music_sea()
if action="send_out" then 
response.write vbcrlf&music_bar_top("center_mail_out",1)
else
response.write vbcrlf&music_bar_top("center_mail_in",1)
end if

select case actions
  case "clear"
    call music_mail_clear()
  case "del"
    call music_mail_delete(1)
  case "delete"
    call music_mail_delete(0)
  case else
    select case action
      case "send_in"
        action_temp2="来自"
        call music_mail_box()
      case "send_out"
        action_temp2="送给"
        call music_mail_box()
      case "msg_view"
        call music_mail_view()
      case else
        action="send_in"
        action_temp2="来自"
        call music_mail_box()
    end select
end select
%>
<script language=javascript>
<!--
function mail_clear()
{
  if (confirm('确定清空<%response.write action_temp%>所有的点歌吗?\n\n清空后将无法恢复！'))
  {
    location.href='?actions=clear&action=<%response.write action%>';
  }
}
-->
</script>
<script language=javascript>
function music_play(emoney,power)
{
  var t1=note_emoney('收听此歌曲',emoney,'power');
  if (t1)
  {
    document.music_frm.submit();
  }
}
</script>
<%
'---------------------------------center end-------------------------------
 response.write vbcrlf&music_bar_end()

call web_end(0,0)
'---------------------------------点歌浏览-------------------------------
sub music_mail_view()
    sql="select * from music_mail where id="&id
    set rs=Cls.exec(sql,1)
    if rs.eof or rs.bof then
    response.write Cls.js_put("alert(""错误的ID参数：\n\n数据库中没有这首点歌！"");window.opener=null;window.close();",1)
    Response.end
    else
      if rs("s_user")<>login_username and rs("r_user")<>login_username then
        response.write Cls.js_put("alert(""错误的ID参数：\n\n这首歌好象与您无关哦！"");window.opener=null;window.close();",1)
        Response.end
      end if
    end if
    rs.close
    sql="select * from music_mail where id="&id
    call Cls.exec(sql,-1)     
    rs.Open sql,conn,1,3
    word=Cls.code_html(rs("words"),2,0)
    word=code_jk_em(word)
    temp1=temp1&"<tr><td height=0><table border=0 cellspacing=1 cellpadding=1 class=mtable>" & _
             vbcrlf&"<form name=music_frm action='music_pass.asp?id="&rs("m_id")&"' method=post target=hiddenframe><input type=hidden name='send_user' value='"&rs("s_user")&"'><input type=hidden name='pay_num' value='"&int(rs("paynum")*100)&"'>" & _
             vbcrlf&"<tr class=bg_td height=24><td align=center><b>歌曲名称：<font class=red2>"&rs("m_name")&"</font></b></td></tr>" & _
             vbcrlf&"<tr class=bg_td height=100><td align=center>" & _
             vbcrlf&"<table border=0 width='96%' class=tf>" & _
             vbcrlf&"<tr><td class=bw>"&word&"</td></tr>" & _
             vbcrlf&"</table>" & _
             vbcrlf&"</td></tr>" & _
             vbcrlf&"<tr class=bg_td height=24><td>&nbsp;&nbsp;收听这首歌曲需要&nbsp;<font class=red>"&rs("emoney")&"</font>&nbsp;"& Cls.web_unit&"&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:;' onclick=javascript:music_play('0','"&rs("power")&"');><font class=red>我要收听</font></a></td></tr>" & _
             vbcrlf&"<tr height=24 class=bg_tds><td align=center>以上是&nbsp;[&nbsp;"&rs("s_user")&"&nbsp;]&nbsp;于&nbsp;<font class=blue>"&rs("tim")&"</font>&nbsp;给您点的歌曲信息</td></tr>" & _
             vbcrlf&"</form>" & _
             vbcrlf&"</table></td></tr>" 
    rs("isread")=1
    rs.update
    rs.close
    response.write temp1
end sub
'---------------------------------点歌单-------------------------------
sub music_mail_box()
  dim numusic_perent,isread
  nummer=dim_num(0)
  nums=nummer
  pageurl="?action="&action&"&"
  sql="select count(id) from music_mail"&sql_add
  set rs=Cls.exec(sql,1)
  rssum=rs(0)
  rs.close
  numusic_perent=formatpercent(rssum/max_num,1)
  temp1=temp1&"<tr><td height=0><table border=0 cellspacing=1 cellpadding=1 class=mtable>" & _
             vbcrlf&"<form name=del_form action='?actions=delete&action="&action&"' method=post>" & _
             vbcrlf&"<tr height=24 class=bg_tds align=center>" & _
             vbcrlf&"<td width='6%' background='images/music/bg_td.gif'>状态</td>" & _
             vbcrlf&"<td width='16%' background='images/music/bg_td.gif'>"&action_temp2&"</td>" & _
             vbcrlf&"<td width='58%' background='images/music/bg_td.gif'>歌曲名称</td>" & _
             vbcrlf&"<td width='14%' background='images/music/bg_td.gif'>发送日期</td>" & _
             vbcrlf&"<td width='6%' background='images/music/bg_td.gif'>操作</td>" & _
             vbcrlf&"</tr>"
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from music_mail"&sql_add&" order by id desc"
  call Cls.exec(sql,-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
      if action="send_in" then
        name_temp=rs("s_user")
      elseif action="send_out" then
        name_temp=rs("r_user")
      end if
      isread=rs("isread")
      if isread=true then
        read_pic="state_old"
      else
        read_pic="state_new"
      end if
    temp1=temp1&"<tr height=24 align=center class=mbg_td>" & _
             vbcrlf&"<td><img src="&Cls.web_dir_skin&"mail/"&read_pic&".gif border=0></td>" & _
             vbcrlf&"<td><a href=user_view.asp?username="&name_temp&">"&name_temp&"</a></td>" & _
             vbcrlf&"<td><a href='javascript:;' onclick=javascript:open_view('?action=msg_view&id="&rs("id")&"',1);>"&rs("m_name")&"</a></td>" & _
             vbcrlf&"<td><font class=tims>"&Cls.time_type(rs("tim"),3)&"</font></a></td>" & _
             vbcrlf&"<td><input type=checkbox name=sel_id value='"&rs("id")&"'></td>" & _
             vbcrlf&"</tr>"
    rs.movenext
  next
  rs.close
  set rs=nothing
 temp1=temp1&"<tr class=bg_tds height=30>" & _
             vbcrlf&"<td colspan=5 align=center>" & _
             vbcrlf&"<table border=0 cellspacing=0 cellpadding=2>" & _
             vbcrlf&"<tr>" & _
             vbcrlf&"<td><font class=Gys>（请删除无用信息以节省空间）</font></td>" & _
             vbcrlf&"<td><input type=checkbox name=sel_all value='yes' onclick=""javascript:select_all(this.form);"" class=bg_tds>所有</td><td><input type=submit value='删除所选' onclick=""return sel_click(this.form);""></td>" & _
             vbcrlf&"<td><input type=button onclick=""javascript:mail_clear();"" value='清空"&action_temp&"'></td>" & _
             vbcrlf&"</tr>" & _
             vbcrlf&"</table>" & _
             vbcrlf&"</td>" & _
             vbcrlf&"</tr>" & _
             vbcrlf&"</form>" & _
             vbcrlf&"</table></td></tr>" 
 temp1=temp1&"<tr height=30><td colspan=5 align=center>" & _
             vbcrlf&"<table cellpadding=0 border=0 cellspacing=0>" & _
             vbcrlf&"<tr>" & _
             vbcrlf&"<td><font class=red><b>[注]：</b></font>您的"&action_temp&"可以存储&nbsp;<font class=red>"&max_num&"</font>&nbsp;条点歌信息，目前已有&nbsp;<font class=red>"&rssum&"</font>&nbsp;条，占<font class=red>"&numusic_perent&"</font>：</td>" & _
             vbcrlf&"<td>" & _
             vbcrlf&"<table cellpadding=0 border=0 cellspacing=0 style='background-color:white; border: #104a7b 1px solid; padding-right: 0px; padding-left: 0px; padding-bottom: 2px; padding-top: 2px;'>" & _
             vbcrlf&"<tr><td width=120><div style='height:5px; width:"&numusic_perent&"; font-size:1px; background-color:#76D769'></div></td></tr>" & _
             vbcrlf&"</table>" & _
             vbcrlf&"</td>" & _
             vbcrlf&"</tr>" & _
             vbcrlf&"</table>" & _
             vbcrlf&"</td></tr>" & _
             vbcrlf&"<tr height=30>" & _
             vbcrlf&"<td colspan=5>&nbsp;<img src='images/music/s_fav_left.gif' align=absMiddle border=0>&nbsp;<font class=blue><b>音乐点歌机</b></font>&nbsp;&nbsp;&nbsp;现有<font class=red>"&rssum&"</font>条点歌，页次：<font class=red>"&viewpage&"</font>/<font class=red>"&thepages&"</font>分页："&jk_pagecute(nummer,thepages,viewpage,pageurl,10,"#ff0000")&"</td>" & _
             vbcrlf&"</tr>"
  response.write temp1
end sub

sub music_mail_delete(dtype)
  dim sel_id,sdim,snum,del_type
  if dtype=0 then
    sel_id=trim(request.form("sel_id"))
    sel_id=replace(sel_id," ","")
    if sel_id="" then
      call web_js_msg(1,action_temp&"中没有可删除的点歌信息！","?")
    end if
  else
    sel_id=trim(request.querystring("id"))
    if not isnumeric(sel_id) then
      call web_js_msg(1,"没有可删除的点歌信息！","?")
    end if
  end if
  
  sdim=split(sel_id,",")
  snum=ubound(sdim)
  for i=0 to snum
    if isnumeric(sdim(i)) then
      sql="delete from music_mail where id="&sdim(i)
      call Cls.exec(sql,0)
    end if
  next
  erase sdim
  call web_js_msg(1,"已从"&action_temp&"中成功删除"&(snum+1)&"条点歌信息！","?")
end sub

sub music_mail_clear()
  sql="delete from music_mail "&sql_add
  call Cls.exec(sql,0)
  call web_js_msg(1,"已成清空了"&action_temp&"中的点歌信息！","?")
end sub
%>