EditNews.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:9k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <!--#include file="../../FS_Inc/Const.asp" -->
  2. <!--#include file="../../FS_Inc/Function.asp"-->
  3. <!--#include file="inc/Function.asp"-->
  4. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  5. <%
  6. Dim Conn,CollectConn
  7. MF_Default_Conn
  8. MF_Collect_Conn
  9. MF_Session_TF
  10. Dim NewsIDStr,Result,RsNewsObj,Sql
  11. Dim Title,Links,Content,AddDate,SiteID,Author,SourceStr
  12. Result = Request("Result")
  13. NewsIDStr = Request("NewsIDStr")
  14. if Result = "Submit" then
  15. Title = Request.Form("Title")
  16. Links = Request.Form("Links")
  17. Content = Request.Form("Content")
  18. AddDate = Request.Form("AddDate")
  19. SiteID = Request.Form("SiteID")
  20. Author = Request.Form("Author")
  21. SourceStr = Request.Form("Source")
  22. if NewsIDStr <> "" then
  23. Sql = "Select * from FS_News where ID=" & NewsIDStr&""
  24. 'On Error Resume Next
  25. Set RsNewsObj = Server.CreateObject("ADODB.RecordSet")
  26. RsNewsObj.Open Sql,CollectConn,3,3
  27. RsNewsObj("Title") = Title 
  28. RsNewsObj("Links") = Links
  29. RsNewsObj("Content") = Content
  30. RsNewsObj("AddDate") = AddDate
  31. RsNewsObj("Author") = Author
  32. RsNewsObj("Source") = SourceStr
  33. RsNewsObj("SiteID") = SiteID
  34. RsNewsObj.UpDate
  35. RsNewsObj.Close
  36. Set RsNewsObj = Nothing
  37. if Err.Number <> 0 then
  38. %>
  39. <script language="JavaScript">
  40. alert('修改失败');
  41. </script>
  42. <%
  43. else
  44. Response.Redirect("Check.asp")
  45. end if
  46. else
  47. %>
  48. <script language="JavaScript">
  49. alert('修改的新闻不存在');
  50. </script>
  51. <%
  52. end if
  53. else
  54. if NewsIDStr <> "" then
  55. Sql = "Select * from FS_News where ID=" & NewsIDStr
  56. Set RsNewsObj = CollectConn.Execute(Sql)
  57. if Not RsNewsObj.Eof then
  58. Title = RsNewsObj("Title")
  59. Links = RsNewsObj("Links")
  60. Content = RsNewsObj("Content")
  61. AddDate = RsNewsObj("AddDate")
  62. SiteID = RsNewsObj("SiteID")
  63. Author = RsNewsObj("Author")
  64. SourceStr = RsNewsObj("Source")
  65. else
  66. %>
  67. <script language="JavaScript">
  68. alert('新闻不存在');
  69. </script>
  70. <%
  71. end if
  72. else
  73. %>
  74. <script language="JavaScript">
  75. alert('参数错误');
  76. </script>
  77. <%
  78. end if
  79. end if
  80. Dim SiteList,RsSiteObj
  81. Set RsSiteObj = CollectConn.Execute("Select ID,SiteName from FS_Site where 1=1 order by id desc")
  82. do while Not RsSiteObj.Eof
  83. if Clng(RsSiteObj("ID")) = Clng(SiteID) then
  84. SiteList = SiteList & "<option selected value=" & RsSiteObj("ID") & "" & ">" & RsSiteObj("SiteName") & "</option><br>"
  85. else
  86. SiteList = SiteList & "<option value=" & RsSiteObj("ID") & "" & ">" & RsSiteObj("SiteName") & "</option><br>"
  87. end if
  88. RsSiteObj.MoveNext
  89. loop
  90. RsSiteObj.Close
  91. Set RsSiteObj = Nothing
  92. %>
  93. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  94. <html>
  95. <head>
  96. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  97. <title>修改新闻</title>
  98. </head>
  99. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  100. <style>
  101. .LableWindow
  102. {
  103. border-right: 1px solid;
  104. border-left: 1px solid;
  105. border-bottom: 1px solid;
  106. border-color: Black;
  107. cursor: default;
  108. }
  109. .LableDefault
  110. {
  111. border-right: 1px solid;
  112. border-top: 1px solid;
  113. font-size: 12px;
  114. border-left: 1px solid;
  115. border-bottom: 1px solid;
  116. font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  117. border-color: Black;
  118. cursor: default;
  119. }
  120. .LableSelected
  121. {
  122. border-right: 1px solid;
  123. border-top: 1px solid;
  124. font-size: 12px;
  125. border-left: 1px solid;
  126. font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  127. border-color: Black;
  128. cursor: default;
  129. }
  130. .ToolBarButtonLine {
  131. border-bottom: 1px solid;
  132. font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  133. border-color: Black;
  134. }
  135. </style>
  136. <link href="FS_css.css" rel="stylesheet">
  137. <script language="JavaScript" src="js/PublicJS.js"></script>
  138. <body topmargin="2" leftmargin="2">
  139. <form action="" method="post" name="NewsForm">
  140. <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  141.   <tr class="hback"> 
  142.     <td height="26" colspan="5" valign="middle">
  143.       <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
  144.         <tr>
  145.             <td style="cursor:hand;" width="35" align="center" alt="保存" onClick="document.NewsForm.submit();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">保存</td>
  146. <td width=2 class="Gray">|</td>
  147. <td style="cursor:hand;" width="35" align="center" alt="后退" onClick="history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">后退</td>
  148.             <td>&nbsp; <input name="Result" type="hidden" id="Result" value="Submit"> 
  149.               <input value="<% = NewsIDStr %>" name="NewsIDStr" type="hidden" id="NewsIDStr"></td>
  150.         </tr>
  151.       </table>
  152.   </td>
  153.   </tr>
  154. </table>
  155. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1">
  156. <tr>
  157.       <td><table width="100%" border="0" cellspacing="1" cellpadding="5" class="table">
  158.           <tr class="hback"> 
  159.             <td width="120" height="26"> 
  160.               <div align="center">新闻标题</div></td>
  161.             <td> <input name="Title" type="text" id="Title2" style="width:100%;" value="<% = Title %>"></td>
  162.           </tr>
  163.           <tr class="hback"> 
  164.             <td height="26"  class="hback"> 
  165.               <div align="center">新闻联接</div></td>
  166.             <td> 
  167.               <input name="Links" type="text" id="Links" style="width:100%;" value="<% = Links %>"></td>
  168.           </tr>
  169.           <tr class="hback"> 
  170.             <td><div align="center">采集站点</div></td>
  171.             <td><select style="width:100%;" name="SiteID">
  172.                 <% = SiteList %>
  173.               </select></td>
  174.           </tr>
  175.           <tr class="hback"> 
  176.             <td height="26">
  177. <div align="center">作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;者</div></td>
  178.             <td><input style="width:100%;" type="text" name="Author" value="<% = Author %>"></td>
  179.           </tr>
  180.           <tr class="hback"> 
  181.             <td height="26">
  182. <div align="center">来&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;源</div></td>
  183.             <td><input style="width:100%;" type="text" name="Source" value="<% = SourceStr %>"></td>
  184.           </tr>
  185.           <tr class="hback"> 
  186.             <td height="26"> 
  187.               <div align="center">采集日期</div></td>
  188.             <td><input name="AddDate" type="text" id="AddDate2" style="width:100%;" value="<% = AddDate %>"> 
  189.               <div align="center"></div></td>
  190.           </tr>
  191.         </table></td>
  192. </tr>
  193.     <tr class="hback"> 
  194.       <td height="20" colspan="2">
  195. <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  196.           <tr> 
  197.             <td id="EditCodeBtn" width="100" class="LableSelected" onClick="CodeContent();" bgcolor="#EFEFEF"> <div align="center"> 
  198.                 代 码</div></td>
  199.             <td width="5" class="ToolBarButtonLine">&nbsp;</td>
  200. <td id="PreviewBtn" width="100" class="LableDefault" onClick="Preview();"> <div align="center">预 
  201.                 览</div></td>
  202.             <td class="ToolBarButtonLine">&nbsp;</td>
  203.           </tr>
  204.         </table></td>
  205.     </tr>
  206.     <tr id="EditCodeArea"> 
  207.       <td height="300" colspan="2"> 
  208.         <textarea name="Content" id="NewsContent" rows="20" style="width:100%;"><% = Content %></textarea></td>
  209.     </tr>
  210.     <tr id="PreviewArea" style="display:none;" bgcolor="#EFEFEF"> 
  211.       <td height="300" colspan="2"> 
  212.         <iframe name="PreviewContent" frameborder="1" class="Composition" ID="PreviewContent" MARGINHEIGHT="1" MARGINWIDTH="1" width="98%" scrolling="yes" src="about:blank"></iframe></td>
  213.     </tr>
  214. </table>
  215. </form>
  216. </body>
  217. </html>
  218. <%
  219. Set CollectConn = Nothing
  220. Set Conn = Nothing
  221. Set RsNewsObj = Nothing
  222. %>
  223. <script language="JavaScript">
  224. function SetEditAreaHeight()
  225. {
  226. var BodyHeight=document.body.clientHeight;
  227. var EditAreaHeight=BodyHeight-200;
  228. document.all.NewsContent.style.height=EditAreaHeight;
  229. document.all.PreviewContent.height=EditAreaHeight;
  230. }
  231. SetEditAreaHeight();
  232. window.onresize=SetEditAreaHeight;
  233. function Preview()
  234. {
  235. var TempStr='';
  236. document.all.EditCodeArea.style.display='none';
  237. document.all.PreviewArea.style.display='';
  238. PreviewContent.document.write('<head><link href="../../CSS/FS_css.css" type="text/css" rel="stylesheet"></head><body MONOSPACE>');
  239. PreviewContent.document.body.innerHTML=document.all.Content.value;
  240. document.all.PreviewBtn.className='LableSelected';
  241. document.all.PreviewBtn.style.backgroundColor='#EFEFEF';
  242. document.all.EditCodeBtn.className='LableDefault';
  243. document.all.EditCodeBtn.style.backgroundColor='#FFFFFF';
  244. }
  245. function CodeContent()
  246. {
  247. document.all.EditCodeArea.style.display='';
  248. document.all.PreviewArea.style.display='none';
  249. document.all.EditCodeBtn.className='LableSelected';
  250. document.all.EditCodeBtn.style.backgroundColor='#EFEFEF';
  251. document.all.PreviewBtn.className='LableDefault';
  252. document.all.PreviewBtn.style.backgroundColor='#FFFFFF';
  253. }
  254. </script>