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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="com.redmoon.forum.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import="com.redmoon.forum.person.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.*"%>
  7. <%@ page import="com.redmoon.forum.plugin.base.*"%>
  8. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  9. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  10. <%
  11. String targeturl = StrUtil.getUrl(request);
  12. if (!privilege.isUserLogin(request)) {
  13. response.sendRedirect("../door.jsp?targeturl="+targeturl);
  14. return;
  15. }
  16. int i=0;
  17. String replyid = request.getParameter("replyid");
  18. if (replyid==null || !StrUtil.isNumeric(replyid))
  19. {
  20. out.println(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, SkinUtil.ERR_ID)));
  21. return;
  22. }
  23. MsgMgr msgMgr = new MsgMgr();
  24. MsgDb msgDb = msgMgr.getMsgDb(Integer.parseInt(replyid));
  25. String boardcode = msgDb.getboardcode();
  26. String userName = privilege.getUser(request);
  27. if (!privilege.canUserDo(request, boardcode, "reply_topic")) {
  28. response.sendRedirect("../info.jsp?info= " + StrUtil.UrlEncode(SkinUtil.LoadString(request, "pvg_invalid")));
  29. return;
  30. }
  31. String privurl = request.getParameter("privurl");
  32. String quote = StrUtil.getNullString(request.getParameter("quote"));
  33. String quotecontent = "";
  34. String retopic;
  35. retopic = msgDb.getTitle();
  36. String qc = SkinUtil.LoadString(request, "res.label.forum.addreply", "quote_content");
  37. qc = qc.replaceFirst("\$u", msgDb.getName());
  38. qc = qc.replaceFirst("\$d", com.redmoon.forum.ForumSkin.formatDateTime(request, msgDb.getAddDate()));
  39. quotecontent = qc + "rnrn" + msgDb.getContent();
  40. quotecontent = "<table align=center style="width:80%" cellpadding=5 cellspacing=1 class=quote><TR><TD>" + quotecontent + "</td></tr></table>";
  41. retopic = SkinUtil.LoadString(request, "res.label.forum.addreply", "reply") + retopic;
  42. Leaf lf = new Leaf();
  43. lf = lf.getLeaf(boardcode);
  44. String boardname = lf.getName();
  45. String hit = request.getParameter("hit");
  46. // 取得皮肤路径
  47. String skincode = lf.getSkin();
  48. if (skincode.equals("") || skincode.equals(UserSet.defaultSkin)) {
  49. skincode = UserSet.getSkin(request);
  50. if (skincode==null || skincode.equals(""))
  51. skincode = UserSet.defaultSkin;
  52. }
  53. SkinMgr skm = new SkinMgr();
  54. Skin skin = skm.getSkin(skincode);
  55. String skinPath = skin.getPath();
  56. com.redmoon.forum.Config cfg1 = new com.redmoon.forum.Config();
  57. int msgTitleLengthMin = cfg1.getIntProperty("forum.msgTitleLengthMin");
  58. int msgTitleLengthMax = cfg1.getIntProperty("forum.msgTitleLengthMax");
  59. int msgLengthMin = cfg1.getIntProperty("forum.msgLengthMin");
  60. int msgLengthMax = cfg1.getIntProperty("forum.msgLengthMax");
  61. int maxAttachmentCount = cfg1.getIntProperty("forum.maxAttachmentCount");
  62. int maxAttachmentSize = cfg1.getIntProperty("forum.maxAttachmentSize");
  63. %>
  64. <html>
  65. <head>
  66. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  67. <title><lt:Label res="res.label.forum.addreply" key="addreply"/> - <%=Global.AppName%></title>
  68. <link href="<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
  69. <STYLE>
  70. TABLE {
  71. BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px
  72. }
  73. TD {
  74. BORDER-RIGHT: 0px; BORDER-TOP: 0px
  75. }
  76. body {
  77. margin-top: 0px;
  78. }
  79. </STYLE>
  80. <script>
  81. function SubmitWithFile(){
  82. if (!cws_validateMode())
  83. return false;
  84. if (document.frmAnnounce.topic.value.length<<%=msgTitleLengthMin%>)
  85. {
  86. alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_title"/><%=msgTitleLengthMin%>");
  87. return false;
  88. }
  89. if (document.frmAnnounce.topic.value.length><%=msgTitleLengthMax%>)
  90. {
  91. alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_title"/><%=msgTitleLengthMax%>");
  92. return false;
  93. }
  94. var html;
  95. html=cws_getText();
  96. html=cws_rCode(html,"<a> </a>","");
  97.   document.frmAnnounce.Content.value=html;
  98. if (document.frmAnnounce.Content.value.length<<%=msgLengthMin%>)
  99. {
  100. alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_content"/><%=msgLengthMin%>");
  101. return false;
  102. }
  103. if (document.frmAnnounce.Content.value.length><%=msgLengthMax%>)
  104. {
  105. alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_content"/><%=msgLengthMax%>");
  106. return false;
  107. }
  108. loadDataToWebeditCtrl(frmAnnounce, frmAnnounce.webedit);
  109. frmAnnounce.webedit.AddSpecialFile("filename", frmAnnounce.filename.value);
  110. frmAnnounce.webedit.AddField("ip", "<%=request.getRemoteAddr()%>");
  111. frmAnnounce.webedit.UploadArticle();
  112. if (frmAnnounce.webedit.ReturnMessage.indexOf("+")!=-1) {
  113. alert(frmAnnounce.webedit.ReturnMessage);
  114. window.location.href = "<%=privurl%>";
  115. }
  116. else
  117. alert(frmAnnounce.webedit.ReturnMessage);
  118. }
  119. function SubmitWithFileDdxc() {
  120. frmAnnounce.webedit.isDdxc = 1;
  121. if (document.frmAnnounce.topic.value.length<<%=msgTitleLengthMin%>)
  122. {
  123. alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_title"/><%=msgTitleLengthMin%>");
  124. return false;
  125. }
  126. if (document.frmAnnounce.topic.value.length><%=msgTitleLengthMax%>)
  127. {
  128. alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_title"/><%=msgTitleLengthMax%>");
  129. return false;
  130. }
  131. var html;
  132. html=cws_getText();
  133. html=cws_rCode(html,"<a> </a>","");
  134.   document.frmAnnounce.Content.value=html;
  135. if (document.frmAnnounce.Content.value.length<<%=msgLengthMin%>)
  136. {
  137. alert("<lt:Label res="res.forum.MsgDb" key="err_too_short_content"/><%=msgLengthMin%>");
  138. return false;
  139. }
  140. if (document.frmAnnounce.Content.value.length><%=msgLengthMax%>)
  141. {
  142. alert("<lt:Label res="res.forum.MsgDb" key="err_too_large_content"/><%=msgLengthMax%>");
  143. return false;
  144. }
  145. loadDataToWebeditCtrl(frmAnnounce, frmAnnounce.webedit);
  146. frmAnnounce.webedit.AddSpecialFile("filename", frmAnnounce.filename.value);
  147. frmAnnounce.webedit.AddField("ip", "<%=request.getRemoteAddr()%>");
  148. frmAnnounce.webedit.MTUpload();
  149. }
  150. function Operate() {
  151. recordFilePath = frmAnnounce.Recorder.FilePath;
  152. frmAnnounce.webedit.InsertFileToList(recordFilePath);
  153. }
  154. function frmAnnounce_onsubmit()
  155. {
  156. SubmitWithFile();
  157. }
  158. </script>
  159. <script language=JavaScript src='inc/formpost.js'></script>
  160. </head>
  161. <body>
  162. <%@ include file="inc/header.jsp"%>
  163. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  164. <jsp:useBean id="userservice" scope="page" class="com.redmoon.forum.person.userservice" />
  165. <%@ include file="inc/position.jsp"%>
  166. <table width="98%" border="1" align="center" cellpadding="4" cellspacing="0" borderColor="<%=skin.getTableBorderClr()%>">
  167. <form name=frmAnnounce method="post" action="addreplytodb.jsp" enctype="MULTIPART/FORM-DATA" onSubmit="return frmAnnounce_onsubmit()">
  168.     <TBODY>
  169.       <tr> 
  170.       <td colspan="2" background="<%=skinPath%>/images/bg1.gif" class="td_title"> <lt:Label res="res.label.forum.addreply" key="reply_topic"/>&nbsp;<a href="showtopic_tree.jsp?rootid=<%=msgDb.getRootid()%>&showid=<%=msgDb.getId()%>"><%=msgDb.getTitle()%></a>&nbsp;&nbsp;&nbsp;&nbsp;
  171.         <lt:Label res="res.label.forum.addreply" key="board"/>&nbsp;<a class=left href="listtopic.jsp?boardcode=<%=boardcode%>"><%=boardname%></a>&nbsp;</td>
  172.       </tr>
  173.     </TBODY>
  174.     <TBODY>
  175.       <tr>
  176.         <td colspan="2">
  177.           <%
  178. String pluginCode = msgDb.getRootMsgPluginCode();
  179.   
  180. PluginMgr pm = new PluginMgr();
  181. Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode);
  182. if (vplugin.size()>0) {
  183. Iterator irplugin = vplugin.iterator();
  184. long msgRootId = msgDb.getRootid();
  185. while (irplugin.hasNext()) {
  186. PluginUnit pu = (PluginUnit)irplugin.next();
  187. IPluginUI ipu = pu.getUI(request, response, out);
  188. IPluginViewAddReply pv = ipu.getViewAddReply(boardcode, msgRootId);
  189. if (pv.IsPluginBoard()) {
  190. boolean showPlugin = false;
  191. if (pu.getType().equals(pu.TYPE_BOARD))
  192. showPlugin = true;
  193. else if (pu.getType().equals(pu.TYPE_TOPIC)) {
  194. if (pluginCode.equals(pu.getCode()))
  195. showPlugin = true;
  196. }
  197. if (showPlugin) {
  198. if (!pu.getAddReplyPage().equals("")) {
  199. %>
  200. <jsp:include page="<%=pu.getAddReplyPage()%>" flush="true">
  201. <jsp:param name="boardcode" value="<%=StrUtil.UrlEncode(boardcode)%>" /> 
  202. </jsp:include>
  203. <% }
  204. else {
  205. out.print(pu.getName(request) + ":&nbsp;" + pv.render(UIAddReply.POS_FORM_NOTE) + "<BR>");
  206. out.print(pv.render(UIAddReply.POS_FORM_ELEMENT));
  207. }
  208. }
  209. }
  210. }
  211. }
  212. %>        </td>
  213.       </tr>
  214. <%
  215. if (cfg1.getBooleanProperty("forum.addUseValidateCode")) {
  216. %>
  217. <tr><td width="20%">
  218. <lt:Label res="res.label.forum.addtopic" key="input_validatecode"/>
  219. </td><td><input name="validateCode" type="text" size="1">
  220.   <img src='../validatecode.jsp' border=0 align="absmiddle" style="cursor:hand" onClick="this.src='../validatecode.jsp'" alt="<lt:Label res="res.label.forum.index" key="refresh_validatecode"/>"></td>
  221. </tr>   <%}%>   
  222.       <tr> 
  223.       <td width="20%"><lt:Label res="res.label.forum.addreply" key="topic_reply"/></td>
  224.         <td width="80%"> <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
  225.             <OPTION selected value=""><lt:Label res="res.label.forum.addtopic" key="sel_topic"/></OPTION>
  226.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_origi"/>><lt:Label res="res.label.forum.addtopic" key="pre_origi"/></OPTION>
  227.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_from"/>><lt:Label res="res.label.forum.addtopic" key="pre_from"/></OPTION>
  228.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_water"/>><lt:Label res="res.label.forum.addtopic" key="pre_water"/></OPTION>
  229.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_discuss"/>><lt:Label res="res.label.forum.addtopic" key="pre_discuss"/></OPTION>
  230.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_help"/>><lt:Label res="res.label.forum.addtopic" key="pre_help"/></OPTION>
  231.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_recommend"/>><lt:Label res="res.label.forum.addtopic" key="pre_recommend"/></OPTION>
  232.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_notice"/>><lt:Label res="res.label.forum.addtopic" key="pre_notice"/></OPTION>
  233.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_note"/>><lt:Label res="res.label.forum.addtopic" key="pre_note"/></OPTION>
  234.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_image"/>><lt:Label res="res.label.forum.addtopic" key="pre_image"/></OPTION>
  235.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_advise"/>><lt:Label res="res.label.forum.addtopic" key="pre_advise"/></OPTION>
  236.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_download"/>><lt:Label res="res.label.forum.addtopic" key="pre_download"/></OPTION>
  237.             <OPTION value=<lt:Label res="res.label.forum.addtopic" key="pre_share"/>><lt:Label res="res.label.forum.addtopic" key="pre_share"/></OPTION>
  238.           </SELECT> 
  239.   <input name="topic" type="text" id="topic" size="60" maxlength="80" value="<%=StrUtil.toHtml(retopic)%>">
  240.   <input type=hidden name=replyid value="<%=replyid%>">
  241.           <input type="hidden" name="boardcode" value="<%=boardcode%>">
  242.           <input type="hidden" name="privurl" value="<%=privurl%>"></td>
  243.       </tr>
  244.       <tr> 
  245.         <td width="20%"><lt:Label res="res.label.forum.addtopic" key="emote_icon"/></td>
  246.         <td width="80%"><iframe src="iframe_emote.jsp" height="25"  width="58%" marginwidth="0" marginheight="0" frameborder="0" scrolling="yes"></iframe>
  247.         <input type="hidden" name="expression" value="25"></td>
  248.       </tr>
  249.       <tr> 
  250.         <td rowspan="2" valign="bottom"><input type="checkbox" name="show_ubbcode" value="0">
  251.           <lt:Label res="res.label.forum.showtopic" key="forbid_ubb"/><br> <input type="checkbox" name="show_smile" value="0">
  252.           <lt:Label res="res.label.forum.showtopic" key="forbid_emote"/><br>        </td>
  253.         <td><table width="100%" border=0 cellspacing=0 cellpadding=0>
  254. <tr><td class=tablebody1 valign=top height=30>
  255. <lt:Label res="res.label.forum.addtopic" key="file"/>
  256. <input type="file" name="filename" size=30>
  257. <select name="select">
  258.   <option>
  259.   <lt:Label res="res.label.forum.addtopic" key="upload_file_ext"/>
  260.   </option>
  261.   <%
  262. String[] ext = StrUtil.split(cfg1.getProperty("forum.ext"), ",");
  263. if (ext!=null) {
  264. int extlen = ext.length;
  265. for (int p=0; p<extlen; p++) {
  266. out.print("<option>" + ext[p] + "</option>");
  267. }
  268. }
  269. %>
  270. </select></td>
  271. </tr>
  272. </table></td>
  273.       </tr>
  274.       <tr> 
  275.         <td><%@ include file="../editor_full/editor.jsp"%>
  276.           <input type=hidden name="Content">
  277.           <input type=hidden name="isWebedit" value="<%=MsgDb.WEBEDIT_NORMAL%>">
  278. <%if (quote!=null && quote.equals("1")) {%>
  279.   <textarea name="tmpContent" style="display:none"><%=quotecontent%></textarea>
  280.   <script>
  281.   IframeID.document.body.innerHTML=frmAnnounce.tmpContent.value;
  282.   </script>
  283. <%}%></td>
  284.       </tr>
  285.       <tr>
  286.         <td valign="bottom">&nbsp;</td>
  287.         <td><table width=""  border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  288.           <tr>
  289.             <td bgcolor="#FFFFFF"><%
  290. Calendar cal = Calendar.getInstance();
  291. String year = "" + (cal.get(cal.YEAR));
  292. String month = "" + (cal.get(cal.MONTH) + 1);
  293. String filepath = "upfile/webedit/" + year + "/" + month;
  294. %>
  295.                 <object classid="CLSID:DE757F80-F499-48D5-BF39-90BC8BA54D8C" codebase="<%=request.getContextPath()%>/activex/webedit.cab#version=6,0,1,1" width=400 height=173 align="middle" id="webedit">
  296.                   <param name="Encode" value="utf-8">
  297.                   <param name="MaxSize" value="<%=Global.MaxSize%>">
  298.                   <!--上传字节-->
  299.                   <param name="ForeColor" value="(255,255,255)">
  300.                   <param name="BgColor" value="(107,154,206)">
  301.                   <param name="ForeColorBar" value="(255,255,255)">
  302.                   <param name="BgColorBar" value="(0,0,255)">
  303.                   <param name="ForeColorBarPre" value="(0,0,0)">
  304.                   <param name="BgColorBarPre" value="(200,200,200)">
  305.                   <param name="FilePath" value="<%=filepath%>">
  306.                   <param name="Relative" value="1">
  307.                   <!--上传后的文件需放在服务器上的路径-->
  308.                   <param name="Server" value="<%=request.getServerName()%>">
  309.                   <param name="Port" value="<%=request.getServerPort()%>">
  310.                   <param name="VirtualPath" value="<%=Global.virtualPath%>">
  311.                   <param name="PostScript" value="<%=Global.virtualPath%>/forum/addreplytodbwe.jsp">
  312.                   <param name="PostScriptDdxc" value="<%=Global.virtualPath%>/forum/forumddxc.jsp">
  313.                   <param name="SegmentLen" value="204800">
  314.               </object></td>
  315.           </tr>
  316.           <tr>
  317.             <td align="center" bgcolor="#FFFFFF"><table width="100%" id="table_recorder" style="display:none">
  318.                 <tr>
  319.                   <td align="center"><a href="../activex/RecordCtl.EXE"><lt:Label res="res.label.forum.addtopic" key="download_recorder"/></a></td>
  320.                 </tr>
  321.                 <tr>
  322.                   <td align="center"><OBJECT ID="Recorder" CLASSID="CLSID:E4A3D135-E189-48AF-B348-EF5DFFD99A67">
  323.               </OBJECT></td>
  324.                 </tr>
  325.               </table>
  326.                 </td>
  327.           </tr>
  328.         </table></td>
  329.       </tr>
  330.       
  331.       <tr>
  332.         <td colspan="2" align="center">
  333. <!--<input name="cmdok2" type="button" class="singleboarder" value="断点续传" onClick="return SubmitWithFileDdxc()">
  334.         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
  335.         <input type="button" onClick="frmAnnounce_onsubmit()" value="<lt:Label res="res.label.forum.addtopic" key="commit"/>">
  336. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  337. <input name="reset" type=reset value="<lt:Label res="res.label.forum.addtopic" key="rewrite"/>">
  338. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  339. <input name="cmdcancel2" type="button" onClick="table_recorder.style.display=''" value="<lt:Label res="res.label.forum.addtopic" key="record"/>">
  340. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  341. <input type="button" onClick="window.location.href='addreply_new.jsp?replyid=<%=replyid%>&boardcode=<%=StrUtil.UrlEncode(boardcode)%>&rootid=<%=msgDb.getRootid()%>&privurl=<%=privurl%>'" value="<lt:Label res="res.label.forum.addtopic" key="add_normal"/>">
  342. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  343. <input type="button" onClick="window.location.href='addreply.jsp?replyid=<%=replyid%>&boardcode=<%=StrUtil.UrlEncode(boardcode)%>&rootid=<%=msgDb.getRootid()%>&privurl=<%=privurl%>'" value="<lt:Label res="res.label.forum.addtopic" key="add_ubb"/>"></td>
  344.       </tr>
  345.     </TBODY></form>
  346. </table>
  347. <%@ include file="inc/footer.jsp"%>
  348. </body>
  349. </html>