<!-- #include file="include/AMH_onlogin.asp" -->
<!-- #INCLUDE file="AMH_music_config.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

del_user_true=true
del_upload_true=true
tit="歌曲管理"
Index_Url="msong"
PageUrl = PageUrl&"ChannelIDs="&iChannelIDs&"&"
Call AMH_Master(1,2)
Call AMH_Header(0)
Select Case AsaiMHMod
Case "isgood"
	ntit="推荐"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1 and isgood=1"
Case "sh"
	ntit="待审核"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=0"
Case Else
	AsaiMHMod=""
	ntit=tit_fir&"列表"
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1"
End Select
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?ChannelIDs=<%=iChannelIDs%>'><%Response.Write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=isgood&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="isgood" then Response.Write " class=red"%>>推荐<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=sh&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="sh" then Response.Write " class=red"%>>待审核<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?Action=Add&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>'<%if action="add" then Response.Write " class=red"%>>添加<%Response.Write tit_fir%></a></td>
 </tr>
  </table>
  </td></tr>
  <tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
<%call AsaiMHIs_Nsort_Review()%>
  </tr>
  </table>
</td></tr>
<tr><td colspan=2 align=center>
  <table border=0 cellspacing=0 cellpadding=2>
  <form action='?' method=get>
  <input type=hidden name=ChannelIDs value='<%Response.Write iChannelIDs%>'>
  <input type=hidden name=AsaiMHMod value='<%Response.Write AsaiMHMod%>'>
  <input type=hidden name=ClassID value='<%Response.Write ClassID%>'>
  <tr>
  <td>搜索（<%Response.Write ntit%>） 关键字：</td>
  <td><input type=text name=keyword value='<%Response.Write Cls.Code_Query("keyword")%>' size=15 maxlength=20></td>
  <td><select name=sea_type size=1><option value='topic'>按标题</option><option value='username'>按发布人</option></select></td>
  <td><select name=sea_term size=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>
  <td><input type=submit value='搜索' class=btn></td>
  </tr>
  </form>
  </table>
</td></tr>
</table>
<%
Call AMH_Table(1)
If Action="handle" Then call AsaiMHGo_Handle()
Select Case LCase(Action)
  case "add"
    call song_add()
  case "edit"
    call song_edit()
  case "clear"
    call AsaiMHGo_Clear()
  case else
    call song_list_main()
end select
call AMH_ender(1)
'-----------------------------------删除歌曲-------------------------------------------
sub song_del()
  dim sel_id,sdim,snum,del_type
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  if sel_id="" then
    call web_js_msg(1,"没有可删除的歌曲！","?")
  end if
  sdim=split(sel_id,",")
  snum=ubound(sdim)
  for i=0 to snum
    if isnumeric(sdim(i)) then
      sql="delete from "&Data_Name&" where id="&sdim(i)
      call Cls.exec(sql,0)
    end if
  next
  erase sdim
  call AMH_msg("已成功删除"&(snum+1)&"首歌曲！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&n_id="&n_id&"&ChannelID="&iChannelID,0)
end sub

