<!--#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")

typeid=request("typeid")
cid=request("cid")
id=request.QueryString("id")


canshu1="tid="&tid&"&typeid="&typeid&"&cid="&cid&""
canshu3="word="&word&"&sortpath="&sortpath&"&pt="&pt&"&tuij="&tuij&"&"&canshu1&""
canshu2="page="&page&"&"&canshu3&""


post=request("post")
if post="edit" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from com_bookpic where id="&id
rs.open sql,conn,1,3
rs("titlecn")=request("titlecn")
rs("titleen")=request("titleen")
rs("imgS")=request("imgS")
rs("imgB")=request("imgB")
rs.update
rs.close
set rs=nothing
response.Write "<script>location='?"&canshu2&"'</script>"
end if


if post="add" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from com_bookpic"
rs.open sql,conn,1,3
rs.addnew
rs("type")=request("typeid")
rs("cid")=request("cid")
rs("titlecn")=request("titlecn")
rs("titleen")=request("titleen")
rs("imgS")=request("imgS")
rs("imgB")=request("imgB")
rs.update
rs.close
set rs=nothing
response.Write "<script>location='?"&canshu2&"'</script>"
end if

select case action
case "tj"
 call editbook("bestbook=1","com_bookpic")
case "pt"
 call editbook("bestbook=0","com_bookpic")
case "cn1"
 call editbook("lookcn=0","com_bookpic")
case "cn2"
 call editbook("lookcn=1","com_bookpic")
case "en1" 
 call editbook("looken=0","com_bookpic")
case "en2"
 call editbook("looken=1","com_bookpic")
case "utf1"
 call editbook("lookutf=0","com_bookpic")
case "utf2"
 call editbook("lookutf=1","com_bookpic")
case "del" 
 id=replace(request("id")," ","")
 id=split(id,",")
 for i=0 to UBound(id)
 conn.execute("delete from com_bookpic where id="&id(i))
 next
 response.Write "<script>location='?"&canshu1&"'</script>"
case "order" 
 pi=REQUEST("pi")
 pi=REPLACE(pi,", ",",")
 SQL5="SELECT * from com_bookpic 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_bookpic 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"-->
<div id="container">
<%if post="" then%>
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="?post=addnew&typeid=<%=typeid%>&cid=<%=cid%>" 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_plS.asp?typeid=<%=typeid%>&cid=<%=cid%>" 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="?<%=canshu1%>"><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%>">
<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_bookpic where titlecn like'%"&word&"%' and type="&typeid&" order by pid asc,id desc"
else
sql= "select * from com_bookpic where type="&typeid&" 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 imgS=rs("imgS")
set imgB=rs("imgB")
set id=rs("id")
set ck=rs("ck")
set books_date=rs("date")
set pid=rs("pid")
%>
<%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:160px;">名称（点击修改）</li>
  <li style="width:100px;">图</li>

<!-- <li style="width:25px;">新品</li>-->
 <li style="width:160px;">时间</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;"><a href="?post=modify&id=<%=id%>&<%=canshu2%>">编辑</a></li>
  <li style="width:160px;"><span id="name$<%=id%>" class="edit"><%=titlename%></span></li>
  <li style="width:100px;" onMouseMove="thumbshow(event,'../<%=imgS%>','<%=titlename%>')" onmouseout="hide(this)"><img src=../<%=imgS%> width="30" height="22" border="0" align="absmiddle"></li>


<!-- <li style="width:25px;"><%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:160px;"><%=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>
<%end if%>

<%if post="modify" then%>
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="book_pic.asp?typeid=<%=typeid%>"><img src="images/but_11.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>
</div>
<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:700px;">修改内容</li>
</div>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from com_bookpic where id="&id
rs.open sql,conn,1,1
%>
<form name="myform" method="post" action="?post=edit&id=<%=rs("id")%>&word=<%=word%>&pt=<%=pt%>&tuij=<%=tuij%>&sortpath=<%=sortpath%>&page=<%=page%>&tid=<%=tid%>&typeid=<%=typeid%>&cid=<%=cid%>" >

<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px">名称</li>
<li><input name="titlecn" type="text" id="titlecn" value="<%=rs("titlecn")%>"></li>
<li style="width:100px;text-align:right;">英文名称：</li>
<li><input name="titleen" type="text" id="titleen"  value="<%=rs("titleen")%>"></li>
</div>
<%if thumb_pic=1 then%>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">缩　　图</li>
 <li><input name="imgS" type="text" id="imgS" value="<%=trim(rs("imgS"))%>" size="60" readonly="readonly"></li>
</div>
<%else%>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">小　　图</li>
 <li><input name="imgS" type="text" id="imgS" value="<%=trim(rs("imgS"))%>" size="60"></li>
  <li><iframe ID="UploadFiles" src="update_file.asp?editname=imgS&sltname=imgS&filepath=upload_files" frameborder=0 scrolling=no width="200" height="20"></iframe></li>
</div>
<%end if%>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">大　　图</li>
 <li><input name="imgB" type="text" id="imgB" value="<%=trim(rs("imgB"))%>" size="60"></li>
  <li><iframe ID="UploadFiles" src="update_file.asp?editname=imgB&sltname=imgS&filepath=upload_files" frameborder=0 scrolling=no width="200" height="20"></iframe></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li><input class="button" type="submit" name="Submit" value="确认ok，修改" > </li>
</div>
<%
rs.close
set rs=nothing
%>
</form>
<%end if%>

<%if post="addnew" then%>
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="book_pic.asp?typeid=<%=typeid%>"><img src="images/but_11.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>
</div>
<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:700px;">修改内容</li>
</div>

<form name="myform" method="post" action="?post=add&word=<%=word%>&pt=<%=pt%>&tuij=<%=tuij%>&sortpath=<%=sortpath%>&page=<%=page%>&tid=<%=tid%>&typeid=<%=typeid%>&cid=<%=cid%>" >

<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px">名称</li>
<li><input name="titlecn" type="text" id="titlecn"></li>
<li style="width:100px;text-align:right;">英文名称：</li>
<li><input name="titleen" type="text" id="titleen" ></li>
</div>
<%if thumb_pic=1 then%>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">缩　　图</li>
 <li><input name="imgS" type="text" id="imgS"  size="60" readonly="readonly"></li>
</div>
<%else%>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">小　　图</li>
 <li><input name="imgS" type="text" id="imgS"  size="60"></li>
  <li><iframe ID="UploadFiles" src="update_file.asp?editname=imgS&sltname=imgS&filepath=upload_files" frameborder=0 scrolling=no width="200" height="20"></iframe></li>
</div>
<%end if%>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:100px;">大　　图</li>
 <li><input name="imgB" type="text" id="imgB" size="60"></li>
  <li><iframe ID="UploadFiles" src="update_file.asp?editname=imgB&sltname=imgS&filepath=upload_files" frameborder=0 scrolling=no width="200" height="20"></iframe></li>
</div>
<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li><input class="button" type="submit" name="Submit" value="确认ok" > </li>
</div>

</form>
<%end if%>
<script language="JavaScript" type="text/JavaScript" src="js/jquery.latest.js"></script> 
<!--#include file="footer.asp"-->