|
From: Alexander G. <gaf...@us...> - 2006-01-18 22:06:47
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6500/src/org/cobricks/portal/wiki Modified Files: Utility.java Log Message: pageheaderwiki and pagefooterwiki added Index: Utility.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki/Utility.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Utility.java 16 Jan 2006 09:23:28 -0000 1.1 +++ Utility.java 18 Jan 2006 22:06:37 -0000 1.2 @@ -14,6 +14,10 @@ import java.util.Map; import java.util.HashMap; +import java.util.Properties; + +import org.cobricks.core.CoreManager; +import org.cobricks.core.util.PropertiesUtil; /** * Makes some functionality available to parse the wiki pages. It translate @@ -72,6 +76,9 @@ //delete this token private static String[] deleteToken = null; + + //Read porperties from property file + private static Properties properties = new Properties(); /** * Initialize the lists with the strings to search in the parse Sting. */ @@ -135,6 +142,9 @@ searchToken = searchTokenTmp; searchTokenWholeLine = searchTokenWholeLineTmp; + + //Initialize the properties + loadProperties(); } /** @@ -187,6 +197,17 @@ */ tmpParse = insertNowikiElements(tmpParse); + + //Insert the pageheader and pagefooter + String pageheaderwiki = properties.getProperty("portal.pageheaderwiki"); + String pagefooterwiki = properties.getProperty("portal.pagefooterwiki"); + + if((pageheaderwiki != null) && (!pageheaderwiki.equals(""))) + tmpParse = pageheaderwiki + ENDOFLINE + tmpParse; + + if((pagefooterwiki != null) && (!pagefooterwiki.equals(""))) + tmpParse = tmpParse + pagefooterwiki + ENDOFLINE; + return tmpParse; } @@ -273,11 +294,13 @@ tmpStringBuffer = tmpStringBuffer.replace( endPosition, endPosition+ENDOFLINE.length(), - (String)exchangeTokenMap.get(tmpEndToken)); + (String)exchangeTokenMap.get(tmpEndToken) + + ENDOFLINE); } else { tmpStringBuffer = tmpStringBuffer.insert( tmpStringBuffer.length(), - (String)exchangeTokenMap.get(tmpEndToken)); + (String)exchangeTokenMap.get(tmpEndToken)+ + ENDOFLINE); } } @@ -809,4 +832,12 @@ return tmp.toString(); } + + /** + * Load the porperties from the property file in 'org.cobrcks.portal'. + */ + private static void loadProperties() { + PropertiesUtil.loadPropertiesResource("org.cobricks.portal", + "properties.txt", properties, new CoreManager()); + } } |