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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8" %>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="cn.js.fan.util.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.auction.*"%>
  7. <%@ page import="com.redmoon.forum.person.*"%>
  8. <%@ page import="com.redmoon.forum.plugin.*"%>
  9. <%@ page import="com.redmoon.forum.*"%>
  10. <%@ page import="com.redmoon.forum.treasure.*"%>
  11. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  12. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  13. <%
  14. String skincode = UserSet.getSkin(request);
  15. if (skincode.equals(""))
  16. skincode = UserSet.defaultSkin;
  17. SkinMgr skm = new SkinMgr();
  18. Skin skin = skm.getSkin(skincode);
  19. if (skin==null)
  20. skin = skm.getSkin(UserSet.defaultSkin);
  21. String skinPath = skin.getPath();
  22. %>
  23. <html><head>
  24. <meta http-equiv="pragma" content="no-cache">
  25. <link href="<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
  26. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  28. <title><lt:Label res="res.label.forum.treasure" key="treasure_use"/> - <%=Global.AppName%></title>
  29. <style type="text/css">
  30. <!--
  31. .style1 {
  32. font-size: 14px;
  33. font-weight: bold;
  34. }
  35. -->
  36. </style>
  37. <body topmargin='0' leftmargin='0'>
  38. <%@ include file="inc/header.jsp"%>
  39. <jsp:useBean id="dir" scope="page" class="com.redmoon.forum.plugin.auction.Directory"/>
  40. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  41. <%
  42. if (!privilege.isUserLogin(request))
  43. {
  44. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, SkinUtil.ERR_NOT_LOGIN)));
  45. return;
  46. }
  47. String userName = privilege.getUser(request);
  48. int id = 0;
  49. try {
  50. id = ParamUtil.getInt(request, "id");
  51. }
  52. catch (ErrMsgException e) {
  53. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, SkinUtil.ERR_ID)));
  54. return;
  55. }
  56. String op = ParamUtil.get(request, "op");
  57. if (op.equals("use")) {
  58. String code = ParamUtil.get(request, "code");
  59. try {
  60. TreasureMgr tmg = new TreasureMgr();
  61. if (tmg.use(request, userName, code, id))
  62. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "showtopic.jsp?rootid="+id));
  63. }
  64. catch (ErrMsgException e) {
  65. out.print(SkinUtil.makeErrMsg(request, e.getMessage()));
  66. }
  67. }
  68. %>
  69. <table width='100%' cellpadding='0' cellspacing='0' >
  70.   <tr>
  71.     <td class="head">
  72. </td>
  73.   </tr>
  74. </table>
  75. <br>
  76. <%
  77. int pagesize = 10;
  78. Paginator paginator = new Paginator(request);
  79. TreasureUserDb tu = new TreasureUserDb();
  80. String sql = "select userName,treasureCode from " + tu.getTableName() + " where userName=" + StrUtil.sqlstr(userName);
  81. int total = tu.getObjectCount(sql);
  82. paginator.init(total, pagesize);
  83. int curpage = paginator.getCurPage();
  84. //设置当前页数和总页数
  85. int totalpages = paginator.getTotalPages();
  86. if (totalpages==0)
  87. {
  88. curpage = 1;
  89. totalpages = 1;
  90. }
  91. %>
  92. <table width="98%" height="227" border='0' align="center" cellpadding='0' cellspacing='0' class="frame_gray">
  93.   <tr> 
  94.     <td height=20 align="center" class="thead style1"><lt:Label res="res.label.forum.treasure" key="treasure_use"/></td>
  95.   </tr>
  96.   <tr> 
  97.     <td valign="top"><br>
  98.       <table width="86%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="<%=skin.getTableBorderClr()%>">
  99.         <tr align="center" class="td_title">
  100.           <td width="17%" height="22"><lt:Label res="res.label.forum.treasure" key="treasure_name"/></td>
  101.           <td width="22%" height="22"><lt:Label res="res.label.forum.treasure" key="buy_date"/></td>
  102.           <td width="21%"><lt:Label res="res.label.forum.treasure" key="count"/></td>
  103.           <td width="26%"><lt:Label key="op"/></td>
  104.         </tr>
  105. <%
  106. Vector v = tu.list(sql, (curpage-1)*pagesize, curpage*pagesize-1);
  107. TreasureMgr tmg = new TreasureMgr();
  108. Iterator ir = v.iterator();
  109. int i = 0;
  110. while (ir.hasNext()) {
  111. tu = (TreasureUserDb)ir.next();
  112. i++;
  113. %>
  114.         <form id="form<%=i%>" name="form<%=i%>" action="?op=modify" method="post">
  115.           <tr align="center">
  116.             <td height="22" bgcolor="#FFFFFF">
  117. <%
  118. String treasureCode = tu.getTreasureCode();
  119. TreasureUnit tun = tmg.getTreasureUnit(treasureCode);
  120. out.print(tun.getName());
  121. %>
  122. </td>
  123.             <td height="22" bgcolor="#FFFFFF">
  124. <%=DateUtil.format(tu.getBuyDate(), "yy-MM-dd")%>
  125.             </td>
  126.             <td bgcolor="#FFFFFF"><%=tu.getAmount()%></td>
  127.             <td height="22" bgcolor="#FFFFFF"><a href="?op=use&code=<%=StrUtil.UrlEncode(tu.getTreasureCode())%>&id=<%=id%>"><lt:Label res="res.label.forum.treasure" key="use"/></a></td>
  128.           </tr>
  129.         </form>
  130.         <%}%>
  131.       </table>
  132.           <table width="86%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  133.             <tr>
  134.               <td height="23"><div align="right">
  135. <%
  136. String querystr = "";
  137.     out.print(paginator.getCurPageBlock(request, "?id=" + id + querystr));
  138. %>
  139.               </div></td>
  140.             </tr>
  141.           </table></td>
  142.   </tr>
  143. </table>
  144. <%@ include file="inc/footer.jsp"%>
  145. </td> </tr>             
  146.       </table>                                        
  147.        </td>                                        
  148.      </tr>                                        
  149.  </table>                                        
  150.                                
  151. </body>                                        
  152. </html>                            
  153.