<!-- #include file="include/admin_onlogin.asp" -->
<!-- #INCLUDE file="admin_music_config.asp" -->
<%
del_user_true=true
del_upload_true=true
tit="专辑管理"
index_url="mdisk"
call admin_master(0,0)
data_name="music_disk"
call admin_header(0,0)
select case jk_mod
case "istop"
  ntit="推荐"&tit_fir
  sql_add=" where hidden=1 and istop=1"
case "sh"
  ntit="待审核"&tit_fir
  sql_add=" where hidden=0"
case else
  jk_mod=""
  ntit=tit_fir&"列表"
  sql_add=" where hidden=1"
end select
%>
<tr><td colspan=2 align=center>
 <table border=0>
  <tr>
  <td><a href='?'><%response.write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=sh'<%if jk_mod="sh" then response.write " class=red"%>>待审核<%response.write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?jk_mod=istop'<%if jk_mod="istop" then response.write " class=red"%>>推荐<%response.write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?action=add&c_id=<%=c_id%>&s_id=<%=s_id%>&n_id=<%=n_id%>'<%if action="add" then response.write " class=red"%>>添加<%response.write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='admin_music_singer.asp'>歌手管理</a></td>
  <td width=10></td>
  <td><a href='admin_music_song.asp'>歌曲管理</a></td>
  <td width=10></td>
  <td><a href='?action=clear' onclick="javascript:return click_return('清空所有专辑',0);">清空所有专辑</a></td>
  </tr>
  </table>
</td></tr>
<tr><td colspan=2 align=center>
  <table border=0 cellspacing=0 cellpadding=2>
  <form action='?' method=get>
  <tr>
  <td>搜索（点歌列表）关键字：</td>
  <td><input type=text name=keyword value='<%response.write trim(request.querystring("keyword"))%>' size=15 maxlength=20></td>
  <td><select name=sea_type size=1>
  <option value='name'>按专辑名称</option>
  <option value='singer'>按所属歌手</option>
  </select></td>
  <td><select name=sea_term size=1>
  <option value='all'>满足所有条件</option>
  <option value='only'>满足一个条件</option>
  </select></td>
  <td><input type=submit value='搜索'></td>
  </tr>
  </form>
  </table>
</td></tr>
<%
call admin_table(1)
if action="handle" then call joekoe_go_handle()
select case action
  case "add"
    call disk_add()
  case "edit"
    call disk_edit()
  case "clear"
    call joekoe_go_clear()
  case else
    call disk_list_main()
end select
call admin_ender(1)
'-----------------------------------修改专辑-----------------------------------------
sub disk_edit()
  dim ispic,hidden
    sql="select * from music_singer where id="&n_id 
    set rs=joekoe_cms.exec(sql,1)
    nclassname=rs("name")
    rs.close
    sql="select top 1 * from music_disk where id="&d_id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
    if rs.eof then
      rs.close
      call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
      exit sub
    end if
    if chk() then
    if trim(request("name"))="" then 
      rs.close
      call admin_error("歌手姓名不能为空！")
      exit sub
    end if
    rs("name")=trim(request.form("name"))
    rs("pcom")=trim(Request.Form("pcom"))
    rs("ptim")=trim(Request.Form("ptim"))
    rs("lang")=trim(Request.Form("lang"))
    rs("hits")=trim(request("hits"))
    rs("c_id")=c_id
    rs("s_id")=s_id
    rs("n_id")=n_id
    rs("singer")=nclassname
    rs("words")=request.form("intro")
    rs("tim")=joekoe_cms.time_type(code_admin("tim",1,20),1)
    rs("pic")=code_admin("pic",1,100)
    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.update
   rs.close
'修改专辑中的歌曲资料
    sql="select * from music_song where d_id="&d_id 
    call joekoe_cms.exec(sql,-1) 
    rs.open sql,conn,1,3
    if not rs.EOF then
      do while not rs.EOF
        rs("Singer")=NClassname
        rs("c_id")=c_id
        rs("s_id")=s_id
        rs("n_id")=n_id
        rs.update
      rs.MoveNext
      loop
    end if
    rs.Close
	call upload_note(index_url,id) 
    call admin_msg("已成功编辑了一张专辑！","?c_id="&c_id&"&s_id="&s_id&"&n_id="&n_id,0)
'结束修改
    exit sub
    end if
    call form_first()
    ispic=apart_filename(pic,1,"/")
    if ispic="" then ispic=joekoe_cms.rand_file(index_url)
    call admin_td("修改专辑&nbsp;"&rs("name")&"&nbsp;的资料")
%>
<form method="POST" action="?action=edit&d_id=<%=d_id%>&c_id=<%=c_id%>&s_id=<%=s_id%>&n_id=<%=n_id%>" name=edit_frm>
<input type=hidden name=chk value='yes'>
<tr>
<td>选择栏目：</td><td><%response.write sel_c_id("?action=edit&d_id="&d_id)&sel_s_id("?action=edit&d_id="&d_id)&sel_n_id("?action=edit&d_id="&d_id)%>
</td>
</tr>
<tr>
<td>专辑名称：</td><td><input type="text" name="name" value="<%=rs("name")%>" size=60 maxlength=50></td>
</tr>
<tr>
<td>发行时间：</td><td><input type="text" name="ptim" value="<%=rs("ptim")%>" size="20">&nbsp;<input type=button name=st_btn value="选择" onclick="javascript:select_time(ptim);return false;"></td>
</tr>
<tr>
<td>发布时间：</td><td><input type="text" name="tim" value="<%=rs("tim")%>" size=20 maxlength=40>&nbsp;<input type=button name=st_btn value="选择" onclick="javascript:select_time(tim);return false;">&nbsp;&nbsp;浏览：<input type="text" name="hits" value="<%=rs("hits")%>" size=5 maxlength=40>&nbsp;人次&nbsp;&nbsp;推荐：<input type=checkbox name=isgood<%if rs("istop")=true then response.write " checked"%> value='yes'>&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden<%if rs("hidden")=false then response.write " checked"%>></td>
</tr>
<tr >
<td>相关属性：</td><td>发行公司：<select size=1 name=pcom><script language=javascript>
<!--
sel_type('<%response.write rs("pcom")%>','<%response.write web_dim(32)%>');
-->
</script></select>
&nbsp;&nbsp;专辑语言：<select size=1 name=lang>
<script language=javascript>
<!--
sel_type('<%response.write rs("lang")%>','<%response.write web_dim(33)%>');
-->
</script>
</select></td>
</tr>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("edit_frm","remark","&nbsp;&nbsp;",0)%></td>
</tr>
<tr>
<td valign=top>专辑简介：</td>
<td>
<table border=0><tr>
<td><textarea name=intro rows=6 cols=65><%response.write joekoe_cms.code_word(rs("words"))%></textarea></td>
<td width=5></td>
<td valign=bottom><%call textarea_resize("intro")%></td>
</tr></table>
</td>
</tr>
<tr>
<td>专辑图片：</td><td><input type="text" name="pic" value="<%=rs("pic")%>" size="50"></td>
</tr>
<tr>
<td>上传图片：</td><td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
</tr>
<%
  call submit_edit()
  rs.close
end sub
'-----------------------------------添加专辑------------------------------------
sub disk_add()
  dim ispic,tim,hidden
  if chk() then
    Sql="select * from music_singer where id="&n_id
    set rs=joekoe_cms.exec(sql,1)
    NClassname=rs("name")
    rs.close
    sql="select * from music_disk where (id is null)"
    call joekoe_cms.exec(sql,-1) 
    rs.open sql,conn,1,3
    rs.addnew
    rs("name")=trim(Request.Form("name"))
    rs("pcom")=trim(Request.Form("pcom"))
    if trim(Request.Form("ptim"))="" then
    rs("ptim")=""
    else
    rs("ptim")=trim(Request.Form("ptim"))
    end if
    rs("lang")=trim(Request.Form("lang"))
    rs("hits")=trim(Request.Form("hits"))
    rs("c_id")=c_id
    rs("s_id")=s_id
    rs("n_id")=n_id
    rs("singer")=Nclassname
    rs("pic")=code_admin("pic",1,100)
    rs("words")=Request.Form("intro")
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.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.update
    rs.close	
	call upload_note(index_url,first_id(data_name,"id")) 
    call admin_msg("已成功添加了一张专辑！","?c_id="&c_id&"&s_id="&s_id&"&n_id="&n_id,0)
  else
    call form_first()
    if ispic="" then ispic=joekoe_cms.rand_file(index_url)
    call admin_td("添加&nbsp;&nbsp;的专辑")
