|
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(); |