<!--#include file="Admin.asp" -->
<!--#include file="cf.asp" -->
<!--#include file="adminconn.asp" -->
<%
if request("no")="modi" then
newsid=request("newsid")
title=request("title")
BigClassName=request("BigClassName")
SmallClassName=request("SmallClassName")
	mimageNum = Request.form("imageNum")
	firstImageName = trim(Request.form("pic_url"))
for i = 1 to request.form("demo").count
	scontent = scontent & request.form("demo")(i)
next
user=request("user")
if user="" then
	user="admin"
end if
come=request("come")
if come="" then
	come="本站原创"
end if
ok=request("ok")

set rs=server.createobject("adodb.recordset")
sql="select * from NEWS where id="&newsid
rs.open sql,conn,1,3
rs("title")=title
rs("content")=scontent
rs("oStyle")=request("oStyle")
rs("oColor")=request("oColor")
rs("user")=user
rs("come")=come
rs("BigClassName")=BigClassName
rs("SmallClassName")=SmallClassName
if ok<>"" then rs("ok") = ok
if mimageNum<>"" then rs("imageNum") = mimageNum 
rs("firstImageName") = firstImageName
rs.update
rs.close
set rs=nothing
response.write "<script language='javascript'>" & chr(13)
		response.write "alert('新闻修改成功！');" & Chr(13)
		response.write "window.document.location.href='admin_info.asp';"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
