News_Save.asp
Upload User: jisenq
Upload Date: 2014-06-29
Package Size: 7216k
Code Size: 27k
Category:

ADO-ODBC

Development Platform:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_Inc/Function.asp"-->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <!--#include file="../../FS_InterFace/NS_Function.asp" -->
  6. <!--#include file="lib/cls_main.asp" -->
  7. <!--#include file="../PublicSite/Public_Function.asp" -->
  8. <!--#include file="../../FS_InterFace/NS_Public.asp" -->
  9. <!--#include file="../../FS_InterFace/MS_Public.asp" -->
  10. <!--#include file="../../FS_InterFace/Other_Public.asp" -->
  11. <!--#include file="../../FS_InterFace/ME_Public.asp" -->
  12. <!--#include file="../../FS_InterFace/MF_Public.asp" -->
  13. <%'Copyright (c)2006 by Foosun Inc. Code by Simpwind.Xie
  14. Response.Buffer = True
  15. Response.Expires = -1
  16. Response.CacheControl = "no-cache"
  17. Dim Conn,User_Conn,obj_Save_Rs,strShowErr,str_checkTF
  18. MF_Default_Conn
  19. MF_User_Conn
  20. MF_Session_TF 
  21. set Fs_news = new Cls_News
  22. Fs_News.GetSysParam()
  23. If Not Fs_news.IsSelfRefer Then response.write "非法提交数据":Response.end
  24. Dim Fs_news,str_News_Action,str_NewsType,str_isdraft,str_ClassID,str_SpecialEName,str_SpecialID_EName,str_NewsTitle,str_TitleColor,str_titleBorder,str_TitleItalic,str_isShowReview,str_PopID
  25. Dim str_URLAddress,str_CurtTitle,str_KeyWords,str_KeywordSaveTF,str_Templet,str_NewsSmallPicFile,str_NewsPicFile,str_PicborderCss,str_Author,str_AuthorSaveTF,str_Source,str_SourceSaveTF
  26. Dim str_NewsNaviContent,str_Content,str_PointNumber,str_Money,str_GroupID,str_FileName,str_FileExtName,str_addtime,str_Hits,str_NewsID,str_TodayNewsPicTF,str_isDraftTF,str_ReturnUrl,obj_isdraft_rs
  27. Dim str_NewsProperty_Rec,str_NewsProperty_mar,str_NewsProperty_rev,str_NewsProperty_constr,str_NewsProperty_tt,str_NewsProperty_hots,str_NewsProperty_jc,str_NewsProperty_unr,str_NewsProperty_ann,str_NewsProperty_filt,str_NewsProperty_Remote
  28. Dim str_NewsProperty_Rec_1,str_NewsProperty_mar_1,str_NewsProperty_rev_1,str_NewsProperty_constr_1,str_NewsProperty_tt_1 ,str_NewsProperty_hots_1,str_NewsProperty_jc_1,str_NewsProperty_unr_1,str_NewsProperty_ann_1,str_NewsProperty_filt_1,str_NewsProperty_Remote_1
  29. '(c)2002-2006 版权所有:Foosun Inc. 不得进行任何性质的程序拷贝、传播。By Foosun__Simpwind.Xie
  30. If not trim(Request.Form("d_Id"))="" Then
  31. If trim(Request.Form("d_Id"))>0 Then
  32. Dim CustColumnRs,CustSql,CustColumnArr
  33. CustSql="select DefineID,ClassID,D_Name,D_Coul,D_Type,D_isNull,D_Value,D_Content,D_SubType from [FS_MF_DefineTable] Where D_SubType='NS' and  Classid="& trim(Request.Form("d_Id")) &""
  34. Set CustColumnRs=CreateObject(G_FS_RS)
  35. CustColumnRs.Open CustSql,Conn,1,3
  36. If Not CustColumnRs.Eof Then
  37. CustColumnArr=CustColumnRs.GetRows()
  38. End If
  39. CustColumnRs.close:Set CustColumnRs = Nothing
  40. End If
  41. end if
  42. '=====================================
  43. str_News_Action = Request.Form("News_Action")
  44. if str_News_Action = "add_Save" then:str_NewsID = Fs_News.GetRamCode(15):Else:str_NewsID = Trim(Request.Form("NewsID")):End if
  45. str_NewsType = Request.Form("NewsType")
  46. str_isdraft = Request.Form("isdraft")
  47. if str_isdraft<>"" then
  48. Set obj_isdraft_rs = server.CreateObject(G_FS_RS)
  49. obj_isdraft_rs.Open "Select ID from FS_NS_News where isdraft=1  Order by ID desc",Conn,1,3
  50. if obj_isdraft_rs.recordcount>20 then
  51. strShowErr = "<li>您的草稿箱中的"& Fs_news.allInfotitle&"已经超过20条信息,操作失败</li>"
  52. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  53. Response.end
  54. End if
  55. End if
  56. str_ClassID = Request.Form("ClassID")
  57. str_SpecialID_EName =  Request.Form("SpecialID_EName")
  58. str_SpecialEName = Request.Form("SpecialID")
  59. str_NewsTitle= Request.Form("NewsTitle")
  60. str_TitleColor = Request.Form("TitleColor")
  61. str_titleBorder = Request.Form("titleBorder")
  62. str_TitleItalic =  Request.Form("TitleItalic")
  63. str_isShowReview = Request.Form("isShowReview")
  64. str_PopID = Request.Form("PopID")
  65. str_URLAddress = Request.Form("URLAddress")
  66. str_CurtTitle = Request.Form("CurtTitle")
  67. str_KeyWords =  Request.Form("KeywordText")
  68. str_KeywordSaveTF =  Trim(Request.Form("KeywordSaveTF"))
  69. str_Templet =  Request.Form("Templet")
  70. str_NewsSmallPicFile =  Request.Form("NewsSmallPicFile")
  71. str_NewsPicFile =  Request.Form("NewsPicFile")
  72. str_PicborderCss = Request.Form("PicborderCss")
  73. str_Author = Request.Form("Author")
  74. str_AuthorSaveTF= Request.Form("AuthorSaveTF")
  75. str_Source = Request.Form("Source")
  76. str_SourceSaveTF = Request.Form("SourceSaveTF")
  77. str_NewsNaviContent = Request.Form("NewsNaviContent")
  78. str_Content = Request.Form("Content")
  79. str_PointNumber = Request.Form("PointNumber")
  80. str_Money = Request.Form("Money")
  81. str_GroupID = Request.Form("BrowPop")
  82. str_FileName = Request.Form("FileName")
  83. str_FileExtName = Request.Form("FileExtName")
  84. str_addtime = Request.Form("addtime")
  85. str_Hits = Request.Form("Hits") 
  86. str_NewsProperty_Rec = Trim(Request.Form("NewsProperty_Rec")) 
  87. str_NewsProperty_mar = Trim(Request.Form("NewsProperty_mar")) 
  88. str_NewsProperty_rev = Trim(Request.Form("NewsProperty_rev")) 
  89. str_NewsProperty_constr =  Trim(Request.Form("NewsProperty_constr")) 
  90. str_NewsProperty_tt =   Trim(Request.Form("NewsProperty_tt")) 
  91. str_NewsProperty_hots=   Trim(Request.Form("NewsProperty_hots")) 
  92. str_NewsProperty_jc=   Trim(Request.Form("NewsProperty_jc")) 
  93. str_NewsProperty_unr = Trim(Request.Form("NewsProperty_unr")) 
  94. str_NewsProperty_ann = Trim(Request.Form("NewsProperty_ann")) 
  95. str_NewsProperty_filt = Trim(Request.Form("NewsProperty_filt")) 
  96. str_NewsProperty_Remote = Trim(Request.Form("NewsProperty_Remote")) 
  97. str_TodayNewsPicTF = Trim(Request.Form("TodayNewsPicTF")) 
  98. Set obj_Save_Rs = server.CreateObject(G_FS_RS)
  99. '判断合法性
  100. If Trim(str_NewsTitle)="" then
  101. strShowErr = "<li>请填写标题</li>"
  102. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  103. Response.end
  104. End if
  105. '自定义字段检查(默认值,必填值)
  106. '(c)2002-2006 版权所有:Foosun Inc. 不得进行任何性质的程序拷贝、传播。By Foosun__Simpwind.Xie 
  107. If IsArray(CustColumnArr) Then
  108. For i = 0 to UBound(CustColumnArr,2)
  109. If CustColumnArr(5,i)="0" Then
  110. If Request.Form("FS_NS_Define_"&CustColumnArr(3,i))="" Then
  111. strShowErr = "<li>["&CustColumnArr(2,i)&"-自定义字段]不可以为空,请填写或设置默认值</li>"
  112. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  113. Response.end
  114. End If
  115. If CustColumnArr(4,i)="6" Then
  116. If Not Isdate(Request.Form("FS_NS_Define_"&CustColumnArr(3,i))) Then
  117. strShowErr="<li>["&CustColumnArr(2,i)&"-自定义字段]必须为为日期,请重新填写!</li>"
  118. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  119. Response.end
  120. End If
  121. End If
  122. End If
  123. If CustColumnArr(4,i)="5" Then
  124. If Not IsNumeric(Request.Form("FS_NS_Define_"&CustColumnArr(3,i))) Then
  125. strShowErr="<li>["&CustColumnArr(2,i)&"-自定义字段]必须为数字,请重新填写!</li>"
  126. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  127. Response.end
  128. End If
  129. End If
  130. Next
  131. End If
  132. If Trim(str_ClassID)="" then
  133. strShowErr = "<li>请选择栏目或您填写的栏目不正确</li>"
  134. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  135. Response.end
  136. End if
  137. if str_NewsType="TitleNews" then
  138. If Trim(str_URLAddress)="" then
  139. strShowErr = "<li>选择外部栏目,请填写外部地址连接</li>"
  140. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  141. Response.end
  142. End if
  143. Else
  144. If isNull(Trim(str_Templet))  or len(Trim(str_Templet))<5 then
  145. strShowErr = "<li>请正确填写模板地址</li>"
  146. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  147. Response.end
  148. End if
  149. If isNull(Trim(str_Content))  or len(Trim(str_Content))<3 then
  150. strShowErr = "<li>请填写内容</li><li>您填写的内容少于3个字符</li>"
  151. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  152. Response.end
  153. End if
  154. If isNull(Trim(str_FileName))  then
  155. strShowErr = "<li>文件名不正确,请填写正确</li>"
  156. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  157. Response.end
  158. End if
  159. If isNull(Trim(str_addtime))  then
  160. strShowErr = "<li>请填写日期</li>"
  161. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  162. Response.end
  163. End if
  164. If isdate(Trim(str_addtime)) =false then
  165. strShowErr = "<li>请正确填写添加日期</li>"
  166. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  167. Response.end
  168. End if
  169. If isnull(Trim(str_FileName)) then
  170. strShowErr = "<li>请填写文件名</li>"
  171. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  172. Response.end
  173. End if
  174. If isnumeric(Trim(str_hits)) =false then
  175. strShowErr = "<li>请正确填写点击率</li>"
  176. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  177. Response.end
  178. End if
  179. if str_NewsType="PicNews" then
  180. If isnull(Trim(str_NewsSmallPicFile))  or len(Trim(str_NewsSmallPicFile))<5 then
  181. strShowErr = "<li>请填写图片小图</li><li>请正确填写图片小图</li>"
  182. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  183. Response.end
  184. End if
  185. End if
  186. if  Instr(str_FileName,"自动编号ID") =false and Instr(str_FileName,"唯一NewsID")=false then
  187. if Not fs_news.chkinputchar(str_FileName) then
  188. strShowErr = "<li>文件名格式有错误</li><li>允许字符为:<br>&nbsp;&nbsp;&nbsp;&nbsp;大小写字母及@,.0123456789|-_</li>"
  189. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  190. Response.end
  191. End if
  192.    End if
  193. End if
  194. if str_News_Action = "add_Save" then
  195. '判断是否有添加权限
  196. if not Get_SubPop_TF(str_ClassID,"NS001","NS","news") then Err_Show
  197. Set obj_Save_Rs=Server.CreateObject(G_FS_RS)
  198. obj_Save_Rs.Open "Select * from FS_NS_News where NewsID='"& str_NewsID &"'",Conn,1,3
  199. if Not obj_Save_Rs.eof then
  200. strShowErr = "<li>NewsID意外重复,请重新添加</li>"
  201. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  202. Response.end
  203. End if
  204. '判断文件名是否重复
  205. Dim tmp_filename_rs
  206. set tmp_filename_rs = Conn.execute("select ID From FS_NS_News where ClassID ='"& str_ClassID &"' and FileName='"& str_FileName &"' and FileExtName='"& str_FileExtName &"' order by id desc")
  207. if Not tmp_filename_rs.eof then
  208. strShowErr = "<li>文件名重复</li>"
  209. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  210. Response.end
  211. End if
  212. tmp_filename_rs.close:set tmp_filename_rs = nothing
  213. obj_Save_Rs.addnew
  214. obj_Save_Rs("NewsID") = str_NewsID
  215. obj_Save_Rs("SaveNewsPath") = Fs_news.SaveNewsPath(Fs_news.fileDirRule)
  216. Elseif str_News_Action = "Edit_Save" then
  217. '判断是否有修改权限
  218. if not Get_SubPop_TF(str_ClassID,"NS002","NS","news") then Err_Show
  219. obj_Save_Rs.Open "Select * from FS_NS_News where NewsID='"& str_NewsID &"'",Conn,1,3
  220. End if
  221. '开始插入或者更新数据
  222. if trim(str_GroupID)<>"" or str_PointNumber <>"" or str_Money<>"" then 
  223. if trim(str_FileExtName)<>"asp" then
  224. strShowErr = "<li>您设置了浏览权限,扩展名必须为.asp</li>"
  225. Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
  226. Response.end
  227. End if
  228. End if
  229. obj_Save_Rs("PopId") = str_PopId
  230. obj_Save_Rs("ClassID") = str_ClassID
  231. obj_Save_Rs("SpecialEName") = str_SpecialID_EName
  232. obj_Save_Rs("NewsTitle") = str_NewsTitle
  233. obj_Save_Rs("NewsNaviContent") = str_NewsNaviContent
  234. if str_isShowReview<>"" then:obj_Save_Rs("isShowReview") = 1:Else:obj_Save_Rs("isShowReview") = 0:End if
  235. obj_Save_Rs("TitleColor") = str_TitleColor
  236. if str_titleBorder <>"" then:obj_Save_Rs("titleBorder") = 1:Else:obj_Save_Rs("titleBorder") = 0:End if
  237. if str_TitleItalic <>"" then:obj_Save_Rs("TitleItalic") = 1:Else:obj_Save_Rs("TitleItalic") = 0:End if
  238. if str_NewsType="TitleNews" then
  239. obj_Save_Rs("URLAddress") = str_URLAddress
  240. obj_Save_Rs("IsURL") = 1 
  241. Else 
  242. obj_Save_Rs("IsURL") = 0 
  243. obj_Save_Rs("CurtTitle") = str_CurtTitle
  244. dim sys_Config,Save_Content,inside_rs ,Remote_Content,config_domain,config_insideLink
  245. set sys_Config = Conn.execute("select top 1 IsDomain,InsideLink From FS_NS_SysParam")
  246. config_domain = sys_Config("isDomain")
  247. config_insideLink = sys_Config("insideLink")
  248. sys_Config.close:set sys_Config=nothing
  249. if config_domain="" then
  250. config_domain = request.Cookies("FoosunMFCookies")("FoosunMFDomain")
  251. else
  252. config_domain = config_domain
  253. end if
  254. Dim TempForVar
  255. '分批保存新闻内容入数据库
  256. Save_Content = ""
  257. For TempForVar = 1 To Request.Form("Content").Count
  258. Save_Content = Save_Content & Request.Form("Content")(TempForVar)
  259. Next
  260. '如果开启远程保存,此处需要引入远程保存函数
  261. if Request.Form("NewsProperty_Remote")<>"" then   
  262. if instr(Lcase(Save_Content),"<img")>0 then
  263. CreateDateDir(Server.MapPath(Replace("/"&G_VIRTUAL_ROOT_DIR&"/"&G_UP_FILES_DIR&"/Remoteupfile","//","/")))
  264. Remote_Content = ReplaceRemoteUrl(Save_Content,replace("/" & G_VIRTUAL_ROOT_DIR &"/"&G_UP_FILES_DIR & "/Remoteupfile/"&year(Now())&"-"&month(now())&"/"&day(Now()),"//","/"),"http://"&config_domain,replace("/"&G_VIRTUAL_ROOT_DIR,"//","/"))
  265. else
  266. Remote_Content =Save_Content
  267. end if
  268.  else
  269.   Remote_Content =Save_Content
  270.  end if
  271. ''--------------------------------------自动分页的处理 
  272.  '' G_FS_Page_Txtlength  [FS:PAGE]
  273. if request.Form("ClearAllPage")="1" then Remote_Content = replace(Remote_Content,"[FS:PAGE]","")
  274. Remote_Content = AutoSplitPages(Remote_Content,"[FS:PAGE]",G_FS_Page_Txtlength)
  275. ''--------------------------------------
  276. obj_Save_Rs("Content") = Remote_Content
  277. '远程保存结束
  278. if str_NewsType="PicNews" then:obj_Save_Rs("isPicNews") = 1:Else:obj_Save_Rs("isPicNews") = 0:End if
  279. obj_Save_Rs("NewsPicFile") = str_NewsPicFile
  280. obj_Save_Rs("NewsSmallPicFile") = str_NewsSmallPicFile
  281. obj_Save_Rs("PicborderCss") = str_PicborderCss
  282. obj_Save_Rs("Templet") = str_Templet
  283. if Trim(str_GroupID)<>"" or Trim(str_PointNumber)<>"" or Trim(str_Money)<>"" then:obj_Save_Rs("isPop") =1:else:obj_Save_Rs("isPop")=0:End if
  284. obj_Save_Rs("Source") = str_Source
  285. obj_Save_Rs("Keywords") = str_Keywords
  286. obj_Save_Rs("Author") = str_Author
  287. obj_Save_Rs("Hits") = clng(str_Hits)
  288. obj_Save_Rs("FileName") = str_FileName
  289. obj_Save_Rs("FileExtName") = str_FileExtName
  290. End if
  291. if str_TodayNewsPicTF <> "" then:obj_Save_Rs("TodayNewsPic") = 1:Else:obj_Save_Rs("TodayNewsPic") = 0:End if
  292. obj_Save_Rs("Editor") = Session("Admin_Name")
  293. if Fs_News.isCheck = 1 then
  294. obj_Save_Rs("isLock") = 1
  295. str_checkTF=true
  296. Else
  297. Dim obj_lockTF,tmp_definedid_class
  298. Set obj_lockTF=conn.execute("select  NewsCheck,DefineID From FS_NS_NewsClass Where ClassID='"& str_ClassID &"'")
  299. if obj_lockTF("NewsCheck") = 1 then
  300. obj_Save_Rs("isLock") = 1
  301. str_checkTF=true
  302. Else
  303. obj_Save_Rs("isLock") = 0
  304. str_checkTF=false
  305. End if
  306. tmp_definedid_class = obj_lockTF(1)
  307. obj_lockTF.close:set obj_lockTF = nothing
  308. End if
  309. '得到新闻类型参数 
  310. if str_NewsProperty_Rec <>"" then:str_NewsProperty_Rec_1 = 1:else:str_NewsProperty_Rec_1 = 0:End if
  311. if str_NewsProperty_mar <>"" then:str_NewsProperty_mar_1 = 1:else:str_NewsProperty_mar_1 = 0:End if
  312. if str_NewsProperty_rev <>"" then:str_NewsProperty_rev_1 = 1:else:str_NewsProperty_rev_1 = 0:End if
  313. if str_NewsProperty_constr <>"" then:str_NewsProperty_constr_1 = 1:else:str_NewsProperty_constr_1 = 0:End if
  314. if str_NewsProperty_tt <>"" then:str_NewsProperty_tt_1 = 1:else:str_NewsProperty_tt_1 = 0:End if
  315. if str_NewsProperty_hots <>"" then:str_NewsProperty_hots_1 = 1:else:str_NewsProperty_hots_1 = 0:End if
  316. if str_NewsProperty_jc <>"" then:str_NewsProperty_jc_1 = 1:else:str_NewsProperty_jc_1 = 0:End if
  317. if str_NewsProperty_unr <>"" then:str_NewsProperty_unr_1 = 1:else:str_NewsProperty_unr_1 = 0:End if
  318. if str_NewsProperty_ann <>"" then:str_NewsProperty_ann_1 = 1:else:str_NewsProperty_ann_1 = 0:End if
  319. if str_NewsProperty_filt <>"" then:str_NewsProperty_filt_1 = 1:else:str_NewsProperty_filt_1 = 0:End if
  320. if str_NewsProperty_Remote <>"" then:str_NewsProperty_Remote_1 = 1:else:str_NewsProperty_Remote_1 = 0:End if
  321. obj_Save_Rs("NewsProperty") = str_NewsProperty_Rec_1&","&str_NewsProperty_mar_1&","&str_NewsProperty_rev_1&","&str_NewsProperty_constr_1&","&str_NewsProperty_Remote_1&","&str_NewsProperty_tt_1&","&str_NewsProperty_hots_1&","&str_NewsProperty_jc_1&","&str_NewsProperty_unr_1&","&str_NewsProperty_ann_1&","&str_NewsProperty_filt_1
  322. obj_Save_Rs("isRecyle") = 0
  323. obj_Save_Rs("addtime") = str_addtime
  324. '辅助字段信息保存
  325. '(c)2002-2006 版权所有:Foosun Inc. 不得进行任何性质的程序拷贝、传播。By Foosun__Simpwind.Xie 
  326. if str_News_Action = "add_Save" then
  327. dim obj_c_rs,i 
  328. If IsArray(CustColumnArr) Then
  329. set obj_c_rs = Server.CreateObject(G_FS_RS)
  330. obj_c_rs.open "select * From [FS_MF_DefineData] where 1=2",Conn,1,3
  331. For i = 0 to UBound(CustColumnArr,2)
  332. If Request.Form("FS_NS_Define_"&CustColumnArr(3,i))<>"" Then
  333. obj_c_rs.Addnew
  334. obj_c_rs("InfoType") = "NS"
  335. obj_c_rs("InfoID") = str_NewsID
  336. obj_c_rs("TableEName") =CustColumnArr(3,i)
  337. obj_c_rs("ColumnValue")=Request.Form("FS_NS_Define_"&CustColumnArr(3,i))
  338. obj_c_rs.Update
  339. End If
  340. Next
  341. obj_c_rs.Close:Set obj_c_rs = nothing
  342. End If
  343. else
  344. 'CustSql="select DefineID,ClassID,D_Name,D_Coul,D_Type,D_isNull,D_Value,D_Content,D_SubType from [FS_MF_DefineTable] Where D_SubType='NS' and  Classid="& trim(Request.Form("d_Id")) &""
  345. If IsArray(CustColumnArr) Then
  346. Dim SaveAuxiSql
  347. For i = 0 to Ubound(CustColumnArr,2)
  348. set obj_c_rs = Server.CreateObject(G_FS_RS)
  349. SaveAuxiSql="select * From [FS_MF_DefineData] where InfoID='"&str_NewsID&"' and TableEName='" & CustColumnArr(3,i) & "' and InfoType='NS'"
  350. obj_c_rs.Open SaveAuxiSql,Conn,1,3
  351. If obj_c_rs.Eof Then
  352. If Request.Form("FS_NS_Define_"&CustColumnArr(3,i))<>"" Then
  353. obj_c_rs.Addnew
  354. obj_c_rs("InfoType") = "NS"
  355. obj_c_rs("TableEName")=CustColumnArr(3,i)
  356. obj_c_rs("ColumnValue")=Request.Form("FS_NS_Define_"&CustColumnArr(3,i))
  357. obj_c_rs("InfoID") = str_NewsID
  358. obj_c_rs.Update
  359. End If
  360. Else
  361. obj_c_rs("ColumnValue")=Request.Form("FS_NS_Define_"&CustColumnArr(3,i))
  362. obj_c_rs.Update
  363. End If
  364. obj_c_rs.Close:set obj_c_rs=nothing
  365. Next
  366. End If
  367. end if
  368. if Trim(str_isdraft)<>"" then:obj_Save_Rs("isdraft")=1:else:obj_Save_Rs("isdraft")=0:end if
  369. obj_Save_Rs.update
  370. Dim Get_News_ID,rssql '取自动编号ID
  371. if G_IS_SQL_DB = 0 then
  372. Get_News_ID = obj_Save_Rs("ID")
  373. Else
  374. set rssql = Conn.execute("select top 1 id from FS_NS_News order by id desc")
  375. Get_News_ID = rssql(0)
  376. rssql.close:set rssql = nothing
  377. End if
  378. obj_Save_Rs.close:set obj_Save_Rs = nothing 
  379. if str_NewsType<>"TitleNews" then
  380. '开始保存关键字,作者,来源等  
  381. Dim obj_save_Gener_Rs,obj_save_Gener_Rs1,obj_save_Gener_Rs2,obj_TF_Rs,tmp
  382. if str_KeywordSaveTF <>"" then
  383. for each tmp in split(Trim(Request.Form("KeywordText")),",")
  384.   if tmp <> "" then 
  385. Set obj_save_Gener_Rs=server.CreateObject(G_FS_RS)
  386.   obj_save_Gener_Rs.open "select Gid,G_Type,G_Name From [FS_NS_General] where G_Type=1 and G_Name='"&tmp&"'",Conn,1,3
  387.   If obj_save_Gener_Rs.eof Then
  388. obj_save_Gener_Rs.Addnew
  389. obj_save_Gener_Rs("G_Name") = tmp
  390. obj_save_Gener_Rs("G_Type") = 1
  391. obj_save_Gener_Rs.Update
  392.   End If
  393.   obj_save_Gener_Rs.Close:set obj_save_Gener_Rs = nothing
  394.   end if
  395. next
  396. End if
  397. '保存作者
  398. if str_AuthorSaveTF <>"" then
  399. Set obj_save_Gener_Rs1=server.CreateObject(G_FS_RS)
  400. obj_save_Gener_Rs1.Open "select Gid,G_Type,G_Name from FS_NS_General where G_Type=3 and G_Name='"& Trim(Request.Form("Author")) &"'",Conn,3,3
  401. if obj_save_Gener_Rs1.eof then:obj_save_Gener_Rs1.addnew:obj_save_Gener_Rs1("G_Type") =3:obj_save_Gener_Rs1("G_Name") = Request.Form("Author"):obj_save_Gener_Rs1.update:end if:set obj_save_Gener_Rs1 = nothing
  402. End if
  403. '保存来源
  404. if str_SourceSaveTF <>"" then
  405. Set obj_save_Gener_Rs2=server.CreateObject(G_FS_RS)
  406. obj_save_Gener_Rs2.Open "select Gid,G_Type,G_Name from FS_NS_General where G_Type=2 and G_Name='"& Trim(Request.Form("Source")) &"'",Conn,3,3
  407. if obj_save_Gener_Rs2.eof then:obj_save_Gener_Rs2.addnew:obj_save_Gener_Rs2("G_Type") =2:obj_save_Gener_Rs2("G_Name") = Request.Form("Source"):obj_save_Gener_Rs2.update:end if:set obj_save_Gener_Rs2 = nothing
  408. End if
  409. '如果生成文件名规则中有:新闻自动编号ID 
  410. Dim TempRsObj
  411. If Instr(str_FileName,"自动编号ID") Then
  412. str_FileName = Replace(str_FileName,"自动编号ID",Get_News_ID)
  413. Set TempRsObj=server.CreateObject(G_FS_RS)
  414. TempRsObj.open "select FileName From [Fs_NS_News] where NewsID='"&str_NewsID&"' and ID="&Clng(Get_News_ID)&"",Conn,1,3
  415. if not TempRsObj.eof Then
  416. TempRsObj("FileName") = Replace(TempRsObj("FileName"),"自动编号ID",Get_News_ID)
  417. TempRsObj.update
  418. End If
  419. TempRsObj.Close
  420. End IF
  421. Dim TempRsObj_1
  422. If Instr(str_FileName,"唯一NewsID") Then
  423. str_FileName = Replace(str_FileName,"唯一NewsID",str_NewsID)
  424. Set TempRsObj_1=server.CreateObject(G_FS_RS)
  425. TempRsObj_1.open "select FileName From [Fs_NS_News] where NewsID='"&str_NewsID&"'",Conn,1,3
  426. if not TempRsObj_1.eof Then
  427. TempRsObj_1("FileName") = Replace(TempRsObj_1("FileName"),"唯一NewsID",str_NewsID)
  428. TempRsObj_1.update
  429. End If
  430. TempRsObj_1.Close
  431. End IF
  432. End if
  433. if Trim(str_GroupID) <>"" or str_PointNumber <> "" or str_Money<>"" then 
  434. Dim obj_insert_rs
  435. set obj_insert_rs = Server.CreateObject(G_FS_RS)
  436. if str_News_Action = "add_Save" then
  437. obj_insert_rs.Open "select  GroupName,PointNumber,FS_Money,InfoID,PopType,isClass From FS_MF_POP",Conn,1,3
  438. obj_insert_rs.addnew
  439. Elseif str_News_Action = "Edit_Save" then
  440. obj_insert_rs.Open "select  GroupName,PointNumber,FS_Money,InfoID,PopType,isClass From FS_MF_POP where InfoID='"& str_NewsID &"' and PopType='NS' and isClass=0",Conn,1,3
  441. End if
  442. obj_insert_rs("GroupName")=str_GroupID
  443. if str_PointNumber <>""  then:obj_insert_rs("PointNumber")=str_PointNumber:Else:obj_insert_rs("PointNumber")=0:End if
  444. if str_Money <>"" then:obj_insert_rs("FS_Money")=str_Money:Else:obj_insert_rs("FS_Money")=0:End if
  445. obj_insert_rs("InfoID")=str_NewsID
  446. obj_insert_rs("PopType")="NS"
  447. obj_insert_rs("isClass")=0
  448. obj_insert_rs.update
  449. obj_insert_rs.close:set obj_insert_rs = nothing
  450. End if
  451. '生成图片头条,有待修正
  452. Dim str_FontSize,str_FontSpace,str_FontColor,str_FontBgColor,FontFace
  453. str_FontSize = Request.Form("FontSize")
  454. str_FontSpace = Request.Form("FontSpace")
  455. str_FontColor = Request.Form("FontColor")
  456. str_FontBgColor = Request.Form("FontBgColor")
  457. FontFace =  Request.Form("FontFace")
  458. If str_TodayNewsPicTF = "FoosunCMS" Then
  459. '图片地址:TempSysRootDir&TmpClassInfo(7) &"/"& TmpClassInfo(2)&NewsPath
  460. Dim NumCanvasWidth,NumCanvasHeight,StrSavePath,TodayClassEName,TempSysRootDir
  461. NumCanvasWidth =CInt(GetStrLengthE(str_NewsTitle))*(Cint(str_FontSize)+Cint(str_FontSpace))
  462. NumCanvasHeight = str_FontSize
  463. if trim(G_VIRTUAL_ROOT_DIR) = "" then
  464. TempSysRootDir = ""
  465. else
  466. TempSysRootDir = "/"&G_VIRTUAL_ROOT_DIR
  467. end if
  468. TodayClassEName=Conn.Execute("select ClassEName From FS_NS_NewsClass Where ClassID='" & str_ClassID & "'")(0)
  469. StrSavePath=Server.MapPath(TempSysRootDir & "/Files/TodayPicFiles/"& str_NewsID & ".jpg")
  470.    '得到水印组件类型
  471. Select Case request.Cookies("FoosunMFCookies")("FoosunMFMarkType")'
  472. Case "1"
  473. AspJpegCreateTextPic NumCanvasWidth,NumCanvasHeight,"&H"&str_FontBgColor,0,str_FontColor,FontFace,0,str_FontSize,str_NewsTitle,0,StrSavePath
  474. Case "2"
  475. WsImgWatermarkText NumCanvasWidth,NumCanvasHeight,"&H"&str_FontColor&"&",FontFace,str_FontSize,0,0,0,str_NewsTitle,StrSavePath
  476. Case "3"
  477. NumCanvasWidth =CInt(GetStrLengthE(str_NewsTitle))*(Cint(str_FontSize))
  478. ImageGenCreateTextPic NumCanvasWidth,NumCanvasHeight,rgb(HexToDec(left(str_FontBgColor,2)),HexToDec(mid(str_FontBgColor,3,2)),HexToDec(right(str_FontBgColor,2))),rgb(HexToDec(left(str_FontColor,2)),HexToDec(mid(str_FontColor,3,2)),HexToDec(right(str_FontColor,2))),FontFace,str_FontSize,str_NewsTitle,0,0,StrSavePath
  479. End Select
  480. End If
  481. '保存图片头条,插入数据库
  482. if str_TodayNewsPicTF<>"" then
  483. dim insertTodayPicobj
  484. set insertTodayPicobj = Server.CreateObject(G_FS_RS)
  485. insertTodayPicobj.open "select * From FS_NS_TodayPic where NewsId='"& Get_News_ID &"'",Conn,1,3
  486. if  insertTodayPicobj.eof then
  487. insertTodayPicobj.addnew
  488. insertTodayPicobj("NewsID")= str_NewsID
  489. insertTodayPicobj("TodayPic_font")= Request.Form("FontFace")
  490. insertTodayPicobj("TodayPic_size")= Request.Form("FontSize")
  491. insertTodayPicobj("TodayPic_color")= Request.Form("FontColor")
  492. insertTodayPicobj("TodayPic_space")= Request.Form("FontSpace")
  493. insertTodayPicobj("TodayPic_PicColor")= Request.Form("FontBgColor")
  494. insertTodayPicobj("ClassID")= str_ClassID
  495. insertTodayPicobj("TodayPic_SavePath")= str_NewsID
  496. insertTodayPicobj("addtime")= now
  497. insertTodayPicobj.update
  498. insertTodayPicobj.close:set insertTodayPicobj = nothing
  499. Else
  500. insertTodayPicobj("TodayPic_font")= Request.Form("FontFace")
  501. insertTodayPicobj("TodayPic_size")= Request.Form("FontSize")
  502. insertTodayPicobj("TodayPic_color")= Request.Form("FontColor")
  503. insertTodayPicobj("TodayPic_space")= Request.Form("FontSpace")
  504. insertTodayPicobj("TodayPic_PicColor")= Request.Form("FontBgColor")
  505. insertTodayPicobj("TodayPic_SavePath")= str_NewsID 
  506. insertTodayPicobj("addtime")= now
  507. insertTodayPicobj.update
  508. insertTodayPicobj.close:set insertTodayPicobj = nothing
  509. End if
  510. End if
  511. '生成静态文件开始
  512. If Not str_NewsType="TitleNews" Then
  513. Call Refresh("NS_news",Get_News_ID)
  514. End If
  515. '*****保留
  516. if Trim(str_isdraft)<>"" then
  517. str_isDraftTF="<li>"& Fs_news.allInfotitle &"已经保存到草稿箱中</li><li>"& Fs_news.allInfotitle &"未发布</li>"
  518. str_ReturnUrl ="../News_MyFolder.asp?Action=draft"
  519. else
  520. if str_News_Action = "Edit_Save" then
  521. str_isDraftTF=""
  522. Else
  523. str_isDraftTF="<li>"& Fs_news.allInfotitle &"添加成功!</li>"
  524. End if
  525. str_ReturnUrl = "../news_Manage.asp?ClassID="&str_ClassID&""
  526. end if
  527. if str_News_Action = "add_Save" then
  528. if str_checkTF = true then
  529. strShowErr = ""& str_isDraftTF &"<li>系统设置(或者栏目)为需要审核后才能发布到前台</li><br><li><a href=""../News_Add.asp?ClassID="& str_ClassID &"""><b>继续添加</b></a>&nbsp;&nbsp;<b><a href=../News_Edit.asp?ClassID="&str_Classid&"&NewsID="&str_NewsID&"><font color=red>返回编辑 </font></a></b>&nbsp;&nbsp;<a href=""../News_Manage.asp?ClassID="& str_ClassID &"""><b>返回管理</b></a></li>"
  530. Else
  531. strShowErr = ""& str_isDraftTF &"<br><li><a href=""../News_Add.asp?ClassID="& str_ClassID &"""><b>继续添加</b></a>&nbsp;&nbsp;<b><a href=../News_Edit.asp?ClassID="&str_ClassID&"&NewsID="&str_NewsID&"><font color=red>返回编辑 </font></a></b>&nbsp;&nbsp;<a href=""../News_Manage.asp?ClassID="& str_ClassID &"""><b>返回管理</b></a></li>"
  532. End if
  533. Elseif str_News_Action = "Edit_Save" then
  534. strShowErr = ""& str_isDraftTF &"<li>修改成功!!</li><li><a href=""../News_Edit.asp?NewsID="& str_NewsID &"&ClassID="&str_ClassID&"""><b>继续修改新闻??</b></a>&nbsp;&nbsp;<a href=""../News_Manage.asp?ClassID="& str_ClassID &"""><b>返回新闻管理??</b></a></li>"
  535. End if
  536. Response.Redirect("lib/Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl="& str_ReturnUrl &"")
  537. Response.end
  538. %>
  539. <!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->