Author: fred
Date: 2007-08-13 17:07:49 +0000 (Mon, 13 Aug 2007)
New Revision: 14654

Modified:
   trunk/plugins/Echo/src/plugins/echo/NodesManager.java
   trunk/plugins/Echo/src/xml/edit.xsl
Log:
create the categories file if it doesnt exist

Modified: trunk/plugins/Echo/src/plugins/echo/NodesManager.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/NodesManager.java       2007-08-13 
17:01:40 UTC (rev 14653)
+++ trunk/plugins/Echo/src/plugins/echo/NodesManager.java       2007-08-13 
17:07:49 UTC (rev 14654)
@@ -44,12 +44,15 @@
                }

                categories = new HashMap<String, String> ();
-               Document categoriesDoc = parser.build(categoriesFile);
-               nu.xom.Nodes cats = categoriesDoc.query("//category");
-               for(int i=0; i < cats.size(); i++) {
-                       categories.put(((Element) 
cats.get(i)).getAttribute("id").getValue() , ((Element) 
cats.get(i)).getValue());
-               }
-
+               
+               if(categoriesFile.exists()) {
+                       Document categoriesDoc = parser.build(categoriesFile);
+                       nu.xom.Nodes cats = categoriesDoc.query("//category");
+                       for(int i=0; i < cats.size(); i++) {
+                               categories.put(((Element) 
cats.get(i)).getAttribute("id").getValue() , ((Element) 
cats.get(i)).getValue());
+                       }
+               } else 
+                       writeCategories();
        }

        public Node getNodeById(String nodeId) throws IOException, 
ParsingException {

Modified: trunk/plugins/Echo/src/xml/edit.xsl
===================================================================
--- trunk/plugins/Echo/src/xml/edit.xsl 2007-08-13 17:01:40 UTC (rev 14653)
+++ trunk/plugins/Echo/src/xml/edit.xsl 2007-08-13 17:07:49 UTC (rev 14654)
@@ -46,7 +46,7 @@
                                                <h1><xsl:value-of 
select="title/text()" /></h1>
                                                <xsl:apply-templates 
select="errors" />
                                                <xsl:apply-templates 
select="data" />
-                                               <div><xsl:copy-of 
select="/node()" /></div>
+<!--                                           <div><xsl:copy-of 
select="/node()" /></div> -->

                                        </div>
                                </div>
@@ -152,7 +152,7 @@
                                </table>
                                </xsl:when>
                                <xsl:otherwise>
-                                       You don't have any node, <a 
href="./new">create a new one</a>.
+                                       You don't have any node, <a 
href="./write">create a new one</a>.
                                </xsl:otherwise>
                                </xsl:choose>
                        </xsl:when>


Reply via email to