📄 read.java
字号:
return this.waste();
} else if (this.getAction().equalsIgnoreCase("auditing")) {
return this.auditing();
} else if (this.getAction().equalsIgnoreCase("auditingAttach")) {
return this.auditingAttach();
} else if (this.getAction().equalsIgnoreCase("elite")) {
return this.elite();
} else {
return ERROR;
}
}
public String topic() {
setUrlRewriteValue();
Pages pages = new Pages();
pages.setPage(this.getInpages());
pages.setPerPageNum(this.getUserPostPerNum(this.getUserCookie().getPostPerNum(), this.getSysConfig()
.getPostPerPage()));
// pages.setPerPageNum(1);
if (Constant.USE_URL_REWRITE) {
pages.setUseUrlRewrite(Constant.USE_URL_REWRITE);
pages.setFileName("read-" + this.getAction() + "-" + this.getBid() + "-" + this.getId() + "-"
+ this.getTagId() + "-" + this.getFcpage() + "-" + this.getFcaction() + "-{page}.html");
} else {
pages.setFileName(this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("read?action=" + this.getAction() + "&bid="
+ this.getBid() + "&id=" + this.getId() + "&fcpage=" + this.getFcpage() + "&fcaction="
+ this.getFcaction() + "&tagId=" + this.getTagId()));
}
this.setPageList(this.getForumService().findForumsTopic(this.getBid(), this.getId(), pages));
if (this.getPageList().getObjectList().isEmpty()) {
// this.addActionError(this.getText("error.post.getpost"));
// return ERROR;
return this.history();
}
this.pageTitle = "";
Forum f = (Forum) this.getPageList().getObjectList().get(0);
if (f.getIsNew() == 1) {
f.setClick(f.getClick() + 1);
try {
f = this.getForumService().updateForum(f);
if (f.getClick() == this.getSysConfig().getForumHotViews() && f.getIsHidden() == 0) {
UserInfo ui = this.getUserService().findUserInfoById(f.getUserID());
if (ui != null) {
ui.setLiterary(ui.getLiterary() + 1); // 增加用户文采值
this.getUserService().saveUserInfo(ui);
}
}
} catch (BbscsException ex) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
} else {
if (this.getInpages() == 1) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
}
this.pageTitle = f.getTitle();
this.setTotalnum(this.getPageList().getPages().getTotalNum());
this.setParentBoards();
this.setForumSiteInit();
return "read";
}
public String history() {
setUrlRewriteValue();
Pages pages = new Pages();
pages.setPage(this.getInpages());
pages.setPerPageNum(this.getUserPostPerNum(this.getUserCookie().getPostPerNum(), this.getSysConfig()
.getPostPerPage()));
// pages.setPerPageNum(1);
if (Constant.USE_URL_REWRITE) {
pages.setUseUrlRewrite(Constant.USE_URL_REWRITE);
pages.setFileName("read-" + this.getAction() + "-" + this.getBid() + "-" + this.getId() + "-"
+ this.getTagId() + "-" + this.getFcpage() + "-" + this.getFcaction() + "-{page}.html");
} else {
pages.setFileName(this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("read?action=" + this.getAction() + "&bid="
+ this.getBid() + "&id=" + this.getId() + "&fcpage=" + this.getFcpage() + "&fcaction="
+ this.getFcaction() + "&tagId=" + this.getTagId()));
}
this.setPageList(this.getForumHistoryService().findForumsTopic(this.getBid(), this.getId(), pages));
if (this.getPageList().getObjectList().isEmpty()) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.pageTitle = "";
Forum f = (Forum) this.getPageList().getObjectList().get(0);
if (f.getIsNew() == 1) {
/*
* f.setClick(f.getClick() + 1); try { f =
* this.getForumService().updateForum(f); if (f.getClick() ==
* this.getSysConfig().getForumHotViews()) { UserInfo ui =
* this.getUserService().findUserInfoById(f.getUserID()); if (ui !=
* null) { ui.setLiterary(ui.getLiterary() + 1); // 增加用户文采值
* this.getUserService().saveUserInfo(ui); } } } catch
* (BbscsException ex) {
* this.addActionError(this.getText("error.post.getpost")); return
* ERROR; }
*/
} else {
if (this.getInpages() == 1) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
}
this.pageTitle = f.getTitle();
this.setTotalnum(this.getPageList().getPages().getTotalNum());
this.setParentBoards();
this.setForumSiteInit();
return "readHistory";
}
public String own() {
setUrlRewriteValue();
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
Pages pages = new Pages();
pages.setPage(this.getInpages());
pages.setPerPageNum(this.getUserPostPerNum(this.getUserCookie().getPostPerNum(), this.getSysConfig()
.getPostPerPage()));
pages.setFileName(this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("read?action=" + this.getAction() + "&bid="
+ this.getBid() + "&id=" + this.getId() + "&fcpage=" + this.getFcpage() + "&fcaction="
+ this.getFcaction()));
this.setPageList(this.getForumService().findForumsOwner(this.getBid(), f.getUserID(), this.getId(), pages));
if (this.getPageList().getObjectList().size() == 0) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.pageTitle = f.getTitle();
this.setParentBoards();
this.setTotalnum(this.getPageList().getPages().getTotalNum());
this.setForumSiteInit();
return "read";
}
public String summary() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.setForum(f);
return "postSummary";
}
public String showip() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return RESULT_HTMLERROR;
}
this.setIpinfo(this.getText("post.showip", new String[] { f.getIpAddress(),
this.getIpSeeker().getCountry(f.getIpAddress()) }));
this.setForum(f);
return "postShowIpInfo";
}
public String summaryhistory() {
Forum f = this.getForumHistoryService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.setForum(f);
return "postSummary";
}
public String showiphistory() {
Forum f = this.getForumHistoryService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return RESULT_HTMLERROR;
}
this.setIpinfo(this.getText("post.showip", new String[] { f.getIpAddress(),
this.getIpSeeker().getCountry(f.getIpAddress()) }));
this.setForum(f);
return "postShowIpInfo";
}
public String showupfile() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return RESULT_HTMLERROR;
}
this.setForum(f);
return "showUpFileInPost";
}
public String attach() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.setForum(f);
return "showAttach";
}
public String showvote() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return RESULT_HTMLERROR;
}
this.setForum(f);
return "showVoteInPost";
}
public String waste() {
this.setTopicList(this.getForumService().findForumsTopicDel(this.getBid(), this.getMainid()));
return "readWaste";
}
public String auditing() {
this.setTopicList(this.getForumService().findForumsTopicAuditing(this.getBid(), this.getMainid()));
return "readAuditing";
}
public String auditingAttach() {
this.setTopicList(this.getForumService().findForumsTopicAuditingAttachFile(this.getBid(), this.getMainid()));
return "readAuditing";
}
public String elite() {
this.setEliteDirs(new ArrayList<Elite>());
Elite elite = this.getEliteService().findEliteByID(this.getEliteId());
if (elite != null) {
List pes = elite.getParentIDs();
for (int i = 0; i < pes.size(); i++) {
Elite pe = this.getEliteService().findEliteByID(((Long) pes.get(i)).longValue());
this.eliteDirs.add(pe);
}
this.eliteDirs.add(elite);
}
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.addActionError(this.getText("error.post.getpost"));
return ERROR;
}
this.setForum(f);
return "readElite";
}
private int getUserPostPerNum(int userNum, int sysNum) {
if (userNum == 0) {
return sysNum;
} else {
return userNum;
}
}
private void setParentBoards() {
this.setParentBoards(this.getBoardService().findBoardsInIDs(this.getBoard().getParentIDs()));
}
public long getTotalnum() {
return totalnum;
}
public void setTotalnum(long totalnum) {
this.totalnum = totalnum;
}
private void setForumSiteInit() {
String url = this.getSysConfig().getForumUrl();
if (url == null) {
url = "bbs.laoer.com";
} else if (url.startsWith("http://")) {
url = url.substring("http://".length(), url.length());
}
this.setForumSite(url);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -