<!-- #include file="include/admin_onlogin.asp" -->
<!-- #InclUDE file="include/jk_pagecute.asp" -->
<!--#include file="include/con_music_conn.asp"-->

<%

tit="歌曲管理"
index_url="music"
call admin_master(0,0)
call admin_header(0,0)

%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a class=h_menu onmouseover=ShowMenu(strMenu_music,100) href='admin_music.asp'>音乐列表</a></td>
  <td width=10></td>
  <td><a href='admin_music_list.asp'>歌曲管理</a></td>
  <td width=10></td>
  <td><a class=h_menu onmouseover=ShowMenu(strMenu_singer,100) href='admin_music_singer.asp'>歌手管理</a></td>
  <td width=10></td>
  <td><a href='admin_music.asp?action=disk_list'>专辑管理</a></td> 
  <td width=10></td>
  <td><a href='admin_music_sort.asp'>音乐分类</a></td>
  <td width=10></td>
  <td><a href='admin_song.asp'>点歌管理</a></td>
  <td width=10></td>
  <td><a href='admin_fav.asp'>歌曲收藏</a></td>
  <td width=10></td>
  <td><a href='admin_disk.asp'>专辑收藏</a></td>
  </tr>
  </table>
</td></tr>
<tr><td colspan=2 align=center>
  <table border=0 cellspacing=0 cellpadding=2>
  <form action='admin_music_search.asp' name="search" method="post">
  <input type=hidden name=sea_term value='only'>
  <input type=hidden name=sea_type value='name'>
  <tr>
  <td>音 乐 搜 索</td>
  <td>&nbsp;<select name='stype' size=1>
<option value='Special'>专辑</option>
<option value='Music'>音乐</option>
<option value='Singer'>歌手</option>
</select></td>
  <td>&nbsp;<input type='text' name='keyword' value='' size=12 maxlength=20 alt='多个关键字请用 空格 格开'></td>
  <td>&nbsp;<select name=s_area size=1>
<option value='' class=mbg_tds>所有地区</option>
<option value='1'>大陆地区</option>
<option value='2'>港台地区</option>
<option value='3'>海外地区</option></select></td>
  <td>&nbsp;<select name=s_sex size=1>
<option value='' class=mbg_tds>所有歌手</option>
<option value='1'>男歌手</option>
<option value='2'>女歌手</option>
<option value='3'>乐队组合</option></select></td>
  <td>&nbsp;<select name=s_lang size=1>
<option value='' class=mbg_tds>语言</option>
<option value='中文'>中文</option>
<option value='粤语'>粤语</option>
<option value='英文'>英文</option>
<option value='日文'>日文</option>
<option value='韩文'>韩文</option>
<option value='其它'>其它</option>
</select></td>
  <td valign=top>&nbsp;<input type=submit value='搜 索'></td>
  </tr>
  </form>
</table>
<%

dim currentpage,classid,sclassid,nclassid,specialid,maxperpage,totalput
dim trs,tsql

if request("page")<>"" then
	currentpage=cint(request("page"))
else
	currentpage=1
end if

if request("classid")<>"" then
	classid=request("classid")
else
	classid=""
end if

if request("sclassid")<>"" then
	sclassid=request("sclassid")
else
	sclassid=""
end if

if request("nclassid")<>"" then
	nclassid=request("nclassid")
else
	nclassid=""
end if

if request("specialid")<>"" then
	specialid=request("specialid")
else
	specialid=""
end if
%>
<table border="0" width="98%" cellspacing="1" cellpadding="1">
<tr>
<td align=center valign=top>
<%
set rs=server.createobject("adodb.recordset")
if classid<>"" then
	if specialid<>"" then
		sql="select * from mv_musiclist where specialid="+cstr(specialid)+" and nclassid="+cstr(nclassid)+" and sclassid="+cstr(sclassid)+" and classid="+cstr(classid)+"  order by id desc" 
	elseif nclassid<>"" then
		sql="select * from mv_musiclist where nclassid="+cstr(nclassid)+" and sclassid="+cstr(sclassid)+" and classid="+cstr(classid)+"  order by id desc" 
	elseif sclassid<>"" then
		sql="select * from mv_musiclist where sclassid="+cstr(sclassid)+" and classid="+cstr(classid)+" order by id desc" 
	else
		sql="select * from mv_musiclist where classid="+cstr(classid)+" order by id desc" 
	end if
