|
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()); + } } |
|
From: Michael K. <ko...@us...> - 2006-02-02 11:39:39
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30653/wiki Modified Files: Utility.java Log Message: Index: Utility.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki/Utility.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Utility.java 1 Feb 2006 20:37:38 -0000 1.4 +++ Utility.java 2 Feb 2006 11:39:26 -0000 1.5 @@ -172,7 +172,7 @@ String tmpParse = toParse; - /* ATENTION: The Methods must be called in the right sequence!! + /* ATTENTION: The Methods must be called in the right sequence!! * 1. initialize() * 2. deleteNowikiElements(String) * 3. parseSearchToken(tmpParse) |
|
From: Alexander G. <gaf...@us...> - 2006-02-02 17:10:41
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31300/src/org/cobricks/portal/wiki Modified Files: Utility.java Log Message: Index: Utility.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/portal/wiki/Utility.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Utility.java 2 Feb 2006 11:39:26 -0000 1.5 +++ Utility.java 2 Feb 2006 17:10:29 -0000 1.6 @@ -36,18 +36,6 @@ //Default ending of a file private final static String DEFAULTENDING = "html"; -// private final static String ITEMID = "%ITEMID%"; -// private final static String LANG = "%LANG%"; - - //Link to edit the page - the itemid must be replaced -// private final static String EDITLINK = "<a href=\"portal/edit.html?itemid="+ -// ITEMID+"\">Edit</a>"; - - //Link to history of the page -// private final static String HISTORYLINK = "<a href=\"" + -// "portal/historywiki.html?" + -// "itemid="+ITEMID+"&lang="+LANG+"\">History</a>"; - //Indicate the begin of the text, that will not be changed private final static String BEGINNOWIKITEXT = "<nowiki>"; //Indicate the end of the text, that will not be changed @@ -94,7 +82,7 @@ /** * Initialize the lists with the strings to search in the parse Sting. */ - private static void initialize() { + static { //Text formatting String[] searchTokenTmp = {"'''''", "'''", "''", "===", "=="}; @@ -154,9 +142,6 @@ searchToken = searchTokenTmp; searchTokenWholeLine = searchTokenWholeLineTmp; - - //Initialize the properties - loadProperties(); } /** @@ -173,19 +158,15 @@ String tmpParse = toParse; /* ATTENTION: The Methods must be called in the right sequence!! - * 1. initialize() - * 2. deleteNowikiElements(String) - * 3. parseSearchToken(tmpParse) - * 4. parseSearchTokenWholeLine(tmpParse) - * 5. parseImages(tmpParse) - * 6. parseShortLinks(tmpParse); - * 7. parseLinks(tmpParse) - * 8. insertNowikiElements(tmpParse) + * 1. deleteNowikiElements(String) + * 2. parseSearchToken(tmpParse) + * 3. parseSearchTokenWholeLine(tmpParse) + * 4. parseImages(tmpParse) + * 5. parseShortLinks(tmpParse); + * 6. parseLinks(tmpParse) + * 7. insertNowikiElements(tmpParse) * * */ - - //initialize the search tokens - initialize(); /* delete the elementes, which should not be parsed -> the elements must * be inserted with the method insertNowikiElements(String) @@ -663,11 +644,9 @@ */ private static String parseShortLinks(String toParse) { - if(toParse == null) + if((toParse == null) || (properties == null)) return toParse; - loadProperties(); - StringBuffer tmpToParse = new StringBuffer(toParse); Map abbreviations = getLinkAbbreviations(); @@ -836,14 +815,17 @@ /** * Load the porperties from the property file in 'org.cobrcks.portal'. */ - private static void loadProperties() { - if(properties == null) { - properties = new Properties(); - CoreManager coreManager = new CoreManager(); - - PropertiesUtil.loadPropertiesResource("org.cobricks.portal", - "properties.txt", properties, coreManager); - } +// private static void loadProperties() { +// if(properties == null) { +// properties = new Properties(); +// CoreManager coreManager = new CoreManager(); +// +// PropertiesUtil.loadPropertiesResource("org.cobricks.portal", +// "properties.txt", properties, coreManager); +// } +// } + public static void setProperties(Properties prop) { + properties = prop; } /** @@ -852,7 +834,9 @@ * @return Map with the link abbreviations and the whole link. */ public static Map getLinkAbbreviations() { - loadProperties(); +// loadProperties(); + if(properties == null) + return null; Map linkMap = new HashMap(); |