<%dbdns="../../"%>
<!--#include file="upload.inc"-->
<!--#include file="../../inc/conn.asp"-->
<!--#include file="../cook.asp"-->
<%if fla15<>1 then
response.write "<script>alert('操作权限出错，您没有权限操作些功能');history.go(-1);</Script>"
Response.End 
end if%>
<%title=request("title")
For i = 1 To Request.Form("news").Count 
	newss = newss & Request.Form("news")(i) 
Next 
if title="" then
errstyle="·请输入完整的新闻标题！"
scripterr
end if
if newss="" or len(newss)<20 then
errstyle="·请输入不少于20个字符的新闻内容！"
scripterr
end if
if newssort="" then
errstyle="·请选择企业新闻所属栏目！"
scripterr
end if
if ly="" then
errstyle="·请输入新闻来源！"
scripterr
end if
if addr="" then
errstyle="·请输入新闻添加人！"
scripterr
end if

ly=request("ly")
addr=request("addr")
newssort=request("newssort")

page=request("page")
if page="" then page=1

if request("action")="add" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from dlxf_xxnews order by dlxf_id desc"
rs.open sql,conn,1,3
rs.addnew
rs("dlxf_title")=title
rs("dlxf_news")=newss
rs("dlxf_ly")=ly
rs("dlxf_addr")=addr
rs("dlxf_key")=1
rs("dlxf_key1")=1
rs("dlxf_key2")=1
rs("dlxf_yp_id")=0
rs("dlxf_enrol")=2
rs("dlxf_newssort")=newssort
rs.update

dlxf_id=rs("dlxf_id")
rs.close
set rs=nothing

if application("cityHTML")=1 then
call savehtml(dlxf_id)
end if

'response.redirect"news_add.asp"

elseif request("action")="edit" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from dlxf_xxnews where dlxf_id="&request("id")
rs.open sql,conn,1,3
rs("dlxf_title")=title
rs("dlxf_news")=newss
rs("dlxf_ly")=ly
rs("dlxf_addr")=addr
rs("dlxf_key1")=1
rs("dlxf_key2")=1
rs("dlxf_newssort")=newssort
rs.update
rs.close
set rs=nothing

if application("cityHTML")=1 then
call savehtml(request("id"))
end if

Response.Redirect "news.asp?page="&page

end if

'=======================================
function savehtml(id)

set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
set fso=server.CreateObject("Scripting.FileSystemObject")
sql="select * from dlxf_xxnews where dlxf_id="&id&""
rs.open sql,conn,1,1
if rs.eof then
response.write "<br><br><div align=center>此内容不存在</div>"
response.end
else
ypid=rs("dlxf_yp_id")
title=rs("dlxf_title")
news=rs("dlxf_news")
newssort=rs("dlxf_newssort")
ly=rs("dlxf_ly")
addr=rs("dlxf_addr")
addsj=rs("dlxf_date")

Ftitle=""
if ly<>"" then Ftitle="来源："&ly&""
if addr<>"" then Ftitle=Ftitle&"　添加人："&addr&""
if addsj<>"" then Ftitle=Ftitle&"　添加时间："&addsj&""

end if
rs.close

folder=year(addsj)&month(addsj)
filename=replace(replace(replace(addsj,"-",""),":","")," ","")&".html"

shtml="<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN""><html><head>"&_
      "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"&_
	  "<title>"&title&" - "&application("citytitle")&"</title></head>"&application("citycss")&"<body topmargin=0>"&_
	  "<script language=javascript src="&application("cityurl")&"Include/top.asp></script>"&_
	  "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center>"

sql1="select * from dlxf_xxnewssort where dlxf_id="&newssort
rs1.open sql1,conn,1,1
if not rs1.eof then
newssortview=" >> <a href="&application("cityurl")&"new_list.asp?id="&rs1("dlxf_id")&">"&rs1("dlxf_newssort")&"</a>"
else
newssortview=""
end if
rs1.close

