📄 postopt.java
字号:
this.getText("error.post.top.seterror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_TOP_EXIST", this.getText("error.post.top.exist"));
}
} else {
if (f.getIsTop() != 0) {
f.setIsTop(0);
try {
this.getForumService().saveOrUpdateForum(f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.top.untop.ok"));
} catch (BbscsException ex3) {
this.getAjaxMessagesJson().setMessage("E_POST_TOP_SET_ERROR",
this.getText("error.post.top.unerror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_TOP_ISUNTOP", this.getText("error.post.top.untop"));
}
}
return RESULT_AJAXJSON;
}
public String cannotdel() {
return this.candelset(true);
}
public String candel() {
return this.candelset(false);
}
private String candelset(boolean yesno) {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (yesno) {
if (f.getCanNotDel() == 0) {
f.setCanNotDel(1);
try {
this.getForumService().saveOrUpdateForum(f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.cannotdel.setok"));
} catch (BbscsException ex4) {
this.getAjaxMessagesJson().setMessage("E_POST_CANNOTDEL_SET_ERROR",
this.getText("error.post.cannotdel.seterror"));
}
} else {
this.getAjaxMessagesJson()
.setMessage("E_POST_CANNOTDEL_EXIST", this.getText("error.post.notdel.exist"));
}
} else {
if (f.getCanNotDel() != 0) {
f.setCanNotDel(0);
try {
this.getForumService().saveOrUpdateForum(f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.uncannotdel.setok"));
} catch (BbscsException ex5) {
this.getAjaxMessagesJson().setMessage("E_POST_CANNOTDEL_SET_ERROR",
this.getText("error.post.cannotdel.unerror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_CANNOTDEL_ISUN", this.getText("error.post.iscandel"));
}
}
return RESULT_AJAXJSON;
}
public String commend() {
return this.commendset(true);
}
public String uncommend() {
return this.commendset(false);
}
private String commendset(boolean yesno) {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (yesno) {
if (f.getCommend() == 0) {
try {
this.getForumService().saveForumCommend(0, this.getBoard(), f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.commend.setok"));
} catch (BbscsException ex3) {
this.getAjaxMessagesJson().setMessage("E_POST_COMMEND_SET_ERROR",
this.getText("error.post.commend.seterror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_COMMEND_EXIST", this.getText("error.post.commend.exist"));
}
} else {
if (f.getCommend() != 0) {
try {
this.getForumService().saveForumCommend(1, this.getBoard(), f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.uncommend.setok"));
} catch (BbscsException ex3) {
this.getAjaxMessagesJson().setMessage("E_POST_COMMEND_SET_ERROR",
this.getText("error.post.commend.unerror"));
}
} else {
this.getAjaxMessagesJson()
.setMessage("E_POST_COMMEND_ISUN", this.getText("error.post.uncommend.exist"));
}
}
return RESULT_AJAXJSON;
}
public String lock() {
return this.lockset(true);
}
public String unlock() {
return this.lockset(false);
}
private String lockset(boolean yesno) {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (yesno) {
if (f.getIsLock() == 0) {
f.setIsLock(1);
try {
this.getForumService().saveOrUpdateForum(f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.lock.setok"));
} catch (BbscsException ex3) {
this.getAjaxMessagesJson().setMessage("E_POST_LOCK_SET_ERROR",
this.getText("error.post.lock.seterror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_LOCK_EXIST", this.getText("error.post.lock.exist"));
}
} else {
if (f.getIsLock() != 0) {
f.setIsLock(0);
try {
this.getForumService().saveOrUpdateForum(f);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.unlock.setok"));
} catch (BbscsException ex3) {
this.getAjaxMessagesJson().setMessage("E_POST_LOCK_SET_ERROR",
this.getText("error.post.lock.unerror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_LOCK_ISUN", this.getText("error.post.unlock.exist"));
}
}
return RESULT_AJAXJSON;
}
public String elite() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (f.getElite() == 0) {
f.setElite(this.getBid());
f.setDoEliteName(this.getUserSession().getUserName());
f.setDoEliteTime(System.currentTimeMillis());
UserInfo ui = this.getUserService().findUserInfoById(f.getUserID());
if (ui == null) {
this.getAjaxMessagesJson().setMessage("E_USER_NOEXIST", this.getText("error.getuser"));
return RESULT_AJAXJSON;
}
try {
this.getForumService().savePostElite(f, ui);
this.getAjaxMessagesJson().setMessage("0", this.getText("post.elite.setok"));
} catch (BbscsException ex6) {
this.getAjaxMessagesJson().setMessage("E_POST_ELITE_SET_ERROR", this.getText("post.elite.seterror"));
}
} else {
this.getAjaxMessagesJson().setMessage("E_POST_ELITE_EXIST", this.getText("post.elite.isexist"));
}
return RESULT_AJAXJSON;
}
@SuppressWarnings("unchecked")
public String mailsend() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (StringUtils.isNotBlank(this.getUserSession().getEmail()) && this.getSysConfig().getUseEmail() == 1) {
try {
String detail = "";
if (f.getIsHidden() != 0) {
detail = this.getText("post.hidden.notmailsend");
} else {
detail = this.getForumService().getForumDetail(f, false);
if (f.getEditType() == 0) {
detail = BBSCSUtil.filterText(detail, (this.getBoard().getAllowHTML() == 1), (this.getBoard()
.getAllowUBB() == 1), true);
} // else {detail = f.getDetail();}
}
String url = this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("main?action=read&bid=" + this.getBoard().getId()
+ "&postID=" + f.getMainID());
Map root = new HashMap();
root.put("website", this.getSysConfig().getForumName());
root.put("title", f.getTitle());
root.put("detail", detail);
root.put("url", url);
this.getTemplateMail().sendMailFromTemplate(this.getUserSession().getEmail(), f.getTitle(),
"mailSend.ftl", root, this.getLocale());
this.getAjaxMessagesJson().setMessage("0", this.getText("post.mailsend.ok"));
} catch (Exception ex7) {
ex7.printStackTrace();
this.getAjaxMessagesJson().setMessage("E_POST_MAILSEND_ERROR", this.getText("post.mailsend.error"));
}
return RESULT_AJAXJSON;
} else {
this.getAjaxMessagesJson().setMessage("E_POST_MAILSEND_ERROR", this.getText("post.mailsend.error"));
return RESULT_AJAXJSON;
}
}
@SuppressWarnings("unchecked")
public String mailsendtopic() {
OrderObj[] oo = { new OrderObj("postTime", Constant.ORDER_ASC) };
List l = this.getForumService().findForumsTopicAll(this.getBid(), this.getMainid(), 0, 0, oo);
if (l == null || l.isEmpty()) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (StringUtils.isNotBlank(this.getUserSession().getEmail()) && this.getSysConfig().getUseEmail() == 1) {
try {
String detail = "";
Forum mainForum = (Forum) l.get(0);
List<Forum> nl = new ArrayList<Forum>();
for (int i = 0; i < l.size(); i++) {
Forum f = (Forum) l.get(i);
if (f.getIsHidden() != 0) {
detail = this.getText("post.hidden.notmailsend");
} else {
detail = this.getForumService().getForumDetail(f, false);
if (f.getEditType() == 0) {
f.setDetail(BBSCSUtil.filterText(detail, (this.getBoard().getAllowHTML() == 1), (this
.getBoard().getAllowUBB() == 1), true));
} else {
f.setDetail(detail);
}
}
nl.add(f);
}
String url = this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("main?action=read&bid=" + this.getBoard().getId()
+ "&postID=" + this.getMainid());
Map root = new HashMap();
root.put("website", this.getSysConfig().getForumName());
root.put("nl", nl);
root.put("url", url);
this.getTemplateMail().sendMailFromTemplate(this.getUserSession().getEmail(), mainForum.getTitle(),
"mailSendTopic.ftl", root, this.getLocale());
this.getAjaxMessagesJson().setMessage("0", this.getText("post.mailsend.ok"));
} catch (Exception ex8) {
ex8.printStackTrace();
this.getAjaxMessagesJson().setMessage("E_POST_MAILSEND_ERROR", this.getText("post.mailsend.error"));
}
return RESULT_AJAXJSON;
} else {
this.getAjaxMessagesJson().setMessage("E_POST_MAILSEND_ERROR", this.getText("post.mailsend.error"));
return RESULT_AJAXJSON;
}
}
@SuppressWarnings("unchecked")
public String report() {
Forum f = this.getForumService().findForumByID(this.getId(), this.getBid());
if (f == null) {
this.getAjaxMessagesJson().setMessage("E_POST_NOT_EXIST", this.getText("error.post.getpost"));
return RESULT_AJAXJSON;
}
if (this.getSysConfig().getUseEmail() == 1) {
try {
String title = this.getText("post.report.msg", new String[] { this.getUserSession().getUserName(),
this.getBoard().getBoardName(), f.getTitle() });
String detail = "";
detail = this.getForumService().getForumDetail(f, false);
if (f.getEditType() == 0) {
detail = BBSCSUtil.filterText(detail, (this.getBoard().getAllowHTML() == 1), (this.getBoard()
.getAllowUBB() == 1), true);
} // else { detail = f.getDetail(); }
String url = this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("main?action=read&bid=" + this.getBoard().getId()
+ "&postID=" + f.getMainID());
Map root = new HashMap();
root.put("userName", this.getUserSession().getUserName());
root.put("title", f.getTitle());
root.put("detail", detail);
root.put("url", url);
this.getTemplateMail().sendMailFromTemplate(this.getSysConfig().getWebmasterEmail(), title,
"report.ftl", root, this.getLocale());
this.getAjaxMessagesJson().setMessage("0", this.getText("post.report.ok"));
} catch (Exception ex7) {
ex7.printStackTrace();
this.getAjaxMessagesJson().setMessage("E_POST_REPORT_ERROR", this.getText("error.post.report.error"));
}
return RESULT_AJAXJSON;
} else {
this.getAjaxMessagesJson().setMessage("E_POST_REPORT_ERROR", this.getText("error.post.report.error"));
return RESULT_AJAXJSON;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -