📄 msgmgr.java
字号:
try { p2u.getMsgAction().AddNew(application, request, md, fu); } catch (ErrMsgException e) { try { md.delTopic(md.getId(), true); } catch (ResKeyException e1) { logger.error("AddNewWE:" + e1.getMessage(request)); } throw e; } } } } if (re) { if (vplugin.size() > 0) { Iterator irplugin = vplugin.iterator(); while (irplugin.hasNext()) { PluginUnit pu = (PluginUnit) irplugin.next(); boolean isPlugin = false; if (pu.getType().equals(pu.TYPE_BOARD)) isPlugin = true; else if (pu.getType().equals(pu.TYPE_TOPIC) && pluginCode.equals(pu.getCode())) isPlugin = true; if (isPlugin) { IPluginMsgAction ipa = pu.getMsgAction(); try { re = ipa.AddNew(application, request, md, fu); } catch (ErrMsgException e) { try { md.delTopic(md.getId(), true); } catch (ResKeyException e1) { logger.error("AddNewWE:" + e1.getMessage(request)); } throw e; } } } } } if (re) { if (privilege.isUserLogin(request)) { ScoreMgr sm = new ScoreMgr(); Vector v = sm.getAllScore(); Iterator ir = v.iterator(); while (ir.hasNext()) { ScoreUnit su = (ScoreUnit) ir.next(); IPluginScore ips = su.getScore(); if (ips != null) ips.AddNew(application, request, md); } } } return true; } public String LoadString(HttpServletRequest request, String key) { return SkinUtil.LoadString(request, "res.forum.MsgMgr", key); } public boolean AddNew(ServletContext application, HttpServletRequest request) throws ErrMsgException { FileUpload fu = doUpload(application, request); String boardcode = StrUtil.getNullString(fu.getFieldValue("boardcode")); if (boardcode.equals("")) throw new ErrMsgException(LoadString(request, "err_need_board")); Leaf lf = new Leaf(); lf = lf.getLeaf(boardcode); if (lf == null || !lf.isLoaded()) throw new ErrMsgException(LoadString(request, "err_board_lost")); if (!privilege.canAddNew(request, boardcode, fu)) throw new ErrMsgException(SkinUtil.LoadString(request, SkinUtil.PVG_INVALID)); String pluginCode = StrUtil.getNullString(fu.getFieldValue("pluginCode")); String name; if (privilege.isUserLogin(request)) name = privilege.getUser(request); else name = ""; boolean re = false; MsgDb msgDb = new MsgDb(); try { re = msgDb.AddNew(application, request, name, fu); if (re) { id = msgDb.getId(); blog = msgDb.isBlog(); name = msgDb.getName(); } } catch (ResKeyException e) { throw new ErrMsgException(e.getMessage(request)); } if (re) { String plugin2Code = StrUtil.getNullString(fu.getFieldValue("plugin2Code")).trim(); if (!plugin2Code.equals("")) { Plugin2Mgr p2m = new Plugin2Mgr(); Plugin2Unit p2u = p2m.getPlugin2Unit(plugin2Code); if (p2u!=null) { try { p2u.getMsgAction().AddNew(application, request, msgDb, fu); } catch (ErrMsgException e) { try { msgDb.delTopic(msgDb.getId(), true); } catch (ResKeyException e1) { logger.error("AddNew:" + e1.getMessage(request)); } throw e; } } } } if (re) { PluginMgr pm = new PluginMgr(); Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode); if (vplugin.size() > 0) { Iterator irplugin = vplugin.iterator(); while (irplugin.hasNext()) { PluginUnit pu = (PluginUnit) irplugin.next(); IPluginMsgAction ipa = pu.getMsgAction(); boolean isPlugin = false; if (pu.getType().equals(pu.TYPE_BOARD)) isPlugin = true; else if (pu.getType().equals(pu.TYPE_TOPIC) && pluginCode.equals(pu.getCode())) isPlugin = true; if (isPlugin) { try { re = ipa.AddNew(application, request, msgDb, fu); } catch (ErrMsgException e) { try { msgDb.delTopic(msgDb.getId(), true); } catch (ResKeyException e1) { logger.error("AddNew:" + e1.getMessage(request)); } throw e; } } } } } if (re) { if (privilege.isUserLogin(request)) { ScoreMgr sm = new ScoreMgr(); Vector v = sm.getAllScore(); Iterator ir = v.iterator(); while (ir.hasNext()) { ScoreUnit su = (ScoreUnit) ir.next(); IPluginScore ips = su.getScore(); if (ips != null) ips.AddNew(application, request, msgDb); } } } return re; } public MsgDb getMsgDb(long id) { MsgDb md = new MsgDb(); return md.getMsgDb(id); } public boolean AddReply(ServletContext application, HttpServletRequest request) throws ErrMsgException { FileUpload fu = doUpload(application, request); String boardcode = StrUtil.getNullString(fu.getFieldValue("boardcode")); if (boardcode.equals("")) throw new ErrMsgException(LoadString(request, "err_need_board")); if (!privilege.canAddReply(request, boardcode, fu)) throw new ErrMsgException(SkinUtil.LoadString(request, SkinUtil.PVG_INVALID)); String name; if (privilege.isUserLogin(request)) name = privilege.getUser(request); else name = ""; boolean re = false; MsgDb msgDb = new MsgDb(); try { re = msgDb.AddReply(application, request, name, fu); } catch (ErrMsgException e) { throw e; } if (re) { id = msgDb.getId(); String pluginCode = StrUtil.getNullString(fu.getFieldValue("pluginCode")); PluginMgr pm = new PluginMgr(); Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode); if (vplugin.size() > 0) { Iterator irplugin = vplugin.iterator(); while (irplugin.hasNext()) { PluginUnit pu = (PluginUnit) irplugin.next(); boolean isPlugin = false; if (pu.getType().equals(pu.TYPE_BOARD)) isPlugin = true; else if (pu.getType().equals(pu.TYPE_TOPIC) && pluginCode.equals(pu.getCode())) isPlugin = true; if (isPlugin) { IPluginMsgAction ipa = pu.getMsgAction(); re = ipa.AddReply(application, request, msgDb, fu); } } } } if (re) { if (privilege.isUserLogin(request)) { ScoreMgr sm = new ScoreMgr(); Vector v = sm.getAllScore(); Iterator ir = v.iterator(); while (ir.hasNext()) { ScoreUnit su = (ScoreUnit) ir.next(); IPluginScore ips = su.getScore(); if (ips != null) ips.AddReply(application, request, msgDb); } } } return true; } public boolean AddReplyWE(ServletContext application, HttpServletRequest request) throws ErrMsgException { MultiFileUpload fu = (MultiFileUpload)doUpload(application, request); String boardcode = StrUtil.getNullString(fu.getFieldValue("boardcode")); if (boardcode.equals("")) throw new ErrMsgException(LoadString(request, "err_need_board")); if (!privilege.canAddReply(request, boardcode, fu)) throw new ErrMsgException(SkinUtil.LoadString(request, SkinUtil.PVG_INVALID)); String name; if (privilege.isUserLogin(request)) name = privilege.getUser(request); else name = ""; boolean re = false; MsgDb msgDb = new MsgDb(); try { re = msgDb.AddReplyWE(application, request, name, fu); } catch (ErrMsgException e) { throw e; } if (re) { id = msgDb.getId(); String pluginCode = StrUtil.getNullString(fu.getFieldValue("pluginCode")); PluginMgr pm = new PluginMgr(); Vector vplugin = pm.getAllPluginUnitOfBoard(boardcode); if (vplugin.size() > 0) { Iterator irplugin = vplugin.iterator(); while (irplugin.hasNext()) { PluginUnit pu = (PluginUnit) irplugin.next(); boolean isPlugin = false; if (pu.getType().equals(pu.TYPE_BOARD)) isPlugin = true; else if (pu.getType().equals(pu.TYPE_TOPIC) && pluginCode.equals(pu.getCode())) isPlugin = true; if (isPlugin) { IPluginMsgAction ipa = pu.getMsgAction(); re = ipa.AddReply(application, request, msgDb, fu); } } } } if (re) { if (privilege.isUserLogin(request)) { ScoreMgr sm = new ScoreMgr(); Vector v = sm.getAllScore(); Iterator ir = v.iterator(); while (ir.hasNext()) { ScoreUnit su = (ScoreUnit) ir.next(); IPluginScore ips = su.getScore(); if (ips != null) ips.AddReply(application, request, msgDb); } } } return true; } public boolean AddQuickReply(ServletContext application, HttpServletRequest request) throws ErrMsgException { long replyid = ParamUtil.getLong(request, "replyid"); MsgDb md = getMsgDb(replyid); if (!privilege.canAddQuickReply(request, md.getboardcode(), md)) throw new ErrMsgException(SkinUtil.LoadString(request, SkinUtil.PVG_INVALID)); String name; if (privilege.isUserLogin(request)) name = privilege.getUser(request); else name = ""; MsgDb msgDb = new MsgDb(); boolean re = msgDb.AddQuickReply(application, request, name); if (re) { id = msgDb.getId(); String pluginCode = ParamUtil.get(request, "pluginCode");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -