<%if session("admin")="" then
response.Write "<script LANGUAGE='javascript'>alert('网络超时或者您还没有登录请登录');window.location.href='login.asp';</script>"
response.End
end if
%>
<!--#include file="ljconn.asp"-->
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../img/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {
	font-size: 12px;
	font-weight: bold;
}
.style3 {font-size: 12px}
.style4 {font-size: 12; }
-->
</style>

</head>
<body>
<%
'//删除商品
selectbookid=request("selectbookid")
key=request("key")
'selectm=request("selectm")
px=request("px")
if selectbookid<>"" then
conn.execute "delete from shop_books where id in ("&selectbookid&")"
response.Redirect "manageshop_books.asp"
response.End
end if
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr> 
<form name="forms" method="post" action="manageshop_books.asp?px=<%=request("px")%>&key=<%=request("key")%>">
<td height="100"> 
<%'开始分页
set rs=server.CreateObject("adodb.recordset")
select case request("px")
case ""
rs.open "select id,aaid,aaid,aaid,title,px,adddate from shop_books order by id desc",conn,1,1
flag="信息管理"
link=""
case "按名称"
rs.open "select id,aaid,title,px,adddate from shop_books where title like '%"+key+"%' order by px,id desc",conn,1,1
link="&px=按名称&key="&request("key")&""
flag="信息管理"
case "按ID"
rs.open "select id,aaid,title,px,adddate from shop_books where id like '%"+key+"%' order by px,id desc",conn,1,1
link="&px=按ID&key="&request("key")&""
flag="信息管理"
case 2008
if request("s1")<>"" and request("s2")="" and request("s3")="" then
bj1=1
end if
if request("s1")<>"" and request("s2")<>"" and request("s3")="" then
bj1=2
end if
if request("s1")<>"" and request("s2")<>"" and request("s3")<>"" then
bj1=3
end if
select case bj1
case 1
rs.open "select id,aaid,title,px,adddate from shop_books where aid="&request("s1")&" order by px,id desc",conn,1,1
set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from a where id="&request("s1")&"",conn,1,1
flag=rsv("name")
rsv.close
set rsv=nothing
link="&px=2008&s1="&request("s1")&""
case 2
rs.open "select id,aaid,title,px,adddate from shop_books where aid="&request("s1")&" and aaid="&request("s2")&" order by px,id desc",conn,1,1
set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from a where id="&request("s1")&"",conn,1,1
flag=rsv("name")
rsv.close
set rsv=nothing
set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from aa where id="&request("s2")&"",conn,1,1
flag=flag&" >> "&rsv("name")&" "
rsv.close
set rsv=nothing
link="&px=2008&s1="&request("s1")&"&s2="&request("s2")&""
case 3
rs.open "select id,aaid,title,px,adddate from shop_books where aid="&request("s1")&" and aaid="&request("s2")&"  and aaaid="&request("s3")&" order by px,id desc",conn,1,1

