<%PageName="list"%>
<!--#include file="../inc/admin_conn.asp"-->
<!--#include file="const1.asp"-->
<!--#include file="system.asp"-->
<!--#include file="top.asp"-->
<!--#include file="error.ini"-->
<link href="Images/Admin_Style.Css" rel="stylesheet" type="text/css">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>审核歌词</title>
</head>
<%
dim rs,sql,MaxPerPage,PageUrl,currentPage,action

if not isempty(request.QueryString("page")) and request.QueryString("page")<>"" then
	currentPage=cint(request.QueryString("page"))
else
	currentPage=1
end if

action=request.QueryString("action")
AddUser=trim(request.QueryString("AddUser"))
Select Case action
	Case "isshow"
		conn.execute("update [ylmv_MusicWord] set isshow=true where Id="&request.QueryString("ID"))
		Response.Write "审核完成"
		If AddUser<>"" Then
			conn.execute("update [user] set boxnum=boxnum+"&Default_AddBoxNum&" where UserName='"&AddUser&"'")
			Response.Write ",并为用户"&AddUser&"增加了"&Default_AddBoxNum&"个音乐盒位置"
		End If
		showlist
	Case "del"
		conn.execute("delete from [ylmv_MusicWord] where Id="&request.QueryString("ID"))
		Response.Write "删除完成"
		showlist
	Case "saveedit"
		MusicWord=trim(request.form("MusicWord"))
		addbox=trim(request.form("addbox"))
		If addbox="" or not IsNumeric(addbox) Then
			addbox=0
		End IF
		If MusicWord<>"" Then
			conn.execute("update [ylmv_MusicWord] set isshow=true ,MusicWord='"&MusicWord&"' where Id="&request.QueryString("ID"))
			Response.Write "修改/审核完成"
			If AddUser<>"" Then
				conn.execute("update [user] set boxnum=boxnum+"&addbox&" where UserName='"&AddUser&"'")
				Response.Write ",并为用户"&AddUser&"增加了"&addbox&"个音乐盒位置"
			End If
			showlist
		Else
			Response.Write ("<script>alert(' 修改审核失败!\n\n 必须输入歌词内容。');history.back();</script>")
		End If
	Case "edit"
		EditSongWord
	Case else
		showlist		
End Select	
%>

<head>
<style>
body,td{font-size:12px}
</style>
</head>
<body>
<center>
<%sub showlist%>
<table border="0" width="96%" cellspacing="1" cellpadding="1">
  <tr>
    <td align=center width="100%" valign=top>
<%
set rs=server.createobject("adodb.recordset")
sql="select id,MusicId,MusicWord,AddUser,AddTime from [ylmv_MusicWord] where isshow=false order by id desc" 
rs.open sql,conn,1,1
if rs.eof and rs.bof then 
	response.write "<p align='center'>暂时没有未审核歌词</p>" 
else 
	MaxPerPage=20
	'MaxPerPage=MaxSpecialList
	PageUrl="songword.asp"
	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 
		showpage totalput,MaxPerPage,PageUrl
		showContent 
		showpage totalput,MaxPerPage,PageUrl
	else 
		if (currentPage-1)*MaxPerPage<totalPut then 
			rs.move  (currentPage-1)*MaxPerPage 
			dim bookmark 
			bookmark=rs.bookmark 
			showpage totalput,MaxPerPage,PageUrl
			showContent 
			showpage totalput,MaxPerPage,PageUrl
		else 
			currentPage=1 
			showpage totalput,MaxPerPage,PageUrl
			showContent 
			showpage totalput,MaxPerPage,PageUrl
		end if 
	end if 
end if 
rs.close 
%>

    </td>
  </tr>
 </table>
<br><br>
<%
end sub
sub showContent 
i=0 
%>
            <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
              <tr>
                <td width="21%" height=22 align=center class="title">歌曲名称</td>
                <td width="15%" height=22 align=center class="title">所属歌手</td>
                <td width="11%" height=22 align=center class="title">添加时间</td>
                <td width="5%" height=22 align=center class="title">审核</td>
                <td width="5%" height=22 align=center class="title">修改</td>
                <td width="5%" height=22 align=center class="title">删除</td>
              </tr>
<%
do while not rs.eof
	Set Music_rs=conn.execute("select MusicName,Singer from [ylmv_MusicList] where ID="&rs(1))
	i=i+1
%>
              <tr>
                <td width="21%" title="歌词内容：
                <%=rs(2)%>"> <%=Music_rs(0)%></td>  
                <td width="15%" align=center><%=Music_rs(1)%></td>
                <td width="11%" align=center><%=month(rs("AddTime"))&"月"&day(rs("AddTime"))&"日"&hour(rs("AddTime"))&"时"%></td>
                <td width="5%" align=center><a href="?action=isshow&id=<%=rs(0)%>&AddUser=<%=rs(3)%>">审核</a></td>
                <td width="5%" align=center><a href="?action=edit&id=<%=rs(0)%>">修改</a></td> 
                <td width="5%" align=center><a href="?action=del&id=<%=rs(0)%>">删除</a></td> 
              </tr>
<%
	Music_rs.close
	Set Music_rs=nothing
	if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
<%
end sub 

function showpage(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
	n= totalnumber \ maxperpage
else
	n= totalnumber \ maxperpage+1
end if
%>
<form method=get action="<%=filename%>?">
  <center>共有<b><%=totalnumber%></b>首未审核歌词                                                                   
<%if CurrentPage<2 then%>
  &nbsp;首页 上一页&nbsp;                                                                   
<%else%>
  &nbsp<a href="<%=filename%>?page=1">首页</a>&nbsp;                                                                   
  <a href="<%=filename%>?page=<%=CurrentPage-1%>">上一页</a>&nbsp;                                                                   
<%
end if
if n-currentpage<1 then
%>
  下一页 末页                                                                   
<%else%>
  <a href="<%=filename%>?page=<%=CurrentPage+1%>">下一页</a>                                                                   
  <a href="<%=filename%>?page=<%=n%>">末页</a>                                                                   
<%end if%>                                                                   
  &nbsp;页次:<strong><%=CurrentPage%>/<%=n%></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

Sub EditSongWord
Dim Word_rs,Music_rs
Set Word_rs=conn.execute("select MusicId,MusicWord,AddUser,addtime from [ylmv_MusicWord] where ID="&request.QueryString("ID"))
Set Music_rs=conn.execute("select MusicName,Singer from [ylmv_MusicList] where ID="&Word_rs(0))

%>
<br><br><br><br>
<center>
<form method=post action="?action=saveedit&id=<%=request.QueryString("ID")%>&AddUser=<%=Word_rs(2)%>">
<table border="1" width="70%" cellspacing="0" cellpadding="5" class="TableLine" bordercolor="#A4CEE4" bordercolordark="#FFFFFF" height="35">
  <tr>
    <td width="100%" colspan="4" align=center bgcolor="#96C5DE" height="9"><font color="#FFFFFF">审核/修改歌词</font></td>
  </tr>
  <tr>
    <td width="19%" height="12">歌曲名称:</td>
    <td width="33%" height="12">&nbsp;《<%=Music_rs(0)%>》</td>        
    <td width="19%" height="12">歌手名称:</td>        
    <td width="31%" height="12">&nbsp;<%=Music_rs(1)%></td>        
  </tr>
  <tr>
    <td width="19%" height="12">添加会员:</td>
    <td width="33%" height="12">&nbsp;<%=Word_rs(2)%></td>        
    <td width="19%" height="12">添加时间:</td>        
    <td width="31%" height="12">&nbsp;<%=Word_rs(3)%></td>        
  </tr>
  <tr>
    <td width="19%" height="12">歌词内容:</td>
    <td width="83%" height="12" colspan="3">&nbsp;<textarea rows="5" name="MusicWord" cols="41"><%=Word_rs(1)%></textarea></td>   
  </tr>
  <tr>
    <td width="19%" height="12">奖励设置:</td>
    <td width="83%" height="12" colspan="3">&nbsp;<input type="text" name="addbox" size="3" value="<%=Default_AddBoxNum%>">个音乐盒位置 
      (<font color="#FD590B">输入负数减音乐盒位置</font>)</td>   
  </tr>
  <tr>
    <td width="100%" height="1" colspan="4">
      <p align="center"> 
<input type="submit" name="Submit" value="确定">&nbsp;&nbsp;&nbsp;<input type="reset" value="重写" name="B1">&nbsp;&nbsp;&nbsp;<input type="button" value="返回" name="B2" onclick="javascript:history.back();"></p>
    </td>
  </tr>
</table>
</form>
</center>
<%end sub%>
  </center>
</body>
<%
set rs=nothing
conn.close
set conn=nothing%>