'-----------------------------------修改歌曲-------------------------------------------
sub song_edit()
  dim power,emoney,tim,musicserver,username,ispic,smi,hidden,NO,SpecialID,istop,Isfocus,words,counter,server_id,url,Name,Music_url,genre
  sql="select name from AsaiMHMusicSinger where id="&n_id
  set rs=Cls.exec(sql,1)
    if not rs.eof then
    singer=rs("name")
  end if
  rs.close
  sql="select * from "&Data_Name&" where id="&id
  call Cls.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
      rs.close
      call AMH_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
      exit sub
      else
      name=rs("name")
      'ptim=rs("ptim")
      SpecialID=rs("SpecialID")
      username=Cls.Code_Admin("username",1,20)
      if ChkName(username)=false then username=login_username
      tim=rs("tim")
      isgood=rs("isgood")
      istop=rs("istop")
      Isfocus=rs("Isfocus")
      hidden=rs("hidden")
      counter=rs("counter")
      words=rs("words")
      server_id=Rs("server_id")
      power=rs("power")
      emoney=rs("emoney")
      Music_url=rs("url")
      Name=rs("Name")
      genre=rs("genre")
      pic=rs("pic")
    end if
  if chk() then
    if trim(request("MusicName"))="" then 
      rs.close
      call AMH_error("歌曲名称不能为空！")
      exit sub
    end if
    musicserver=trim(request.form("Server_id"))
    if musicserver="" or isnull(musicserver) then musicserver=0
    musicserver=int(musicserver)
    if musicserver>0 and instr(trim(request.form("ListenUrl")),"://")<>0 then
      call AMH_error("本地服务器"&tit_fir&"地址"&i&" 错误！请输入服务器相对路径！")
      exit sub
    end if
    if musicserver=0 and instr(trim(request.form("ListenUrl")),"://")<1 then
      call AMH_error("非本地服务器"&tit_fir&"地址"&i&" 错误！请输入服务器绝对路径！")
      exit sub
    end if
    power=Cls.code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    smi=Cls.code_admin("pic",1,100)
    rs("url")=trim(request.form("ListenUrl"))
    rs("urltype")=musicserver
    rs("Name")=trim(request.form("MusicName"))
    rs("classid")=classid
    rs("n_id")=n_id
    rs("d_id")=d_id
    rs("counter")=trim(request.form("counter"))
    rs("power")=power
    rs("emoney")=emoney
    rs("genre")=trim(request.form("genre"))
    rs("username")=username
    rs("singer")=trim(request.form("singer"))
    rs("words")=Request.Form("words")
    rs("smi")=smi
    rs("pic")=trim(request.form("pic"))
    tim=Cls.code_admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    rs("tim")=tim
    isgood=trim(request.form("isgood"))
    hidden=trim(request.form("hidden"))
    if isgood="yes" then
      rs("istop")=true
    else
      rs("istop")=false
    end if
    if hidden="yes" then
      rs("hidden")=false
    else
      rs("hidden")=true
    end if
    rs("Server_id")=musicserver
    rs.update
    rs.close
    sql="select * from AsaiMHMusicFav where f_id="&id
    call Cls.exec(sql,-1)
    rs.open sql,conn,1,3
    if not rs.eof then
      rs("Name")=trim(request.form("MusicName"))
      rs.update
    end if
    rs.close
    call AMH_msg("已成功修改了一首歌曲！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&n_id="&n_id&"&ChannelIDs="&iChannelIDs,0)
    
    exit sub
  end if
  call form_first()
%>
<tr><td colspan=2 class=td>修改歌曲&nbsp;<%=name%>&nbsp;的资料</td></tr>
<form name="edit_frm" action='?AsaiMHMod=<%Response.Write AsaiMHMod%>&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>&action=edit&id=<%Response.Write id%>&n_id=<%=n_id%>&page=<%=page%>' method=post>
<input type="hidden" name="singer" value="<%=singer%>">
<input type=hidden name=chk value='yes'>
<tr>
<td>所属专辑：</td><td><%response.write sel_s_id("?ChannelIDs="&iChannelIDs&"&Action=edit",iChannelIDs,Cls.ClassDepth,ClassID)&sel_n_id("?ChannelIDs="&iChannelIDs&"&Action=edit&id="&id)&sel_d_id("?ChannelIDs="&iChannelIDs&"&Action=edit&id="&id)%></td>
</tr>
<%
  Response.Write ShowSpecialSel(iChannelIDs,SpecialID)
  Response.Write ShowPutInfo(username,tim)
  Response.Write ShowRelateInfo(isgood,istop,Isfocus,hidden,counter)
  Response.Write ShowLimit(power,0,emoney)
  Response.Write Server_InitSelect("","Server_id",iChannelIDS,server_id)
  %>
<tr>
<td>音乐地址：</td><td><input type=text name=ListenUrl value='<%=Music_url%>' size=20>     歌曲名字：<input type=text name=MusicName value='<%=name%>' size=20>    <img src='../images/video/ico_rp.gif' width=16 height=16> <input type=radio value='real' name=genre<%if genre="real" then response.write " checked"%>>
&nbsp;<img src='../images/video/ico_wmp.gif' width=16 height=16> <input type=radio value='wmp' name=genre<%if genre="wmp" then response.write " checked"%>></td>
</tr>
  <%
  Response.Write ShowUBBEditor(iChannelIDs,"add_frm","words","歌词",words,"Basic",560,200)
   Response.Write ShowPicUpload(iChannelIDs,pic,"pic")
  Response.Write ShowUploadList()
  Call Submit_Edit()
