⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forumcomponent.java

📁 交易撮合系统是一套买卖信息沟通的平台
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				Vote vote = voteService.findVoteByID(f.getVoteID());
				// System.out.println(vote);
				if (vote != null) {
					// System.out.println("Vote exist..");
					VoteItemService voteItemService = (VoteItemService) wc.getBean("voteItemService");
					List voteItems = voteItemService.findVoteItemsByVoteID(vote.getId());
					Configuration tempConfiguration = (Configuration) wc.getBean("tempConfiguration");
					try {
						tempConfiguration
								.setDirectoryForTemplateLoading(new File(Constant.ROOTPATH + Constant.FTL_PATH));
						tempConfiguration.setDefaultEncoding(Constant.CHARSET);
						tempConfiguration.setLocale(request.getLocale());
						tempConfiguration.setNumberFormat("0.##########");

						Map root = new HashMap();

						root.put("postid", f.getId());
						root.put("bid", Long.valueOf(f.getBoardID()));
						root.put("vote", vote);
						root.put("vis", voteItems);
						root.put("fdetail", this.getForumDetail(f, board, sysConfig, request, us, messageSource));

						Template temp = tempConfiguration.getTemplate("vote.ftl");
						// Writer writer = pageContext.getOut();
						StringWriter sw = new StringWriter();
						temp.process(root, sw);
						// writer.flush();
						this.write(writer, sw.toString());
						sw.flush();
					} catch (TemplateException ex) {
						logger.error(ex);
					} catch (IOException ex) {
						logger.error(ex);
					}
				}
			}

			return result;
		}

		if (type.equalsIgnoreCase("attach")) {
			Object usObj = this.getStack().findValue("userSession");
			UserSession us = (UserSession) usObj;
			if (f.getHaveAttachFile() != 0 && f.getAttachFileName() != null && !f.getAttachFileName().isEmpty()) {
				if (f.getIsHidden() != 0) {
					if (f.getUserID().equals(us.getId())
							|| us.isHaveBoardSpecialPermission(Constant.SPERMISSION_CAN_SEE_HIDDENDETAIL)) { // 发表人或有直接查看隐藏帖权限

						if (f.getIsHidden() == 1) {
							sb.append(messageSource.getMessage("post.hidden.needre0", null, request.getLocale()));
						}
						if (f.getIsHidden() == 2) {
							sb.append(messageSource.getMessage("post.hidden.buy", null, request.getLocale()));
						}
						if (f.getIsHidden() == 3) {
							sb.append(messageSource.getMessage("post.hidden.artnum", null, request.getLocale()));
						}

						sb.append("<br/>");

						sb.append(this.getAttachFile(f, sysConfig, true, request, us, true, messageSource));

					} else {
						if (f.getIsHidden() == 1) { // 回复帖
							ForumService forumService = (ForumService) wc.getBean("forumService");
							if (forumService.isReedUser(f.getBoardID(), f.getMainID(), us.getId())) {
								sb.append(messageSource.getMessage("post.hidden.needre0", null, request.getLocale()));
								sb.append("<br/>");

								sb.append(this.getAttachFile(f, sysConfig, true, request, us, true, messageSource));
							} else {
								sb.append(messageSource.getMessage("error.post.hidden.needre", null, request
										.getLocale()));
								if (f.getPreviewAttach() > 0) {
									sb.append("<br/>");
									sb.append(this.getPreviewAttachFile(f, sysConfig, true, request, us, true,
											messageSource));
								}
							}
						}
						if (f.getIsHidden() == 2) { // 金钱购买帖
							ForumService forumService = (ForumService) wc.getBean("forumService");
							ForumBuy fb = forumService.findForumBuyByPostIdFromId(f.getId(), us.getId());
							if (fb != null) { // 购买过或有直接查看隐藏帖权限
								sb.append(messageSource.getMessage("post.hidden.buy", null, request.getLocale()));
								sb.append("<br/>");
								sb.append(this.getAttachFile(f, sysConfig, true, request, us, true, messageSource));
							} else {
								sb.append(messageSource.getMessage("post.hidden.buy2", null, request.getLocale()));
								if (f.getPreviewAttach() > 0) {
									sb.append("<br/>");
									sb.append(this.getPreviewAttachFile(f, sysConfig, true, request, us, true,
											messageSource));
								}
							}
						}
						if (f.getIsHidden() == 3) { // 资历帖
							UserService userService = (UserService) wc.getBean("userService");
							UserInfoSimple uis = userService.getUserInfoSimple(us.getId());
							if (uis.getArticleNum() >= f.getIsHiddenValue()) {
								sb.append(messageSource.getMessage("post.hidden.artnum", null, request.getLocale()));
								sb.append("<br/>");
								sb.append(this.getAttachFile(f, sysConfig, true, request, us, true, messageSource));
							} else {
								sb.append(messageSource.getMessage("error.post.hidden.artnum", new String[] { String
										.valueOf(f.getIsHiddenValue()) }, request.getLocale()));
							}
						}

					}
				} else {
					sb.append(this.getAttachFile(f, sysConfig, true, request, us, true, messageSource));
				}
			} else {
				sb.append(messageSource.getMessage("error.post.upfile.notexist1", null, request.getLocale()));
			}
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("sign")) {
			if (StringUtils.isNotBlank(f.getSign())) {
				sb.append("<div id=\"sign");
				sb.append(f.getId());
				sb.append("\" class=\"");
				sb.append(this.getItemClass());
				sb.append("\">");
				sb.append(BBSCSUtil.filterText(f.getSign(), sysConfig.isSignUseHtml(), sysConfig.isSignUseUBB(),
						sysConfig.isSignUseSmile()));
				sb.append("</div>");
				this.write(writer, sb.toString());
			}
			return result;
		}
		if (type.equalsIgnoreCase("amend")) {
			if (StringUtils.isNotBlank(f.getAmend())) {
				sb.append("<div id=\"amend");
				sb.append(f.getId());
				sb.append("\">");
				sb.append("<br/>------<br/><font color=\"#0099CC\">");
				sb.append(f.getAmend());
				sb.append("</font>");
				sb.append("</div>");
				this.write(writer, sb.toString());
			}
			return result;
		}
		if (type.equalsIgnoreCase("delmsg")) {
			if (f.getDelSign() == 1) {
				sb.append("<div id=\"delmsg");
				sb.append(f.getId());
				sb.append("\">");
				sb.append("<br/><br/><font color=\"#0099CC\">");
				sb.append(messageSource.getMessage("forum.delmsg", new String[] { f.getDelUserName(),
						Util.formatDateTime(new Date(f.getDelTime())), f.getDelIP() }, request.getLocale()));
				sb.append("</font>");
				sb.append("</div>");
				this.write(writer, sb.toString());

			}
			return result;
		}

		if (type.equalsIgnoreCase("re") || type.equalsIgnoreCase("requote")) {
			Object forumCurrentPageObj = this.getStack().findValue(this.currentPageValue);
			int fcpage = 1;
			if (forumCurrentPageObj != null) {
				fcpage = ((Integer) forumCurrentPageObj).intValue();
			}

			long topicTotal = 0;
			Object topicTotalObj = this.getStack().findValue(this.totalnumValue);
			if (topicTotalObj != null) {
				topicTotal = ((Long) topicTotalObj).longValue();
			}
			String tagId = "0";
			Object tagIdObj = this.getStack().findValue(this.tagIdValue);
			if (tagIdObj != null) {
				tagId = (String) tagIdObj;
			}

			StringBuffer linksb = new StringBuffer();
			linksb.append("/post?action=");
			linksb.append(type);
			linksb.append("&bid=");
			linksb.append(f.getBoardID());
			linksb.append("&parentID=");
			linksb.append(f.getId());
			linksb.append("&mainID=");
			linksb.append(f.getMainID());
			// linksb.append("&page=");
			linksb.append("&fcpage=");
			linksb.append(fcpage);
			linksb.append("&totalnum=");
			linksb.append(topicTotal);
			linksb.append("&tagId=");
			linksb.append(tagId);
			// linksb.append(f.getTagID());
			sb.append("<a href=\"");
			sb.append(BBSCSUtil.getActionMappingURL(linksb.toString(), request));
			sb.append("\">");
			if (type.equalsIgnoreCase("re")) {
				sb.append(messageSource.getMessage("bbscs.re", null, request.getLocale()));
			} else {
				sb.append(messageSource.getMessage("bbscs.requote", null, request.getLocale()));
			}
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("sendnote")) {
			sb.append("<a href=\"javascript:;\" onclick=\"loadNoteSend('");
			sb.append(f.getId());
			sb.append("');\">");
			sb.append(messageSource.getMessage("pot.sendnote", null, request.getLocale()));
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("upfilepage")) {
			sb.append("<a href=\"javascript:;\" onclick=\"showUpfilePage('");
			sb.append(f.getBoardID());
			sb.append("','");
			sb.append(f.getId());
			sb.append("');\">");
			sb.append(messageSource.getMessage("post.upfile", null, request.getLocale()));
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("delattachpage")) {
			sb.append("<a href=\"javascript:;\" onclick=\"showDelAttachPage('");
			sb.append(f.getBoardID());
			sb.append("','");
			sb.append(f.getId());
			sb.append("');\">");
			sb.append(messageSource.getMessage("post.upfile.del", null, request.getLocale()));
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("movepage")) {
			sb.append("<a href=\"javascript:;\" onclick=\"showMovePage('");
			sb.append(f.getBoardID());
			sb.append("','");
			sb.append(f.getId());
			sb.append("');\">");
			sb.append(messageSource.getMessage("post.move.showpage", null, request.getLocale()));
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("upfileinpost")) {
			Object usObj = this.getStack().findValue("userSession");
			UserSession us = (UserSession) usObj;
			if (f.getHaveAttachFile() != 0 && f.getAttachFileName() != null && !f.getAttachFileName().isEmpty()) {
				sb.append(this.getAttachFile(f, sysConfig, true, request, us, false, messageSource));
			}
			this.write(writer, sb.toString());
			return result;
		}

		if (type.equalsIgnoreCase("voteinpost")) {
			VoteService voteService = (VoteService) wc.getBean("voteService");
			// System.out.println(f.getVoteID());
			Vote vote = voteService.findVoteByID(f.getVoteID());
			// System.out.println(vote);
			if (vote != null) {
				// System.out.println("Vote exist..");
				VoteItemService voteItemService = (VoteItemService) wc.getBean("voteItemService");
				List voteItems = voteItemService.findVoteItemsByVoteID(vote.getId());
				Configuration tempConfiguration = (Configuration) wc.getBean("tempConfiguration");
				try {
					tempConfiguration.setDirectoryForTemplateLoading(new File(Constant.ROOTPATH + Constant.FTL_PATH));
					tempConfiguration.setDefaultEncoding(Constant.CHARSET);
					tempConfiguration.setLocale(request.getLocale());
					tempConfiguration.setNumberFormat("0.##########");

					Map root = new HashMap();

					root.put("postid", f.getId());
					root.put("bid", Long.valueOf(f.getBoardID()));
					root.put("vote", vote);
					root.put("vis", voteItems);

					Template temp = tempConfiguration.getTemplate("voteInPost.ftl");
					this.write(writer, sb.toString());

					temp.process(root, writer);
					// writer.flush();
				} catch (TemplateException ex) {
					logger.error(ex);
				} catch (IOException ex) {
					logger.error(ex);
				}
			}
			return result;
		}

		if (type.equalsIgnoreCase("edit")) {
			Object forumCurrentPageObj = this.getStack().findValue(this.currentPageValue);
			int fcpage = 1;
			if (forumCurrentPageObj != null) {
				fcpage = ((Integer) forumCurrentPageObj).intValue();
			}

			int inpages = 1;
			Object inpagesObj = this.getStack().findValue(inPagesValue);
			if (inpagesObj != null) {
				inpages = ((Integer) inpagesObj).intValue();
			}

			String tagId = "0";
			Object tagIdObj = this.getStack().findValue(this.tagIdValue);
			if (tagIdObj != null) {
				tagId = (String) tagIdObj;
			}

			StringBuffer linksb = new StringBuffer();
			if (f.getIsVote() == 0) {
				linksb.append("/post?action=edit&");
			} else {
				linksb.append("/votePost?action=edit&");
			}
			linksb.append("id=");
			linksb.append(f.getId());
			linksb.append("&bid=");
			linksb.append(f.getBoardID());
			// linksb.append("&page=");
			linksb.append("&fcpage=");
			linksb.append(fcpage);
			linksb.append("&inpages=");
			linksb.append(inpages);
			linksb.append("&mainID=");
			linksb.append(f.getMainID());
			linksb.append("&tagId=");
			linksb.append(tagId);
			// linksb.append(f.getTagID());
			sb.append("<a href=\"");
			sb.append(BBSCSUtil.getActionMappingURL(linksb.toString(), request));
			sb.append("\">");
			sb.append(messageSource.getMessage("bbscs.change", null, request.getLocale()));
			sb.append("</a>");
			this.write(writer, sb.toString());
			return result;
		}
		if (type.equalsIgnoreCase("del")) {
			Object forumCurrentPageObj = this.getStack().findValue(this.currentPageValue);
			int fcpage = 1;
			if (forumCurrentPageObj != null) {
				fcpage = ((Integer) forumCurrentPageObj).intValue();
			}
			sb.append("<a href=\"javascript:;\" onclick=\"delapost('");
			sb.append(f.getBoardID());

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -