<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="inc/htmlconfig.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_news where id = "&id&" ",conn,1,3
  rs("titlecn")=request.form("titlecn")
  rs("titleen")=request.form("titleen")
  rs("titleutf")=request.form("titleutf")
  rs("looken")=request.form("looken")
  rs("lookcn")=request.form("lookcn")
  rs("lookutf")=request.form("lookutf")
  rs("texten")=request.form("texten")
  rs("textcn")=request.form("textcn")
  rs("textutf")=request.form("textutf")
  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_news 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 "utf1"
 call editbook("lookutf=0")
case "utf2"
 call editbook("lookutf=1")
case "del" 
id=replace(request("id")," ","")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("delete from com_news where id="&id(i))
next
response.Write "<script>location='?action=&"&canshu2&"'</script>"
case "order" 
pi=REQUEST("pi")
pi=REPLACE(pi,", ",",")
SQL5="SELECT * from com_news 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 "add" 
set rs=server.createobject("adodb.recordset")
rs.open "select * from com_news",conn,1,3
rs.addnew
rs("type")=tid
rs("titlecn")=trim(request("titlecn"))
rs("titleen")=trim(request("titleen"))
rs("titleutf")=trim(request("titleutf"))
rs("looken")=1
rs("lookcn")=1
rs("lookutf")=1
rs("texten")=" "
rs("textcn")=" "
rs("textutf")=" "
rs("adminuser")=session("admin_xyz") 
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 titlecn,titleen,pid,titleutf,id,type,lookcn,looken,lookutf from com_news where type="&tid&" order by pid asc, id asc",conn,1,1

set news_titlecn=rs("titlecn")
set news_titleen=rs("titleen")
set news_titleutf=rs("titleutf")
set news_id=rs("id")
set news_pid=rs("pid")
set news_lookcn=rs("lookcn")
set news_looken=rs("looken")
set news_lookutf=rs("lookutf")
%>
<!--#include file="top.asp"-->
<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%>
<%if Const_webUtf =1 then%><li style="width:150px;"><%=language_utf%>标题</li><%end if%>
 <li style="width:25px;"><%=language_cn%></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:50px;">排序</li>
</div>
<%do while not rs.eof%>
<div class="tableAll trbgcolor">
 <li style="width:30px;"><input type="checkbox" name="ID"  value="<%=news_id%>"></li>
 <li style="width:50px;"><a href="?action=modify&id=<%=news_id%>&<%=canshu2%>">编辑</a></li>
 <li style="width:150px"><%=news_titlecn%>&nbsp;</li>
 <%if Const_webEn =1 then%><li style="width:150px"><%=news_titleen%>&nbsp;</li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:150px"><%=news_titleutf%>&nbsp;</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=#999999>×</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=#999999>×</font></a><%end if%></li>
 <%end if%>
<%if Const_webUtf =1 then%>
 <li style="width:25px;"><%if news_lookutf=1 then%><a href="?action=utf1&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=utf2&id=<%=news_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</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="titleen"></li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:150px"><input name="titleutf" type="text" id="titleutf"></li><%end if%>
 <li style="width:40px">&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

Case "modify" 
sql = "SELECT * from com_news where id="&id
Set rs_modify = Server.CreateObject("ADODB.Recordset")
rs_modify.OPEN sql,Conn,1,1
%><!--#include file="top.asp"-->
<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="profile_manage.asp?tid=<%=tid%>"><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>

<form name="formadd" method="POST" action="?action=edit&id=<%=id%>&<%=canshu2%>">
<div class="tableAll titlebgcolor">
  <li style="width:30px">&nbsp;</li> 
  <li style="width:700px">修改内容</li> 
</div>
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px"><%=language_cn%>标题</li>
<li><input name="titlecn" type="text" id="titlecn" style="width:650px;" value="<%=rs_modify("titlecn")%>"></li>
</div>
<%if Const_webEn =1 then%>
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px"><%=language_en%>标题</li>
<li><input name="titleen" type="text" id="titleen" style="width:650px;" value="<%=rs_modify("titleen")%>"></li>
</div>
<%end if%>
<%if Const_webUtf =1 then%>
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px"><%=language_Utf%>标题</li>
<li><input name="titleutf" type="text" id="titleutf" style="width:650px;" value="<%=rs_modify("titleutf")%>"></li>
</div>
<%end if%>
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:100px">版本显示</li>
<li><input name="lookcn" type="checkbox" onClick="set()" value="1" <%if rs_modify("lookcn")=1 then%>checked<%end if%>>
        <%=language_cn%> 
        <%if Const_webEn =1 then%>
        <input name="looken" type="checkbox" value="1" <%if rs_modify("looken")=1 then%>checked<%end if%>>
        <%=language_en%>
        <%end if%>
        <%if Const_webUtf =1 then%>
        <input name="lookutf" type="checkbox" id="lookutf" value="1" <%if rs_modify("lookutf")=1 then%>checked<%end if%>>
        <%=language_Utf%>
        <%end if%></li>
</div>

<div class="clear"></div> 
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:90%;"><textarea id="textcn" name="textcn" style="width:100%;height:280px;"><%=rs_modify("textcn")%></textarea></li>
</div>
<%if Const_webEn =1 then%>
<div class="clear"></div> 
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:90%;"><textarea id="texten" name="texten" style="width:100%;height:280px;"><%=rs_modify("texten")%></textarea></li>
</div>
<%end if%>
<%if Const_webUtf =1 then%>
<div class="clear"></div> 
<div class="tableAll trbgcolor">
<li style="width:30px;">&nbsp;</li>
<li style="width:90%;"><textarea id="textutf" name="textutf" style="width:100%;height:280px;"><%=rs_modify("textutf")%></textarea></li>
</div>
<%end if%>

  <div class="tableAll trbgcolor">
    <li style="width:30px;">&nbsp;</li>
 <li><%=CKtext%></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>
</div>
<%
rs_modify.close
set rs_modify=nothing
End Select

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