<!--#include file="../inc/conn1.asp"-->
<%
'判断是否正常登录
if session("admin_name")="" then
    response.redirect "admin_login.asp"
	response.end
end if
%>
<html>
<head>
<link href="css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<table border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#3399FF">
  <tr>
    <td width="760" height="460" align="center" valign="top" bgcolor="#FFFFFF"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="730">&nbsp;</td>
      </tr>
      <tr>
        <td height="25" background="images/daohang.jpg" style="padding-left:20px;"><b>新闻信息管理</b></td>
      </tr>
      <tr>
        <td height="300" align="center" valign="top" style="padding-top:10px; ">
	<%
	if request.querystring("action")="add" then
	%>
          <table border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
		<form name="form1" method="post" action="news_admin_form.asp">
            <tr bgcolor="#FFFFFF">
              <td width="140" align="center"><b>新闻标题</b></td>
              <td width="520"><input name="news_name" type="text" id="news_name" size="30"></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center"><b>所属分类</b></td>
              <td><select name="sort_id" id="sort_id">
			  <%
			  set rs1=server.createobject("adodb.recordset")
			  sql="select * from newssort order by sort_id desc"
			  rs1.open sql,conn,1,1
			  do while not rs1.eof
			  %>
                <option value="<%=rs1("sort_id")%>"><%=rs1("sort_name")%></option>
			  <%
			  rs1.movenext
			  loop
			  if rs1.eof and rs1.bof then
			  %>
                <option value="">暂无分类</option>
			  <%end if%>
              </select></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center"><b>新闻内容</b></td>
              <td><textarea name="content" style="display:none"></textarea>
                  <iframe id="eWebEditor1" src="htmlEdit/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="550" height="450"></iframe></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center">&nbsp;</td>
              <td><font color="#FF0000">换行按Shift+Enter 另起一段按Enter</font></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center">&nbsp;</td>
              <td><input type="submit" name="Submit" value="确认添加">
                  <input type="reset" name="Submit2" value="取消重填">
                  <input type="hidden" name="action" value="add">
			  </td>
            </tr>
        </form>
		  </table>
	<%
	rs1.close
	set rs1=nothing
	else
		news_id=request.querystring("newsid")
		set rs=server.createobject("adodb.recordset")
		sql="select * from news where news_id="&news_id&""
		rs.open sql,conn,1,3
		sort_id=rs("sort_id")
	%>	
          <table border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
		<form name="form1" method="post" action="news_admin_form.asp">
            <tr bgcolor="#FFFFFF">
              <td width="140" align="center"><b>新闻标题</b></td>
              <td width="520"><input name="news_name" type="text" id="news_name" value="<%=rs("news_name")%>" size="30"></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center"><b>所属分类</b></td>
              <td><select name="sort_id" id="sort_id">
			  <%
			  set rs1=server.createobject("adodb.recordset")
			  sql="select * from newssort order by sort_id desc"
			  rs1.open sql,conn,1,1
			  do while not rs1.eof
			  sort_id2=rs1("sort_id")
			  %>
                <option value="<%=sort_id2%>" <%if sort_id2=sort_id then%>selected<%end if%>><%=rs1("sort_name")%></option>
			  <%
			  rs1.movenext
			  loop
			  if rs1.bof and rs1.eof then
			  %>
                <option value="">暂无分类</option>
			  <%end if%>
              </select></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center"><b>新闻内容</b></td>
              <td><textarea name="content" style="display:none"><%=server.HTMLEncode(rs("news_content"))%></textarea>
                  <iframe id="eWebEditor1" src="htmlEdit/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="550" height="450"></iframe></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center">&nbsp;</td>
              <td><font color="#FF0000">换行按Shift+Enter 另起一段按Enter</font></td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td align="center">&nbsp;</td>
              <td><input type="submit" name="Submit" value="确认修改">
                  <input type="reset" name="Submit2" value="取消重填">
                  <input type="hidden" name="action" value="edit">
				  <input type="hidden" name="news_id" value="<%=news_id%>">

			  </td>
            </tr>
        </form>
		  </table>
	<%
	end if
	conn.close
	set conn=nothing
	%>  
		</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