end if%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
'sql = "select * from SmallClass where SmallClassID in ("&session("strsmallidtype")&") order by SmallClassID asc"
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.addNEWS.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.addNEWS.SmallClassName.options[document.addNEWS.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    
function CheckForm()
{
     document.addNEWS.cnWords.value = document.frames.cnEditBox.getHTML(true);     
     document.addNEWS.imageNum.value = document.frames.cnEditBox.document.all("editImageNum").value;
     document.addNEWS.editFirstImageName.value = document.frames.cnEditBox.document.all("editFirstImageName").value;

	if (document.addNEWS.title.value.length == 0) {
		alert("新闻标题没有填写.");
		document.addNEWS.title.focus();
		return false;
	}
		if (document.addNEWS.user.value.length == 0) {
		alert("新闻发布人没有填写");
		document.addNEWS.user.focus();
		return false;
	}
	return true;
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../include/css.css" type="text/css">
<title>添加新闻</title>
</head>

<body leftmargin="0" topmargin="0" bgcolor="#FFFFEE">
<% 
newsid=request("id")
Set rso=Server.CreateObject("ADODB.RecordSet") 
sql="select * from NEWS where  id="&newsid
rso.Open sql,conn,1,1
if rso.eof and rso.bof then
response.Write("没有记录")
else
%>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="2">
  <form name="addNEWS" method="post" action="admin_infomodi.asp?no=modi" onSubmit="return CheckForm();">
    <tr align="center" bgcolor="#FFFFEE"> 
      <td height="30" colspan="3"><font color="#0000FF"><strong>修改新闻</strong></font></td>
    </tr>
    <tr> 
      <td width="184" height="30" align="right" bgcolor="#FFFFEE"><font color="#FF0000">*</font>新闻标题：</td>
      <td colspan="2" valign="top" bgcolor="#FFFFEE">　 
        <input name="title" type="text" class="input" value="<%=rso("title")%>" size="50" maxlength="100"></td>
    </tr>
	<tr>
  <td height="30" align="right">&nbsp; 属性：</td>
  <td colspan="3">　 
       <select class='css_select' name="oStyle" type="text" id="oStyle">
          <option value="">标题样式</option>
          <option value="s01" <%if rso("oStyle")="s01" then%> selected<%end if%>>粗体</option>
          <option value="s02" <%if rso("oStyle")="s02" then%> selected<%end if%>>斜体</option>
        </select>
        <select class='css_select' name="oColor" type="text" id="oColor">
          <option value="links">标题颜色</option>
          <option value="a01" style="background-color:#FF0000;" <%if rso("oColor")="a01" then%> selected<%end if%>></option>
          <option value="a02" style="background-color:#0000FF;" <%if rso("oColor")="a02" then%> selected<%end if%>></option>
          <option value="a03" style="background-color:#00FFFF;" <%if rso("oColor")="a03" then%> selected<%end if%>></option>
          <option value="a04" style="background-color:#FF9900;" <%if rso("oColor")="a04" then%> selected<%end if%>></option>
          <option value="a05" style="background-color:#339966;" <%if rso("oColor")="a05" then%> selected<%end if%>></option>
        </select>
		<select class='css_select' name="top" type="text" id="top">
          <option value="0">文章置顶</option>
          <option value="1" <%if rso("top")=1 then%> selected<%end if%>>置顶是</option>
          <option value="0" <%if rso("top")=0 then%> selected<%end if%>>置顶否</option>
        </select>
		<select class='css_select' name="tuijian" type="text" id="tuijian">
          <option value="0">文章推荐</option>
          <option value="1" <%if rso("tuijian")=1 then%> selected<%end if%>>推荐是</option>
          <option value="0" <%if rso("tuijian")=0 then%> selected<%end if%>>推荐否</option>
        </select></td>
</tr>
    <tr> 
      <td height="30" align="right" bgcolor="#FFFFEE"><font color="#FF0000">*</font>新闻类别：</td>
      <td colspan="2" valign="top" bgcolor="#FFFFEE">
　 
         
                    <%
	if session("aleave")="check" then
		response.write rso("BigClassName") & "<input name='BigClassName' type='hidden' value='" & rso("BigClassName") & "'>&gt;&gt;"
	else		
        'sql = "select * from BigClass where urlok=0 and  bigclassid in ("&session("strbigidtype")&")"
		 sql = "select * from BigClass where urlok=0"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>
                    <select name="BigClassName" onChange="changelocation(document.addNEWS.BigClassName.options[document.addNEWS.BigClassName.selectedIndex].value)" size="1">
                      <%
		    do while not rs.eof
			%>
                      <option <% if rs("BigClassName")=rso("BigClassName") then response.Write("selected") end if%> value="<%=trim(rs("BigClassName"))%>">总第<%=trim(rs("BigClassID"))%>期</option>
                      <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
                    </select> 
                    <%
	end if
	if session("aleave")="check" then
		response.write rso("SmallClassName") & "<input name='SmallClassName' type='hidden' value='" & rso("SmallClassName") & "'>"
	else
	%>
                    <select name="SmallClassName">
                      <option value="" <%if rso("SmallClassName")="" then response.write "selected"%>>请指定版面</option>
                      <%
			sql="select * from SmallClass where BigClassName='" & rso("BigClassName") & "'" 
			rs.open sql,conn,1,1 
			if not(rs.eof and rs.bof) then  
				do while not rs.eof %> 
                      <option <% if rs("SmallClassName")=rso("SmallClassName") then response.Write("selected") end if%> value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                      <%
			    	rs.movenext
				loop
			end if
	        rs.close
			%>
                    </select> 
                    <%
	end if
	%>      </td>
    </tr>
	<tr> 
      <td height="30" align="right">&nbsp; 首页小图：</td>
      <td width="318">　 
	  <input name="pic_url" type="text" class="input" id="pic_url" value="<%=rso("firstimagename")%>" size="30" maxlength="255"></td>
      <td width="370"><iframe border=0 frameborder=0 framespacing=0 height=22 width=300 marginheight=0 marginwidth=0 name=new_date noresize scrolling=no  src="upload.asp" vspale="0"></iframe></td>
	</tr>
    <tr> 
      <td height="30" align="right" valign="top" bgcolor="#FFFFEE"><font color="#FF0000">*</font>新闻内容：</td>
      <td colspan="2" valign="top" bgcolor="#FFFFEE">　 
        <textarea name="demo" style="display:none"><%=server.htmlencode(rso("content"))%></textarea><iframe id="demo" src="./SouthidcEditor/ewebeditor.asp?id=demo&style=s_yellow" frameborder="0" scrolling="no" width="550" height="350"></iframe>
		</td>
    </tr>
    <tr> 
      <td height="24" align="left" bgcolor="#ffffee"><font color="#ff0000">*</font>文章作者：</td>
      <td colspan="2" valign="top" bgcolor="#ffffee">　 <input name="user" type="text" class="input" size="30" value="<%=rso("user")%>"></td>
    </tr>
    <tr> 
      <td height="24" align="left" bgcolor="#ffffee"><font color="#ff0000">*</font>文章来源：</td>
      <td colspan="2" valign="top" bgcolor="#ffffee">　 <input name="come" type="text" class="input" size="30" value="<%=rso("come")%>"></td>
    </tr>
    <tr> 
      <td height="30" align="right" bgcolor="#FFFFEE">图片新闻：</td>
      <td colspan="2" bgcolor="#FFFFEE">　 
        <input type="radio" value="True" <%if rso("ok")=True then Response.Write "checked"%>  name="ok">是 
        <input type="radio" value="False" <%if rso("ok")=False then Response.Write "checked"%> name="ok">
        否 　<font color="#FF0000">选择此项时请注意文章中是否添加有图片 ！</font></td>
    </tr>
    <tr align="center"> 
      <td height="35" colspan="3" bgcolor="#FFFFEE"> 
        <input type="submit" name="Submit" value="提交" class="input">
        <input type="hidden" name="newsId" value="<%=newsId%>">　 
        <input type="reset" name="Submit2" value="重置" class="input"> 
        <!--获取EditBox的内容-->
        <input name=cnWords type=hidden ID="cnWords" value=""> <input name=imageNum type=hidden ID="imageNum" value="<%=mImageNum%>"> 
        <input name=editFirstImageName type=hidden ID="editFirstImageName" value=""> 
        <!--获取EditBox的内容-->      </td>
    </tr>
  </form>
</table>
<% End If
rso.close
set rso=nothing
 %>
</body>
</html>