else
	sql="select * from mv_musiclist order by id desc"
end if
rs.open sql,conn_mv,1,1
if rs.eof and rs.bof then 
	response.write "<p align='center'><b>暂时没有收集任何歌曲<br><br><a href='javascript:history.go(-1)'>...::: 点 此 返 回 :::...</a></b></p>" 
else 
	maxperpage=60
	totalput=rs.recordcount 
	if currentpage<1 then currentpage=1
	if (currentpage-1)*maxperpage>totalput then 
		if (totalput mod maxperpage)=0 then 
			currentpage= totalput \ maxperpage 
		else 
			currentpage= totalput \ maxperpage + 1 
		end if 
	end if 
	if currentpage=1 then
		showContent 
		showpage totalput,maxperpage,"admin_music_list.asp"
	else 
		if (currentpage-1)*maxperpage<totalput then 
			rs.move  (currentpage-1)*maxperpage 
			dim bookmark 
			bookmark=rs.bookmark 
			showContent 
			showpage totalput,maxperpage,"admin_music_list.asp" 
		else 
			currentpage=1 
			showContent 
			showpage totalput,maxperpage,"admin_music_list.asp" 
'			showlist
		end if 
	end if 
	rs.close 
end if 

sub showContent 
dim i
i=0 
%>
<table class=table cellspacing=1 cellpadding=1>
<tr height=22 align=center>
   <td width="7%"><b>序号</b></td>
   <td width="41%"><b>歌曲名字</b></td>
   <td width="31%" height=22 align=center><b>所属歌手</b></td>
   <td width="7%" height=22 align=center><b>推荐</b></td>
   <td width="7%" height=22 align=center><b>修改</b></td>
   <td width="7%" height=22 align=center><b>删除</b></td>
</tr>
<%do while not rs.eof%>
<tr height=22 align=center>
   <td><%=(i+1)%></td>
   <td align=left><a href=javascript:play('<%=rs("id")%>')><%=rs("musicName")%></a></td>
   <td><%=rs("singer")%><a href=admin_music.asp?action=music_add&classid=<%=rs("classid")%>&sclassid=<%=rs("sclassid")%>&nclassid=<%=rs("nclassid")%>&specialid=<%=rs("specialid")%>>[进入添歌]</a></td>
   <td><a href=admin_music_add.asp?action=music_good&act=SetisGood&id=<%=rs("id")%>&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>&page=<%=Currentpage%>><%if rs("IsGood")=true then%><font color=red>撤销</font><%else%>推荐<%end if%></a></td> 
   <td><a href=admin_music_add.asp?action=music_edit&id=<%=rs("id")%>&askclassid=<%=rs("classid")%>&asknclassid=<%=rs("nclassid")%>&page=<%=Currentpage%>>修改</a></td>
   <td><a href=admin_music_add.asp?action=music_del&id=<%=rs("id")%>&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>&page=<%=Currentpage%>>删除</a></td>
</tr>
<%
i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
%>
</table>
<%
end sub 

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
	n= totalnumber \ maxperpage
else
	n= totalnumber \ maxperpage+1
end if
%>
<form method=Post action="<%=filename%>?classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>">
  <center>共<font color="#ff0000"><b><%=totalnumber%></b></font>首歌曲，每页显示<%=maxperpage%>首&nbsp;
<%if Currentpage<2 then%>
&nbsp;首页 上一页&nbsp;
<%else%>
&nbsp<a href="<%=filename%>?page=1&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>">首页</a>&nbsp;
<a href="<%=filename%>?page=<%=Currentpage-1%>&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>">上一页</a>&nbsp;
<%
end if
if n-currentpage<1 then
%>
  下一页 末页
<%else%>
  <a href="<%=filename%>?page=<%=Currentpage+1%>&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>">下一页</a>
  <a href="<%=filename%>?page=<%=n%>&classid=<%=classid%>&sclassid=<%=sclassid%>&nclassid=<%=nclassid%>">末页</a>
<%end if%>
&nbsp;页次:<strong><font color="#ff0000"><%=Currentpage%>/<%=n%></font></strong>页
  转到:<select name="page" size="1" onchange="javascript:submit()">
<%for i = 1 to n%>           
  <option value="<%=i%>" <%if cint(Currentpage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>   
<%next%>   
  </select>        
</form>
<%
end function
response.write "</td></tr></table>"

%>