end sub

'-----------------------------------添加歌曲-------------------------------------------
sub song_add()
  if chk() then
    dim power,emoney,musicserver,no,urlS,name,tim,username,hits,hidden,istop,counter,smi,ispic,keyes,Isfocus,oSpecialID,tcolor,Urlname,server_id,Url,genre
    call AMH_td("添加"&tit_fir)
     if chk() then
    Urls=Cls.Code_Remark("Urls")  'Cls.code_admin("url",1,200)
    Name=Cls.Code_Admin("Name",1,150)
    genre=Cls.Code_Admin("genre",1,150)
    csid=Cls.Code_Form("ClassID")
    no=trim(request.form("no"))
	if not Cls.is_int(no) then no=0
	server_id=trim(request.form("server_id"))
	musicserver=trim(request.form("server_id"))
    if not Cls.is_int(server_id) then server_id=1
    songwords=Cls.Code_Remark("songwords")
    if Cls.Code_Remark("remote")="yes" then songwords=DoRemoteUpload(Remark,Cls.ChannelUpMax,Cls.ChannelUpFileType(4),Cls.ChannelUploadDir,Cls.Get_ChannelSetup(Cls.ChannelSetup,15))
        if cs_nd(csid)=false then
      call AMH_error("请选择 "&tit_fir&"分类！<br />如有下级分类，请如实选择所属下级分类")
      exit sub
    End If
    if musicserver="" or isnull(musicserver) then musicserver=0
    musicserver=int(musicserver)
 for i=1 to no
        Url=Cls.code_admin("Url"&i&"",1,255)
      if Url="" then
        call AMH_error(tit_fir&"地址"&i&" 不能为空！")
        exit sub
      end if
       genre=Cls.code_admin("genre"&i&"",1,255)
      if genre="" then
        call AMH_error(tit_fir&"播放器"&i&" 不能为空！")
        exit sub
      end if
      if server_id>0 and instr(Url,"://")<>0 then
        call AMH_error("本地服务器"&tit_fir&"地址"&i&" 错误！请输入服务器相对路径！")
        exit sub
      end if
      if server_id=0 and instr(Url,"://")<1 then
        call AMH_error("非本地服务器"&tit_fir&"地址"&i&" 错误！请输入服务器绝对路径！")
        exit sub
      end if
      Name=Cls.code_admin("Name"&i&"",1,20)
      if Name="" then
        call AMH_error(tit_fir&"名称"&i&" 不能为空！")
        exit sub
      end if
    next
    pic=Cls.code_admin("pic",1,100)
	ispic=true
   if pic="" then ispic=false
    keyes=Cls.code_admin("keyes",1,20)
    power=Cls.code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=Cls.code_admin("username",1,20)
    if ChkName(username)=false then username=login_username
    tim=Cls.Code_Admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    isgood=false
    if Cls.Code_Form("isgood")="yes" then isgood=true
	istop=0
    if Cls.Code_Form("istop")="yes" then istop=1
	Isfocus=false
    if Cls.Code_Form("Isfocus")="yes" then Isfocus=true
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    oSpecialID=Cls.Code_Int("SpecialID",0)
    tcolor=Cls.Code_Form("tcolor")
    Call Chk_Cid()
    hits=trim(Request.Form("hits"))
    if not isnumeric(hits) then hits=0
    sql="select name from AsaiMHMusicSinger where id="&n_id
    set rs=Cls.exec(sql,1)
    singer=rs("name")
    rs.close
    Call Chk_Cid()
    sql="select * from "&Data_Name&"" 
    call Cls.exec(sql,-1)
    rs.open sql,conn,1,3
    for i=1 to no
    rs.addnew
    rs("ChannelIDs")=iChannelIDs
		rs("Url")=Cls.Code_Admin("Url"&i,1,255)
		rs("Name")=Cls.Code_Admin("Name"&i,1,20)
		rs("genre")=Cls.Code_Admin("genre"&i,1,20)
    rs("urltype")=musicserver
    rs("ClassID")=ClassID
    rs("n_id")=n_id
    rs("d_id")=d_id
    rs("smi")=smi
    rs("counter")=Cls.Code_Form("counter")
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("singer")=singer
    rs("words")=songwords
    rs("tim")=tim
 	rs("Isfocus")=Isfocus
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
	rs("ispic")=ispic
    rs("isgood")=isgood
    rs("Istop")=Istop
    rs("cod")=1
    rs("tcolor")=tcolor
    rs("server_id")=server_id
	rs("HtmlFileDate")=Cls.HtmlRndFileName()
    rs("isUpdate")=True
    rs.update
    next
    rs.close
    end if
    call AMH_msg("已成功添加了"&no&"首歌曲！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&n_id="&n_id&"&ChannelIDs="&iChannelIDs,0)
  else
    call form_first()
    ispic=Cls.rand_file(Index_Url)
%>
<form method=post name=add_frm action="<%Response.Write PageUrl%>Action=add&types=chk&ClassID=<%=ClassID%>&n_id=<%=n_id%>" onSubmit="PostUrl('add_frm','Url','Urls');">
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<script language=javascript>
<!--
function seturl()
{
	var str="";
	var j="";
	var temname1=add_frm.t1.value
	var temname2=add_frm.t2.value
	if (!window.add_frm.no.value) window.add_frm.no.value=1;
	for(i=1;i<=window.add_frm.no.value;i++)
	{
	if (i<10)
	{ j=''+i; }
	else
	{ j=i; }
	str+='&nbsp;'+j+'：&nbsp;<input type=text name="Url'+i+'" size=50 value="'+temname1+j+temname2+'" maxlength=255>&nbsp;本曲名称：&nbsp;<input type=text name="Name'+i+'" size=10 maxlength=20 value="第'+j+'首">&nbsp;<img src="../images/video/ico_rp.gif" width=16 height=16><input type=radio name="genre'+i+'"  value="real" >&nbsp;<img src="../images/video/ico_wmp.gif" width=16 height=16><input type=radio name="genre'+i+'"  value="wmp" checked><br />';
	}
	window.addid.innerHTML=str;
}
-->
</script>
<tr>
<td colspan=2 class=td>添加歌曲</td>
</tr>
<tr>
<td>所属专辑：</td>
<td><%response.write sel_s_id("?ChannelIDs="&iChannelIDs&"&Action=add",iChannelIDs,Cls.ClassDepth,ClassID)&sel_n_id("?ChannelIDs="&iChannelIDs&"&Action=add")&sel_d_id("?ChannelIDs="&iChannelIDs&"&Action=add")%></td><%
Response.Write ShowPutInfo(Login_username,Cls.Now_time)
Response.Write ShowRelateInfo("",Istop,"",1,0)
Response.Write ShowLimit("",1,0)
Response.Write Server_InitSelect("","Server_id",iChannelIDs,0)
Response.Write Ulr_Home(iChannelIDs,"添加","no","",0,"","")
 Response.Write ShowUBBEditor(iChannelIDs,"add_frm","songwords","歌词","","Basic",560,200)
   Response.Write ShowPicUpload(iChannelIDs,"","pic")
  Response.Write ShowUploadList()
  call submit_add()
  end if
end sub