set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from a where id="&request("s1")&"",conn,1,1
flag=rsv("name")
rsv.close
set rsv=nothing
set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from aa where id="&request("s2")&"",conn,1,1
flag=flag&" >> "&rsv("name")
rsv.close
set rsv=nothing
set rsv=server.CreateObject("adodb.recordset")
rsv.open "select name from aaa where id="&request("s3")&"",conn,1,1
flag=flag&" >> "&rsv("name")&" "
rsv.close
set rsv=nothing
link="&action=save&s1="&request("s1")&"&s2="&request("s2")&"&s3="&request("s3")&""
end select
end select'else
%>
<table class="tableBorder" width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
    <td colspan="4" align="center" background="img/admin_bg_1.gif"><span class="style2"><font color="#ffffff"><%=flag%>查看与修改</font></span></td>
  </tr>
  <tr>
    <td colspan="6" align="left" bgcolor="#D7D7FF"></td>
  </tr>
  <tr bgcolor="#E8F1FF">
    <td width="17%" align="center"><span class="style3">Id</span></td>
    <td align="center"><span class="style3">信息标题</span></td>
    <td width="18%" align="center"><span class="style3">加入时间</span></td>
    <td width="19%" align="center"><span class="style3">选 择</span></td>
  </tr>
  <%if rs.eof then%>
  <tr>
    <td colspan=6><span class="style3">抱歉,没找到你想要的!<a href="manageshop_books.asp">返回>>></a></span></td>
  </tr>
  <%else%>
  <%
	if not isempty(request("page")) then
      					currentPage=cint(request("page"))
   					else
      					currentPage=1
   					end if
					rs.pagesize=11
   					totalPut=rs.recordcount '记录总数    
   					totalPage=rs.pagecount    
   					MaxPerPage=rs.pagesize    
      				if currentpage<1 then    
          				currentpage=1    
      				end if    
      				if currentpage>totalPage then    
          				currentpage=totalPage    
      				end if    
   					if currentPage=1 then    
      					showContent    
                        showpages1
    				else    
         				if (currentPage-1)*MaxPerPage<totalPut then    
         					rs.move  (currentPage-1)*MaxPerPage    
         					dim bookmark    
         					bookmark=rs.bookmark '移动到开始显示的记录位置    
         					showContent    
                  showpages1
      					end if    
   					end if    
					'set rs=nothing      
					rs.close    
					
					%>
  <%sub showContent   
					dim i
					%>
  <%for i=1 to rs.pagesize%>
  <tr bgcolor="#E8F1FF">
    <td height="20" align="center"><span class="style3"><%=rs("id")%></span></td>
    <td width="28%" style='PADDING-LEFT: 10px'><a href="editbook.asp?id=<%=rs("id")%>" class="style4">
      <% if len(trim(rs("title")))>18 then
			response.write left(trim(rs("title")),18)&".."
			else
			response.write trim(rs("title"))
			end if%></a>&nbsp;&nbsp;<%if rs("aaid")>98 and rs("aaid")<105 then%><span class="style3"><a href="showpl.asp?id=<%=rs("id")%>" target="_blank">查看评论</a></span><%end if%></td>
    <td align="center"><span class="style4"><%=rs("adddate")%></span></td>
    <td align="center"><input name="selectbookid" type="checkbox" id="selectbookid" value="<%=rs("id")%>">    </td>
  </tr>
  <%rs.movenext
  if rs.eof then exit for
  next
  %>
  <%end sub%>
  <%
sub showpages1()     
dim n     
n=totalPage
%>
  <tr align="center" bgcolor="#E8F1FF">
    <td height="20" colspan="6"><span class="style3">
      <% If currentPage <> 1 Then %>
&nbsp;<a href="manageshop_books.asp?Page=1<%=link%>" class="top">首页</a>&nbsp;<a href="manageshop_books.asp?Page=<%=(currentPage-1)%><%=link%>" class="top">上一页</a>
      <%else%>
&nbsp;首页&nbsp;上一页
      <% End If %>
      <% If currentPage <> rs.PageCount Then %>
      <a href="manageshop_books.asp?Page=<%=(currentPage+1)%><%=link%>" class="top">下一页</a>&nbsp;<a href="manageshop_books.asp?Page=<%=totalPage%><%=link%>" class="top">尾页</a>
      <%else%>
      下一页&nbsp;尾页
      <% End If %>
      第<%=currentPage%>页/共<%=totalPage%>页&nbsp;共有<%=rs.RecordCount%>条</span></td>
  </tr>
  <%end sub%>
  <tr bgcolor="#E8F1FF">
    <td height="30" colspan="3" align="center"><span class="style3" style="display:none;"><a href="manageshop_books.asp">所有信息</a> </span></td>
    <td height="30" align="right"><span class="style3 style3">全选
        <input type="checkbox" name="checkbox" value="Check All" onClick="mm()">
        <input type="submit" name="Submit" value="删 除" onClick="return test();">
&nbsp;</span></td>
  </table>
<table width="12" height="7" border="0" cellpadding="0" cellspacing="0">
<tr> 
<td height=7></td>
</tr>
</table>
</td>
</form>
</tr>
</table>



<script language="JavaScript">
<!--
<%
'二级数据保存到数组
Dim count2,rsClass2,sqlClass2
set rsClass2=server.createobject("adodb.recordset")
sqlClass2="select * from aa" 
rsClass2.open sqlClass2,conn,1,1
%>
var subval2 = new Array();
//数组结构：一级根值,二级根值,二级显示值
<%
count2 = 0
do while not rsClass2.eof
%>
subval2[<%=count2%>] = new Array('<%=rsClass2("aID")%>','<%=rsClass2("ID")%>','<%=rsClass2("Name")%>')
<%
count2 = count2 + 1
rsClass2.movenext
loop
rsClass2.close
%>

<%
'三级数据保存到数组
Dim count3,rsClass3,sqlClass3
set rsClass3=server.createobject("adodb.recordset")
sqlClass3="select * from aaa" 
rsClass3.open sqlClass3,conn,1,1
%>
var subval3 = new Array();
//数组结构：二级根值,三级根值,三级显示值
<%
count3 = 0
do while not rsClass3.eof
%>
subval3[<%=count3%>] = new Array('<%=rsClass3("aaID")%>','<%=rsClass3("ID")%>','<%=rsClass3("Name")%>')
<%
count3 = count3 + 1
rsClass3.movenext
loop
rsClass3.close
%>

function changeselect1(locationid)
{
document.form1.s2.length = 0;
document.form1.s2.options[0] = new Option('==二级分类==','');
document.form1.s3.length = 0;
document.form1.s3.options[0] = new Option('==三级分类==','');
for (i=0; i<subval2.length; i++)
{
if (subval2[i][0] == locationid)
{document.form1.s2.options[document.form1.s2.length] = new Option(subval2[i][2],subval2[i][1]);}
}
}

function changeselect2(locationid)
{
document.form1.s3.length = 0;
document.form1.s3.options[0] = new Option('==三级分类==','');
for (i=0; i<subval3.length; i++)
{
if (subval3[i][0] == locationid)
{document.form1.s3.options[document.form1.s3.length] = new Option(subval3[i][2],subval3[i][1]);}
}
}
//-->
</script>

<table class="tableBorder" width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
    <td colspan="2" align="center" background="img/admin_bg_1.gif"><span class="style3"><b><font color="#ffffff">信息分类查询</font></b></span></td>
  </tr>
  <tr bgcolor="#E8F1FF">
    <td height="20" align="center"><table width="586" border="0" cellspacing="3" cellpadding="0">
      <form id="form1" name="form1" method="post" action="manageshop_books.asp?px=2008"  OnSubmit="return checkkk()">
        <tr>
          <td width="101" height="20" align="center"><span class="style3">选择信息分类
              <label></label>
          </span></td>
          <td align="left">
<%
Dim count1,rsClass1,sqlClass1
set rsClass1=server.createobject("adodb.recordset")
sqlClass1="select * from a" 
rsClass1.open sqlClass1,conn,1,1
%>
<select name="s1" onChange="changeselect1(this.value)">
<option>==一级分类==</option>
<%
count1 = 0
do while not rsClass1.eof
response.write"<option value="&rsClass1("ID")&">"&rsClass1("Name")&"</option>"
count1 = count1 + 1
rsClass1.movenext
loop
rsClass1.close
%>
</select>

<select name="s2" onChange="changeselect2(this.value)">
  <option value="">==二级分类==</option>
</select>

<select name="s3" style="display:none;">
  <option value="">==三级分类==</option>
</select>
<%
conn.close
set conn=nothing
%>	  <label>
<input type="submit" name="Submit2" value="查 询" />
</label></td>
        </tr>
      </form>
    </table></td>
  </tr>
</table>

<br>

<table class="tableBorder" width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  <tr>
    <td colspan="2" align="center" background="img/admin_bg_1.gif"><span class="style3"><b><font color="#ffffff">查询</font></b></span></td>
  </tr>
  <tr bgcolor="#E8F1FF">
      <td height="20" align="left">
        <table border="0" align="center" cellpadding="0" cellspacing="0">
        <form name="form2" method="post" action="manageshop_books.asp" onSubmit="return checkdata()">
<tr>
          <td width="200" align="center">
            <input name="key" type="text" id="key"></td>
          <td width="120" align="center">
            <select name="px" id="px">
              <option value="按ID">按ID</option>
              <option value="按名称">按名称</option>
            </select></td>
          <td width="40" height="30" align="center">
            <input type="submit" name="Submit2" value="查 询"></td>
        </tr>
        </form></table>
  </tr>
</table>
<!--#include file="copyright.asp"-->
<%end if%>
</body>
</html>
<script>
function test()
{
  if(!confirm('确认删除吗？')) return false;
}
</script>
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>
<%
set conn=nothing
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkkk()
{
    if(checkspace(document.form1.s1.value)) {
	document.form1.s1.focus();
    alert("请选择一级分类！");
	return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
