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

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. <% if (Function1.StrToInt((String)session.getAttribute("AdminType"))<2) 
  5. {
  6.    response.sendError(403,"禁止访问 您没有这个权限");
  7.    return;
  8. }
  9. %>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Language" content="zh-cn">
  13. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  14. <link href="css/bodystyle.css" rel="stylesheet" type="text/css">
  15. <script src="js/post.js"></script>
  16. <title>新闻专题管理</title></head>
  17. <% 
  18. request.setCharacterEncoding("GBK");  //设置编码方式为GBK
  19. String Action = request.getParameter("Action");
  20. String IP = request.getRemoteAddr(); //得到客户端Ip地址
  21. String AdminName = (String)session.getAttribute("AdminName"); 
  22. AdminClass aClass = new AdminClass();
  23. Function Fun = new Function();
  24. String s = "";
  25. String SpecialID   = request.getParameter("SpecialID");
  26. String SpecialName   = request.getParameter("SpecialName");
  27. String SpecialInfo = request.getParameter("SpecialInfo");
  28. if (Action == null || Action.equals("")) Action = "List";
  29. //读取类别列表
  30. if (Action.equals("List")) 
  31. String sOK = aClass.ReadSpecial();
  32. if (sOK.equals("No"))
  33. {
  34. out.println(Fun.OutError("读取专题列表操作出错!"));
  35. return;
  36. }
  37. else
  38. {
  39. out.println(sOK);
  40. }
  41. }
  42. //保存添加专题
  43. else if (Action.equals("SaveAdd"))
  44. {
  45. s = aClass.AddSpecial(SpecialName,SpecialInfo,AdminName,IP);
  46. if (s.equals("Yes")) 
  47. out.print("<script>alert('添加专题成功!');location.href='Admin_Special.jsp?Action=List';</script>");
  48. else 
  49. {
  50. out.print(Fun.OutError(s));
  51. return;
  52. }
  53. }
  54. //保存修改的专题
  55. else if (Action.equals("SaveEdit"))
  56. {
  57. String OldSpecialName = request.getParameter("OldSpecialName");
  58. s = aClass.EditSpecial(SpecialName,SpecialInfo,AdminName,IP,SpecialID,OldSpecialName);
  59. if (s.equals("Yes")) 
  60. out.print("<script>alert('修改专题成功!');location.href='Admin_Special.jsp?Action=List';</script>");
  61. else 
  62. {
  63. out.print(Fun.OutError(s));
  64. return;
  65. }
  66. }
  67. //删除小类
  68. else if (Action.equals("Del"))
  69. {
  70. //给出提示信息
  71. String sWarn = "该操作将删除该专题本身、以及该专题下的所有新闻,该操作将不可恢复,你是否确定要删除?";
  72. sWarn += "该操作只有这一次确认,请您谨慎操作!";
  73. if (request.getParameter("OK") != null && request.getParameter("OK").equals("Yes"))
  74. {
  75. if (aClass.DelSpecial(SpecialID,AdminName,IP))
  76. out.print("<script>alert('删除专题成功!');location.href='Admin_Special.jsp?Action=List';</script>");
  77. else 
  78. {
  79. out.print(Fun.OutError("删除操作出错!"));
  80. return;
  81. }
  82. }
  83. else out.print(Fun.OutWarn(sWarn));
  84. }
  85. if (Action.equals("Add")) { 
  86. %> 
  87. <br><br>
  88. <form action="Admin_Special.jsp" method="POST" Name="Special" id="Special" onSubmit="return CheckSpecial()">
  89.   <table width="90%"  border="1" align="center" cellpadding="2" cellspacing="0">
  90.     <tr background="images/bg.gif">
  91.       <td height="27" colspan="2" background="images/bg.gif">
  92.   <div align="center"><span class="title"><strong>增加专题</strong></span></div></td>
  93.     </tr>
  94.     <tr>
  95.       <td width="38%" height="25"><div align="right" class="chinese">专题名称:</div></td>
  96.       <td width="62%"><input name="SpecialName" type="text" class="chinese" id="SpecialName" size="20" maxlength="30">&nbsp;<span class="info1">* 必填</span></td>
  97.     </tr>
  98.     <tr>
  99.       <td height="25"><div align="right" class="chinese">专题说明:</div></td>
  100.       <td><textarea name="SpecialInfo" cols="20" rows="5" class="chinese" id="SpecialInfo" onKeyDown="SpPressKey();"></textarea>&nbsp;<span class="info1">* 必填(可按Ctrl+Enter)提交</span></td>
  101.     </tr>
  102.     <tr>
  103.       <td height="30" colspan="2"><div align="center">
  104.           <input name="Submit3" type="submit" class="button" value="确定">
  105.           <input name="Action" type="hidden" id="Action" value="SaveAdd">
  106.           <input name="Return" type="button" class="button" id="Return5" value="返回" onClick="javascript:history.back();">
  107.       </div></td>
  108.     </tr>
  109.   </table>
  110. </form>
  111. <br><br>
  112. <% } 
  113. if (Action.equals("Edit")) 
  114. {
  115. String [] sa = aClass.ReadSpecial(SpecialID);
  116. %>
  117. <br><br>
  118. <form action="Admin_Special.jsp" method="POST"  Name="Special" id="Special" onSubmit="return CheckSpecial()">
  119.   <table width="90%"  border="1" align="center" cellpadding="2" cellspacing="0">
  120.     <tr background="images/bg.gif">
  121.       <td height="27" colspan="2" background="images/bg.gif"><div align="center"><span class="title"><strong>修改专题</strong></span></div></td>
  122.     </tr>
  123.     <tr>
  124.       <td width="38%" height="25"><div align="right" class="chinese">专题名称:</div></td>
  125.       <td width="62%"><input name="SpecialName" type="text" class="chinese" id="SpecialName" value="<%=sa[0]%>" size="20" maxlength="30">
  126.           <input name="OldSpecialName" type="hidden" id="OldSpecialName" value="<%=sa[0]%>"><span class="info1">* 必填</span></td>
  127.     </tr>
  128.     <tr>
  129.       <td height="25"><div align="right" class="chinese">专题说明:</div></td>
  130.       <td><textarea name="SpecialInfo" cols="20" rows="5" class="chinese" id="SpecialInfo" onKeyDown="SpPressKey();"><%=sa[1]%></textarea>&nbsp;<span class="info1">* 必填(可按Ctrl+Enter)提交</span></td>
  131.     </tr>
  132.     <tr>
  133.       <td height="30" colspan="2"><div align="center">
  134.           <input name="Submit" type="submit" class="button" value="确定">
  135.           <input name="Action" type="hidden" id="Action" value="SaveEdit">
  136.   <input name="SpecialID" type="hidden" id="SpecialID" value="<%=SpecialID%>">
  137.           <input name="Return" type="button" class="button" id="Return" value="返回" onClick="javascript:history.back();">
  138.       </div></td>
  139.     </tr>
  140.   </table>
  141. </form>
  142. <br><br>
  143. <% } %>
  144. <br><br>
  145. </body>
  146. </html>