'-----------------------------------歌曲列表-------------------------------------------
sub song_list_main()
Dim IncludeInfo,IsReview,topic,pageurl2,tcolor,obj_page
  response.write "<form name=del_form action='"&PageUrl&"&ClassID="&c_id&"&n_id="&n_id&"&Action=handle' method=post>" & _
             vbcrlf&"<tr align=center>" & _
             vbcrlf&"<td class=td width='7%'>序号</td>" & _
             vbcrlf&"<td class=td width='42%'>歌曲名字</td>" & _
             vbcrlf&"<td class=td width='12%'>所属歌手</td>" & _
             vbcrlf&"<td class=td width='7%'>点击</td>" & _
             vbcrlf&"<td class=td width='25%'>相关属性</td>" & _
             vbcrlf&"<td class=td width='7%'><input type=checkbox name=sel_all value='yes' onclick=""javascript:select_all(this.form);""></td>" & _
             vbcrlf&"</tr>"
  if c_id<>"" then
    if n_id<>"" then
      sql_add=sql_add&" and n_id="&n_id&"  and ClassID="&c_id
      else
      sql_add=sql_add&" and ClassID="&c_id
    end if
  end if
  if d_id<>"" then
    sql_add=" d_id="&d_id
  end if
  if types="sea" then 
    sql_add=" where name like '%"& keyword &"%'"
    pageurl="?types=sea"
  end if
  set obj_page=New Cls_pageCute
  obj_page.nummer=nummer
  obj_page.pageurl=pageurl
  obj_page.page_tit=tit_fir
  obj_page.page_unit="条"
  obj_page.v_id="id"
  call obj_page.p_init("id,ClassID,IncludeInfo,n_id,istop,name,tim,isgood,hidden,singer,hits,tcolor,Isfocus,cod,ispic,d_id",Data_Name,sql_add,"id desc")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  call obj_page.p_main("id,ClassID,IncludeInfo,n_id,istop,name,tim,isgood,hidden,singer,hits,tcolor,Isfocus,cod,ispic,d_id",Data_Name,sql_add,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    IncludeInfo=rs("IncludeInfo")
    topic=rs("name")
    tcolor=rs("tcolor")
    topic=Cls.code_html(topic,1,40)
    if Cls.Is_Null(tcolor)<>"" then
      topic="<font color=#"&tcolor&">"&topic&"</font>"
    End If
    response.write "<tr align=center>" & _
             vbcrlf&"<td>"&i&"</td>" & _
             vbcrlf&"<td><table border=0 cellspacing=0 cellpadding=0 width='100%'><tr>" & _
             vbcrlf&"<td><a href='"&PageUrl&"action=edit&id="&rs("id")&"&ClassID="&rs("ClassID")&"&n_id="&rs("n_id")&"&d_id="&Rs("d_id")&"'>"&rs("name")&"</a></td>" & _
             vbcrlf&"<td align=right><font class=tims>"&Cls.time_type(rs("tim"),4)&"</font></td>" & _
             vbcrlf&"</tr></table></td>" & _
             vbcrlf&"<td>"&rs("singer")&"</td>" & _
             vbcrlf&"<td>"&rs("hits")&"</td>" & _
             vbcrlf&"<td align=center>"&pro_edit(PageUrl&"Action=edit&id="&rs("id")&"&ClassID="&rs("ClassID")&"&n_id="&rs("n_id")&"&d_id="&Rs("d_id")&"","编辑该歌曲") &"&nbsp;"& pro_hidden(rs("hidden"),1) &"&nbsp;"& pro_cod(rs("cod")) &"&nbsp;"& pro_isgood(rs("isgood")) &"&nbsp;"& pro_Isfocus(rs("Isfocus")) &"&nbsp;"& pro_istop(rs("istop")) &"&nbsp;"& pro_ispic(rs("ispic")) &"</td>" & _
             vbcrlf&"<td><input type=checkbox name=sel_id value='"&rs("id")&"' class=bg_tds></td>" & _
             vbcrlf&"</tr>"
    rs.movenext
  next
    rs.close
  set rs=nothing
   response.write "<tr class=tr1>" & _
            vbcrlf&"<td colspan=2>" & _
    vbcrlf&"<table border=0 cellspacing=0 cellpadding=2>" & _
    vbcrlf&"<tr class=tr1><td>"&obj_page.page_var&"</td><td width=3></td><td>分页：</td><td>"&obj_page.page_cute&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"</table>" & _
    vbcrlf&"</td>" & _
    vbcrlf&"<td colspan=4 align=center>执行<select name=sel_type size=1><option value='推荐'>推荐</option><option value='取消推荐'>取消推荐</option><option value='焦点'>焦点</option><option value='取消焦点'>取消焦点</option><option value='固顶'>固顶</option><option value='取消固顶'>取消固顶</option><option value='审核'>审核</option><option value='待审核'>待审核</option><option value='删除'>删除</option></select><input type=submit value='操作' onclick=""return sel_click(this.form);"" class=btn>" & _
    vbcrlf&"</td>" & _
    vbcrlf&"</tr>" & _
    vbcrlf&"</form>" & _
    vbcrlf&"</table>" & _
    vbcrlf&"</td>" & _
    vbcrlf&"</tr>"
end sub
%>
