<!--#include file="check_login.asp"-->
<!--#include file="Config.asp"-->
<%
  '如果编辑的内容很多，上传速度太慢，请设置以下的时间，单位秒
    Server.ScriptTimeout = 1000
    Dim sContent1, i
    sContent1=""
    For i = 1 To Request.Form("content1").Count 
	    sContent1 = sContent1 & Request.Form("content1")(i) 
    Next 
	
     Newtitle=trim(request.Form("LName")) '新闻标题
     TreeID=trim(request.Form("LSort")) '新闻类别ID值
     GroupID=trim(request.Form("GroupID"))
     Exclusive=trim(request.Form("Exclusive"))
     Putman=trim(request.Form("LPutman")) '新闻发布者
   
     '添加产品目录表  
     V=Split(TreeID,"-")
	 
	 For i = 0 To UBound(V)
	   
       set rs2=server.createobject("adodb.recordset")
       sql2="select id,content from newtree where id="&V(i)
       rs2.open sql2,conn,1,3
	   if not rs2.eof then
	      ClassName2=ClassName2+">"+rs2("content")
       end if 
       rs2.Close
       set r2=nothing  
	 next
     ClassName1=ClassName2 '完成添加产品目录表的取值  
     TreeName=ClassName1 '新闻类别中文内容值
    '添加
     Putout=trim(request.Form("LPutout")) '是否发布出去
     Hot=trim(request.Form("NewsHot")) '是否为热点新闻
     Newcontent=sContent1                 '新闻内容
     addtime=date()
   '===================================
     if len(Newtitle)=0 or isempty(Newtitle)  then
        response.write "<script language=javascript> alert('新闻的标题必填！');history.back(-1);</script>"
        response.end
     end if 
     if len(TreeID)=0 or isempty(TreeID)  then
        response.write "<script language=javascript> alert('新闻所在的目录必选!');history.back(-1);</script>"
        response.end
     end if 
     if len(Newcontent)=0 or isempty(Newcontent)  then
        response.write "<script language=javascript> alert('该新闻的内容不可少！\n请编辑好后再发布，支持远程自动获取新闻图片功能！');history.back(-1);</script>"
        response.end
     end if

   '===================================
     Newsdoo=trim(request.QueryString("Newsdoo"))
  
     if Newsdoo="UpdateD" then
	    NewsID=trim(request.QueryString("NewsID"))
	    sql="select * from News where id="&NewsID&""
	    set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,1,3
	    rs("TreeID")=TreeID
	    rs("TreeName")=TreeName
	    rs("Newtitle")=Newtitle
	    rs("GroupID")=GroupID
	    rs("Exclusive")= Exclusive
	    rs("Newcontent")=Newcontent
	    rs("Putman")=Putman
	    rs("Hot")=Hot
   	    rs("Putout")=Putout
	    rs("addtime")=addtime
        rs.update
     else
	    sql="select * from News where (id is null)"
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,1,3
	   
	    rs.addnew
	    rs("TreeID")=TreeID
	    rs("TreeName")=TreeName
	    rs("Newtitle")=Newtitle
	    rs("GroupID")=GroupID
	    rs("Exclusive")= Exclusive
	    rs("Newcontent")=Newcontent
	    rs("Putman")=Putman
	    rs("Hot")=Hot
	    rs("Putout")=Putout
	    rs("addtime")=addtime
        rs.update
     end if
     rs.close
     set rs=nothing
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../CSS/System.css" rel="stylesheet" type="text/css">

</head>
<body  topmargin="0" leftmargin="0" rightmargin="0" <%=kkk%>>
<!--#include file="top/Ltop04.asp"-->
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="5"></td>
  </tr>
</table>
<table width="99%"  border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#CCCCCC">
    <tr valign="top" bgcolor="#EBEBEB">
      <td width="100%" height="73" align="center"><br>
        新闻发布成功！<br>
        <br>
        <a href="NewsList.asp">新闻列表</a> || <a href="NewAdd2.asp">添加新闻</a></td>
    </tr>
    <tr align="center" valign="top" bgcolor="#CBD50D">
      <td bgcolor="#C6BEC6">&nbsp; </td>
    </tr>
</table>
<!--#include file="fuct.asp"-->
<br>
</body>
</html>