%>
<form method="POST" action="?action=add&c_id=<%=c_id%>&s_id=<%=s_id%>&n_id=<%=n_id%>" name=add_frm><input type=hidden name=chk value='yes'>
<tr>
<td>选择栏目：</td><td><%response.write sel_c_id("?action=add")&sel_s_id("?action=add")&sel_n_id("?action=add")%>
</td>
</tr>
<tr>
<td>专辑名称：</td><td ><input type="text" name="name" size="60" maxlength=50></td>
</tr>
<tr>
<td>发行时间：</td><td><input type="text" name="ptim" size="20">&nbsp;<input type=button name=st_btn value="选择" onclick="javascript:select_time(ptim);return false;"></td>
</tr>
<tr>
<td>发布时间：</td><td><input type="text" name="tim" value="<%=now()%>" size=20 maxlength=40>&nbsp;<input type=button name=st_btn value="选择" onclick="javascript:select_time(tim);return false;">&nbsp;&nbsp;浏览：<input type="text" name="hits" value="0" size=5 maxlength=40>&nbsp;人次&nbsp;&nbsp;推荐：<input type=checkbox name=isgood value='yes'>&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'></td>
</tr>
<tr>
<td>相关属性：</td><td>发行公司：<select size=1 name=pcom><script language=javascript>
<!--
sel_type('','<%response.write web_dim(32)%>');
-->
</script></select>
&nbsp;&nbsp;专辑语言：<select size=1 name=lang>
<script language=javascript>
<!--
sel_type('','<%response.write web_dim(33)%>');
-->
</script></select></td>
</tr>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("add_frm","remark","&nbsp;&nbsp;",0)%></td>
</tr>
<tr>
<td valign=top>专辑简介：</td>
<td>
<table border=0><tr>
<td><textarea name=intro rows=6 cols=65></textarea></td>
<td width=5></td>
<td valign=bottom><%call textarea_resize("intro")%></td>
</tr></table>
</td>
</tr>
<tr>
<td>专辑图片：</td><td><input type="text" name="pic" size="50"></td>
</tr>
<tr>
<td>上传图片：</td><td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
</tr>
<%
  call submit_add()
  end if
end sub
'-----------------------------------专辑列表--------------------------------------
sub disk_list_main()
  PageUrl="?c_id="&c_id&"&s_id="&s_id&"&n_id="&n_id&"&"
  response.write "<form name=sel_form action='?jk_mod="&jk_mod&"&action=handle&c_id="&c_id&"&s_id="&s_id&"&n_id="&n_id&"' method=post>" & _
             vbcrlf&"<tr align=center>" & _
             vbcrlf&"<td class=td width='7%'>序号</td>" & _
             vbcrlf&"<td class=td width='40%'>专辑名称及整理时间</td>" & _
             vbcrlf&"<td class=td width='12%'>所属歌手</td>" & _
             vbcrlf&"<td class=td  width='12%'>歌曲列表</td>" & _
             vbcrlf&"<td class=td width='7%'>点击</td>" & _
             vbcrlf&"<td class=td width='15%'>相关属性</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 n_id<>"" then
    
  sql_add=sql_add&" and n_id="+cstr(n_id)
  
  elseif c_id<>"" then
    
  sql_add=sql_add&" and c_id="+cstr(c_id)
  
  end if
  call format_search("name","name,singer",2,1)
  sql="select count(n_id) from music_disk"&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from music_disk"&sql_add&" order by id desc"
  call joekoe_cms.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
      response.write "<tr align=center>" & _
             vbcrlf&"<td>"&i&"</td>" & _
             vbcrlf&"<td>" & _
             vbcrlf&"<table border=0 cellspacing=0 cellpadding=0 width='100%'><tr>" & _
             vbcrlf&"<td><a href='?jk_mod="&jk_mod&"&action=edit&d_id="&rs("id")&"&c_id="&rs("c_id")&"&s_id="&rs("s_id")&"&n_id="&rs("n_id")&"'>"&rs("name")&"</a></td><td align=right><font class=tims>"&joekoe_cms.time_type(rs("tim"),4)&"</font></td>" & _
             vbcrlf&"</tr></table>" & _
             vbcrlf&"</td>" & _
             vbcrlf&"<td>"&rs("singer")&"</td>" & _
             vbcrlf&"<td><a href='admin_music_song.asp?d_id="&rs("id")&"&c_id="&rs("c_id")&"&s_id="&rs("s_id")&"&n_id="&rs("n_id")&"'>歌曲列表</a></td>" & _
             vbcrlf&"<td>"&rs("hits")&"</td>" & _
             vbcrlf&"<td>"&pro_edit("?jk_mod="&jk_mod&"&action=edit&d_id="&rs("id")&"&c_id="&rs("c_id")&"&s_id="&rs("s_id")&"&n_id="&rs("n_id"),"编辑该专辑") &"&nbsp;"&pro_hidden(rs("hidden"),1)&"&nbsp;"& pro_istop(rs("istop"))&"</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=4>&nbsp;现有<font class=red>"&rssum&"</font>张专辑，页次：<font class=red>"&viewpage&"</font>/<font class=red>"&thepages&"</font>分页："&jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")&"</td>" & _
             vbcrlf&"<td colspan=3 align=center>执行&nbsp;&nbsp;<select name=sel_type size=1><option value='推荐'>推荐</option><option value='取消推荐'>取消推荐</option><option value='审核'>审核</option><option value='待审核'>待审核</option><option value='删除'>删除</option></select>&nbsp;&nbsp;<input type=submit value='操作' onclick=""return sel_click(this.form);""></td>" & _
             vbcrlf&"</tr>" & _
             vbcrlf&"</form>" & _
             vbcrlf&"</table></td></tr>" 
end sub

%>