<!--#include file="conn.asp"-->
<!--#include file="denlu.asp"-->

<%
if request("Submit2")="ok" and request("delbox")<>"" then
	conn.execute "delete from cbgl where id in ("&request("delbox")&")"
end if
%>

<%
if request("imgdel")="del" and request("iid")<>"" then
set rs=server.createobject("adodb.recordset")
sqla="select * from cbgl where id="& request("iid")
rs.open sqla,conn,0,2
rs("pic")=null
rs.update
response.write "<script>alert('产品图片已经成功删除！')</script>"
response.write "<script>window.location.href='cbgl.asp?topage="&request("topage")&"&zt="&request("zt")&"&ssxn="&request("ssxn")&"&submit="&request("submit")&"&sxh="&request("sxh")&"'</script>"
response.End()
end if
%>
<html>
<head>

<script language=javascript>
function CheckAll(form)
  {
  for (var i=0;i<form1.elements.length;i++)
    {
    var e = form1.elements[i];
    if (e.name != 'chkall')
       e.checked = form1.chkall.checked;
    }
  }
</script>	
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel=stylesheet type="text/css" href="js/media.css">
<link rel=stylesheet type="text/css" href="js/form_media.css">
<script language="JavaScript" src="js/whir.js"></script>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>

<body text="#000000" leftmargin="0" topmargin="5">
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" height="6">
  <tr> 
    <td height="25" width="701"><font color="#FF0000">当前位置：产品数据库 -> 产品管理</font></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr> 

<td>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">

      <tr>
        <td width="18%" valign="top"><div align="right">
      </div></td>

<td width="82%" valign="top">
<form name="frm2" method="post" action="cbgl.asp">
产品名称：
              <input name="zt" type="text" class="text" size="15">
              &nbsp;
<select name="ssxn" id="ssxn" style="background-color: rgb();font-size: 9pt;border:1px double rgb(255,255,255);width:150px;height:14px" >
<%
set rs=server.createobject("adodb.recordset")          
rs.open "select * from productsort where levels=0 order by orderid",conn,3
if rs.bof and rs.eof then
%>
                  <option value="">暂无产品类别！</option>
                  <%else%>
<option value="">请选择产品类别!</option>
<%										
for i=0 to rs.recordcount-1
if rs.eof then
exit for
end if
%>
                  <option value="<%=rs("id")%>"><%=rs("SortName")%></option>
<%
rs.movenext
next
end if
rs.close
set rs=nothing
%>
              </select>

<input type="hidden" value="eee" name="submit">
&nbsp;
<input name="image" type="image" src="images/shousuo.gif" width="72" height="21">
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr> 
<td height="1" bgcolor="#2F4D6A" colspan="2"></td>
</tr>
<tr> 
<td height="10" colspan="10"></td>
</tr>
<tr>
<td height="400" align="center" valign="top">
<form action="cbgl.asp" method="post" name="form1">
			 <input type="hidden" value="<%=request("ssxn")%>" name="ssxn">
			 <input type="hidden" value="<%=request("zt")%>" name="zt">             
			 <input type="hidden" value="1" name="submit"> 
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td> <input type="hidden" name="Submit2">
<input type="hidden" name="topage" <%if request("topage")<>"" then%> value="<%=request("topage")%>"<%else%>value="1"<%end if%>>
        <input type="image" src="images/del.gif" width="72" height="21" onclick="javascript:if(window.confirm('您确实要删除吗？')) window.form1.Submit2.value='ok'">
<a href="addcbgl.asp"><img src="images/add.gif" width="72" height="21" border="0"></a>
</td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="1" cellpadding="1" bordercolordark="#ffffff">
        <tr bgcolor="177B2F">
          <td width="3%" align="center">&nbsp;</td> 
          <td width="4%" align="center" bgcolor="177B2F"><div align="center"><span class="style1"><font color="#FFFFFF">序</font>号</span></div></td>
          <td width="38%" height="23" align="center" bgcolor="177B2F" class="style1"><span class="style1">产品名称</span></td>
          <td width="17%" align="center" class="style1">产品类别</td>
          <td width="18%" colspan="2" align="center" class="style1">产品图片</td>
          <td width="10%" align="center"><span class="style1">发布时间</span></td>
          <td height="23" colspan="2" align="center"><span class="style1">相关操作</span></td>
        </tr>
<%
set rs=server.createobject("adodb.recordset")

if request("submit")<>"" then
aa=""
if request("zt")<>"" then
  aa=aa+" and jxmc like '%"&request("zt")&"%'"
end if


if request("ssxn")<>"" then
  aa=aa+" and ssxn = "&request("ssxn")&""
end if

Dsql="select * from cbgl where id is not null"+aa+" order by fbtime desc,id desc"

else

Dsql="select * from cbgl order by fbtime desc,id desc"

end if
'response.Write dsql
rs.open Dsql,conn,3
%>
        <% if rs.bof and rs.eof then %>
        <tr bgcolor="#F6F6F6"> 
          <td height="22" colspan="9" align=center>数据库里还没有产品!</td>
        </tr>
        <% else %>
        <%
if request("topage")="" then
topage=1
end if
rs.pagesize=15
if not isempty(request("topage")) then
topage=cint(request("topage"))
if topage>rs.pagecount then
rs.absolutepage=rs.pagecount
elseif topage<=0 then
rs.absolutepage=1
else
rs.absolutepage=topage
end if
end if
intcurpage=rs.absolutepage
%>
        <%
				for i=1 to rs.pagesize
				if rs.eof then
				exit for
				end if
				%>
        <tr bgcolor="#F6F6F6" onmouseover="this.bgColor='#e6e6e6';" onmouseout="this.bgColor='#F6F6F6';">
          <td><div align="center">
            <input type="checkbox" name="delbox" value="<%=rs("id")%>">
          </div></td> 
          <td><div align="center"><%=i+(topage-1)*(rs.pagesize)%></div></td>
          <td height="22"><div align="center"></div>            
            <div align="center"><%=rs("jxmc")%></div></td>
          <td align="center"><%
Set NewRs=Server.CreateObject("Adodb.RecordSet")
Sql="Select SortName from productsort where id="&trim(rs("ssxn"))
NewRs.OPen Sql,conn,1,3
If Not NewRs.Eof then
xnmc=NewRs("SortName")
end if
NewRs.close
set NewRs=nothing
%>
            <%=xnmc%></td>
          <td align="center">
<%if trim(rs("pic"))<>"" then%>
<font color="#FF0000">已 上 传</font>
<%else%>
<a href="javascript:{}" onClick="open('upload_pic_img.asp?id=<%=rs("id")%>&topage=<%=intcurpage%>&zt=<%=request("zt")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>','photo','scrollbars=yes,width=560,height=350,left=125,top=100')">上传图片</a>
<%end if%>
		  </td>
          <td align="center">
<%if trim(rs("pic"))<>"" then%>
<a href="javascript:if(window.confirm('您确实要删除吗')) window.location.href='cbgl.asp?imgdel=del&iid=<%=rs("id")%>&topage=<%=intcurpage%>&zt=<%=request("zt")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>';">删除图片</a>
<%else%>
<font color="#999999">删除图片</font>
<%end if%>
		  </td>
          <td align="center"><%=rs("fbtime")%></td>
  <td width="10%" align="center"><a href="cbgl_modi.asp?id=<%=rs("id")%>&topage=<%=intcurpage%>&lid=<%=rs("ssxn")%>">修改</a></td>
        </tr>
<%
  rs.movenext
  next
  end if
%>
</table></td>
      </tr>
      <tr>
        <td height="30">　　 
        <input type="checkbox" name="chkall" value="on" onclick="CheckAll(form1)">
        <span class="style2"><font color="#4E6A82">全部选中</font></span> </td>
      </tr>
    </table>

</form>



</td>
  </tr>
	  <tr> 
		  
    <td height="25"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="26">
				 <form action=cbgl.asp method=post> 
<tr> <td height="26" align="center">目前在第<%=intcurpage %>页，共有<%=rs.pagecount%>页,共有<%=rs.recordcount%>条记录&nbsp;&nbsp;&nbsp;&nbsp; 
<%
				if intcurpage<>1 then
				%> <a href="cbgl.asp?topage=<%=1%>&zt=<%=request("zt")%>&id=<%=request("id")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>">第一页</a> <a href="cbgl.asp?topage=<%=intcurpage-1%>&zt=<%=request("zt")%>&id=<%=request("id")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>">上一页</a> 
<%
end if
if intcurpage<>rs.pagecount then
%> 
        <a href="cbgl.asp?topage=<%=intcurpage+1%>&zt=<%=request("zt")%>&id=<%=request("id")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>">下一页</a> <a href="cbgl.asp?topage=<%=rs.pagecount%>&zt=<%=request("zt")%>&id=<%=request("id")%>&ssxn=<%=request("ssxn")%>&submit=<%=request("submit")%>">最后一页</a>
<%end if%> 
				 请输入页次： <input type=text size=5 name=topage value="<%=intcurpage%>" class="text"> 
&nbsp;<input type="submit" name="Submit" value="Go" class="text">

			 <input type="hidden" value="<%=request("ssxn")%>" name="ssxn">
			 <input type="hidden" value="<%=request("zt")%>" name="zt">
</td>
</tr> </form></table></td></tr> </table>
</body>
</html>
<%
Rs.close
set Rs=nothing
conn.close
%>