<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="inc/page.asp"-->
<%
tid = int(Request("tid"))
word=trim(request("word"))
pt=request("pt")
tuij=request("tuij")
xcid=request("xcid")
ncid=request("ncid")

xcidm=request("xcidm")
xcids=request("xcids")

canshu1="tid="&tid&""
canshu3="word="&word&"&sortpath="&sortpath&"&xcid="&xcid&"&xcidm="&xcidm&"&pt="&pt&"&tuij="&tuij&"&"&canshu1&""
canshu2="page="&page&"&"&canshu3&""

select case action
case "hj"
 call editbook("homebook=1","com_books")
case "ht"
 call editbook("homebook=0","com_books")
 case "lj"
 call editbook("homelbook=1","com_books")
case "lt"
 call editbook("homelbook=0","com_books")
case "tj"
 call editbook("bestbook=1","com_books")
case "pt"
 call editbook("bestbook=0","com_books")
case "cn1"
 call editbook("lookcn=0","com_books")
case "cn2"
 call editbook("lookcn=1","com_books")
case "en1" 
 call editbook("looken=0","com_books")
case "en2"
 call editbook("looken=1","com_books")
case "utf1"
 call editbook("lookutf=0","com_books")
case "utf2"
 call editbook("lookutf=1","com_books")
case "del" 
 id=replace(request("id")," ","")
 id=split(id,",")
 for i=0 to UBound(id)
	'删除产品上传的文件
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from com_books where id="&id(i)
	rs.open sql,conn,1,3
	FileNameA=rs("bookpicm")
	FileNameB=rs("bookpicmm")
	FileNameC=rs("bookpic")
	FileNameD=rs("bookpicl")
	DefaultPicAll=rs("DefaultPic")
	rs.close
	set rs=nothing 
	
	On Error Resume Next
	set fso = Server.CreateObject("Scripting.FileSystemObject")
	fso.DeleteFile(Server.MapPath("../"&FileNameA))
	fso.DeleteFile(Server.MapPath("../"&FileNameB))
	fso.DeleteFile(Server.MapPath("../"&FileNameC))
	fso.DeleteFile(Server.MapPath("../"&FileNameD))
		If DefaultPicAll<>"" then
		DefaultPic=Split(DefaultPicAll,",")
		For j =0 to ubound(DefaultPic)
	fso.DeleteFile(Server.MapPath("../upload_files/"&DefaultPic(j)))
	fso.DeleteFile(Server.MapPath("../upload_files/"&Splitm_scj(DefaultPic(j),".")))
	fso.DeleteFile(Server.MapPath("../upload_files/"&Split_scj(DefaultPic(j),".")))
		Next
		End If
	if err.Number<>0 then
	'Response.Write "删除失败！错误信息："&err.description
	else
	'Response.Write"删除成功！"
	end if
	Set fso = nothing
	'删除产品上传的资料
	conn.execute("delete from com_books where id="&id(i))
	conn.execute ("delete from com_PCR where proid="&id(i))
	conn.execute("delete from com_fav where shopxpptid="&id(i))
 next
 response.Write "<script>location='?"&canshu1&"'</script>"
case "order" 
 pi=REQUEST("pi")
 pi=REPLACE(pi,", ",",")
 SQL5="SELECT * from com_books where id IN ("&pi&")"
 SET RS5=SERVER.CREATEOBJECT("ADODB.RECORDSET")
 rs5.open sql5,conn,1,3
 while not rs5.eof 
 RS5("pid")=REQUEST("pid"&RS5("id"))
 RS5.UPDATE
 RS5.MOVENEXT
 wend
 response.Write "<script>location='?"&canshu2&"'</script>"
 response.end
case "inputedit"
 attrKey = split(Trim(Request("id")), "$")(0) 
 index = split(Trim(Request("id")), "$")(1) 
 set rs=server.CreateObject("adodb.recordset")
 sql="select titlecn from com_books where id="&index
 rs.open sql,conn,1,3
 rs("titlecn")=Trim(Request("value"))
 rs.update
 rs.close
 set rs=nothing
 Response.Write(Trim(Request("value"))) 
 Response.end()  
end select
%>
<!--#include file="top.asp"--><script language="JavaScript" type="text/JavaScript" src="js/jquery.latest.js"></script>


<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  <script type="text/javascript" src="box/jquery.easing.1.3.js"></script>
  <script type="text/javascript" src="box/sexylightbox.v2.3.jquery.min.js"></script>
  <link rel="stylesheet" href="box/sexylightbox.css" type="text/css" media="all" />

  <script type="text/javascript">
    $(document).ready(function(){
      SexyLightbox.initialize({color:'black', dir: 'box/sexyimages'});
    });
  </script>
<div id="container">

<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="book_add.asp?tid=<%=tid%>" onClick="parent.frmleft.bb('2_2')"><img src="images/but_1.gif" alt="添加" ></a></li>
 <li><img src="images/but_2.gif" alt="排序" onclick="form1.action='?action=order&<%=canshu2%>';form1.submit();"></li>
 <li><img src="images/but_3.gif" alt="删除" onclick="form1.action='?action=del&<%=canshu2%>';ConfirmDel();"></li>
 <li><a href="book_pl.asp?tid=<%=tid%>" onClick="parent.frmleft.bb('2_3')"><img src="images/but_4.gif" alt="批量上传"></a></li>
 <li><a href="?pt=yes&<%=canshu1%>"><img src="images/but_5.gif" alt="普通" ></a></li>
 <li><a href="?tuij=yes&<%=canshu1%>"><img src="images/but_6.gif" alt="推荐" ></a></li>
 <li><a href="?tid=<%=tid%>"><img src="images/but_7.gif" alt="全部" ></a></li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
<form name="form_search" method="post" action="?<%=canshu1%>">
 <li class="right">
  <%
  set rs_c=server.CreateObject("adodb.recordset")
  rs_c.open "select * from com_class where type="&tid&" and Cid=0 and LevelID=0 order by pid asc,id desc",conn,1,1
  %>
   <select name="xcid" size="1" onChange="MM_jumpMenu('this',this,0)" class="s_a">
    <option value="">选择分类</option>
	<%
    do while not rs_c.eof
	%>
    <option value="?xcid=<%=rs_c("ID")%>&<%=canshu1%>"><%=rs_c("ClassNamecn")%></option>
  <%
  set rs2=server.CreateObject("adodb.recordset")
  rs2.open "select * from com_class where Cid="&rs_c("ID")&" and nid=0 order by pid asc,id desc",conn,1,1
  %>
    <%
    do while not rs2.eof
	%>
    <option value="?xcidm=<%=rs2("ID")%>&<%=canshu1%>&">&nbsp;&nbsp;-&nbsp;<%=rs2("ClassNamecn")%></option>
    <%
  set rs3=server.CreateObject("adodb.recordset")
  rs3.open "select * from com_class where Cid="&rs2("cID")&" and  nid="&rs2("id")&" order by pid asc,id desc",conn,1,1
  %>
    <%
    do while not rs3.eof
	%>
    <option value="?xcids=<%=rs3("ID")%>&<%=canshu1%>">&nbsp;&nbsp;--&nbsp;<%=rs3("ClassNamecn")%></option>
    <%
    rs3.movenext
    loop
	%>
    <%
	rs3.close
	set rs3=nothing
	%>
	<%
    rs2.movenext
    loop
	%>
    <%
	rs2.close
	set rs2=nothing
	%>
    <%
    rs_c.movenext
    loop
	%>
    </select>
    <%
	rs_c.close
	set rs_c=nothing
	%>

<input name="word" type="text" id="word" class="s_b"><input type="image" name="Submit22" src="images/ss_b.gif" class="s_c" value="搜索" align="absmiddle"></li>
</form>
</div>
<%
if word<>"" then
sql= "select * from com_books where titlecn like'%"&word&"%' and type="&tid&" order by pid asc,id desc"
elseif request("pt")<>"" then
sql= "select * from com_books where bestbook=0 and type="&tid&" and sortid=0 order by pid asc,id desc"
elseif request("tuij")<>"" then
sql= "select * from com_books where bestbook=1 and type="&tid&" and sortid=0 order by pid asc,id desc"
elseif xcid<>"" then
sql= "select * from com_books where Cid="&xcid&" and type="&tid&" and sortid=0 order by pid asc,id desc"
elseif xcidm<>"" then
sql= "select * from com_books where nid="&xcidm&" and type="&tid&" and sortid=0 order by pid desc,nid asc"
elseif xcids<>"" then
sql= "select * from com_books where sid="&xcids&" and type="&tid&" and sortid=0 order by pid desc,id desc"
elseif ncid<>"" then
sql= "select * from com_books where Nid="&ncid&" and type="&tid&" and sortid=0 order by pid asc,id desc"
else
sql= "select * from com_books where type="&tid&" and sortid=0 order by pid asc,id desc"
end if
set rs=server.createobject("adodb.recordset")                     
rs.open sql,conn,1,1                     
if rs.eof and rs.bof then                     
response.write conn_eof
else 
page1("20")
i=1	

