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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.db.Conn"%>
  4. <%@ page import="cn.js.fan.util.*"%>
  5. <%@ page import="com.redmoon.forum.plugin.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.entrance.*"%>
  7. <%@ page import="com.redmoon.forum.*"%>
  8. <%@ page import="com.redmoon.forum.person.*"%>
  9. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  10. <html><head>
  11. <meta http-equiv="pragma" content="no-cache">
  12. <link rel="stylesheet" href="../../common.css">
  13. <LINK href="default.css" type=text/css rel=stylesheet>
  14. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>付费用户管理管理</title>
  17. <script>
  18. function findObj(theObj, theDoc)
  19. {
  20.   var p, i, foundObj;
  21.   
  22.   if(!theDoc) theDoc = document;
  23.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  24.   {
  25.     theDoc = parent.frames[theObj.substring(p+1)].document;
  26.     theObj = theObj.substring(0,p);
  27.   }
  28.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  29.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  30.     foundObj = theDoc.forms[i][theObj];
  31.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  32.     foundObj = findObj(theObj,theDoc.layers[i].document);
  33.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  34.   
  35.   return foundObj;
  36. }
  37. var GetDate=""; 
  38. function SelectDate(ObjName,FormatDate) {
  39. var PostAtt = new Array;
  40. PostAtt[0]= FormatDate;
  41. PostAtt[1]= findObj(ObjName);
  42. GetDate = showModalDialog("../../util/calendar/calendar.htm", PostAtt ,"dialogWidth:286px;dialogHeight:221px;status:no;help:no;");
  43. }
  44. function SetDate()
  45. findObj(ObjName).value = GetDate; 
  46. function openWinKinds() {
  47. var ret = showModalDialog('board_sel_multi.jsp',window.self,'dialogWidth:480px;dialogHeight:320px;status:no;help:no;')
  48. if (ret==null)
  49. return;
  50. form1.boardNames.value = "";
  51. form1.boards.value = "";
  52. for (var i=0; i<ret.length; i++) {
  53. if (form1.boardNames.value=="") {
  54. form1.boards.value += ret[i][0];
  55. form1.boardNames.value += ret[i][1];
  56. }
  57. else {
  58. form1.boards.value += "," + ret[i][0];
  59. form1.boardNames.value += "," + ret[i][1];
  60. }
  61. }
  62. }
  63. function getLeaves() {
  64. return form1.boards.value;
  65. }
  66. </script>
  67. <body bgcolor="#FFFFFF" topmargin='0' leftmargin='0'>
  68. <jsp:useBean id="privilege" scope="page" class="cn.js.fan.module.pvg.Privilege"/>
  69. <table width='100%' cellpadding='0' cellspacing='0' >
  70.   <tr>
  71.     <td class="head">管理VIP用户</td>
  72.   </tr>
  73. </table>
  74. <br>
  75. <table width="98%" height="227" border='0' align="center" cellpadding='0' cellspacing='0' class="frame_gray">
  76.   <tr> 
  77.     <td height=20 align="left" class="thead"> 添加VIP用户 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="entranceVIPUser.jsp">入口管理</a></td>
  78.   </tr>
  79.   <tr> 
  80.     <td valign="top">
  81. <%
  82. if (!privilege.isUserPrivValid(request, "forum.plugin"))
  83. {
  84. out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  85. return;
  86. }
  87. String op = ParamUtil.get(request, "op");
  88. VIPUserDb vtu = new VIPUserDb();
  89. if (op.equals("add")) {
  90. String userName = ParamUtil.get(request, "userName").trim();
  91. String errMsg = "";
  92. if (userName.equals("")) {
  93. // errMsg += "用户名不能为空!\r\n";
  94. }
  95. else {
  96. // 检查用户在论坛中是否存在
  97. UserDb ud = new UserDb();
  98. ud = ud.getUser(userName);
  99. if (!ud.isLoaded())
  100. errMsg += "用户不存在!\r\n";
  101. else if (!ud.isValid())
  102. errMsg += "该用户帐号已被禁止!\r\n";
  103. }
  104. String boards="",bDate,eDate;
  105. Date beginDate=null,endDate=null;
  106. boolean isValid = false;
  107. boards = ParamUtil.get(request, "boards");
  108. try {
  109. bDate = ParamUtil.get(request, "beginDate");
  110. eDate = ParamUtil.get(request, "endDate");
  111. beginDate = DateUtil.parse(bDate, "yyyy-MM-dd");
  112. endDate = DateUtil.parse(eDate, "yyyy-MM-dd");
  113. isValid = ParamUtil.getBoolean(request, "isValid", false);
  114. }
  115. catch (Exception e) {
  116. errMsg += e.getMessage() + "\r\n";
  117. }
  118. if (beginDate==null || endDate==null)
  119. errMsg += "开始和结束日期不能为空!";
  120. if (!errMsg.equals("")) {
  121. out.print(StrUtil.Alert(errMsg));
  122. }
  123. else {
  124. vtu.setUserName(userName);
  125. vtu.setBeginDate(beginDate);
  126. vtu.setEndDate(endDate);
  127. vtu.setValid(isValid);
  128. vtu.setBoards(boards);
  129. if (vtu.create())
  130. out.print(StrUtil.p_center("<BR>添加成功!您现在可以继续添加!"));
  131. else
  132. out.print(StrUtil.Alert("添加失败,请检查是否重复!"));
  133. }
  134. }
  135. %>
  136. <br>
  137.       <br>
  138.       <table width="38%"  border="0" align="center" cellpadding="5" class="tableframe_gray">
  139.         <form name="form1" method="post" action="?op=add">
  140.         
  141.         <tr>
  142.           <td align="center">用&nbsp;&nbsp;户&nbsp;&nbsp;名</td>
  143.           <td align="left"><label>
  144.             <input name="userName" type="text" id="userName">
  145.           </label></td>
  146.         </tr>
  147.         
  148.         <tr>
  149.           <td width="29%" align="center">开始时间</td>
  150.           <td width="71%" align="left"><input name="beginDate" size=10 readonly value="">
  151.             &nbsp;<img src="../../util/calendar/calendar.gif" align=absMiddle style="cursor:hand" onClick="SelectDate('beginDate','yyyy-mm-dd')"></td>
  152.         </tr>
  153.         <tr>
  154.           <td align="center">到期时间</td>
  155.           <td align="left"><input name="endDate" size=10 readonly>
  156.             &nbsp;<img src="../../util/calendar/calendar.gif" align=absMiddle style="cursor:hand" onClick="SelectDate('endDate','yyyy-mm-dd')"></td>
  157.         </tr>
  158.         
  159.         <tr>
  160.           <td align="center">版&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;块</td>
  161.           <td align="left"><label>
  162.   <input name="boards" value="" type="hidden">
  163.           <textarea name="boardNames" cols="45" rows="3" readOnly wrap="yes" id="boardNames"></textarea>
  164.             <input class="SmallButton" title="选择版块" onClick="openWinKinds()" type="button" value="选择版块" name="button">
  165.             </label></td>
  166.         </tr>
  167.         <tr>
  168.           <td align="center">是否有效</td>
  169.           <td align="left"><input type=checkbox name="isValid" value="true"></td>
  170.         </tr>
  171.         <tr>
  172.           <td colspan="2" align="center"><input type="submit" name="Submit" value="确定">
  173. &nbsp;&nbsp;&nbsp;&nbsp;            &nbsp;
  174. <input type="reset" name="Submit2" value="重写"></td>
  175.         </tr>
  176.       </form>
  177.       </table>
  178.       <br></td>
  179.   </tr>
  180. </table>
  181. </td> </tr>             
  182.       </table>                                        
  183.        </td>                                        
  184.      </tr>                                        
  185.  </table>                                        
  186.                                
  187. </body>                                        
  188. </html>                            
  189.