ad_list.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="cn.js.fan.web.*"%>
  5. <%@ page import="com.redmoon.forum.*"%>
  6. <%@ page import="com.redmoon.forum.ad.*"%>
  7. <%@ page import="com.cloudwebsoft.framework.base.*" %>
  8. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  10. <html>
  11. <head>
  12. <title>AD List</title>
  13. <link href="default.css" rel="stylesheet" type="text/css">
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <style type="text/css">
  16. <!--
  17. .style4 {
  18. color: #FFFFFF;
  19. font-weight: bold;
  20. }
  21. -->
  22. </style>
  23. </head>
  24. <body bgcolor="#FFFFFF" text="#000000">
  25. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  26. <%
  27. if (!privilege.isMasterLogin(request)) {
  28. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  29. return;
  30. }
  31. %>
  32. <table cellSpacing="0" cellPadding="0" width="100%">
  33.   <tbody>
  34.     <tr>
  35.       <td class="head"><lt:Label res="res.label.forum.admin.ad_list" key="ad_mgr"/></td>
  36.     </tr>
  37.   </tbody>
  38. </table>
  39. <%
  40. AdDb ad = new AdDb();
  41. String op = ParamUtil.get(request, "op");
  42. if (op.equals("del")) {
  43. int id = ParamUtil.getInt(request, "id");
  44. ad = (AdDb)ad.getQObjectDb(new Integer(id));
  45. boolean re = ad.del();
  46. if (re)
  47. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "ad_list.jsp"));
  48. else
  49. out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "info_op_fail")));
  50. }
  51. String sql = ad.getTable().getQueryList();
  52. int total = (int)ad.getQObjectCount(sql);
  53. int pagesize = total;  // 20;
  54. int curpage,totalpages;
  55. Paginator paginator = new Paginator(request, total, pagesize);
  56. // 设置当前页数和总页数
  57. totalpages = paginator.getTotalPages();
  58. curpage = paginator.getCurrentPage();
  59. if (totalpages==0) {
  60. curpage = 1;
  61. totalpages = 1;
  62. }
  63. QObjectBlockIterator oir = ad.getQObjects(sql, (curpage-1)*pagesize, curpage*pagesize);
  64. String[] types = new String[] {"头部横幅", "底部横幅", "页内文字", "漂浮广告", "贴子底部", "门联广告", "贴内广告"};
  65. %>
  66. <table width="98%" align="center">
  67.   <tr>
  68.     <td align="center" height="5"></td>
  69.   </tr>
  70.   <tr>
  71.     <td align="center">
  72. <%
  73. int typesLen = types.length;
  74. for (int k=0; k<typesLen; k++) {
  75. %>
  76.         <INPUT name="button" type="button" 
  77. onclick="javascript:location.href='ad_add.jsp?ad_type=<%=k%>';" value="<%=types[k]%>">
  78.       &nbsp;
  79.       <%}%>    </td>
  80.   </tr>
  81. </table>
  82. <br>
  83. <table style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" cellSpacing="1" cellPadding="3" width="95%" align="center">
  84.   <tbody>
  85.     <tr>
  86.       <td class="thead" noWrap width="18%"><lt:Label res="res.label.forum.admin.ad_list" key="name"/></td>
  87.       <td class="thead" noWrap width="19%"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.forum.admin.ad_list" key="sort"/></td>
  88.       <td class="thead" noWrap width="24%"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.forum.admin.ad_list" key="board"/></td>
  89.       <td class="thead" noWrap width="14%"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.forum.admin.ad_list" key="begin_date"/></td>
  90.       <td class="thead" noWrap width="13%"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.forum.admin.ad_list" key="end_date"/></td>
  91.       <td width="12%" noWrap class="thead"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.forum.admin.ad_list" key="oper"/></td>
  92.     </tr>
  93. <%
  94. Directory dir = new Directory();
  95. while (oir.hasNext()) {
  96.   ad = (AdDb)oir.next();
  97. %>
  98.     <tr class="row" style="BACKGROUND-COLOR: #ffffff">
  99.       <td><%=ad.getString("title")%></td>
  100.       <td><%=types[ad.getInt("ad_type")]%></td>
  101.       <td>
  102.   <%
  103.   String[] boards = StrUtil.split(ad.getString("boardcodes"), ",");
  104.   String boardNames = "";
  105.   if (boards!=null) {
  106.    int len = boards.length;
  107. for (int i=0; i<len; i++) {
  108.    Leaf lf = dir.getLeaf(boards[i]);
  109. if (lf!=null) {
  110. if (boardNames.equals(""))
  111. boardNames = lf.getName();
  112. else
  113. boardNames += "," + lf.getName();
  114. }
  115. }
  116.   }
  117.   else {
  118.    boardNames = "论坛首页";
  119.   }
  120.   out.print(boardNames);
  121.   %>
  122.   </td>
  123.       <td><%=DateUtil.format(ad.getDate("begin_date"), "yyyy-MM-dd")%></td>
  124.       <td><%=DateUtil.format(ad.getDate("end_date"), "yyyy-MM-dd")%></td>
  125.       <td>
  126.   [<a href="ad_edit.jsp?id=<%=ad.getInt("id")%>"><lt:Label res="res.label.cms.dir" key="modify"/></a>]&nbsp;[<a href="ad_list.jsp?op=del&id=<%=ad.getInt("id")%>"><lt:Label res="res.label.cms.dir" key="del"/></a>]&nbsp;</td>
  127.     </tr>
  128. <%}%>
  129.   </tbody>
  130. </table>
  131. </body>
  132. </html>