set titlecn=rs("titlecn")
set titleen=rs("titleen")
set titleutf=rs("titleutf")
set bookpicm=rs("bookpicm")
set id=rs("id")
set cid=rs("cid")
set adminuser=rs("adminuser")
set ck=rs("ck")
set bestbook=rs("bestbook")
set homebook=rs("homebook")
set homelbook=rs("homelbook")
set books_date=rs("books_date")
set pid=rs("pid")
set lookcn=rs("lookcn")
set looken=rs("looken")
set lookutf=rs("lookutf")
set shopxphyjia=rs("shopxphyjia")
%>
<%if word<>"" then%><div class="tablesearch">您搜索的关键字是：<font color=#ff6600><%=word%></font>，共搜索到 <%=rs.recordcount%> 条信息。 </div><%end if%>
<form name="form1" id="form1" method="post" action="?<%=canshu2%>">
<div class="tableAll titlebgcolor">
<ul>
 <li style="width:30px"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form);" ></li>
 <li style="width:50px;">图片</li>
 <li style="width:50px;">操作</li>
 <li style="width:200px;">名称（点击修改）</li>
 <li style="width:100px;">颜色规格库存</li>
 <li style="width:70px;">价格</li>
 <li style="width:50px;">点击</li>
 <li style="width:25px;">显示</li>
 <%if Const_webEn =1 then%><li style="width:25px;"><%=language_en%></li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:25px;"><%=language_utf%></li><%end if%>
 <li style="width:25px;">荐推</li>
  <li style="width:25px;">首显</li>
    <li style="width:25px;">首长</li>
 <li style="width:100px;">时间</li>
 <li style="width:50px;">排序</li>
 </ul>
</div>
<%
while not rs.eof and i<=rs.pagesize
if titlecn="" then
if titleen="" then
if titleutf="" then
titlename="无标题"
else
titlname=titleutf
end if
else
titlename=titleen
end if
else
titlename=titlecn
end if
'titlename=replace(titlename,word,"<font color=#ff6600>"&word&"</font>")
%>
<div class="tableAll trbgcolor">
 <li style="width:30px;"><input type="checkbox" name="ID"  value="<%=id%>"></li>
 <li style="width:50px;" onMouseMove="thumbshow(event,'../<%=bookpicm%>','<%=titlename%>')" onmouseout="hide(this)"><img src=../<%=bookpicm%> width="30" height="22" border="0" align="absmiddle"></li>
 <li style="width:50px;"><a href="book_modify.asp?id=<%=id%>&<%=canshu2%>">编辑</a></li>
 <li style="width:200px;"><span id="name$<%=id%>" class="edit"><%=titlename%></span></li>
 <li style="width:100px;"><a href="book_PCR.asp?typeid=<%=id%>&cid=<%=cid%>&<%=canshu2%>&TB_iframe=true&height=400&width=700" rel="sexylightbox" ><%call selPCR(id)%></li>
 <li style="width:70px;"><%=shopxphyjia%></li>
 <li style="width:50px;"><%=ck%></li>
 <li style="width:25px; text-align:center;"><%if lookcn=1 then%><a href="?action=cn1&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=cn2&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <%if Const_webEn =1 then%>
 <li style="width:25px; text-align:center;"><%if looken=1 then%><a href="?action=en1&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=en2&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <%end if%>
 <%if Const_webUtf =1 then%>
 <li style="width:25px; text-align:center;"><%if lookutf=1 then%><a href="?action=utf1&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=utf2&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <%end if%>
 <li style="width:25px; text-align:center;"><%if bestbook=1 then%><a href="?action=pt&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=tj&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
  <li style="width:25px; text-align:center;"><%if homebook=1 then%><a href="?action=ht&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=hj&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
   <li style="width:25px; text-align:center;"><%if homelbook=1 then%><a href="?action=lt&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=lj&id=<%=id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <li style="width:100px;"><%=books_date%></li>
 <li style="width:50px;"><input name="pid<%=id%>" type="text" id="pid<%=id%>" value="<%=pid%>" size="3"> 
<input name="pi" type="hidden" id="pi" value="<%=id%>"></li>
</div>
<%
i=i+1
rs.movenext
wend
%>
</form>

<div id="divStayTop" class="bottom titlebgcolor">
<%call page2(5,""&canshu3&"&")%>
</div>
<!--小图放大div-->
<div id="a1" style="position:absolute; z-index:10;"></div>
<%
end if
rs.close
set rs=nothing
%>
</div>

<!--#include file="footer.asp"-->