📄 infoviewshowmsg.java
字号:
package com.redmoon.forum.plugin.info;import javax.servlet.http.HttpServletRequest;import com.redmoon.forum.MsgDb;import com.redmoon.forum.plugin.base.IPluginViewShowMsg;import com.redmoon.forum.plugin.base.UIShowMsg;import cn.js.fan.util.StrUtil;import com.redmoon.forum.Privilege;import com.redmoon.forum.person.UserMgr;import javax.servlet.jsp.JspWriter;import javax.servlet.http.HttpServletResponse;import javax.servlet.RequestDispatcher;import com.cloudwebsoft.framework.servlet.ServletResponseWrapperInclude;import com.cloudwebsoft.framework.util.LogUtil;public class InfoViewShowMsg implements IPluginViewShowMsg { HttpServletRequest request; HttpServletResponse response; JspWriter out; boolean isRoot = false; public InfoViewShowMsg(HttpServletRequest request, HttpServletResponse response, JspWriter out, String boardCode, MsgDb msgDb) { this.request = request; this.response = response; this.out = out; this.msgDb = msgDb; this.boardCode = boardCode; if (msgDb.getReplyid()==-1) isRoot = true; } public String getShowtopicSql(HttpServletRequest request, MsgDb rootMsgDb, String userId) { return ""; } public String getQuickReplyFormElement() { String str = ""; return ""; } public String getQucikReplyNote() { String str = ""; String username = Privilege.getUser(request); if (username.equals(msgDb.getName())) str = InfoSkin.LoadString(request, "LABEL_NOTE_OWNER"); else { } return str; } public String getNote() { UserMgr um = new UserMgr(); String str = InfoSkin.LoadString(request, "LABEL_MSG_OWNER") + "<a href='../userinfo.jsp?username=" + StrUtil.UrlEncode(msgDb.getName()) + "'>" + um.getUser(msgDb.getName()).getNick() + "</a>"; String relativePath = "plugin/info/inc_slidemenu.jsp?pageUrl=" + StrUtil. UrlEncode("forum/listtopic.jsp?boardcode=" + StrUtil.UrlEncode(boardCode) + "&pluginCode=" + InfoUnit.code + "&typeCode="); try { RequestDispatcher rd = request.getRequestDispatcher( relativePath); rd.include(request, new ServletResponseWrapperInclude(response, out)); } catch (Exception e) { LogUtil.getLog(getClass()).error("render:" + e.getMessage()); } return str; } public String render(int position) { String str = ""; switch (position) { case UIShowMsg.POS_NOTE: str = getNote(); break; case UIShowMsg.POS_BEFORE_MSG: String skinCode = "default"; String skinPath = InfoSkin.getSkinPath(skinCode); if (isRoot) { InfoDb infoDb = new InfoDb(); infoDb = infoDb.getInfoDb(msgDb.getId()); str += infoDb.getTypeName() + "<BR>"; } break; case UIShowMsg.POS_QUICK_REPLY_NOTE: str = getQucikReplyNote(); break; case UIShowMsg.POS_QUICK_REPLY_ELEMENT: str = getQuickReplyFormElement(); break; default: } return str; } public void setBoardCode(String boardCode) { this.boardCode = boardCode; } public void setMsgDb(MsgDb msgDb) { this.msgDb = msgDb; } public String getBoardCode() { return boardCode; } public MsgDb getMsgDb() { return msgDb; } public boolean IsPluginBoard() { InfoUnit iu = new InfoUnit(); return iu.isPluginBoard(boardCode); } public String LoadString(String key) { return InfoSkin.LoadString(request, key); } private String boardCode; private MsgDb msgDb;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -