<!-- #include file="../Include/conn.asp" -->
<!-- #include file="Include/Chk.asp" -->


<%
	id=request("id")
	if id="" or not isnumeric(id) then
	Response.Write "<script language='javascript'>alert('参数错误!');location.replace('News_Manage.asp');</script>"
	Response.End()
	end if
	img=request("img")
	SQL="Select * from Xin_News where id="&id
	set rs=server.createobject("adodb.recordset")
	rs.open SQL,conn,1,3
	if rs.eof and rs.bof then
	Response.Write "<script language='javascript'>alert('参数错误!');location.replace('News_Manage.asp');</script>"
	Response.End()
	end if
if Request("Action")=1 then
		if Trim(Request("title"))="" or Trim(Request("tid"))="" or Trim(Request("info"))="" then
				Response.write "<script language='javascript'>alert('信息填写不完整：\n标题、栏目、内容必须填写！');history.go(-1);</script>"
		Response.End()
	end if

	rs("title")=Trim(Request("title"))
	rs("tid")=Trim(Request("tid"))
	rs("from")=Trim(Request("from"))
	rs("info")=Trim(Request("info"))
	rs("img")=Trim(Request("img"))


	rs.Update
	rs.Close
	Set rs=nothing
	Response.Write "<script language='javascript'>alert('修改成功!');location.replace('News_Manage.asp');</script>"
	Response.End()
else
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="Images/main.css" rel="stylesheet" type="text/css" />
<script charset="utf-8" src="../cneditor/kindeditor.js"></script>
<script charset="utf-8" src="../cneditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="../cneditor/plugins/code/prettify.js"></script>
<script charset="utf-8" src="js/e.js"></script>
<script charset="utf-8" src="js/up.js"></script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="ta">
      <tr>
        <td width="50%" height="25" align="left" valign="middle" class="t2">修改新闻</td>
        <td width="50%" align="right" valign="middle" class="t2">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="8"></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" class="ta">
      <tr>
        <td colspan="2" align="left" valign="top" bgcolor="#FFFFFF">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <form name="form1" method="post" action="?action=1&id=<%=Request("id")%>">
            <tr>
              <td width="20%" height="30" align="right" valign="middle" class="bline"><span class="t3">新闻标题：</span></td>
              <td width="80%" height="30" colspan="2" align="left" valign="middle" class="bline"><input name="title" type="text" class="main" id="title" value="<%=rs("title")%>" size="80" maxlength="100">
                <span class="ts">                *标题字数限100字之内 	</span></td>
            </tr>
            <tr>
              <td height="30" align="right" valign="middle" class="bline"><span class="t3">所属栏目：</span></td>
              <td height="30" colspan="2" align="left" valign="middle" class="bline"><select name="tid" class="main" id="tid">
<%
Set Rs1 = Conn.Execute("select * from Xin_News_Type where pid=0")
Do While Not Rs1.EOF
s=""
if Cint(rs("tid"))=Cint(Rs1("id")) then
s="selected"
end if
Response.Write "<option value='" & Rs1("id") & "' "&s&">"& Rs1("name") &"</option>"

	Set Rs2=Conn.Execute("select * from Xin_News_Type where pid="&Rs1("id")&"")
	Do While Not Rs2.EOF
	j=""
	if Cint(rs("tid"))=Cint(Rs2("id")) then
	j="selected"
	end if
	Response.Write "<option style='color:#999999' value='" & Rs2("id") & "' "&j&">--"& Rs2("name") &"</option>"
	Rs2.movenext
	loop
	rs2.close

Rs1.MoveNext
loop
Rs1.Close
%>
              </select>              </td>
            </tr>
            <tr class="bline">
              <td height="30" align="right" valign="middle" class="bline"><span class="t3">来&nbsp;&nbsp;&nbsp;&nbsp;源：</span></td>
              <td height="30" colspan="2" align="left" valign="middle" class="bline"><input name="from" type="text" class="main" id="from" value="<%=rs("from")%>" size="15" maxlength="20"></td>
            </tr>
            <tr>
              <td height="30" align="right" valign="middle" class="bline"><span class="t3">图片新闻：</span></td>
              <td height="30" align="left" valign="middle" class="bline">
			  <input name="img" type="text" id="img"  size="28" value="<%=rs("img")%>"> 
<input name="insertfile" type="button" id="insertfile" value="选择图片" />			  </td>
              <td width="360" align="left" valign="middle" class="bline"><img src="<%=rs("img")%>" width="180" height="120"></td>
            </tr>
    
            <tr>
              <td width="20%" height="30" align="right" valign="middle" class="bline"><span class="t3">新闻内容：</span></td>
              <td width="80%" colspan="2" align="left" valign="middle" class="bline">
                <p>
<textarea  name="info" style="width:900px;height:530px;"> 
<%=rs("info")%>
</textarea>	     </p>                </td>
            </tr>
            <tr>
              <td height="50" colspan="3" align="center" valign="middle"><input name="Submit" type="submit" class="inputbut" value="修改">
                &nbsp;
                <input name="Submit2" type="reset" class="inputbut" value="返回" onClick="history.back()"></td>
              </tr>
			</form>
          </table>
                
        </td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>
<%
end if
%>