<%@ codepage ="936" %>
<!--#include file="checkUser.asp"-->
<!--#include file="conn.asp"-->
<%
const MaxPerPage=10
dim totalPut 
dim CurrentPage
dim TotalPages
dim i
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
dim sql
dim rs

if request("act")="del" then
   sql="delete * from Product where shop_id="&request("shop_id")
   conn.execute sql
   response.redirect "shop_list.asp"
end if
if request("act")="audit" then
   sql="update product set audit=1 where shop_id="&request("shop_id")
   conn.execute sql
   response.redirect "shop_list.asp"
end if
if request("act")="noaudit" then
   sql="update product set audit=0 where shop_id="&request("shop_id")
   conn.execute sql
   response.redirect "shop_list.asp"
end if
sql="select * from product order by dateandtime desc,audit desc"
set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1 
if rs.eof and rs.bof then
response.write "<script language='javascript'>alert('您还没有发布产品信息，请发布！');this.location.href='shop_add.asp';</SCRIPT>"
else 
totalPut=rs.recordcount 
if currentpage<1 then 
currentpage=1 
end if 
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,"shop_list.asp"
content 
else 
if (currentPage-1)*MaxPerPage<totalPut then 
rs.move (currentPage-1)*MaxPerPage 
dim bookmark 
bookmark=rs.bookmark 
showContent 
showpage totalput,MaxPerPage,"shop_list.asp"
content 
else 
currentPage=1 
showContent 
showpage totalput,MaxPerPage,"shop_list.asp"
content 
end if 
end if 
end if
conn.close
set conn=nothing 
sub showContent
%>
<html>
<head>
<STYLE type=text/css>
TD {
COLOR: #000; FONT-FAMILY: 宋体; FONT-SIZE: 12px
}
.GR {
COLOR: #666
}
.style1 {color: #FF0000}
.style2 {color: #0000FF}
</STYLE>
<script language=JavaScript src="opennew.js"--></script>
<link rel="stylesheet" href="Images/Admin_style.css">
</head>
<BODY text=#000000 leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" bgcolor="#F7F7FF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1">
<tr>
<td width="100%"> 
<center>
<table width="98%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111"> 
<tr>
<td align="right"> 
<div align="center">
<center> 
<table border="0" cellspacing="0" cellpadding="0" width=100% height="22" style="border-collapse: collapse" bordercolor="#111111"> 
<tr align=center height=30 bgcolor=#ececec>
<td height="22" width="100%" bgcolor="#CEDBFF"><p><font class="f12" color="#ff6600"><span style="font-size: 10.5pt"><b>产品管理</b></span></font></td></tr>
</table>
</center>
</div>
<div align="right"><strong>温馨提示:&quot;推荐&quot;后排序会靠前
</strong>
  <center>
<table border="0" cellspacing="0" width="100%" style="border-collapse: collapse" height="1"> 
<%do while not rs.eof%> 
<tr>
<td height="22" rowspan="5" bgcolor="#F7F7FF">
<p align="center">
<a target="_blank" href="../List.asp?shop_id=<%=rs("shop_id")%>">
<IMG border=0 src="<%if rs("PIC")<>"" then%>../<%=rs("pic")%><%else%>../pic/no.jpg<%end if%>" width="88" height="88" alt="<%=rs("shop_name")%>" style="border: 1px solid #000000"></a></td>
  </tr>
<tr>
  <td colspan="4" valign="bottom" bgcolor="#F0F0FF" >  <span style="font-size: 10.5pt"><span style="font-size: 10.5pt">&nbsp; <a target="_blank" href="../List.asp?shop_id=<%=rs("shop_id")%>"><%=rs("shop_name")%></a></span></span><%=rs("dateandtime")%></td>
</tr>
<tr>
  <td colspan="4" valign="bottom" bgcolor="#F0F0FF" >&nbsp; <%=mid(rs("introduce"),1,22)%>...</td>
</tr>
<tr>
  <td colspan="4" valign="bottom" bgcolor="#F0F0FF" >&nbsp;</td>
</tr>
<tr>
<td width="428" height="1" align="right" bgcolor="#F7F7FF"> &nbsp; <%if rs("audit")=0 then%><a href="?act=audit&shop_id=<%=rs("shop_id")%>"><span class="style1">设为推荐</span></a>
  <%else%> <a href="?act=noaudit&shop_id=<%=rs("shop_id")%>"><span class="style2">取消推荐</span></a>
  <%end if%>
  &nbsp;.</td>
<td height="1" bgcolor="#F7F7FF">
<a href="shop_edit.asp?shop_id=<%=rs("shop_id")%>&page=<%=request("page")%>">
<img src="IMAGES/Edit_2.gif" width="47" height="18" border="0"></a></td>
<td height="1" bgcolor="#F7F7FF"><a href="?shop_id=<%=rs("shop_id")%>&act=del"><img src="IMAGES/A_delete.gif" width="52" height="16" border="0"></a></td>
<td height="1" valign="middle" bgcolor="#F7F7FF">
<p align="center"></td>
</tr>
<tr>
<td width="428" colspan="5" bgcolor="#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5">
<tr>
<TD height="1" width="100%" bgcolor="#F4FAFF" style="font-family: 宋体; font-size: 9pt; line-height: 14pt">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber7">
<tr>
<TD background=../../images/bg_b.gif style="color: #000; font-family: 宋体; font-size: 12px; line-height:100%" bgcolor="#EEF7FF"><IMG 
height=1 src="" width=1></TD>
</tr>
</table>
</TD> 
</tr>
</table>
</td>
</tr>
<% i=i+1 
if i>=MaxPerPage then exit do 
rs.movenext 
loop 
rs.close 
set rs=nothing 
%>
</table>
</center>
</div>
<%
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 
response.write "<form method=Post action="&filename&"gsid="&gsid&">" 
if CurrentPage<2 then 
response.write "<table border=0 width=100% cellspacing=2 cellpadding=2>"
response.write "<tr height=0>"
response.write "<td align=left valign=top>"
response.write "<font color=red><b>共"&n&"页&nbsp;第"&CurrentPage&"页 " 
response.write "共查询到"&totalnumber&"&nbsp;种产品</b></font>" 
response.write "</td>"
response.write "<td VALIGN=middle align=right >"
response.write "【最前页】【上一页】" 
else 
response.write "<table border=0 width=100% cellspacing=2 cellpadding=2>"
response.write "<tr height=0>"
response.write "<td align=left VALIGN=top>"
response.write "<font color=red><b>共"&n&"页&nbsp;第"&CurrentPage&"页 " 
response.write "共查询到"&totalnumber&"&nbsp种产品</b></font>" 
response.write "</td>"
response.write "<td VALIGN=center align=right >"
response.write "【<a href="&filename&"?page=1&gsid="&gsid&">最前页</a>】" 
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&gsid="&gsid&">上一页</a>】" 
end if 
if n-currentpage<1 then 
response.write "【下一页】【最后页】</font>" 
else 
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&gsid="&gsid&">" 
response.write "【下一页</a>】【 <a href="&filename&"?page="&n&"&gsid="&gsid&">最后页</a>】" 
end if 
response.write "</form>" 
response.write "</td>"
response.write "</tr>"
response.write "</table>"
end function
%>
</td> 
<%sub content%> 
</tr> 
</table> 
<%end sub%>
</td>
</tr>
</table>
</body>
</html>