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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="com.redmoon.blog.*" %>
  3. <%@ page import="com.redmoon.forum.*" %>
  4. <%@ page import="cn.js.fan.util.*" %>
  5. <%@ page import="java.util.*" %>
  6. <%@ page import="com.redmoon.forum.plugin.*"%>
  7. <%@ page import="com.redmoon.forum.plugin2.alipay.*"%>
  8. <%@ page import="com.redmoon.forum.plugin.base.*"%>
  9. <%@ page import="com.redmoon.forum.person.UserSet"%>
  10. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  11. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  12. <%
  13. long editid = -1;
  14. try {
  15. editid = ParamUtil.getInt(request, "editid");
  16. }
  17. catch (ErrMsgException e) {
  18. out.print(SkinUtil.makeErrMsg(request, "标识错误!"));
  19. return;
  20. }
  21. String privurl = request.getParameter("privurl"); 
  22. if (!privilege.isUserLogin(request))
  23. {
  24. out.print(StrUtil.makeErrMsg("您尚未登录!"));
  25. return;
  26. }
  27. MsgMgr mm = new MsgMgr();
  28. MsgDb Topic = mm.getMsgDb(editid);
  29. int i=0;
  30. String name = privilege.getUser(request);
  31. try {
  32. if (!privilege.canEdit(request, Topic))
  33. {
  34. out.print(StrUtil.makeErrMsg("您无权编辑!"));
  35. return;
  36. }
  37. }
  38. catch (ErrMsgException e) {
  39. out.print(StrUtil.Alert_Back(e.getMessage()));
  40. return;
  41. }
  42. String topic="",content="";
  43. int expression=1;
  44. String show_ubbcode = "" + Topic.getShowUbbcode();
  45. String show_smile = "" + Topic.getShowSmile();
  46. String email_notify = "" + Topic.getEmailNotify();
  47. long rootid = Topic.getRootid();
  48. topic = Topic.getTitle();
  49. content = Topic.getContent();
  50. expression = Topic.getExpression();
  51. String boardname;
  52. String hit = request.getParameter("hit");
  53. String boardcode = Topic.getboardcode();
  54. Leaf curleaf = new Leaf();
  55. curleaf = curleaf.getLeaf(boardcode);
  56. boardname = curleaf.getName();
  57. // 取得皮肤路径
  58. String skincode = curleaf.getSkin();
  59. if (skincode.equals("") || skincode.equals(UserSet.defaultSkin)) {
  60. skincode = UserSet.getSkin(request);
  61. if (skincode==null || skincode.equals(""))
  62. skincode = UserSet.defaultSkin;
  63. }
  64. SkinMgr skm = new SkinMgr();
  65. Skin skin = skm.getSkin(skincode);
  66. String skinPath = skin.getPath();
  67. com.redmoon.forum.Config cfg1 = new com.redmoon.forum.Config();
  68. int msgTitleLengthMin = cfg1.getIntProperty("forum.msgTitleLengthMin");
  69. int msgTitleLengthMax = cfg1.getIntProperty("forum.msgTitleLengthMax");
  70. int msgLengthMin = cfg1.getIntProperty("forum.msgLengthMin");
  71. int msgLengthMax = cfg1.getIntProperty("forum.msgLengthMax");
  72. int maxAttachmentCount = cfg1.getIntProperty("forum.maxAttachmentCount");
  73. int maxAttachmentSize = cfg1.getIntProperty("forum.maxAttachmentSize");
  74. Vector attachments = Topic.getAttachments();
  75. %>
  76. <html>
  77. <head>
  78. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  79. <title><%=Global.AppName%> - 编辑贴子</title>
  80. <link href="<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
  81. <STYLE>
  82. TABLE {
  83. BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px
  84. }
  85. TD {
  86. BORDER-RIGHT: 0px; BORDER-TOP: 0px
  87. }
  88. </STYLE>
  89. <script>
  90. function delAttach(attach_id, msgId) {
  91. if (!window.confirm("您确定要删除吗?")) {
  92. return;
  93. }
  94. document.frames.hideframe.location.href = "edittopicdo.jsp?op=delAttach&msgId=" + msgId + "&attach_id=" + attach_id
  95. }
  96. function findObj(theObj, theDoc)
  97. {
  98.   var p, i, foundObj;
  99.   
  100.   if(!theDoc) theDoc = document;
  101.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  102.   {
  103.     theDoc = parent.frames[theObj.substring(p+1)].document;
  104.     theObj = theObj.substring(0,p);
  105.   }
  106.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  107.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  108.     foundObj = theDoc.forms[i][theObj];
  109.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  110.     foundObj = findObj(theObj,theDoc.layers[i].document);
  111.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  112.   
  113.   return foundObj;
  114. }
  115. function frmAnnounce_onsubmit() {
  116. if (!cws_validateMode())
  117. return false;
  118. var html;
  119. html=cws_getText();
  120. html=cws_rCode(html,"<a> </a>","");
  121.   document.frmAnnounce.Content.value=html;
  122. if (frmAnnounce.topic.value.length<<%=msgTitleLengthMin%>)
  123. {
  124. alert("您输入的主题太短了,注意最短不能少于<%=msgTitleLengthMin%>字!");
  125. return false;
  126. }
  127. if (frmAnnounce.topic.value.length><%=msgTitleLengthMax%>)
  128. {
  129. alert("您输入的主题太长了,注意最长不能超过<%=msgTitleLengthMax%>字!");
  130. return false;
  131. }
  132. if (frmAnnounce.Content.value.length<<%=msgLengthMin%>)
  133. {
  134. alert("您输入的内容太短了,注意最短不能少于<%=msgLengthMin%>字!");
  135. return false;
  136. }
  137. if (frmAnnounce.Content.value.length><%=msgLengthMax%>)
  138. {
  139. alert("您输入的内容太长了,注意最长不能超过<%=msgLengthMax%>字!");
  140. return false;
  141. }
  142. }
  143. function changeAttachName(attach_id, msgId, nm) {
  144. var obj = findObj(nm);
  145. // document.frames.hideframe.location.href = "fwebedit_do.jsp?op=changeattachname&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id + "&newname=" + obj.value
  146. form3.action = "edittopicdo.jsp?op=changeattachname&msgId=" + msgId + "&attach_id=" + attach_id;
  147. form3.newname.value = obj.value;
  148. form3.submit();
  149. }
  150. var attachCount = <%=attachments.size()%> + 1; // 把默认输入框计算在内
  151. function AddAttach() {
  152. if (attachCount>=<%=maxAttachmentCount%>) {
  153. alert("附件最多只能上传<%=maxAttachmentCount%>个!");
  154. return;
  155. }
  156. updiv.insertAdjacentHTML("BeforeEnd", "<table width=100%><tr><lt:Label res="res.label.forum.addtopic" key="file"/>&nbsp;<input type='file' name='filename" + attachCount + "' size=10><td></td></tr></table>");
  157. // updiv.innerHTML += "<table width=100%><tr>文件&nbsp;<input type='file' name='filename" + attachCount + "' size=10><td></td></tr></table>";
  158. attachCount += 1;
  159. }
  160. </script>
  161. <script src="inc/ubbcode.jsp"></script>
  162. </head>
  163. <body topmargin="2">
  164. <%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
  165. <%@ include file="inc/header.jsp"%>
  166. <%}%>
  167. <jsp:include page="inc/position.jsp" flush="true">
  168. <jsp:param name="boardcode" value="<%=StrUtil.UrlEncode(boardcode)%>" />
  169. </jsp:include>
  170.   <table width="98%" border="1" align="center" cellpadding="4" cellspacing="0" borderColor="<%=skin.getTableBorderClr()%>">
  171. <form name=frmAnnounce method="post" action="edittopicdo.jsp" enctype="MULTIPART/FORM-DATA" onSubmit="return frmAnnounce_onsubmit()">
  172.     <TBODY>
  173.       <tr> 
  174.       <td colspan="2" class="td_title"> 编辑贴子&nbsp;<a href="showtopictree.jsp?rootid=<%=Topic.getRootid()%>"><%=Topic.getTitle()%></a></td>
  175.       </tr>
  176.     </TBODY>
  177.     <TBODY>
  178.       <tr>
  179.         <td colspan="2">
  180. <%
  181. PluginMgr pm = new PluginMgr();
  182. Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode);
  183. if (vplugin.size()>0) {
  184. Iterator irplugin = vplugin.iterator();
  185. while (irplugin.hasNext()) {
  186. PluginUnit pu = (PluginUnit)irplugin.next();
  187. IPluginUI ipu = pu.getUI(request);
  188. IPluginViewEditMsg pv = ipu.getViewEditMsg(boardcode, Topic.getId());
  189. if (pv.IsPluginBoard()) {
  190. out.print(pu.getName(request) + ":&nbsp;" + pv.render(UIEditMsg.POS_FORM_NOTE) + "<BR>");
  191. out.print(pv.render(UIEditMsg.POS_FORM_ELEMENT));
  192. }
  193. }
  194. }
  195. %></td>
  196.       </tr>
  197.   <%
  198.   // 判别该用户的博客是否已被激活及该贴是否为根贴,只有两项全符合,才会出现编辑博客的选项
  199.   if (Topic.getReplyid()==-1) {
  200.   UserConfigDb ucd = new UserConfigDb();
  201.   ucd = ucd.getUserConfigDb(Topic.getName());
  202.   if (ucd!=null && ucd.isLoaded()) {
  203.   %>
  204.   <tr>
  205. <td>发表至博客目录</td>
  206. <td>
  207. <%
  208. UserDirDb udd = new UserDirDb();
  209. String checked = "";
  210. if (Topic.isBlog())
  211. checked = "checked";
  212. %>
  213.   <select name=blogUserDir>
  214. <option value="<%=UserDirDb.DEFAULT%>">默认目录</option>
  215. <%=udd.toOptions(privilege.getUser(request))%>
  216.   </select>
  217.   <script>
  218. frmAnnounce.blogUserDir.value = "<%=Topic.getBlogUserDir()%>";
  219.   </script>
  220.   <input name=isBlog value=1 type=checkbox <%=checked%>> 
  221.   发表至博客</td>
  222.   </tr>
  223.   <%}
  224.   }%>
  225.   <tr>
  226.                 <td>支付宝账号</td>
  227.     <td>
  228. <%
  229. AlipayDb ad = new AlipayDb();
  230. ad = ad.getAlipaydDb(Topic.getId());
  231. %>
  232. <input class="input" maxlength="200" size="35" name="alipay_seller" value="<%=ad.getSeller()%>">
  233.                     <input name="plugin2Code" value="alipay" type="hidden">                </td>
  234.       </tr>
  235.   <tr>
  236.                 <td>商品名称</td>
  237.     <td><input class="input" maxlength="200" size="25" name="alipay_subject" value="<%=ad.getSubject()%>">
  238.       &nbsp;&nbsp;  
  239.       价格
  240.       <input class="input" maxlength="20" size="5" name="alipay_price" value="<%=ad.getPrice()%>">
  241.       元</td>
  242.       </tr>
  243.   <tr>
  244.                 <td>邮费承担方</td>
  245.     <td><input id="alipay_transport" onClick="checkTransport();" type="radio" value="3" name="alipay_transport" <%=ad.getTransport()==3?"checked":""%>>
  246. 虚拟物品不需邮递
  247.   <input id="alipay_transport" onClick="checkTransport();" type="radio" checked value="2" name="alipay_transport" <%=ad.getTransport()==2?"checked":""%>>
  248. 卖家承担运费
  249. <input id="alipay_transport" onClick="checkTransport();" type="radio" value="1" name="alipay_transport" <%=ad.getTransport()==1?"checked":""%>>
  250. 买家承担运费 
  251. <br>
  252.       平邮
  253.       <input class="input" disabled maxlength="20" size="5" name="alipay_ordinary" value="<%=ad.getOrdinary()%>">
  254.       元&nbsp;&nbsp; 快递
  255.       <input class="input" disabled maxlength="20" size="5" name="alipay_express" value="<%=ad.getExpress()%>">
  256.         元 (不填为平邮)</td>
  257.       </tr>
  258.   <tr>
  259.                 <td>演示网址</td>
  260.     <td><input class="input" maxlength="200" size="35" name="alipay_demo" value="<%=ad.getDemo()%>">
  261.       商品说明请填写于信息内容中</td>
  262.       </tr>
  263.   <tr>
  264.                 <td>联系方式</td>
  265.     <td>淘宝旺旺
  266.       <input class="input" maxlength="20" size="10" name="alipay_ww" value="<%=ad.getWw()%>">
  267.       腾讯QQ
  268.       <input class="input" maxlength="20" size="10" name="alipay_qq" value="<%=ad.getQq()%>">
  269.       让买家在线联系您 </td>
  270.       </tr>
  271.       <tr> 
  272.       <td width="20%">回复标题:</td>
  273.         <td width="80%"> <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
  274.             <OPTION selected value="">选择话题</OPTION>
  275.             <OPTION value=[原创]>[原创]</OPTION>
  276.             <OPTION value=[转帖]>[转帖]</OPTION>
  277.             <OPTION value=[灌水]>[灌水]</OPTION>
  278.             <OPTION value=[讨论]>[讨论]</OPTION>
  279.             <OPTION value=[求助]>[求助]</OPTION>
  280.             <OPTION value=[推荐]>[推荐]</OPTION>
  281.             <OPTION value=[公告]>[公告]</OPTION>
  282.             <OPTION value=[注意]>[注意]</OPTION>
  283.             <OPTION value=[贴图]>[贴图]</OPTION>
  284.             <OPTION value=[建议]>[建议]</OPTION>
  285.             <OPTION value=[下载]>[下载]</OPTION>
  286.             <OPTION value=[分享]>[分享]</OPTION>
  287.           </SELECT> 
  288.   <input name="topic" type="text" id="topic" size="60" maxlength="80" value="<%=topic%>">
  289.           <input type=hidden name="editid" value="<%=editid%>">
  290.           <input type="hidden" name="boardcode" value="<%=boardcode%>">
  291.           <input type="hidden" name="boardname" value="<%=boardname%>">
  292.           <input type="hidden" name="hit" value="<%=hit%>">
  293.           <input type="hidden" name="privurl" value="<%=privurl%>">        </td>
  294.       </tr>
  295.       <tr> 
  296.         <td valign="top" width="20%">当前心情:<br>
  297.           将放在帖子的前面</td>
  298.         <td><iframe src="iframe_emote.jsp?expression=<%=Topic.getExpression()%>" height="25"  width="500px" marginwidth="0" marginheight="0" frameborder="0" scrolling="yes"></iframe>
  299.         <input type="hidden" name="expression" value="<%=Topic.getExpression()%>"></td>
  300.       </tr>
  301.       <tr> 
  302.         <td rowspan="2" valign="bottom"><%if (privilege.isManager(request, boardcode)) {%>
  303.           <table width="100%" border="0" cellspacing="0" cellpadding="5">
  304.             <tr>
  305.               <td><a href="javascript:replyCanSee()">回复可见</a></td>
  306.             </tr>
  307.             <tr>
  308.               <td><a href="javascript:experienceCanSee()">经验可见</a></td>
  309.             </tr>
  310.           </table>
  311.           <%}%>
  312.           <br>
  313.   <input type="checkbox" id="email_notify" name="email_notify" value="1" <%=Topic.getEmailNotify()==1?"checked":""%>>
  314.   有回复通知我
  315. <script language="JavaScript">
  316. <!--
  317. <% if (rootid==-1) {
  318. if (email_notify.equals("1")){ %>
  319. frmAnnounce.email_notify.checked = true;
  320. <% }
  321.  } %>
  322. <% if (show_ubbcode.equals("0")) { %>
  323. frmAnnounce.show_ubbcode.checked = true;
  324. <% } %>
  325. <% if (show_smile.equals("0")) { %>
  326. frmAnnounce.show_smile.checked = true;
  327. <% } %>
  328. //-->
  329. </script>     </td>
  330.         <td><%if (attachments.size()<maxAttachmentCount) {%>
  331. <table width="100%" border=0 cellspacing=0 cellpadding=0>
  332. <tr><td class=tablebody1 valign=top height=30>
  333. 文件&nbsp;<input type="file" name="filename" size=10>
  334.               可以上传: 
  335.               <select name="filetype" size=1>
  336. <option value="">文件类型</option>
  337. <option value=rar>rar</option><option value=gif>gif</option><option value=jpg>jpg</option><option value=bmp>bmp</option><option value=zip>zip</option><option value=png>png</option><option value=swf>swf</option><option value=doc>doc</option>
  338. </select>
  339.               限制:<%=maxAttachmentCount%>个,限制大小<%=maxAttachmentSize%>K
  340.               <input name="button" type=button onClick="AddAttach()" value="增加附件">
  341.   </td>
  342.             </tr>
  343. </table>
  344. <%}%>
  345. <div id=updiv name=updiv></div></td>
  346.       </tr>
  347.       
  348.       <tr> 
  349.         <td><%@ include file="../editor_full/editor.jsp"%>
  350. <input type=hidden name="Content">
  351.           <input type=hidden name="isWebedit" value="<%=MsgDb.WEBEDIT_NORMAL%>">
  352.           <br>
  353.   <textarea name="tmpContent" style="display:none"><%=content%></textarea>
  354.   <script>
  355.   IframeID.document.body.innerHTML=frmAnnounce.tmpContent.value;
  356.   </script>
  357.   <%
  358.   if (Topic!=null) {
  359.   Iterator ir = attachments.iterator();
  360.   while (ir.hasNext()) {
  361.    Attachment am = (Attachment) ir.next(); %>
  362.           <table width="98%"  border="0" cellspacing="0" cellpadding="0">
  363.             <tr>
  364.               <td width="4%" align="center"><img src=../images/attach.gif width="17" height="17"></td>
  365.               <td width="96%">&nbsp;
  366.                   <input name="attach_name<%=am.getId()%>" value="<%=am.getName()%>" size="30">
  367.                 &nbsp;
  368.                 <a href="javascript:changeAttachName('<%=am.getId()%>', '<%=Topic.getId()%>', '<%="attach_name"+am.getId()%>')">改名</a>
  369.                 &nbsp;<a href="javascript:delAttach('<%=am.getId()%>', '<%=Topic.getId()%>')">删除</a>&nbsp;&nbsp;<a target=_blank href="<%=am.getVisualPath()%>">查看</a>&nbsp;&nbsp;</td>
  370.             </tr>
  371.           </table>
  372.           <%}
  373.   }
  374.   %>
  375.           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  376. <input type=submit value=" 发 出 ">
  377. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  378. <input type=reset value=" 重 写 ">      </td>
  379.       </tr>
  380.     </TBODY>
  381. </form>
  382.   </table>
  383.   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  384.     <tr>
  385.       <form name="form3" action="?" method="post">
  386.         <td align="center"><input name="newname" type="hidden">
  387.         </td>
  388.       </form>
  389.     </tr>
  390.   </table>
  391.   <iframe id="hideframe" name="hideframe" src="edittopicdo_we.jsp" width=0 height=0></iframe>
  392. <%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
  393. <%@ include file="inc/footer.jsp"%>
  394. <%}%>
  395. </body>
  396. <script>
  397. function getRadioValue(myitem)
  398. {
  399.      var radioboxs = document.all.item(myitem);
  400.      if (radioboxs!=null)
  401.      {
  402.    //如果只有一个radio
  403.    if (radioboxs.length==null) {
  404. if (radioboxs.type=="radio" && radioboxs.checked)
  405. return radioboxs.value;
  406. else
  407. return "";
  408.    }
  409.    for (i=0; i<radioboxs.length; i++)
  410.        {
  411.             if (radioboxs[i].type=="radio" && radioboxs[i].checked)
  412.             {
  413.                  return radioboxs[i].value;
  414.             }
  415.        }
  416.      }
  417.  return "";
  418. }
  419. function checkTransport() {
  420.      if (getRadioValue("alipay_transport")=="1") {
  421.          frmAnnounce.alipay_ordinary.disabled = false;
  422.          frmAnnounce.alipay_express.disabled = false;
  423.      } else {
  424.          frmAnnounce.alipay_ordinary.disabled = true;
  425.          frmAnnounce.alipay_express.disabled = true;
  426.      }
  427. }
  428. </script>
  429. </html>