⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bbsconfigoper.java

📁 tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package biz.tbuy.bbs;import biz.tbuy.common.ComApplication;import biz.tbuy.common.logs.Elog;import biz.tbuy.share.XmlOper;import java.util.HashMap;import java.util.Map;import org.w3c.dom.Document;import org.w3c.dom.Element;/** * * @author Administrator */public class BBSConfigOper {        public BBSConfigOper() {}        // -------------------------------------------------- configOper display    /**     * 关于BBS全局“开关”信息的装载, 全局的配置信息包括以下各项:<br>     * displays.get("face") <br/>     * displays.get("bgsound") <br/>     * displays.get("signable") <br/>     * displays.get("rss") <br/>     * displays.get("articleSearch") <br/>     * displays.get("showArticleInfo") <br/>     * displays.get("showMemberInfo") <br/>     * displays.get("showFriendLink") <br/>     * @return displays     */    public Map<String, Boolean> loadDisplay() {        Map<String, Boolean> displays = new HashMap<String, Boolean>(8);        try {            Document doc = XmlOper.getDocument(getAppConfig());            Element root = doc.getDocumentElement();            Element display = (Element) root.                    getElementsByTagName("display").item(0);            Boolean face = Boolean.valueOf(display.                    getElementsByTagName("face").item(0).getTextContent().trim());            Boolean bgsound = Boolean.valueOf(display.                    getElementsByTagName("bgsound").item(0).getTextContent().trim());            Boolean signable = Boolean.valueOf(display.                    getElementsByTagName("signable").item(0).getTextContent().trim());            Boolean rss = Boolean.valueOf(display.                    getElementsByTagName("rss").item(0).getTextContent().trim());            Boolean articleSearch = Boolean.valueOf(display.                    getElementsByTagName("article-search").item(0).getTextContent().trim());            Boolean showArticleInfo = Boolean.valueOf(display.                    getElementsByTagName("show-article-info").item(0).getTextContent().trim());            Boolean showMemberInfo = Boolean.valueOf(display.                    getElementsByTagName("show-member-info").item(0).getTextContent().trim());            Boolean showFriendLink = Boolean.valueOf(display.                    getElementsByTagName("show-friend-link").item(0).getTextContent().trim());            displays.put("face", face);            displays.put("bgsound", bgsound);            displays.put("signable", signable);            displays.put("rss", rss);            displays.put("articleSearch", articleSearch);            displays.put("showArticleInfo", showArticleInfo);            displays.put("showMemberInfo", showMemberInfo);            displays.put("showFriendLink", showFriendLink);        } catch (Exception e) {            Elog.log("Exception:BBSConfigOper:loadDisplay:" + e.getMessage());        }        return displays;    }        /**     * 更新BBS“开关”信息!参数displays的keys应该是这些<br>     * face|bgsound|signable|rss|articleSearch|     * showArticleInfo|showMemberInfo|showFriendLink     * @param displays Map类型     */     public void updateDisplay(Map<String, Boolean> displays) {        Boolean face = displays.get("face");        Boolean bgsound = displays.get("bgsound");        Boolean signable = displays.get("signable");        Boolean rss = displays.get("rss");        Boolean articleSearch = displays.get("articleSearch");        Boolean showArticleInfo = displays.get("showArticleInfo");        Boolean showMemberInfo = displays.get("showMemberInfo");        Boolean showFriendLink = displays.get("showFriendLink");        try {            Document doc = XmlOper.getDocument(getAppConfig());            Element root = doc.getDocumentElement();            Element dis = (Element)root.getElementsByTagName("display").item(0);            if (face != null) dis.getElementsByTagName("face").                    item(0).setTextContent(String.valueOf(face));            if (bgsound != null) dis.getElementsByTagName("bgsound").                    item(0).setTextContent(String.valueOf(bgsound));            if (signable != null) dis.getElementsByTagName("signable").                    item(0).setTextContent(String.valueOf(signable));            if (rss != null) dis.getElementsByTagName("rss").                    item(0).setTextContent(String.valueOf(rss));            if (articleSearch != null) dis.getElementsByTagName("article-search").                    item(0).setTextContent(String.valueOf(articleSearch));            if (showArticleInfo != null) dis.getElementsByTagName("show-article-info").                    item(0).setTextContent(String.valueOf(showArticleInfo));            if (showMemberInfo != null) dis.getElementsByTagName("show-member-info").                    item(0).setTextContent(String.valueOf(showMemberInfo));            if (showFriendLink != null) dis.getElementsByTagName("show-friend-link").                    item(0).setTextContent(String.valueOf(showFriendLink));            XmlOper.saveDocument(doc, getAppConfig());        } catch (Exception e) {            Elog.log("Exception:BBSConfigOper:updateDisplay:" + e.getMessage());        }    }        /**     * 获取全局配置文件的绝对路径     * @return appConfig     */    private String getAppConfig() {        return ComApplication.getInstance().getServletContextPath()                 + BBSGroups.PATH_APPCONFIG;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -