<%@language=vbscript codepage=936 %>
<%path="../basedata"%>
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<!--#include file="../conn/conn_data.asp"-->
<!--#include file="../inc/config.asp"-->

<!-- #include file="../Inc/Head.asp" -->
<script language=Javascript>
function sel()
{
	num=0;
	var UId = document.getElementsByName("id");
	var length=UId.length;
	for(i=0;i<length;i++)
	{
		//alert(UId[i].checked);
		if(UId[i].checked==true)
		 {
			num+=1;
		 }
	}
return num;
}
function del(obj)
{
	sel();
	if(num<1)
	{	alert("请选择您要删除的选项！");return false;		}
	else
	{
		if(confirm("您确信要删除所选项吗？删除后不可恢复！"))
		{
			obj.submit();
			return true;
		}
else
{return false;}
	}
}
function checkall(all)//用于判断全选记录的函数
{
var a = document.getElementsByName("id");
for (var i=0; i<a.length; i++)
a[i].checked = all.checked;
}
</script>
<script language="javascript">
function deletebox()
{
alert("!!!!!!!!!!!!警告？？？？？？？");
if(confirm("你删除的信息将无法恢复，你确定删除吗？"))
{
return true;
}
else
{
return false;
}
}
</script>
<br/><br/><br/>
<div style="text-align:center;">
<%
	dim search,nopass
	search=codedeHTML(request.querystring("search"))
	nopass=request.querystring("nopass")
%>
<br/><br/><br/>
<div style="text-align:center;">
<table cellspacing="2" border="1" cellpadding="0" bordercolor="#A5B6D6">
	<tr>
		<td height="25px" colspan="9" align="center" class="southidc"><a href="?">歌曲管理管理</a></td>
	</tr>
	<tr>
	<form name="form1" action="" method="get">
		<td height="25px" colspan="6" align="center" >
歌曲+歌手: <input type="text" size="25" id="" value="<%=search%>" name="search" style="margin:0 0 0 0;border:1px solid #999999;" onmouseover="this.style.background='#56FF10';" onmouseout="this.style.background='#ffffff'" />
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value="搜索" style="margin:0 0 0 0;border:1px solid #999999;" onmouseover="this.style.background='#56FF10';" onmouseout="this.style.background='#ffffff'" />
		</td>
		</form>
	</tr>
  <tr align="center">
    <td width="70px" height="20">id</td>
    <td width="200px">栏目</td>
    <td width="200px">歌曲+歌手</td>
    <td width="30px"><%if nopass=1 then%><a href="?nopass=0">审核</a><%else%><a href="?nopass=1">审核</a><%end if%></td>
    <td width="100px">时间</td>
    <td width="80px">操作</td>
  </tr>
   <form name="DelProcuctId" method="get" action="songs_Del.asp">
<%

pages=cint(request.form("page"))
pagecode=request.form("pagecode")
pageclass=request.form("pageclass")
pagesizes=cint(request.form("pagesize"))
%>
<%

'-----------总页数---------------
	if search<>"" then
	    sql="select count(1) from songs"
	else
		IF nopass<>"" then
			if int(nopass)=0 then
			sql="select count(1) from songs where songs_pass=0"
			elseif int(nopass)=1 then
			sql="select count(1) from songs where songs_pass=1"
			end if
		else
			sql="select count(1) from songs"
		end if
	end if


totalput=conn_data.execute(sql)(0)
pagesize=10
if totalput mod pagesize = 0 then
n=totalput\pagesize
else
n=totalput\pagesize+1
end if
up=pages-1
down=pages+1

if pages > pagesizes then
ps=pagesizes+1
else
ps=pagesizes
end if
if pages <= 1 then
up=1:down=2
end if
if pages >= n then
up=pages-1:down=n
end if
'-----------总页数---------------
'-----------分页显示内容---------
if pages > 1 and pageclass="uppage" then
 PpageE=instr(pagecode,"p"&pages)
 PpageS=instrrev(pagecode,"|",PpageE+Len(pages))
 identifystr=replace(mid(pagecode,PpageS,PpageE+Len(pages)-PpageS+1),"|","")
 array_id=split(identifystr,":")
 strwhere="songs_id <= "& array_id(0) &" and"
end if
if pages > 1 and pageclass="nextpage" then
 PpageE=instr(pagecode,"p"&pages-1)
 PpageS=instrrev(pagecode,"|",PpageE+Len(pages-1))
 identifystr=replace(mid(pagecode,PpageS,PpageE+Len(pages-1)-PpageS+1),"|","")
 array_id=split(identifystr,":")
 strwhere="songs_id < "&array_id(1) &" and"
end if
'-----------分页显示内容---------
'-----------读出记录---------
	if search<>"" then
	    sql1="select top "&pagesize&" * from songs where "&strwhere&" songs_label like '%"&search&"%' order by songs_id desc"
	else
		IF nopass<>"" then
			if int(nopass)=0 then
			sql1="select top "&pagesize&" *  from songs where "&strwhere&" songs_pass=0 order by songs_id desc"
			elseif int(nopass)=1 then
			sql1="select top "&pagesize&" *  from songs where "&strwhere&" songs_pass=1 order by songs_id desc"
			end if
		else
		sql1="select top "&pagesize&" *  from songs where "&strwhere&" 1=1 order by songs_id desc"
		end if
	end if


set rs=server.createobject("adodb.recordset")
	rs.open sql1,conn_data,2,3
	if not rs.eof and not rs.bof then

for i = 0 to pagesize-1 step 1
if rs.eof then exit for
if  i=0 then startid=rs("songs_id")
if  i = pagesize-1 then endid=rs("songs_id")
%>
  <tr align="center">
    <td height="20" align="left"><input type="checkbox" name="id" value="<%=rs("songs_id")%>" ID="Checkbox1" >&nbsp;<%=i+ii%></td>
    <td><div style="width:200px;text-overflow:ellipsis;overflow:hidden;">&nbsp;<%=rs("songs_class_name")%></div></td>
    <td><div style="width:200px;text-overflow:ellipsis;overflow:hidden;"><%=rs("songs_label")%></div></td>
    <td><%if rs("songs_pass")=1 then%><a href="songs_good.asp?pass=0&id=<%=rs("songs_id")%>"><img src="../images/icon_01.gif" border=0 /></a><%else%><a href="songs_good.asp?pass=1&id=<%=rs("songs_id")%>"><img src="../images/icon_02.gif" border=0 /></a><%end if%></td>
    <td>&nbsp;<%=FormatDate(rs("songs_time"),2)%></td>
    <td><a href="songs_Modify.asp?id=<%=rs("songs_id")%>">修改</a> <a href="songs_Del.asp?id=<%=rs("songs_id")%>" onclick="return deletebox();">删除</a></td>
</tr>
<%
rs.movenext
next
'-----------读出记录---------
'-----------以|100:96:p1|95:90:p2|75:71:p3|70:66:p4|65:64:p5 方式写入---------
if pages > 1 then
currentpage="|"& startid &":"& endid &":p"&pages
pagecode=replace(pagecode,currentpage,"")
pagecode=pagecode&currentpage
else
currentpage="|"& startid &":"& endid &":p1"
pagecode=replace(pagecode,currentpage,"")
pagecode=pagecode&currentpage
end if
'-----------|为分隔符,100是我数据最大的记录数,96是我本页最后一条记录，下面以此推类---------
%>
  	<tr>
		<td height="25px" colspan="2">
		<input type="checkbox" name="chkall" value="" onclick="checkall(this)">选中---<input type="submit" onclick="return del(DelProcuctId)"  value="全部删除" id=""  name="" style="margin:0 0 0 0;border:1px solid #999999;" onmouseover="this.style.background='#56FF10';" onmouseout="this.style.background='#ffffff'" />
		</td>
		</form>
		<td colspan="7" align="center" >
<form method="post" action="" name="form">
<input type="hidden" name="pageclass" value="">
<input type="hidden" name="pagesize" value="<%=pS%>">
<input type="hidden" value="<%=pages%>" name="page">
<input type="hidden" value="<%=pagecode%>" name="pagecode">
</form>
<a href="#" onclick="javascript:document.form.pageclass.value='uppage';document.form.page.value='<%=up%>';document.form.submit()">上一页</a>

||||||
<%
if ps>10 then
for i=ps-10 to ps
if pages=i then
response.write "<a href=# onclick=""javascript:document.form.pageclass.value='uppage';document.form.page.value="&i&";document.form.submit()""><span style=""color:#ff0000"">"&i&"</span></a>&nbsp;"
else
response.write "<a href=# onclick=""javascript:document.form.pageclass.value='uppage';document.form.page.value="&i&";document.form.submit()"">"&i&"</a>&nbsp;"
end if
next
else
for i=1 to ps
if pages=i then
response.write "<a href=# onclick=""javascript:document.form.pageclass.value='uppage';document.form.page.value="&i&";document.form.submit()""><span style=""color:#ff0000"">"&i&"</span></a>&nbsp;"
else
response.write "<a href=# onclick=""javascript:document.form.pageclass.value='uppage';document.form.page.value="&i&";document.form.submit()"">"&i&"</a>&nbsp;"
end if
next
end if

%>
||||||
<a name href="#" onclick="javascript:document.form.pageclass.value='nextpage';document.form.page.value='<%=down%>';document.form.submit()">下一页</a>
===<%=pages%>/<%=n%>===
</td>
</tr>
<%
else
%>

	<tr>
		<td height="25px" colspan="9" align="center" >暂时没有数据……</td>
	</tr>

<%
end if
rs.close
set rs=nothing
conn_data.close
set conn_data=nothing
%>
</table>
</div>
<!-- #include file="../Inc/Foot.asp" -->













