ModifyNews.jsp
上传用户:sdtxjx
上传日期:2022-07-09
资源大小:2937k
文件大小:9k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" language="java" buffer="32kb"%>
  2. <%@ page import="dreamtime.dreamnews.*"%>
  3. <%@ include file="Session.jsp"%>
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Language" content="zh-cn">
  7. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  8. <link href="css/bodystyle.css" rel="stylesheet" type="text/css">
  9. <title>修改新闻</title>
  10. <script Language=Javascript src="js/post.js"></script>
  11. <script Language=Javascript src="js/news.js"></script>
  12. </head>
  13. <%
  14. request.setCharacterEncoding("GBK");   //设置编码方式为GBK
  15. AdminClass aClass = new AdminClass();
  16. News News1 = new News();
  17. Function Fun = new Function();
  18. String [] sa = null;
  19. String [][] sBig = aClass.GetAllClass(true,false,null);
  20. String [][] sSmall = aClass.GetAllClass(false,false,null);
  21. String [][] sSpecial = aClass.GetAllClass(true,true,null);
  22. String NewsID = request.getParameter("NewsID");
  23. String Action = request.getParameter("Action");
  24. if (Action!=null && Action.equals("Edit"))
  25. {
  26. String IP = request.getRemoteAddr(); //得到客户端Ip地址
  27. String AdminName = (String)session.getAttribute("AdminName"); 
  28. String [] s = new String[15];
  29. s[0] = request.getParameter("NewsTitle");
  30. s[1] = request.getParameter("NewsContent");
  31. s[2] = request.getParameter("NewsKey");
  32. s[3] = request.getParameter("NewsAuthor");
  33. s[4] = request.getParameter("NewsFrom");
  34. s[5] = (new java.util.Date()).toLocaleString();
  35. s[6] = request.getParameter("NewsPicture");
  36. s[7] = request.getParameter("BigClassID");
  37. s[8] = request.getParameter("SClassID");
  38. s[9] = request.getParameter("IsHead");
  39. s[10] = request.getParameter("HeadPicture");
  40. s[11] = request.getParameter("IsImg");
  41. s[12] = request.getParameter("IsHot");
  42. s[13] = request.getParameter("SpecialID");
  43. s[14] = request.getParameter("NewsInfo");
  44. String sOK = News1.EditNews(s,NewsID,AdminName,IP);
  45. if (sOK.equals("Yes"))
  46. {
  47. out.println("<script>alert('修改新闻成功!');location.href='ListNews.jsp';</script>");
  48. return;
  49. }
  50. else 
  51. {
  52. out.print(Fun.OutError(sOK));
  53. return;
  54. }
  55. }
  56. else
  57. {
  58. sa = News1.ReadNews(NewsID);
  59. if(sa==null) 
  60. { out.println(Fun.OutError("读取新闻信息操作出错!"));
  61. return;
  62. }
  63. }
  64. %>
  65. <script language = "JavaScript">
  66. var iCount;
  67. subcat = new Array();
  68. <%
  69. int iCount = 0;
  70. for(iCount=0;iCount<sSmall.length;iCount++)
  71. {
  72. %>
  73. subcat[<%=iCount%>] = new Array("<%=sSmall[iCount][0]%>","<%=sSmall[iCount][1]%>","<%=sSmall[iCount][2]%>");
  74. <% } %>
  75. iCount=<%=iCount%>;
  76. </script>
  77. <%  String isShow="none";
  78. String isShowHead="none";
  79. if(sa[9].toString().equals(("Yes").toString())) isShowHead="";
  80. if(sa[11].toString().equals(("Yes").toString())) isShow="";
  81. %>
  82. <body>
  83. <br><br>
  84. <form name="AddNews" method="POST" action="ModifyNews.jsp" onSubmit="return CheckNews();">
  85. <table width="90%" border="1" align=center cellpadding="1" cellspacing="1">
  86.   <tr background="images/bg.gif">
  87.     <td height="27" colspan="3" background="images/bg.gif">&nbsp;&nbsp;<b class="title">修改新闻 <span class="info1">&nbsp;&nbsp;该新闻由管理员 [<%=sa[15]%>] 添加</span></b></td>
  88.   </tr>
  89.   <tr class="chinese">
  90.     <td width="130" height="25" align="right">所属大类:</td>
  91.     <td height="25" colspan="2">
  92.       <select name="BigClassID" onChange="ChangeLocation(document.AddNews.BigClassID.options[document.AddNews.BigClassID.selectedIndex].value)" size="1" class="chinese">
  93.         <%  if (sBig[0][0]==null)
  94. {
  95. out.println("<option value="" selected>暂无大类</option>");
  96. }
  97. else
  98. {
  99. out.println("<option value="" selected>请选择新闻大类</option>");
  100. for(int i=0;i<sBig.length;i++)
  101. {
  102. out.print("<option value="" + sBig[i][0] + """);
  103. if(sBig[i][0].equals(sa[7])) out.print(" selected"); 
  104. out.println(">" + sBig[i][1] + "</option>");
  105. }
  106. }
  107.  %>
  108.       </select>&nbsp;
  109.       <select name="SClassID" size="1" class="chinese">
  110.         <% String [][] sSmall1 = aClass.GetAllClass(false,false,sa[7]);
  111. if (sSmall1[0][0]==null)
  112. {
  113. out.println("<option value="" selected>暂无小类</option>");
  114. }
  115. else
  116. {
  117. out.println("<option value="">请选择新闻小类</option>");
  118. for(int i=0;i<sSmall1.length;i++)
  119. {
  120. out.print("<option value="" + sSmall1[i][0] + """);
  121. if(sSmall1[i][0].equals(sa[8])) out.print(" selected"); 
  122. out.println(">" + sSmall1[i][1] + "</option>");
  123. }
  124. }
  125.  %>
  126.       </select>
  127.       <span class="info1"> &nbsp;*请选择新闻的类别</span></td>
  128.   </tr>
  129.   <tr class="chinese">
  130.     <td width="130" height="25" align="right">所属专题:</td>
  131.     <td height="25" colspan="2"><select name="SpecialID" size="1" class="chinese" id="SpecialID" onChange="ChangeLocation(document.AddNews.BigClassID.options[document.AddNews.BigClassID.selectedIndex].value)">
  132.       <option selected value="">不属于任何专题</option>
  133.       <%  if (sSpecial==null)
  134. {
  135. out.println("<option value="" selected>暂无专题</option>");
  136. }
  137. else
  138. {
  139. for(int i=0;i<sSpecial.length;i++)
  140. {
  141. out.print("<option value="" + sSpecial[i][0] + """);
  142. if(sSpecial[i][0].equals(sa[13])) out.print(" selected"); 
  143. out.println(">" + sSpecial[i][1] + "</option>");
  144. }
  145. }
  146.  %>
  147.     </select></td>
  148.   </tr>
  149.   <tr class="chinese">
  150.     <td width="130" height="25" align="right">新闻标题:</td>
  151.     <td height="25" colspan="2"><input name="NewsTitle" type="text" class="chinese" id="NewsTitle" value="<%=sa[0]%>" size="40" maxlength="60"></td>
  152.   </tr>
  153.   <tr class="chinese">
  154.     <td width="130" height="25" align="right">发布人:</td>
  155.     <td height="25" colspan="2"><input name="NewsAuthor" type="text" class="chinese" id="NewsAuthor" value="<%=sa[3]%>" size="40" maxlength="20"></td>
  156.   </tr>
  157.   <tr class="chinese">
  158.     <td width="130" height="25" align="right">新闻出处:</td>
  159.     <td height="25" colspan="2"><input name="NewsFrom" type="text" class="chinese" id="NewsFrom" value="<%=sa[4]%>" size="40" maxlength="60"></td>
  160.   </tr>
  161.   <tr class="chinese">
  162.     <td width="130" height="25" align="right">新闻关键字:</td>
  163.     <td height="25" colspan="2"><input name="NewsKey" type="text" class="chinese" id="NewsKey" value="<%=sa[2]%>" size="40" maxlength="30"></td>
  164.   </tr>
  165.   <tr class="chinese">
  166.     <td width="130" height="25" align="right">是否图片新闻:</td>
  167.     <td height="25"><label><input <%=((sa[11].toString().equals(("Yes").toString()))?"CHECKED":"")%> type="radio" name="IsImg" value="Yes" onClick="ShowPicture(true);">是</label>
  168.       <label><input <%=((sa[11].toString().equals(("No").toString()))?"CHECKED":"")%> name="IsImg" type="radio" value="No" onClick="ShowPicture(false);">否</label>
  169.   </td>
  170.  <td width="462" height="25"><div id="p" style="display:<%=isShow%>">&nbsp;<input name="NewsPicture" type="text" class="chinese" id="NewsPicture" size=25 maxlength="120" value="<%=sa[6]%>">
  171.          <input name="UpImg" type="button" class="button" id="UpImg" onClick="getPicture()" value="修改>>"></div></td>
  172. </tr>
  173.   <tr class="chinese">
  174.     <td width="130" height="25" align="right">是否头条新闻:</td>
  175.     <td width="90" height="25"><label><input <%=((sa[9].toString().equals(("Yes").toString()))?"CHECKED":"")%> type="radio" name="IsHead" value="Yes"  onClick="ShowHeadPicture(true)">是</label>
  176.         <label><input <%=((sa[9].toString().equals(("No").toString()))?"CHECKED":"")%> name="IsHead" type="radio" value="No" onClick="ShowHeadPicture(false)">否</label></td>
  177.     <td height="25" align="left">
  178.         <div id="p1" style="display:<%=isShowHead%>">&nbsp;<input name="HeadPicture" type="text" class="chinese" id="HeadPicture" size=25 maxlength="120" value="<%=sa[10]%>">
  179.       <input name="UpImg2" type="button" class="button" id="UpImg2" onClick="getHeadPicture()" value="修改>>"></div></td>
  180.     </tr>
  181.   <tr class="chinese">
  182.     <td width="130" height="25" align="right">是否滚动新闻:</td>
  183.     <td width="90" height="25"><label><input <%=((sa[12].toString().equals(("Yes").toString()))?"CHECKED":"")%> name="IsHot" type="radio" value="Yes">是</label>
  184.         <label><input <%=((sa[12].toString().equals(("No").toString()))?"CHECKED":"")%> name="IsHot" type="radio" value="No">否</label></td>
  185.     <td height="25">&nbsp; </td>
  186.     </tr>
  187.   <tr class="chinese">
  188.     <td height="25" align="right">新闻摘要:</td>
  189.     <td height="25" colspan="2"><textarea name="NewsInfo" cols="40" rows="3" id="NewsInfo"><%=sa[14]%></textarea></td>
  190.   </tr>
  191.   <tr class="chinese">
  192.     <td width="130" height="25" align="right">新闻内容:</td>
  193.     <td height="25" colspan="2">&nbsp;</td>
  194.   </tr>
  195.   <tr>
  196.     <td height="25" colspan="3"><div align="center">
  197.         <textarea name="NewsContent" class="chinese" style="display:none"><%=sa[1]%></textarea>
  198.       <iframe ID="DreamEditor" src="../eWebEditor.jsp?id=NewsContent&style=CoolBlue" frameborder="0" scrolling="no" width="620" height="350"></iframe>
  199.     </div></td>
  200.   </tr>
  201.   <tr>
  202.     <td colspan=3><p align="center"><br>
  203.             <input name="B1" type="button" class="button" value="返回>>" onClick="history.back();">
  204.             <input name="Action" type="hidden" id="Action" value="Edit">&nbsp;
  205. <input name="NewsID" type="hidden" id="<%=NewsID%>" value="<%=NewsID%>">
  206.             <input name="B2" type="submit" class="button" id="B22" value="修改>>">
  207.             <br>
  208.             <br>
  209.             <br>
  210.     </p></td>
  211.   </tr>
  212. </table>  
  213. <br>
  214. <br>
  215. </form>
  216. </body>
  217. </html>