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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.web.*"%>
  4. <%@ page import="com.redmoon.forum.person.*"%>
  5. <%@ page import="com.redmoon.forum.plugin.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.base.*"%>
  7. <%@ page import="com.redmoon.blog.*"%>
  8. <%@ page import="java.util.*"%>
  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. %>
  17. <%
  18. String boardcode = ParamUtil.get(request, "boardcode");
  19. Leaf curleaf = new Leaf();
  20. curleaf = curleaf.getLeaf(boardcode);
  21. if (curleaf==null || !curleaf.isLoaded()) {
  22. out.print(SkinUtil.makeErrMsg(request, "该版块" + boardcode + "不存在"));
  23. return;
  24. }
  25. if (!curleaf.isUsePlugin2("alipay")) {
  26. out.print(SkinUtil.makeErrMsg(request, "该版不能够发起支付宝交易!"));
  27. return;
  28. }
  29. String boardname = curleaf.getName();
  30. String blogUserDir = ParamUtil.get(request, "blogUserDir");
  31. if (blogUserDir.equals(""))
  32. blogUserDir = UserDirDb.DEFAULT;
  33. // 取得皮肤路径
  34. String skincode = curleaf.getSkin();
  35. if (skincode.equals("") || skincode.equals(UserSet.defaultSkin)) {
  36. skincode = UserSet.getSkin(request);
  37. if (skincode==null || skincode.equals(""))
  38. skincode = UserSet.defaultSkin;
  39. }
  40. SkinMgr skm = new SkinMgr();
  41. Skin skin = skm.getSkin(skincode);
  42. String skinPath = skin.getPath();
  43. com.redmoon.forum.Config cfg1 = new com.redmoon.forum.Config();
  44. int msgTitleLengthMin = cfg1.getIntProperty("forum.msgTitleLengthMin");
  45. int msgTitleLengthMax = cfg1.getIntProperty("forum.msgTitleLengthMax");
  46. int msgLengthMin = cfg1.getIntProperty("forum.msgLengthMin");
  47. int msgLengthMax = cfg1.getIntProperty("forum.msgLengthMax");
  48. int maxAttachmentCount = cfg1.getIntProperty("forum.maxAttachmentCount");
  49. int maxAttachmentSize = cfg1.getIntProperty("forum.maxAttachmentSize");
  50. %>
  51. <html>
  52. <head>
  53. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  54. <title><%=Global.AppName%> - 发新贴</title>
  55. <link href="<%=skinPath%>/skin.css" rel="stylesheet" type="text/css">
  56. <STYLE>TABLE {
  57. BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px
  58. }
  59. TD {
  60. BORDER-RIGHT: 0px; BORDER-TOP: 0px
  61. }
  62. body {
  63. margin-top: 0px;
  64. margin-left: 0px;
  65. margin-right: 0px;
  66. }
  67. </STYLE>
  68. <script language="javascript">
  69. <!--
  70. function findObj(theObj, theDoc)
  71. {
  72.   var p, i, foundObj;
  73.   
  74.   if(!theDoc) theDoc = document;
  75.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  76.   {
  77.     theDoc = parent.frames[theObj.substring(p+1)].document;
  78.     theObj = theObj.substring(0,p);
  79.   }
  80.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  81.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  82.     foundObj = theDoc.forms[i][theObj];
  83.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  84.     foundObj = findObj(theObj,theDoc.layers[i].document);
  85.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  86.   
  87.   return foundObj;
  88. }
  89. function showvote(isshow)
  90. {
  91. if (frmAnnounce.isvote.checked)
  92. {
  93. frmAnnounce.vote.style.display = "";
  94. }
  95. else
  96. {
  97. frmAnnounce.vote.style.display = "none";
  98. }
  99. }
  100. function frmAnnounce_onsubmit()
  101. {
  102. if (!cws_validateMode())
  103. return false;
  104. if (frmAnnounce.topic.value.length<<%=msgTitleLengthMin%>)
  105. {
  106. alert("您输入的主题太短了,注意最短不能少于<%=msgTitleLengthMin%>字!");
  107. return false;
  108. }
  109. if (frmAnnounce.topic.value.length><%=msgTitleLengthMax%>)
  110. {
  111. alert("您输入的主题太长了,注意最长不能超过<%=msgTitleLengthMax%>字!");
  112. return false;
  113. }
  114. var html;
  115. html=cws_getText();
  116. html=cws_rCode(html,"<a> </a>","");
  117.   document.frmAnnounce.Content.value=html;
  118. if (frmAnnounce.Content.value.length<<%=msgLengthMin%>)
  119. {
  120. alert("您输入的内容太短了,注意最短不能少于<%=msgLengthMin%>字!");
  121. return false;
  122. }
  123. if (frmAnnounce.Content.value.length><%=msgLengthMax%>)
  124. {
  125. alert("您输入的内容太长了,注意最长不能超过<%=msgLengthMax%>字!");
  126. return false;
  127. }
  128. }
  129. var attachCount = 1;
  130. function AddAttach() {
  131. if (attachCount>=<%=maxAttachmentCount%>) {
  132. alert("附件最多只能上传<%=maxAttachmentCount%>个!");
  133. return;
  134. }
  135. 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>");
  136. // updiv.innerHTML += "<table width=100%><tr>文件&nbsp;<input type='file' name='filename" + attachCount + "' size=10><td></td></tr></table>";
  137. attachCount += 1;
  138. }
  139. //-->
  140. </script>
  141. </head>
  142. <body>
  143. <%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
  144. <%@ include file="inc/header.jsp"%>
  145. <%@ include file="inc/position.jsp"%>
  146. <%}%>
  147. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  148. <jsp:useBean id="userservice" scope="page" class="com.redmoon.forum.person.userservice"/>
  149. <%
  150. String privurl = ParamUtil.get(request, "privurl");
  151. String notwe = request.getParameter("notwe");
  152. if (notwe==null) {
  153. //if (privilege.canWebEdit(request)) {
  154. // response.sendRedirect("addtopic_we.jsp?privurl="+StrUtil.UrlEncode(privurl, "utf-8")+"&boardcode="+boardcode+"&boardname="+StrUtil.UrlEncode(boardname, "utf-8"));
  155. // return;
  156. //}
  157. }
  158. %>
  159. <br>
  160. <script src="inc/ubbcode.jsp"></script>
  161. <%
  162. int i=0;
  163. %>
  164. <table width="98%" border="1" align="center" cellpadding="4" cellspacing="0" borderColor="<%=skin.getTableBorderClr()%>">
  165. <form name=frmAnnounce method="post" action="addtopictodb.jsp" enctype="MULTIPART/FORM-DATA" onSubmit="return frmAnnounce_onsubmit()">
  166.     <TBODY>
  167.       <tr> 
  168.         <td height="26" colspan="2" background="<%=skinPath%>/images/bg1.gif" class="td_title">发表新贴至:<a href="listtopic.jsp?boardcode=<%=boardcode%>"><%=boardname%></a></td>
  169.       </tr>
  170.     </TBODY>
  171.     <TBODY>
  172.       <tr>
  173.         <td>发表至论坛版块</td>
  174.         <td>
  175. <%
  176. UserConfigDb ucd = new UserConfigDb();
  177. ucd = ucd.getUserConfigDb(privilege.getUser(request));
  178. // 如果用户的博客未开通,则不能选择版块
  179. if (Global.hasBlog && ucd!=null && ucd.isLoaded()) {
  180. %>
  181.   <script>
  182.   var bcode<%=i%> = "<%=boardcode%>";
  183.   </script>
  184.   <select name="boardcode" onChange="if(this.options[this.selectedIndex].value=='not'){alert(this.options[this.selectedIndex].text+' 不能被选择!'); this.value=bcode<%=i%>; return false;}">
  185.                 <option value="not" selected>请选择版块</option>
  186.                 <%
  187. com.redmoon.forum.Directory directory = new com.redmoon.forum.Directory();
  188. com.redmoon.forum.Leaf lf = directory.getLeaf("root");
  189. com.redmoon.forum.DirectoryView dv = new com.redmoon.forum.DirectoryView(lf);
  190. dv.ShowDirectoryAsOptions(out, lf, lf.getLayer());
  191. %>
  192.           </select>
  193.   <script>
  194. frmAnnounce.boardcode.value = "<%=boardcode%>";
  195.   </script>
  196.   <%if (boardcode.equals(Leaf.CODE_BLOG)) {%>
  197. (如果需要发表至论坛中,则选择其它版块,否则将不会显示在论坛中)
  198.   <%}
  199.   }else{%>
  200.   <%=boardname%><input type="hidden" name="boardcode" value="<%=boardcode%>">
  201.   <%}%> </td>
  202.       </tr>
  203.   <%
  204.   if (Global.hasBlog && ucd.isLoaded()) {
  205.   %>
  206.       <tr>
  207.         <td>发表至博客目录</td>
  208.         <td>
  209. <%
  210. UserDirDb udd = new UserDirDb();
  211. %>
  212. <select name=blogUserDir>
  213.           <option value="<%=UserDirDb.DEFAULT%>">默认目录</option>
  214.           <%=udd.toOptions(privilege.getUser(request))%>
  215.         </select>
  216. <script>
  217. frmAnnounce.blogUserDir.value = "<%=blogUserDir%>";
  218. </script>
  219. <input name=isBlog value=1 type=checkbox <%=boardcode.equals(Leaf.CODE_BLOG)?"checked":""%>>
  220. 发表至博客 </td>
  221.       </tr>
  222.   <%}%>
  223.       <tr>
  224.         <td colspan="2">
  225.           <%
  226. PluginMgr pm = new PluginMgr();
  227. Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode);
  228. if (vplugin.size()>0) {
  229. Iterator irplugin = vplugin.iterator();
  230. while (irplugin.hasNext()) {
  231. PluginUnit pu = (PluginUnit)irplugin.next();
  232. IPluginUI ipu = pu.getUI(request);
  233. IPluginViewAddMsg pv = ipu.getViewAddMsg(boardcode);
  234. if (pv.IsPluginBoard()) {
  235. out.print(pu.getName(request) + ":&nbsp;" + pv.render(UIAddMsg.POS_TITLE) + "<BR>");
  236. out.print(pv.render(UIAddMsg.POS_FORM_ELEMENT) + "<BR>");
  237. }
  238. }
  239. }
  240. String hit = request.getParameter("hit");
  241. String isvote = StrUtil.getNullString(request.getParameter("isvote"));
  242. %>        </td>
  243.       </tr>
  244. <%
  245. if (cfg1.getBooleanProperty("forum.addUseValidateCode")) {
  246. %>
  247. <tr><td width="20%">
  248. 请输入验证码:
  249. </td><td><input name="validateCode" type="text" size="1">
  250.   <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>
  251. </tr>   <%}%>      
  252.       <tr>
  253.         <td>支付宝账号</td>
  254.         <td><input class="input" maxlength="200" size="35" name="alipay_seller">
  255. <input name="plugin2Code" value="alipay" type="hidden"> </td>
  256.       </tr>
  257.       <tr>
  258.         <td>商品名称</td>
  259.         <td><input class="input" maxlength="200" size="25" name="alipay_subject">
  260.           &nbsp;&nbsp;  
  261.       价格
  262.       <input class="input" maxlength="20" size="5" name="alipay_price">
  263. 元</td>
  264.       </tr>
  265.       <tr>
  266.         <td>邮费承担方</td>
  267.         <td><input id="alipay_transport" onClick="checkTransport();" type="radio" value="3" name="alipay_transport">
  268.           虚拟物品不需邮递
  269.           <input id="alipay_transport" onClick="checkTransport();" type="radio" checked value="2" name="alipay_transport">
  270.           卖家承担运费
  271.           <input id="alipay_transport" onClick="checkTransport();" type="radio" value="1" name="alipay_transport">
  272.           买家承担运费
  273.           <br>
  274. 平邮
  275. <input class="input" disabled maxlength="20" size="5" name="alipay_ordinary">
  276. 元&nbsp;&nbsp; 快递
  277. <input class="input" disabled maxlength="20" size="5" name="alipay_express">
  278. 元 (不填为平邮)</td>
  279.       </tr>
  280.       <tr>
  281.         <td>演示网址</td>
  282.         <td><input class="input" maxlength="200" size="35" name="alipay_demo">
  283.         商品说明请填写于信息内容中</td>
  284.       </tr>
  285.       <tr>
  286.         <td>联系方式</td>
  287.         <td>淘宝旺旺
  288.           <input class="input" maxlength="20" size="10" name="alipay_ww">
  289. 腾讯QQ
  290. <input class="input" maxlength="20" size="10" name="alipay_qq">
  291. 让买家在线联系您</td>
  292.       </tr>
  293.       
  294.       <tr> 
  295.         <td width="20%">主题标题:</td>
  296.         <td width="80%"> <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
  297.             <OPTION selected value="">选择话题</OPTION>
  298.             <OPTION value=[原创]>[原创]</OPTION>
  299.             <OPTION value=[转帖]>[转帖]</OPTION>
  300.             <OPTION value=[灌水]>[灌水]</OPTION>
  301.             <OPTION value=[讨论]>[讨论]</OPTION>
  302.             <OPTION value=[求助]>[求助]</OPTION>
  303.             <OPTION value=[推荐]>[推荐]</OPTION>
  304.             <OPTION value=[公告]>[公告]</OPTION>
  305.             <OPTION value=[注意]>[注意]</OPTION>
  306.             <OPTION value=[贴图]>[贴图]</OPTION>
  307.             <OPTION value=[建议]>[建议]</OPTION>
  308.             <OPTION value=[下载]>[下载]</OPTION>
  309.             <OPTION value=[分享]>[分享]</OPTION>
  310.           </SELECT> <input name="topic" type="text" id="topic" size="60" maxlength="80">
  311.           <input type="hidden" name="boardname" value="<%=boardname%>">
  312.           <input type="hidden" name="hit" value="<%=hit%>">
  313.           <input type="hidden" name="privurl" value="<%=privurl%>"></td>
  314.       </tr>
  315.       <tr>
  316.         <td valign="top">当前心情:<br>
  317.           将放在帖子的前面</td>
  318.         <td><iframe src="iframe_emote.jsp" height="25"  width="500px" marginwidth="0" marginheight="0" frameborder="0" scrolling="yes"></iframe>
  319.         <input type="hidden" name="expression" value="25"></td>
  320.       </tr>
  321.       <tr> 
  322.         <td valign="top" width="20%">
  323. <%
  324. String display="none",ischecked="false";
  325. if (isvote.equals("1")) {
  326. display = "";
  327. ischecked = "checked";
  328. }
  329. %>
  330. <input type="checkbox" name="isvote" value="1" onClick="showvote()" <%=ischecked%>>投票选项 </td>
  331.         <td width="80%"><textarea style="display:<%=display%>" cols="55" name="vote" rows="8" wrap="VIRTUAL" title="输入投票选项"></textarea>
  332.           每行代表一个选项</td>
  333.       </tr>
  334.       <tr> 
  335.         <td rowspan="3" valign="bottom"><input type="checkbox" name="email_notify" value="1">
  336.           有回复通知我 </td><td><table width="100%" border=0 cellspacing=0 cellpadding=0>
  337.             <tr>
  338.               <td class=tablebody1 valign=top height=30>文件&nbsp;<input type="file" name="filename" size=10>
  339.                 限制:<%=maxAttachmentCount%>个,限制大小<%=maxAttachmentSize%>K
  340.                 <input type=button onClick="AddAttach()" value="增加附件"></td>
  341.             </tr>
  342.           </table>
  343.   <div id=updiv name=updiv></div></td>
  344.       </tr>
  345.       <tr> 
  346.         <td>
  347.           <%@ include file="../editor_full/editor.jsp"%>        </td>
  348.       </tr>
  349.       <tr> 
  350.         <td><input type=hidden name="Content">
  351.           <input type=hidden name="isWebedit" value="<%=MsgDb.WEBEDIT_NORMAL%>">
  352.           <br>
  353.           <input type=submit value=" 发 出 ">
  354. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  355. <input type=reset value=" 重 写 ">
  356. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  357. <%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
  358. <input type="button" onClick="window.location.href='addtopic.jsp?boardcode=<%=StrUtil.UrlEncode(boardcode)%>&privurl=<%=privurl%>'" value="UBB发贴">
  359. <%}%>
  360. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  361. <%if (privilege.canWebEditRedMoon(request, boardcode)) {%>
  362. <input type="button" onClick="window.location.href='addtopic_we.jsp?boardcode=<%=StrUtil.UrlEncode(boardcode)%>&blogUserDir=<%=blogUserDir%>&privurl=<%=privurl%>'" value="高级发贴">
  363. <%}%></td>
  364.       </tr>
  365.     </TBODY></form>
  366. </table>
  367. <%if (!boardcode.equals(Leaf.CODE_BLOG)) {%>
  368. <%@ include file="inc/footer.jsp"%>
  369. <%}%>
  370. </body>
  371. <script>
  372. function getRadioValue(myitem)
  373. {
  374.      var radioboxs = document.all.item(myitem);
  375.      if (radioboxs!=null)
  376.      {
  377.    //如果只有一个radio
  378.    if (radioboxs.length==null) {
  379. if (radioboxs.type=="radio" && radioboxs.checked)
  380. return radioboxs.value;
  381. else
  382. return "";
  383.    }
  384.    for (i=0; i<radioboxs.length; i++)
  385.        {
  386.             if (radioboxs[i].type=="radio" && radioboxs[i].checked)
  387.             {
  388.                  return radioboxs[i].value;
  389.             }
  390.        }
  391.      }
  392.  return "";
  393. }
  394. function checkTransport() {
  395.      if (getRadioValue("alipay_transport")=="1") {
  396.          frmAnnounce.alipay_ordinary.disabled = false;
  397.          frmAnnounce.alipay_express.disabled = false;
  398.      } else {
  399.          frmAnnounce.alipay_ordinary.disabled = true;
  400.          frmAnnounce.alipay_express.disabled = true;
  401.      }
  402. }
  403. </script>
  404. </html>