shtml=shtml&"<tr><td width=580 valign=top><table width=""98%"" border=0 cellspacing=1 cellpadding=0 align=center>"&_
      "<tr><td height=30>当前位置：<a href="&application("cityurl")&"index.asp>首页</a> >> <a href="&application("cityurl")&"news.asp>行业新闻</a>"&newssortview&" >> 正文</td></tr>"&_
      "<tr><td height=5></td></tr><tr><td height=40 align=center class=f18><strong>"&title&"</strong></td></tr>"&_
      "<tr><td align=right>"&_
      "<table width=""100%"" border=0 cellspacing=0 cellpadding=5>"&_
      "<tr><td align=right><img src="&application("cityurl")&"img/item.gif border=0 align=absmiddle> <a onclick=""window.print()"" style=""cursor:hand"">我要打印</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/collection.gif border=0 align=absmiddle> <a href=# onClick=""javascript:window.external.AddFavorite('"&application("cityurl")&"Html/xxnews/"&folder&"/"&filename&"','"&title&"');return false"">IE收藏</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/gwb.gif border=0 align=absmiddle> <a href=# onClick=""javascript:window.open('"&application("cityurl")&"collection.asp?tit="&title&"&page=Html/xxnews/"&folder&"/"&filename&"','_n','width=300,height=150');return false"">放入公文包</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/icon_info_01.gif border=0 align=absmiddle> <a href=#book>我要留言</a>　"&_
      "&nbsp;<img src="&application("cityurl")&"img/icon_info_02.gif border=0 align=absmiddle> <a href=#view>查看留言</a>&nbsp;"&_
      "</td></tr></table>"&_
      "</td></tr>"&_
      "<tr><td height=22 align=center bgcolor=FF7300><font color=#ffffff>"&Ftitle&"</font></td></tr>"&_
      "<tr><td height=10></td></tr>"&_
      "<tr><td height=300 valign=top><p style=""line-height:190%"" class=f14>"&news&"</td></tr>"&_
      "<tr><td height=20></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=#FF7300>"&_
      "<tr><td width=""50%""><font color=white><strong>最新供应信息</strong></font></td>"&_
      "<td width=""50%""><font color=white><strong>最新求购信息</strong></font></td></tr>"&_
      "<tr bgcolor=#ffffff><td><script language=javascript src="&application("cityurl")&"Include/sca.asp?aid=3&bid=6&cid=26&did=1&eid=1&fid=1></script></td>"&_
      "<td><script language=javascript src="&application("cityurl")&"Include/sca.asp?aid=2&bid=6&cid=26&did=1&eid=1&fid=1></script></td></tr>"&_
      "</table></td></tr>"&_

      "<a name=view></a><tr><td height=5></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=FF7300>"&_
      "<tr><td><font color=white><strong>查看留言</strong></font></td></tr>"&_
      "<tr><td bgcolor=#ffffff height=20><script language=javascript src="&application("cityurl")&"Include/leaveword_view.asp?sortid=7&tableid="&id&"></script></td></tr>"&_
      "</table></td></tr>"&_
	  
	  "<a name=book></a><tr><td height=5></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=FF7300>"&_
      "<tr><td><font color=white><strong>用户留言</strong></font></td></tr>"&_
      "<tr><td bgcolor=#ffffff><script language=javascript src="&application("cityurl")&"Include/leaveword.asp?sortid=7&tableid="&id&"&ypid="&ypid&"></script></td></tr>"&_
      "</table></td></tr>"&_

      "</table></td>"&_

      "<td width=180 valign=top bgcolor=#D6DFF7>"&_
      "<table width=""100%"" border=0 cellspacing=0 cellpadding=3>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14>　<strong><font color=#ffffff>站内搜索</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/search.asp?search=2></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14>　<strong><font color=#ffffff>企业动态</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/news.asp?aid=0&bid=8&cid=24&did=0&eid=0&fid=1&gid=0></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14>　<strong><font color=#ffffff>产品推荐</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/cp.asp?aid=1&bid=4&cid=20&did=1&eid=1&fid=80></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14>　<strong><font color=#ffffff>行业动态</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/news.asp?aid=1&bid=20&cid=20&did=1&eid=0&fid=1&gid=0></script></td></tr>"&_
      "</table>"&_

      "</td></tr></table>"&_

      "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center bgcolor=#ffffff>"&_
      "<tr><td height=10></td></tr>"&_
      "<tr><td height=2 bgcolor=#4795EC></td></tr>"&_
      "<tr><td align=center height=80><script language=javascript src="&application("cityurl")&"Include/bottom.asp></script></td></tr></table>"&_

      "</body></html>"

path=server.MapPath("../../Html/xxnews/"&folder)
if fso.FolderExists(path)=false then
fso.CreateFolder(path)
end if
path=path&"/"&filename

set ts=fso.OpenTextFile(path,2,true,-2)
   ts.writeline""&shtml&""
   ts.close
set ts=nothing
set fso=nothing
set rs1=nothing
set rs=nothing

end function
%> 
<%
dim upload,file,formName,formPath,iCount,title,typeid,tjhyxxs,tjnews,tjhome,wagg,homehot,content,selectpic,from,picurl,rs,imgs
set upload=new upload_5xSoft
formPath=upload.form("filepath")
if right(formPath,1)<>"/" then formPath=formPath&"/" 
title=upload.form("title")
typeid=upload.form("typeid")
dim sql1
dim rs1
dim typename1
sql1="select * from newstype where typeid="&typeid
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,1,1
typename1=rs1("type")
if upload.form("checkbox1")="1" then
tjnews=1
else
tjnews=0
end if
if upload.form("checkbox2")="1" then
tjhome=1
else
tjhome=0
end if
if upload.form("checkbox4")="1" then
wzgg=1
else
wzgg=0
end if
if upload.form("checkbox110")="1" then
homehot=1
else
homehot=0
end if
content=changechr(upload.form("content"))
from=upload.form("from")
if upload.form("checkbox3")="1" then
selectpic=1
else
selectpic=0
end if
iCount=0

'set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
'formPath="pic/"
set file=upload.file("file") ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
thename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.filename,4)
file.filename=thename
file.SaveAs Server.mappath(formPath&file.FileName)
imgs=File.FileName
'else
'response.write "未找到文件 &nbsp;&nbsp;<A HREF=javascript:history.back(1)>返回</A>"
'response.end
end if


set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select * from news",conn,3,2
rs.addnew
rs("title")=title
rs("content")=content
rs("nfrom")=from
rs("selectpic")=selectpic
rs("typeid")=typeid
rs("typename")=typename1
rs("tjnews")=tjnews
rs("tjhome")=tjhome
rs("wzgg")=wzgg
rs("homehot")=homehot
rs("picurl")=imgs
rs.update
rs.close
set rs=nothing
conn.close
set upload=nothing ''删除此对象
'response.redirect("index.asp")
Htmend iCount&" 个文件上传结束!"
sub HtmEnd(Msg)
set upload=nothing
'response.write ("123")
response.write (""&imgs&"")
'response.redirect ("default.asp")
response.end
end sub
%>