<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="inc/htmlconfig.asp"-->
<!--#include file="top.asp"-->
<%
tid = int(Request("tid"))
canshu1="tid="&tid&""
canshu3=canshu1
canshu2=canshu3

id = Request("id")
if not isnumeric(id) then id = "1"

Select Case request("action")
Case "edit"
set rs=server.createobject("adodb.recordset")
rs.open "select * from com_nav where id = "&id&" ",conn,1,3
  rs("titlecn")=request.form("titlecn")
  rs("titleen")=request.form("titleen")
  rs("linkcn")=request.form("linkcn")
  rs("linken")=request.form("linken")
  rs("lookcn")=request.form("lookcn")
  rs("looken")=request.form("looken")
  rs("lookcn")=request.form("lookcn")

  rs.update
rs.close
set rs=nothing
conn.close
set conn=Nothing


response.redirect "?action=&"&canshu2&""
response.end
 
Case "editpid" 

id=request("id")
id=replace(id,", ",",")
for y=1 to request.form("id").count
id=replace(request.form("id")(y),"'","")
pid=replace(request.form("pid")(y),"'","")
conn.execute("update com_nav set pid='"&pid&"' where id="&id)
next
response.redirect "?action=&"&canshu2&""
response.end

case "cn1"
 call editbook("lookcn=0")
case "cn2"
 call editbook("lookcn=1")
case "en1" 
 call editbook("looken=0")
case "en2"
 call editbook("looken=1")
case "del" 
id=replace(request("id")," ","")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("delete from com_nav where id="&id(i))
next
response.Write "<script>location='?action=&"&canshu2&"'</script>"
case "order" 
pi=REQUEST("pi")
pi=REPLACE(pi,", ",",")
SQL5="SELECT * from com_nav 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='?action=&"&canshu2&"'</script>"
response.end

case "ordered" 
edid=REQUEST("edid")
pid=request.form("pid"&edid)
titlecn=request.form("titlecn"&edid)
titleen=request.form("titleen"&edid)
linkcn=request.form("linkcn"&edid)
linken=request.form("linken"&edid)
conn.execute("update com_nav set pid='"&pid&"' where id="&edid)
conn.execute("update com_nav set titlecn='"&titlecn&"' where id="&edid)
conn.execute("update com_nav set titleen='"&titleen&"' where id="&edid)
conn.execute("update com_nav set linkcn='"&linkcn&"' where id="&edid)
conn.execute("update com_nav set linken='"&linken&"' where id="&edid)

response.Write "<script>location='?action=&"&canshu2&"'</script>"
response.end

Case "add" 
set rs=server.createobject("adodb.recordset")
rs.open "select * from com_nav",conn,1,3
rs.addnew
rs("titlecn")=trim(request("titlecn"))
rs("titleen")=trim(request("titleen"))
rs("linkcn")=trim(request("linkcn"))
rs("linken")=trim(request("linken"))
rs("looken")=1
rs("lookcn")=1
rs("pid")=trim(request("pid"))
rs.update
rs.close
set rs=nothing
response.redirect "?action=&"&canshu2&""
response.end

Case "" 
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_nav order by pid asc, id asc",conn,1,1

set news_titlecn=rs("titlecn")
set news_titleen=rs("titleen")
set news_id=rs("id")
set news_pid=rs("pid")
set news_lookcn=rs("lookcn")
set news_looken=rs("looken")
set news_linkcn=rs("linkcn")
set news_linken=rs("linken")
%>

<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="#"><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><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>

<form name="form1" id="form1" method="POST" action="?action=editpid&<%=canshu2%>">
<div class="tableAll titlebgcolor">
 <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:150px;"><%=language_cn%>标题</li>
 <%if Const_webEn =1 then%><li style="width:150px;"><%=language_en%>标题</li><%end if%>
  <li style="width:300px;"><%=language_cn%>链接</li>

<%if Const_webEn =1 then%><li style="width:200px;"><%=language_en%>链接</li><%end if%>

 <li style="width:25px;"><%=language_cn%></li>
 <%if Const_webEn =1 then%><li style="width:25px;"><%=language_en%></li><%end if%>

 <li style="width:50px;">排序</li>

</div>
<%do while not rs.eof%>
<div class="tableAll trbgcolor">
 <li style="width:30px;"><input type="checkbox" name="ID"  value="<%=news_id%>" <%if news_id<10 then%>disabled="disabled" <%end if%>></li>
 <li style="width:50px;"><a href="javascript:form1.action='?action=ordered&edid=<%=news_id%>';form1.submit();">编辑</a></li>
 <li style="width:150px"><input name="titlecn<%=news_id%>" type="text" id="titlecn<%=news_id%>" value="<%=news_titlecn%>"></li>
   <%if Const_webEn =1 then%><li style="width:150px"><input name="titleen<%=news_id%>" type="text" id="titleen<%=news_id%>" value="<%=news_titleen%>"></li><%end if%>
<li style="width:300px">../cn_asp/<input name="linkcn<%=news_id%>" type="text" id="linkcn<%=news_id%>" value="<%=news_linkcn%>" style="width:200px;"></li>
 <%if Const_webEn =1 then%><li style="width:200px">../en_asp/<input name="linken<%=news_id%>" type="text" id="linken<%=news_id%>" value="<%=news_linken%>"></li><%end if%>
 <li style="width:25px;"><%if news_lookcn=1 then%><a href="?action=cn1&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>显示</font></a>
 <%else%><a href="?action=cn2&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=red>隐藏</font></a><%end if%></li>
<%if Const_webEn =1 then%>
 <li style="width:25px;"><%if news_looken=1 then%><a href="?action=en1&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>显示</font></a>
 <%else%><a href="?action=en2&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=red>隐藏</font></a><%end if%></li>
 <%end if%>

 <li style="width:50px"><input name="pid<%=news_id%>" type="text" id="pid<%=news_id%>" value="<%=news_pid%>" size="3"> 
<input name="pi" type="hidden" id="pi" value="<%=news_id%>"></li>

</div>
<%
rs.movenext
loop
paixu=rs.RecordCount
%>
</form>

<form name="formadd" method="POST" action="?action=add&<%=canshu2%>">
<div class="tableAll titlebgcolor">
 <li style="width:30px"></li>
 <li style="width:700px;">添加</li>
</div>

<div class="tableAll trbgcolor">
 <li style="width:30px">&nbsp;</li>
 <li style="width:50px;"><a href="javascript:formadd.submit();">添加</a></li>
 <li style="width:150px"><input name="titlecn" type="text" id="titlecn"></li>
  <%if Const_webEn =1 then%> <li style="width:150px"><input name="titleen" type="text" id="titlecn"></li><%end if%>
<li style="width:300px">../cn_asp/<input name="linkcn" type="text" id="linkcn" style="width:200px;"></li>
 <%if Const_webEn =1 then%><li style="width:200px">../en_asp/<input name="linken" type="text" id="linken"></li><%end if%>
 <li style="width:25px">&nbsp;</li>
 <li style="width:50px;"><input name="pid" type="text" id="pid4" value="<%=paixu+1%>" size="3"></li>
  </div>
  </form>  
</div>
<%
rs.close
set rs=nothing


End Select

function editbook(b_name)
id=request("id")
conn.execute("update com_nav set "&b_name&" where id="&id)
response.Write "<script>location='?action=&"&canshu2&"'</script>"
End Function
%>
<!--#include file="footer.asp"-->