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

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. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  11. <html><head>
  12. <meta http-equiv="pragma" content="no-cache">
  13. <link rel="stylesheet" href="../../common.css">
  14. <LINK href="default.css" type=text/css rel=stylesheet>
  15. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  16. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  17. <title>付费用户管理管理</title>
  18. <script>
  19. function findObj(theObj, theDoc)
  20. {
  21.   var p, i, foundObj;
  22.   
  23.   if(!theDoc) theDoc = document;
  24.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  25.   {
  26.     theDoc = parent.frames[theObj.substring(p+1)].document;
  27.     theObj = theObj.substring(0,p);
  28.   }
  29.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  30.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  31.     foundObj = theDoc.forms[i][theObj];
  32.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  33.     foundObj = findObj(theObj,theDoc.layers[i].document);
  34.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  35.   
  36.   return foundObj;
  37. }
  38. var GetDate=""; 
  39. function SelectDate(ObjName,FormatDate){
  40. var PostAtt = new Array;
  41. PostAtt[0]= FormatDate;
  42. PostAtt[1]= findObj(ObjName);
  43. GetDate = showModalDialog("../../util/calendar/calendar.htm", PostAtt ,"dialogWidth:286px;dialogHeight:221px;status:no;help:no;");
  44. }
  45. function SetDate()
  46. findObj(ObjName).value = GetDate; 
  47. function openWinKinds() {
  48. var ret = showModalDialog('VIPCard_dir_sel_multi.jsp',window.self,'dialogWidth:480px;dialogHeight:320px;status:no;help:no;')
  49. if (ret==null)
  50. return;
  51. form1.kindNames.value = "";
  52. form1.kind.value = "";
  53. for (var i=0; i<ret.length; i++) {
  54. if (form1.kindNames.value=="") {
  55. form1.kind.value += ret[i][0];
  56. form1.kindNames.value += ret[i][1];
  57. }
  58. else {
  59. form1.kind.value += "," + ret[i][0];
  60. form1.kindNames.value += "," + ret[i][1];
  61. }
  62. }
  63. }
  64. function getLeaves() {
  65. return form1.kind.value;
  66. }
  67. function setFee(fee) {
  68. form1.fee.value = fee;
  69. }
  70. function getFee() {
  71. if (form1.fee.value=="")
  72. return 0.0;
  73. else
  74. return form1.fee.value/1;
  75. }
  76. </script>
  77. <body bgcolor="#FFFFFF" topmargin='0' leftmargin='0'>
  78. <jsp:useBean id="privilege" scope="page" class="cn.js.fan.module.pvg.Privilege"/>
  79. <table width='100%' cellpadding='0' cellspacing='0' >
  80.   <tr>
  81.     <td class="head">管理付费用户</td>
  82.   </tr>
  83. </table>
  84. <br>
  85. <table width="98%" height="227" border='0' align="center" cellpadding='0' cellspacing='0' class="frame_gray">
  86.   <tr> 
  87.     <td height=20 align="left" class="thead"> 添加付费用户 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="entranceVIPTeach.jsp">入口管理</a></td>
  88.   </tr>
  89.   <tr> 
  90.     <td valign="top">
  91. <%
  92. if (!privilege.isUserPrivValid(request, "forum.plugin"))
  93. {
  94. out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  95. return;
  96. }
  97. String id = ParamUtil.get(request, "id");
  98. if (id.equals("")) {
  99. out.print(StrUtil.Alert_Back("缺少标识!"));
  100. return;
  101. }
  102. VIPCardDb vpc = new VIPCardDb();
  103. vpc = vpc.getVIPCardDb(id);
  104. if (vpc==null || !vpc.isLoaded()) {
  105. out.print(StrUtil.Alert_Back("该卡不存在!"));
  106. return;
  107. }
  108. String op = ParamUtil.get(request, "op");
  109. if (op.equals("edit")) {
  110. String userName = ParamUtil.get(request, "userName").trim();
  111. String errMsg = "";
  112. if (userName.equals("")) {
  113. // errMsg += "用户名不能为空!\r\n";
  114. }
  115. else {
  116. // 检查用户在论坛中是否存在
  117. UserDb ud = new UserDb();
  118. ud = ud.getUser(userName);
  119. if (!ud.isLoaded())
  120. errMsg += "用户不存在!\r\n";
  121. else if (!ud.isValid())
  122. errMsg += "该用户帐号已被禁止!\r\n";
  123. }
  124. String pwd = ParamUtil.get(request, "pwd").trim();
  125. if (pwd.equals(""))
  126. errMsg += "密码不能为空!\r\n";
  127. double fee = 0;
  128. String kind="",bDate,eDate,fingerPrint="";
  129. Date beginDate=null,endDate=null;
  130. boolean isUseFingerPrint = false;
  131. boolean isValid = false;
  132. try {
  133. fee = ParamUtil.getDouble(request, "fee");
  134. String[] kindary = ParamUtil.getParameters(request, "kind");
  135. if (kindary==null)
  136. errMsg += "对不起,您必须选择至少一项类别!\r\n";
  137. else {
  138. int klen = kindary.length;
  139. for (int k=0; k<klen; k++) {
  140. if (kind.equals(""))
  141. kind = kindary[k];
  142. else
  143. kind += "|" + kindary[k];
  144. }
  145. }
  146. bDate = ParamUtil.get(request, "beginDate");
  147. eDate = ParamUtil.get(request, "endDate");
  148. beginDate = DateUtil.parse(bDate, "yyyy-MM-dd");
  149. endDate = DateUtil.parse(eDate, "yyyy-MM-dd");
  150. fingerPrint = ParamUtil.get(request, "fingerPrint");
  151. isUseFingerPrint = ParamUtil.getBoolean(request, "isUseFingerPrint", false);
  152. isValid = ParamUtil.getBoolean(request, "isValid", false);
  153. }
  154. catch (Exception e) {
  155. errMsg += e.getMessage() + "\r\n";
  156. }
  157. if (beginDate==null || endDate==null)
  158. errMsg += "开始和结束日期不能为空!";
  159. if (!errMsg.equals("")) {
  160. out.print(StrUtil.Alert(errMsg));
  161. }
  162. else {
  163. vpc.setUserName(userName);
  164. vpc.setFee(fee);
  165. vpc.setBeginDate(beginDate);
  166. vpc.setEndDate(endDate);
  167. vpc.setKind(kind);
  168. vpc.setPwd(pwd);
  169. vpc.setFingerPrint(fingerPrint);
  170. vpc.setUseFingerPrint(isUseFingerPrint);
  171. vpc.setValid(isValid);
  172. if (vpc.save())
  173. out.print(StrUtil.p_center("<BR>修改成功!"));
  174. else
  175. out.print(StrUtil.Alert("修改失败!"));
  176. }
  177. }
  178. %>
  179. <br>
  180. <table width="40%"  border="0" align="center" cellpadding="5" class="tableframe_gray">
  181.         <form id="form1" name="form1" method="post" action="?op=edit">
  182.         <tr>
  183.           <td align="center">卡&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</td>
  184.           <td align="left"><%=id%><input name="id" type="hidden" id="id" value="<%=id%>"></td>
  185.         </tr>
  186.         <tr>
  187.           <td align="center">新&nbsp;&nbsp;密&nbsp;&nbsp;码</td>
  188.           <td align="left"><input name="pwd" type="text" id="pwd" value="<%=vpc.getPwdRaw()%>"></td>
  189.         </tr>
  190.         <tr>
  191.           <td align="center">用&nbsp;&nbsp;户&nbsp;&nbsp;名</td>
  192.           <td align="left"><input name="userName" type="text" id="userName" value="<%=vpc.getUserName()%>"></td>
  193.         </tr>
  194.         <tr>
  195.           <td width="27%" align="center">开始时间</td>
  196.           <td width="73%" align="left"><input name="beginDate" size=10 readonly value="<%=DateUtil.format(vpc.getBeginDate(), "yyyy-MM-dd")%>">
  197.             &nbsp;<img src="../../util/calendar/calendar.gif" align=absMiddle style="cursor:hand" onClick="SelectDate('beginDate','yyyy-mm-dd')"></td>
  198.         </tr>
  199.         <tr>
  200.           <td align="center">到期时间</td>
  201.           <td align="left"><input name="endDate" size=10 readonly value="<%=DateUtil.format(vpc.getEndDate(), "yyyy-MM-dd")%>">
  202.             &nbsp;<img src="../../util/calendar/calendar.gif" align=absMiddle style="cursor:hand" onClick="SelectDate('endDate','yyyy-mm-dd')"></td>
  203.         </tr>
  204.         
  205.         <tr>
  206.           <td align="center">费&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用</td>
  207.           <td align="left"><input name="fee" type="text" id="fee" size="10" value="<%=vpc.getFee()%>">
  208.             <label>
  209.             &nbsp;元&nbsp;&nbsp;&nbsp;</label></td>
  210.         </tr>
  211.         <tr>
  212.           <td align="center">类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别</td>
  213.           <td align="left"><label>
  214.           <input type="hidden" name="kind" value="<%=vpc.getKind()%>">
  215.   <%
  216.   String kind = vpc.getKind();
  217.   String kindNames = "";
  218.   if (kind!=null && !kind.equals("")) {
  219.    String[] kindAry = kind.split(",");
  220. int len = kindAry.length;
  221. cn.js.fan.module.cms.Directory dir = new cn.js.fan.module.cms.Directory();
  222. cn.js.fan.module.cms.Leaf lf = null;
  223. for (int i=0; i<len; i++) {
  224. lf = dir.getLeaf(kindAry[i]);
  225. // System.out.println("VIPCard_edit.jsp " + kindAry[i]);
  226. if (lf!=null) {
  227. if (kindNames.equals(""))
  228. kindNames = lf.getName();
  229. else
  230. kindNames += "," + lf.getName();
  231. }
  232. }
  233.   }
  234.   %>
  235.           <textarea name="kindNames" cols="45" rows="3" readOnly wrap="yes" id="kindNames"><%=kindNames%></textarea>
  236.           <input class="SmallButton" title="添加部门" onClick="openWinKinds()" type="button" value="选择目录" name="button">
  237. </label></td>
  238.         </tr>
  239.         <tr>
  240.           <td align="center">电脑指纹</td>
  241.           <td align="left"><input name="fingerPrint" type="text" id="fingerPrint" size="20" value="<%=StrUtil.getNullString(vpc.getFingerPrint())%>">
  242.             &nbsp;
  243.             <label>
  244. <%
  245. String fChecked = "";
  246. if (vpc.isUseFingerPrint())
  247. fChecked = "checked";
  248. %>
  249.             <input name="isUseFingerPrint" type="checkbox" id="isUseFingerPrint" value="true" <%=fChecked%>>
  250.             </label>
  251.             使用</td>
  252.         </tr>
  253.         <tr>
  254.           <td align="center">是否有效</td>
  255.           <td align="left">
  256.   <input type=checkbox name="isValid" value="true" <%=vpc.isValid()?"checked":""%>></td>
  257.         </tr>
  258.         <tr>
  259.           <td colspan="2" align="center"><input type="submit" name="Submit" value="确定">
  260. &nbsp;&nbsp;&nbsp;&nbsp;            &nbsp;
  261. <input type="reset" name="Submit2" value="重写"></td>
  262.         </tr>
  263.       </form>
  264.       </table>
  265. <br></td>
  266.   </tr>
  267. </table>
  268. </td> </tr>             
  269.       </table>                                        
  270.        </td>                                        
  271.      </tr>                                        
  272.  </table>                                        
  273.                                
  274. </body>                                        
  275. </html>                            
  276.