@Override public PortalDeployDefinition[] getPortalModules() { List<PortalDeployDefinition> moduleList = new ArrayList<PortalDeployDefinition>(); String dir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR; File f = new File(dir); File[] fs = f.listFiles(); for (int i = 0; i < fs.length; i++) { File mDir = fs[i]; if (mDir.isDirectory()) { File specDir = new File(mDir.getAbsolutePath() + "/portalspec"); if (specDir.exists() && specDir.isDirectory()) { File specFile = new File(specDir.getAbsolutePath() + "/portal.xml"); if (specFile.exists() && specFile.isFile()) { PortalDeployDefinition definition = parseModule(mDir.getAbsolutePath()); if (definition != null) moduleList.add(definition); } } } } try { return PortalModuleUtil.sortDefinition(moduleList); } catch (PortalServiceException e) { LfwLogger.info("Error:" + e.getMessage()); return new PortalDeployDefinition[0]; } }
@Override public void deploySkin(String projectModuleName) { try { new PtLookAndFeelDeploy().scanSkins(projectModuleName); } catch (PortalServiceException e) { LfwLogger.error(e.getMessage(), e); } }
@Override public PortalModule getPortal(String projectPath, String projectModuleName) { try { PortalModule pm = PortalModuleUtil.parsePortalModule( new File(getPortalSpecPath(projectPath, projectModuleName) + "/portal.xml")); return pm; } catch (PortalServiceException e) { LfwLogger.error(e.getMessage(), e); } return null; }
@Override public Page getPage(String projectPath, String projectModuleName, String PageName) { String filePath = getPortalSpecPath(projectPath, projectModuleName) + "/pml"; String fileName = PageName; File f = new File(filePath + "/" + fileName + ".pml"); try { return PmlUtil.parser(f); } catch (PortalServiceException e) { LfwLogger.error(e.getMessage(), e); return null; } }
@Override public void onDataLoad(DataLoadEvent se) { WebSession ses = getGlobalContext().getWebSession(); String cmd = (String) ses.getAttribute("cmd"); String pk_message = (String) ses.getAttribute("pk_message"); LfwWidget widget = getGlobalContext().getPageMeta().getWidget("main"); Dataset ds = widget.getViewModels().getDataset("msgds"); /** 初始化数据集 */ ds.setCurrentKey(Dataset.MASTER_KEY); Row row = ds.getEmptyRow(); ds.addRow(row); ds.setSelectedIndex(ds.getRowIndex(row)); ds.setEnabled(true); /** 撰写 */ if (cmd.equals("compose")) { return; } PtMessageVO vo = null; try { vo = PortalServiceUtil.getMessageQryService().getMessageByPK(pk_message); } catch (PortalServiceException e) { LfwLogger.error(e.getMessage(), e); } if (vo == null || vo.getPk_message() == null) return; /** 转发 */ if (cmd.equals("fwd")) { row.setString(ds.nameToIndex("title"), "转发:" + vo.getTitle()); row.setString(ds.nameToIndex("content"), vo.doGetContent()); } /** 回复 */ if (cmd.equals("reply")) { if (!MCConstant.PERSON_MESSAGE.equals(vo.getSystemcode())) throw new LfwRuntimeException("无法回复非私人信息!"); row.setString(ds.nameToIndex("title"), "回复:" + vo.getTitle()); row.setString(ds.nameToIndex("pk_user"), vo.getPk_sender()); row.setString(ds.nameToIndex("username"), vo.getSendername()); } }