[Yanel-commits] rev 29120 - in public/yanel/trunk/src: contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources contributions/resources/contact-form/src/java/org/wyona/yanel/impl/resources contributions/resources/resource-creator/htdocs/css contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources core/java/org/wyona/yanel/core/api/attributes resources/directory/src/java/org/wyona/yanel/impl/resources/collection resources/file/src/java/org/wyona/yanel/impl/resources/node resources/xml/src/java/org/wyona/yanel/impl/resources

josias at wyona.com josias at wyona.com
Thu Nov 22 09:34:10 CET 2007


Author: josias
Date: 2007-11-22 09:34:09 +0100 (Thu, 22 Nov 2007)
New Revision: 29120

Modified:
   public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
   public/yanel/trunk/src/contributions/resources/contact-form/src/java/org/wyona/yanel/impl/resources/ContactResource.java
   public/yanel/trunk/src/contributions/resources/resource-creator/htdocs/css/resource-creator.css
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
   public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
   public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java
   public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java
   public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
   public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
allow a resource to override the name of a newly created resource. fixes bug #5465, thanks to simon

Modified: public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/calendar/src/java/org/wyona/yanel/impl/resources/CalendarResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -120,7 +120,7 @@
                 InputStream in = dataRepo.getInputStream(children[i]);
                 java.io.ByteArrayOutputStream baos  = new java.io.ByteArrayOutputStream();
                 //StringBuffer event = new StringBuffer();
-            
+
                 byte[] buffer = new byte[8192];
                 int bytesRead;
                 while ((bytesRead = in.read(buffer)) != -1) {
@@ -133,7 +133,7 @@
                 if (endOfProcessingInstruction > 0) {
                     calendar.append(event.toString().substring(endOfProcessingInstruction + 2));
                 } else {
-                    log.error("No processing instruction: " + children[i]);            
+                    log.error("No processing instruction: " + children[i]);
                 }
             }
         }
@@ -296,6 +296,10 @@
         return map;
     }
 
+    public String getCreateName(String suggestedName) {
+        return suggestedName;
+    }
+
     /**
      *
      */

Modified: public/yanel/trunk/src/contributions/resources/contact-form/src/java/org/wyona/yanel/impl/resources/ContactResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/contact-form/src/java/org/wyona/yanel/impl/resources/ContactResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/contact-form/src/java/org/wyona/yanel/impl/resources/ContactResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -72,7 +72,7 @@
 ;
 
 /**
- * 
+ *
  */
 public class ContactResource extends Resource implements ViewableV1, CreatableV2 {
 
@@ -87,7 +87,7 @@
     private ContactBean contact = null;
     private String defaultLanguage = "en";
     private String messageBundle = "contact-form";
-    
+
     private HashMap properties = new HashMap();
     private Repository repository  = null;
     private RepoPath rp = null;
@@ -95,29 +95,29 @@
     private String language = null;
 
     private String defaultEmailRegEx = "(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*";
-    
+
     /**
-     * 
+     *
      */
     public ContactResource() {
     }
 
     /**
-     * 
+     *
      */
     public ViewDescriptor[] getViewDescriptors() {
         return null;
     }
-    
+
     /**
-     * 
+     *
      */
     public View getView(Path path, String viewId) {
         return null;
     }
 
     /**
-     * 
+     *
      */
     public View getView(HttpServletRequest request, String viewId)
             throws Exception {
@@ -134,24 +134,24 @@
             log.debug("language param is empty or null : " + language);
             language = defaultLanguage;
         }
-        File xmlFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xml" + File.separator + "contact-form.xml");        
+        File xmlFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xml" + File.separator + "contact-form.xml");
         try {
-            
+
             // create reader:
             XMLReader xmlReader = XMLReaderFactory.createXMLReader();
             CatalogResolver catalogResolver = new CatalogResolver();
             xmlReader.setEntityResolver(catalogResolver);
-            
+
             // create Body xslt transformer:
             SAXTransformerFactory tf = (SAXTransformerFactory)TransformerFactory.newInstance();
 
             TransformerHandler xsltHandler1 = tf.newTransformerHandler(getBodyXSLTStreamSource());
             Transformer transformer = xsltHandler1.getTransformer();
-            
+
             boolean submit = false;
             Enumeration enumeration = request.getParameterNames();
             while(enumeration.hasMoreElements()){
-                if(enumeration.nextElement().toString().equals("email")) 
+                if(enumeration.nextElement().toString().equals("email"))
                     submit = true;
             }   
             if(submit) {
@@ -166,7 +166,7 @@
                     if (request.getParameter("message") != null) transformer.setParameter("message", request.getParameter("message"));
                 }
             }
-            
+
             // create xslt transformer for global layout
             TransformerHandler xsltHandler2 = tf.newTransformerHandler(getGlobalXSLTStreamSource(path));
             transformer = xsltHandler2.getTransformer();
@@ -179,15 +179,15 @@
             XIncludeTransformer xIncludeTransformer = new XIncludeTransformer();
             ResourceResolver resolver = new ResourceResolver(this);
             xIncludeTransformer.setResolver(resolver);
-            
+
             // create i18n transformer:
             String[] messageBundles = new String[2];
             messageBundles[0] = messageBundle;
             messageBundles[1] = "global";
-            
+
             I18nTransformer2 i18nTransformer = new I18nTransformer2(messageBundles, language, getRealm().getDefaultLanguage());
             i18nTransformer.setEntityResolver(catalogResolver);
-            
+
             // create serializer:
             Serializer serializer = SerializerFactory.getSerializer(SerializerFactory.XHTML_STRICT);
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -199,7 +199,7 @@
             xIncludeTransformer.setResult(new SAXResult(i18nTransformer));
             i18nTransformer.setResult(new SAXResult(serializer.asContentHandler()));
             serializer.setOutputStream(baos);
-            
+
             // execute pipeline:
             xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
 
@@ -208,7 +208,7 @@
             defaultView.setMimeType(getMimeType());
             defaultView.setInputStream(new ByteArrayInputStream(baos.toByteArray()));
             return defaultView;
-            
+
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             throw e;
@@ -238,17 +238,20 @@
        // TODO: Do not hardcode xslt ...
        map.put("#xslt", "/xslt/global.xsl");
        // TODO: Make mime-type configurable (depending on global XSLT) ...
-       map.put("mime-type", "application/xhtml+xml");       
+       map.put("mime-type", "application/xhtml+xml");
        map.put("smtpHost",request.getParameter("rp.smtpHost"));
        map.put("smtpPort",request.getParameter("rp.smtpPort"));
        map.put("to",request.getParameter("rp.to"));
        map.put("subject", request.getParameter("rp.subject"));
-       
+
        return map;
    }
 
+   public String getCreateName(String suggestedName) {
+       return suggestedName;
+   }
    /**
-     * 
+     *
      */
    public String[] getPropertyNames() {
        String[] propertyNames = (String[])properties.keySet().toArray(new String[properties.keySet().size()]);
@@ -256,14 +259,14 @@
    }
 
    /**
-    * 
+    *
     */
    public void setProperty(String name, Object value){
        properties.put(name, value);
    }
 
    /**
-    * 
+    *
     */
    public Object getProperty(String name){
        Object property = properties.get(name);
@@ -271,9 +274,9 @@
    }
 
 
-    
+
     /**
-     * 
+     *
      * @param request
      * @param transformer
      */
@@ -311,7 +314,7 @@
 	    if (contact.getCity() != null) content = content + "City: " + contact.getCity() + "\n";
 	    if (contact.getEmail() != null) content = content + "E-Mail: " + contact.getEmail() + "\n" + "\n";
             if (contact.message != null) content = content + "Message:\n" + contact.message;
-            
+
             if(smtpHost != null && smtpPort != 0 && to != null) {
                 try {
                     SendMail.send(smtpHost, smtpPort, from, to, subject, content);
@@ -331,7 +334,7 @@
             }
         }
     }
-    
+
     /**
      * this method checks if the specified email is valid against a regular expression
      * @param email
@@ -342,9 +345,9 @@
         Matcher matcher = pattern.matcher(email);
         return matcher.find();
     }
-    
+
     /**
-     * 
+     *
      * @param path
      * @return
      * @throws Exception
@@ -353,7 +356,7 @@
         return new YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(
                 path.toString()), getRepositoryFactory());
     }
-    
+
     /**
      * Get global XSLT
      * @param path
@@ -368,7 +371,7 @@
             return new StreamSource(xsltFile);
         }
     }
-    
+
     /**
      * Get body XSLT
      */
@@ -380,7 +383,7 @@
             return new StreamSource(org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xslt" + File.separator + "contact-form.xsl"));
         }
     }
-    
+
     /**
      * Get mime type
      */
@@ -390,9 +393,9 @@
 
         return "application/xhtml+xml";
     }
-   
+
    /**
-    * 
+    *
     * @return
     */
    protected RepositoryFactory getRepositoryFactory() {

Modified: public/yanel/trunk/src/contributions/resources/resource-creator/htdocs/css/resource-creator.css
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/htdocs/css/resource-creator.css	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/htdocs/css/resource-creator.css	2007-11-22 08:34:09 UTC (rev 29120)
@@ -1,3 +1,14 @@
+div.creatorFileBrowser table {
+border-collapse:collapse;
+  width:100%;
+  border:1px solid;
+  border-color:#999999;
+}
+div.creatorFileBrowser table td.fileBrowserNewName {
+  width:100%;
+  border-bottom:1px solid;
+  border-color:#999999;
+}
 div#lookup #resourceCreatorSaveAsTable {
   width:100%;
 }

Modified: public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -90,7 +90,7 @@
         if(request.getHeader("User-Agent").indexOf("rv:1.7") < 0) {
             ajaxBrowser = true;
         }
-        
+
         View view = new View();
         String mimeType = getMimeType(viewId);
         view.setMimeType(mimeType);
@@ -106,15 +106,15 @@
 
             String[] xsltPath = getXSLTPath(getPath());
             if (xsltPath != null) {
-                
+
                 // create reader:
                 XMLReader xmlReader = XMLReaderFactory.createXMLReader();
                 CatalogResolver catalogResolver = new CatalogResolver();
                 xmlReader.setEntityResolver(catalogResolver);
-                
+
                 // create xslt transformer:
                 SAXTransformerFactory tf = (SAXTransformerFactory)TransformerFactory.newInstance();
-                
+
                 TransformerHandler[] xsltHandlers = new TransformerHandler[xsltPath.length];
                 for (int i = 0; i < xsltPath.length; i++) {
                     xsltHandlers[i] = tf.newTransformerHandler(new StreamSource(repo.getNode(xsltPath[i]).getInputStream()));
@@ -122,23 +122,23 @@
                     xsltHandlers[i].getTransformer().setParameter("yanel.path", getPath());
                     xsltHandlers[i].getTransformer().setParameter("yanel.back2context", PathUtil.backToContext(realm, getPath()));
                     xsltHandlers[i].getTransformer().setParameter("yarep.back2realm", PathUtil.backToRealm(getPath()));
-                   
+
                     xsltHandlers[i].getTransformer().setParameter("language", getRequestedLanguage());
                 }
-                
+
                 // create i18n transformer:
                 I18nTransformer2 i18nTransformer = new I18nTransformer2("global", getRequestedLanguage(), getRealm().getDefaultLanguage());
                 i18nTransformer.setEntityResolver(catalogResolver);
-                
+
                 // create xinclude transformer:
                 XIncludeTransformer xIncludeTransformer = new XIncludeTransformer();
                 ResourceResolver resolver = new ResourceResolver(this);
                 xIncludeTransformer.setResolver(resolver);
-                
+
                 // create serializer:
                 Serializer serializer = SerializerFactory.getSerializer(SerializerFactory.XHTML_STRICT);
                 ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                
+
                 // chain everything together (create a pipeline):
                 xmlReader.setContentHandler(xsltHandlers[0]);
                 for (int i=0; i<xsltHandlers.length-1; i++) {
@@ -148,10 +148,10 @@
                 xIncludeTransformer.setResult(new SAXResult(i18nTransformer));
                 i18nTransformer.setResult(new SAXResult(serializer.asContentHandler()));
                 serializer.setOutputStream(baos);
-                
+
                 // execute pipeline:
                 xmlReader.parse(new InputSource(new java.io.StringBufferInputStream(getScreen())));
-                
+
                 // write result into view:
                 view.setInputStream(new ByteArrayInputStream(baos.toByteArray()));
                 return view;
@@ -163,7 +163,7 @@
         } catch(Exception e) {
             log.error(e + " (" + getPath() + ", " + getRealm() + ")", e);
         }
-        
+
         view.setInputStream(new java.io.StringBufferInputStream(getScreen()));
         return view;
     }
@@ -227,7 +227,7 @@
      *
      */
     private void getSelectResourceTypeScreen(StringBuffer sb) {
-        sb.append("<h4>Create new page (step 1)</h4>");
+        sb.append("<h4>Create new page (step 0)</h4>");
         sb.append("<h2>Select template (resp. resource type)</h2>");
         sb.append("<form>");
 
@@ -253,7 +253,9 @@
         } else {
         sb.append("<p>No resource types!</p>");
         }
-        sb.append("<br/><input type=\"submit\" value=\"Next\"/>");
+        sb.append("<br/><input type=\"button\" name=\"Cancel\" value=\"Cancel\" onclick=\"location.href='" + getReferer() + "'\"/>");
+        sb.append("<input type=\"hidden\" name=\"referer\" value=\"" + getReferer() + "\"/>");
+        sb.append("<input type=\"submit\" value=\"Next\"/>");
         sb.append("</form>");
     }
 
@@ -268,7 +270,7 @@
      * Save screen
      */
     private void getSaveScreen(StringBuffer sb) {
-        sb.append("<h4>Create new page (step 3)</h4>");
+        sb.append("<h4>Create new page (step 2)</h4>");
 
         Path pathOfNewResource = null;
         try {
@@ -276,6 +278,7 @@
         } catch(Exception e) {
             log.error(e.getMessage(), e);
             sb.append("<p>Exception: "+e.getMessage()+"</p>");
+            sb.append("<a href=\"javascript:history.back()\">back</a>");
             return;
         }
 
@@ -317,8 +320,8 @@
                 log.error(e.getMessage(), e);
             }
         }
-        
-        
+
+
         try {
             String universalName = "<{"+ resNamespace +"}"+ resName +"/>";
             log.debug("Universal Name: " + universalName);
@@ -326,10 +329,10 @@
             if (resource != null) {
                 if (ResourceAttributeHelper.hasAttributeImplemented(resource, "Creatable", "2")) {
 
-                    sb.append("<h4>Create new page (step 2)</h4>");
+                    sb.append("<h4>Create new page (step 1)</h4>");
                     sb.append("<h2>Enter/Select template (resp. resource) specific parameters and \"Save As\"</h2>");
+                    sb.append("<form enctype=\"multipart/form-data\" method=\"post\">");
                     sb.append("<p>Template (resp. resource type): " + resName + " ("+resNamespace+")</p>");
-                    sb.append("<form enctype=\"multipart/form-data\" method=\"post\">");
                     // TODO: Add this parameter to the continuation within the session!
                     sb.append("<input type=\"hidden\" name=\"resource-type\" value=\"" + rtps + "\"/>");
 
@@ -348,7 +351,7 @@
                             String propertyType = ((CreatableV2) resource).getPropertyType(propertyNames[i]);
                             if (propertyType != null && propertyType.equals(CreatableV2.TYPE_UPLOAD)) {
                                 sb.append("<input type=\"file\" name=\"rp." + propertyNames[i] + "\"/><br/>");
-                    } else if (propertyType != null && propertyType.equals(CreatableV2.TYPE_SELECT)) {
+                            } else if (propertyType != null && propertyType.equals(CreatableV2.TYPE_SELECT)) {
                                 Object defaultValues = ((CreatableV2) resource).getProperty(propertyNames[i]);
                                 if (defaultValues instanceof java.util.HashMap) {
                                     sb.append("<select name=\"rp." + propertyNames[i] + "\">");
@@ -372,38 +375,48 @@
                         sb.append("</table>");
                     }
                     if (defaultProperties != null) {
+                        sb.append("<ul>");
                         for (int i = 0; i < defaultProperties.length; i++) {
-                            sb.append("<p>Default property: " + defaultProperties[i] + "</p>");
-                            sb.append("<input type=\"hidden\" name=\"rp." + defaultProperties[i].getName() + "\" value=\"" + defaultProperties[i].getValue() + "\"/><br/>");
+                            sb.append("<li>");
+                            sb.append("Default property: " + defaultProperties[i]);
+                            sb.append("<input type=\"hidden\" name=\"rp." + defaultProperties[i].getName() + "\" value=\"" + defaultProperties[i].getValue() + "\"/>");
+                            sb.append("</li>");
                         }
+                        sb.append("</ul>");
                     }
 
-                    //sb.append("<br/><br/><input type=\"submit\" value=\"Save As\" name=\"save-as\"/>");
+                    sb.append("<br/><br/>");
 
-                    // TODO: Display repository navigation of this path ...
-                    Sitetree sitetree = (Sitetree) getYanel().getBeanFactory().getBean("repo-navigation");
-                    Node node = null;
-                    String lookinPath = getRequest().getParameter("lookin");
-                    if (lookinPath != null) {
-                        node = sitetree.getNode(getRealm(), lookinPath);
+                    sb.append("<div class=\"creatorFileBrowser\">");
+                    sb.append("<table>");
+                    sb.append("<tr><td colspan=\"2\" class=\"fileBrowserHead\">Save as:</td></tr>");
+                    sb.append("<tr><td colspan=\"2\">");
+                    sb.append("<div id=\"lookup\">");
+                    sb.append(getLookUp());
+                    sb.append("</div>");
+                    sb.append("</td></tr>");
+                    sb.append("<tr><td colspan=\"2\" class=\"fileBrowserNewName\">");
+
+                    String createName = getRequest().getParameter("create-name");
+                    if (createName != null) {
+                        sb.append("New name: <input type=\"text\" name=\"create-name\" value=\"" + createName + "\"/>");
                     } else {
-                        node = sitetree.getNode(getRealm(), getPath());
+                        sb.append("New name: <input type=\"text\" name=\"create-name\"/>");
                     }
-                    if (node.isCollection()) {
-                        if(log.isDebugEnabled()) log.debug("Is Collection: " + node.getName());
-                    } else if (node.isResource()) {
-                        if (log.isDebugEnabled()) log.debug("Is Resource: " + node.getName());
-                        node = node.getParent();
-                    } else {
-                        log.error("Neither collection nor resource: " + getPath());
-                    }
+                    sb.append("</td></tr>");
 
-                    sb.append("<br/><br/>");
-                    
-                    sb.append("<div id=\"lookup\">");
-                    sb.append(getLookUp());
+                    sb.append("<tr>");
+                    sb.append("<td>");
+                    sb.append("<input type=\"button\" name=\"Cancel\" value=\"Cancel\" onclick=\"location.href='" + getReferer() + "'\"/>");
+                    sb.append("<input type=\"hidden\" name=\"referer\" value=\"" + getReferer() + "\"/>");
+                    sb.append("</td>");
+                    sb.append("<td  align=\"right\">");
+                    sb.append("<input type=\"submit\" value=\"Save new resource\" name=\"save\"/>");
+                    sb.append("</td>");
+                    sb.append("</tr>");
+                    sb.append("</table>");
                     sb.append("</div>");
-                    
+
                     sb.append("</form>");
 
                     // TODO: Display realm navigation (sitetree, topic map, ...) resp. introduce another step
@@ -414,7 +427,7 @@
             log.error(e.getMessage(), e);
         }
     }
-    
+
     /**
      * Creates new resource
      * @return Path of new resource
@@ -433,32 +446,28 @@
     private Path create(String createName, String lookinPath, String resourceType) throws Exception {
         org.wyona.yanel.core.map.Realm realm = getRealm();
         Path pathOfResourceCreator = new Path(getPath());
-        
+
         org.wyona.commons.io.Path parent = new org.wyona.commons.io.Path(pathOfResourceCreator.toString()).getParent();
-        
-        Path pathOfNewResource = null;
-        
-        if(parent.equals("null")) {
-            // if pathOfResourceCreator is ROOT
-            pathOfNewResource = new Path("/" + lookinPath + "/" + createName);
-        } else if(parent.toString().equals("/")){
-            pathOfNewResource = new Path(parent + "/" + lookinPath + "/" + createName);
-        } else {
-            if (log.isDebugEnabled()) log.debug("Parent: " + parent + ", Lookin-path: " + lookinPath + ", Create Name: " + createName);
-            pathOfNewResource = new Path("/" + lookinPath + "/" + createName);
-        }
-        
+
+        Path pathOfNewResource = new Path(getParentOfNewResource(parent, lookinPath).toString() + createName);
+
         if (log.isDebugEnabled()) log.debug("Path of new resource: " + pathOfNewResource);
         pathOfNewResource = new Path(removeTooManySlashes(pathOfNewResource.toString()));
         if (log.isDebugEnabled()) log.debug("Path of new resource without too many slashes: " + pathOfNewResource);
-        
+
         String rtps = resourceType;
         String resNamespace = rtps.substring(0, rtps.indexOf("::"));
         String resName = rtps.substring(rtps.indexOf("::") + 2);
         Resource newResource = yanel.getResourceManager().getResource(getEnvironment(), realm, pathOfNewResource.toString(), new ResourceConfiguration(resName, resNamespace, null));
-        
+
         if (newResource != null) {
             if (ResourceAttributeHelper.hasAttributeImplemented(newResource, "Creatable", "2")) {
+                createName = ((CreatableV2) newResource).getCreateName(createName);
+                if (createName == null || createName.equals("")) {
+                    throw new Exception("Please enter a name!");
+                }
+                pathOfNewResource = new Path(removeTooManySlashes(getParentOfNewResource(parent, lookinPath).toString()) + createName);
+                newResource.setPath(pathOfNewResource.toString());
                 ((CreatableV2) newResource).create(request);
                 createResourceConfiguration(newResource);
             } else {
@@ -466,7 +475,7 @@
             }
         } else {
             throw new Exception("creation NOT successful (newResource == null)!");
-            
+
         }
         return pathOfNewResource;
     }
@@ -600,7 +609,7 @@
         }
         return resName;
     }
-    
+
     private StringBuffer getLookUp() {
         StringBuffer sb = new StringBuffer("");
         Sitetree sitetree = (Sitetree) getYanel().getBeanFactory().getBean("repo-navigation");
@@ -622,10 +631,10 @@
         String rtps = getRequest().getParameter("resource-type");
         String resNamespace = rtps.substring(0, rtps.indexOf("::"));
         String resName = rtps.substring(rtps.indexOf("::") + 2);
-        
-        sb.append("<table id=\"resourceCreatorSaveAsTable\"><tr><td colspan=\"2\">Save as:</td></tr>");
+
+        sb.append("<table id=\"resourceCreatorSaveAsTable\">");
         sb.append("<tr><td>Look in: " + node.getPath() + "&#160;&#160;&#160;</td><td>New folder: <input type=\"text\" name=\"create-new-folder\"/>&#160;<input type=\"image\" src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/folder-new.png\" alt=\"make a new folder\"/> ");
-        
+
         String parent = "/";
         if (!node.getPath().equals("/")) {
             parent = new org.wyona.commons.io.Path(node.getPath()).getParent().toString();
@@ -669,30 +678,19 @@
                 sb.append("<tr><td>?</td><td>"+children[i].getName()+"</td><td>-</td></tr>");
                     }
                 }
-        
+
         sb.append("</tbody>");
         sb.append("</table>");
+        sb.append("<input type=\"hidden\" name=\"lookin\" value=\"" + node.getPath() + "\"/>");
         sb.append("</div>");
         sb.append("</td></tr>");
 
-        sb.append("<tr><td colspan=\"2\">");
-       
-        String createName = getRequest().getParameter("create-name");
-        if (createName != null) {
-            sb.append("New name: <input type=\"text\" name=\"create-name\" value=\"" + createName + "\"/>");
-        } else {
-            sb.append("New name: <input type=\"text\" name=\"create-name\"/>");
-        }
-        sb.append("</td></tr>");
 
-        sb.append("<tr><td colspan=\"2\" align=\"right\">");
-        sb.append("<input type=\"hidden\" name=\"lookin\" value=\"" + node.getPath() + "\"/>");
-        sb.append("<input type=\"submit\" value=\"Save new resource\" name=\"save\"/></td></tr>");
         sb.append("</table>");
-        
+
         return sb;
     }
-    
+
     /**
      * Get XSLT path
      */
@@ -724,6 +722,45 @@
         }
         return sb.toString();
     }
+
+    private Path getParentOfNewResource(org.wyona.commons.io.Path parent, String lookinPath) {
+        Path parentOfNewResource = null;
+        if(parent.equals("null")) {
+            // if pathOfResourceCreator is ROOT
+            parentOfNewResource = new Path("/" + lookinPath + "/");
+        } else if(parent.toString().equals("/")){
+            parentOfNewResource = new Path(parent + "/" + lookinPath + "/");
+        } else {
+            parentOfNewResource = new Path("/" + lookinPath + "/");
+        }
+        return parentOfNewResource;
+    }
+
+    private String getReferer() {
+        if(request.getParameter("referer") != null) {
+            return request.getParameter("referer");
+        }
+        if(request.getHeader("referer") != null) {
+            return replaceEntities(request.getHeader("referer"));
+        }
+        return PathUtil.backToRealm(getPath());
+    }
+
+    /**
+     * Replaces some characters by their corresponding xml entities.
+     * This method escapes those characters which must not occur in an xml text node.
+     * @param string
+     * @return escaped string
+     */
+    public String replaceEntities(String str) {
+        // there may be some &amp; and some & mixed in the input, so first transform all
+        // &amp; to & and then transform all & back to &amp;
+        // this way we don't get double escaped &amp;amp;
+        str = str.replaceAll("&amp;", "&");
+        str = str.replaceAll("&", "&amp;");
+        str = str.replaceAll("<", "&lt;");
+        return str;
+    }
 }
 
 /**

Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -70,7 +70,7 @@
 import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
- * 
+ *
  */
 public class WikiResource extends Resource implements ViewableV1, CreatableV2, IntrospectableV1, ModifiableV2 {
 
@@ -81,7 +81,7 @@
     private final String DEFAULT_WIKI_PARSER_BEAN_ID = "jspWikiParser";
 
     /**
-     * 
+     *
      */
     public WikiResource() {
         dbf = DocumentBuilderFactory.newInstance();
@@ -90,7 +90,7 @@
     }
 
     /**
-     * 
+     *
      */
     public ViewDescriptor[] getViewDescriptors() {
         ViewDescriptor[] vd = new ViewDescriptor[3];
@@ -102,7 +102,7 @@
         vd[2].setMimeType("text/plain");
         return vd;
     }
-    
+
     /**
      * Get view of resource
      */
@@ -117,12 +117,12 @@
             }
 
             View defaultView = new View();
-            
+
             String wikiParserBeanId = getWikiSyntax(path);
             InputStream inputStream = dataRepo.getInputStream(new org.wyona.yarep.core.Path(getDataPathImplementation().getDataPath(getPath())));
             IWikiParser wikiParser = (IWikiParser) yanel.getBeanFactory().getBean(wikiParserBeanId);
             wikiParser.parse(inputStream);
-            
+
             Transformer transformer = null;
             if(viewId != null && viewId.equals("source")) {
                 transformer = TransformerFactory.newInstance().newTransformer();
@@ -137,22 +137,22 @@
                 transformer.setParameter("yanel.last.modified", new java.util.Date(getLastModified()));
                 defaultView.setMimeType("application/xhtml+xml");
             }
-            
+
             LinkChecker linkChecker = new LinkChecker(getRealm().getRepository(), getPath(), getDataPathImplementation());
             SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
             saxParser.parse(wikiParser.getInputStream(), linkChecker);
-            
+
             java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream();
-            
+
             transformer.transform(new StreamSource(linkChecker.getInputStream()), new StreamResult(byteArrayOutputStream));
 
             inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-            
+
             if(viewId != null && viewId.equals("source")) {
                 defaultView.setInputStream(inputStream);
                 return defaultView;
             }
-            
+
             // create reader:
             XMLReader xmlReader = XMLReaderFactory.createXMLReader();
             CatalogResolver catalogResolver = new CatalogResolver();
@@ -185,11 +185,11 @@
             XIncludeTransformer xIncludeTransformer = new XIncludeTransformer();
             ResourceResolver resolver = new ResourceResolver(this);
             xIncludeTransformer.setResolver(resolver);
-            
+
             // create i18n transformer:
             I18nTransformer2 i18nTransformer = new I18nTransformer2("global", getRealm().getDefaultLanguage(), getRealm().getDefaultLanguage());
             i18nTransformer.setEntityResolver(catalogResolver);
-            
+
             // create serializer:
             Serializer serializer = SerializerFactory.getSerializer(SerializerFactory.XHTML_STRICT);
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -204,7 +204,7 @@
             xIncludeTransformer.setResult(new SAXResult(i18nTransformer));
             i18nTransformer.setResult(new SAXResult(serializer.asContentHandler()));
             serializer.setOutputStream(baos);
-            
+
             // execute pipeline:
             xmlReader.parse(new InputSource(inputStream));
 
@@ -217,7 +217,7 @@
     }
 
     /**
-     * 
+     *
      */
     public View getView(HttpServletRequest request, String viewId) {
         String _language = getRealm().getDefaultLanguage();
@@ -233,7 +233,7 @@
     }
 
     /**
-     * 
+     *
      */
     public View getView(HttpServletRequest request, OutputStream outputStream, String viewId) {
         return null;
@@ -256,12 +256,12 @@
         log.info("No XSLT Path for: " + getPath());
         return null;
     }
-    
+
     /**
-     * this method will get the wikiparser type for this resource 
-     * first it will look up the rti resp. rtd than 
+     * this method will get the wikiparser type for this resource
+     * first it will look up the rti resp. rtd than
      * it will look in the config file for this resource if none of the could be found
-     * it will use the default hard coded in this class  
+     * it will use the default hard coded in this class
      */
     private String getWikiSyntax(Path path) {
         String wikiParserBeanId = null;
@@ -295,23 +295,23 @@
         } catch (Exception e) {
             log.error("Exception" + e);//was warn
         } finally {
-            wikiParserBeanId = DEFAULT_WIKI_PARSER_BEAN_ID;    
+            wikiParserBeanId = DEFAULT_WIKI_PARSER_BEAN_ID;
         }
         log.warn("Using fallback default wiki parser: " + DEFAULT_WIKI_PARSER_BEAN_ID);
         return DEFAULT_WIKI_PARSER_BEAN_ID;
     }
-    
 
+
     /**
-     * @return the empty wiki resource as String 
+     * @return the empty wiki resource as String
      */
     private String getEmptyWiki(String title) {
         StringBuffer emptyWikiXml = new StringBuffer();
         emptyWikiXml.append("!"+title);
-        
+
         return emptyWikiXml.toString();
     }
-    
+
     /**
      *
      */
@@ -328,10 +328,10 @@
         emptyWikiPageContent.append("\n  </edit>");
         emptyWikiPageContent.append("\n  </resource>");
         emptyWikiPageContent.append("\n</introspection>");
-        
+
         return emptyWikiPageContent.toString();
-    }    
-    
+    }
+
     public String[] getPropertyNames() {
         String[] propertyNames = (String[])properties.keySet().toArray(new String[properties.keySet().size()]);
         return propertyNames;
@@ -345,12 +345,12 @@
         Object property = properties.get(name);
         return property;
     }
-    
+
     public String getPropertyType(String propertyName){
         //TODO not implemented yet
         return null;
     }
-  
+
     /**
      *
      */
@@ -358,7 +358,7 @@
         String title = getRequest().getParameter("rp.title");
         writeContentAndIntrospection(getEmptyWiki(title), title);
     }
- 
+
     /**
      * Write new content into data repository
      */
@@ -409,6 +409,10 @@
         return map;
     }
 
+    public String getCreateName(String suggestedName) {
+        return suggestedName;
+    }
+
     /**
      *
      */

Modified: public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/contributions/resources/yanel-user/src/java/org/wyona/yanel/impl/resources/YanelUserResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -63,7 +63,7 @@
     protected static final String WORLD = "world";
 
     protected static final String USER = "user";
-    
+
     protected static final String GROUP = "group";
 
     protected static final String PERMISSION_ATTR = "permission";
@@ -89,7 +89,7 @@
 
         properties.put("userId", "");
         properties.put("userName", "");
-        properties.put("email", "");        
+        properties.put("email", "");
         properties.put("password", "");
         properties.put("group", "");
 
@@ -111,10 +111,10 @@
 
     /**
      * @see org.wyona.yanel.core.api.attributes.ViewableV2#getView(String)
-     * @return The requested view. Possible views are: 
-     * defaultView - Displays change password, edit profile and delete forms 
-     * submitProfile - Result of updating the user's profile 
-     * submitPassword - Result of changing the user's password 
+     * @return The requested view. Possible views are:
+     * defaultView - Displays change password, edit profile and delete forms
+     * submitProfile - Result of updating the user's profile
+     * submitPassword - Result of changing the user's password
      * submitDelete - Result of deleting the user
      */
     public View getView(String viewId) throws Exception {
@@ -148,7 +148,7 @@
                 }
                 transformer.setParameter("userId", userId);
                 transformer.setParameter("deletion", "true");
-            } else if (action.startsWith("submitDeleteFromGroup")) {        	
+            } else if (action.startsWith("submitDeleteFromGroup")) {
                 deleteFromGroup(action, transformer);
             } else if (action.equals("submitAddToGroup")) {
                 addToGroup(request,transformer);
@@ -169,22 +169,22 @@
                 for (int i = 0; i < userGroups.length; i++) {
                     userGroupsString.append(userGroups[i].getID()).append(";");
                 }
-                transformer.setParameter("userGroupsString", userGroupsString);            
+                transformer.setParameter("userGroupsString", userGroupsString);
 
                 Group[] allGroups = getRealm().getIdentityManager().getGroupManager().getGroups();
                 StringBuffer allGroupsString = new StringBuffer();
                 for (int i = 0; i < allGroups.length; i++) {
-                    boolean isMember = false;        	
+                    boolean isMember = false;
                     for(int j = 0; j < userGroups.length; j++) {
                         if(userGroups[j].getID().equals(allGroups[i].getID())) {
-                            isMember = true;      		
+                            isMember = true;
                         }
-                    } 
+                    }
                     if(!isMember) {
                         allGroupsString.append(allGroups[i].getID()).append(";");
                     }
                 }
-                transformer.setParameter("allGroupsString", allGroupsString);            
+                transformer.setParameter("allGroupsString", allGroupsString);
             }
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             transformer.transform(new javax.xml.transform.stream.StreamSource(xmlFile), new StreamResult(baos));
@@ -269,6 +269,10 @@
         return map;
     }
 
+    public String getCreateName(String suggestedName) {
+        return suggestedName;
+    }
+
     /**
      * @see org.wyona.yanel.core.api.attributes.CreatableV1#getPropertyNames()
      */
@@ -297,7 +301,7 @@
     /**
      * Create a configuration object with the policies to access the user data.
      * Only the user and lenya will be able to access the user data.
-     * 
+     *
      * @param userId
      *            The user who must be granted permission to modify data
      * @return Configuration object containing the corresponding policies
@@ -359,7 +363,7 @@
 
     /**
      * Updates the user profile
-     * 
+     *
      * @param request
      *            The request containing the data to update
      * @param transformer
@@ -376,7 +380,7 @@
                 User user = realm.getIdentityManager().getUserManager().getUser(userId);
                 user.setEmail(request.getParameter("email"));
                 user.setName(request.getParameter("userName"));
-                user.save();               
+                user.save();
                 transformer.setParameter("success", "Profile updated successfully");
             } catch (Exception e) {
                 log.error(e.getMessage(), e);
@@ -388,7 +392,7 @@
      * Updates the groups the user belongs to. Currently it only allows for
      * deletion of membership The action parameter is always
      * submitDeleteFromGroup_X where X is the target group
-     * 
+     *
      * @param request
      *            The request containing the group involved
      * @param transformer
@@ -400,18 +404,18 @@
             Group[] userGroups = user.getGroups();
             GroupManager gm = getRealm().getIdentityManager().getGroupManager();
 
-            String targetGroup = action.substring(action.indexOf("_")+1);            
+            String targetGroup = action.substring(action.indexOf("_")+1);
             if (userGroups.length > 0) {
                 if(userGroups.length > 1) {
                     Group group = gm.getGroup(targetGroup);
-                    if (group.isMember(user)) {                   
+                    if (group.isMember(user)) {
                         group.removeMember(user);
-                        group.save();                    
+                        group.save();
                     }
                     transformer.setParameter("success", "User successfully deleted from group: " + targetGroup);
                 } else {
-                    transformer.setParameter("error", "User can not be removed from group: " + targetGroup + ". Users must belong to one group at least."); 
-                }        	
+                    transformer.setParameter("error", "User can not be removed from group: " + targetGroup + ". Users must belong to one group at least.");
+                }
             } else {
                 log.error("The user " + userId + "does not belong to any group!");
             }
@@ -428,7 +432,7 @@
     private void addToGroup(HttpServletRequest request, Transformer transformer) {
         String groupId = request.getParameter("Group");
         try {
-            String userId = getUserId();	
+            String userId = getUserId();
             Group group = getRealm().getIdentityManager().getGroupManager().getGroup(groupId);
             User user = getRealm().getIdentityManager().getUserManager().getUser(userId);
             group.addMember(user);
@@ -441,7 +445,7 @@
 
     /**
      * Change user password
-     * 
+     *
      * @param request
      * @param transformer
      */
@@ -466,7 +470,7 @@
                 }
             } else {
                 transformer.setParameter("error", "Authentication failed!");
-            }            
+            }
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -474,7 +478,7 @@
 
     /**
      * This method checks if the specified email is valid against a regex
-     * 
+     *
      * @param email
      * @return true if email is valid
      */
@@ -489,7 +493,7 @@
     /**
      * Determine the requested view: defaultView, submitProfile,
      * submitPassword,submitGroup, submitDelete
-     * 
+     *
      * @param request
      * @return name of the desired view
      */

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/api/attributes/CreatableV2.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -36,14 +36,19 @@
      *
      */
     public String getPropertyType(String propertyName);
-    
+
     /**
      * Creates the resource
      */
     public void create(HttpServletRequest request);
-    
+
     /**
      * Creates RTI properties
      */
     public HashMap createRTIProperties(HttpServletRequest request);
+
+    /**
+     * getCreateName
+     */
+    public String getCreateName(String suggestedName);
 }

Modified: public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java
===================================================================
--- public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -306,6 +306,10 @@
        return map;
    }
 
+   public String getCreateName(String suggestedName) {
+       return suggestedName;
+   }
+
    /**
     *
     */

Modified: public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
===================================================================
--- public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -61,7 +61,7 @@
 //public class NodeResource extends Resource implements ViewableV2, ModifiableV2, VersionableV2, CreatableV2 {
 
     private static Category log = Category.getInstance(NodeResource.class);
-    
+
     private String uploadMimeType;
 
     /**
@@ -79,7 +79,7 @@
 
     public View getView(String viewId, String revisionName) throws Exception {
         View view = new View();
-        
+
         view.setInputStream(getRealm().getRepository().getNode(getPath()).getRevision(revisionName).getInputStream());
         view.setMimeType(getMimeType(viewId));
         view.setEncoding(getResourceConfigProperty("encoding"));
@@ -92,7 +92,7 @@
      */
     public View getView(String viewId) throws Exception {
         View view = new View();
-        
+
         view.setInputStream(getRealm().getRepository().getNode(getPath()).getInputStream());
         view.setMimeType(getMimeType(viewId));
         view.setEncoding(getResourceConfigProperty("encoding"));
@@ -104,9 +104,9 @@
      *
      */
     public String getMimeType(String viewId) throws Exception {
-        
+
         String mimeType = getResourceConfigProperty("mime-type");
-        
+
         if (mimeType != null) return mimeType;
 
         // TODO: Load config mime.types ...
@@ -183,7 +183,7 @@
         getRealm().getRepository().getNode(getPath()).delete();
         return true;
     }
-    
+
     /**
      * @see org.wyona.yanel.core.api.attributes.VersionableV2#getRevisions()
      */
@@ -191,7 +191,7 @@
         Revision[] revisions = getRealm().getRepository().getNode(getPath()).getRevisions();
 
         RevisionInformation[] revisionInfos = new RevisionInformation[revisions.length];
-   
+
         for (int i = 0; i < revisions.length; i++) {
             revisionInfos[i] = new RevisionInformation(revisions[i]);
         }
@@ -200,13 +200,13 @@
         }
         return revisionInfos;
     }
-   
+
     public void checkin(String comment) throws Exception {
         Node node = getRealm().getRepository().getNode(getPath());
         node.checkin(comment);
         /*
         if (node.isCheckedOut()) {
-            String checkoutUserID = node.getCheckoutUserID(); 
+            String checkoutUserID = node.getCheckoutUserID();
             if (checkoutUserID.equals(userID)) {
                 node.checkin();
             } else {
@@ -223,7 +223,7 @@
         node.checkout(userID);
         /*
         if (node.isCheckedOut()) {
-            String checkoutUserID = node.getCheckoutUserID(); 
+            String checkoutUserID = node.getCheckoutUserID();
             if (checkoutUserID.equals(userID)) {
                 log.warn("Resource " + getPath() + " is already checked out by this user: " + checkoutUserID);
             } else {
@@ -234,7 +234,7 @@
         }
         */
     }
-    
+
     public void cancelCheckout() throws Exception {
         Node node = getRealm().getRepository().getNode(getPath());
         node.cancelCheckout();
@@ -265,7 +265,7 @@
     }
 
     /**
-     * 
+     *
      */
     public long getSize() throws Exception {
         Node node = getRealm().getRepository().getNode(getPath());
@@ -314,7 +314,7 @@
                     Enumeration parameters = yanelRequest.getFileNames();
                     if (parameters.hasMoreElements()) {
                         String name = (String) parameters.nextElement();
-                        
+
                         Node newNode = org.wyona.yanel.core.util.YarepUtil.addNodes(repo, getPath().toString(), org.wyona.yarep.core.NodeType.RESOURCE);
                         OutputStream output = newNode.getOutputStream();
                         InputStream is = yanelRequest.getInputStream(name);
@@ -328,8 +328,8 @@
             } else {
                 log.error("this is NOT a HttpRequest");
             }
-            
-            
+
+
             // TODO: Introspection should not be hardcoded!
 /*            String name = new org.wyona.commons.io.Path(getPath()).getName();
             String parent = new org.wyona.commons.io.Path(getPath()).getParent().toString();
@@ -361,6 +361,24 @@
         return map;
     }
 
+    public String getCreateName(String suggestedName) {
+        if (suggestedName != null && !suggestedName.equals("")) return suggestedName;
+        if (request instanceof HttpRequest) {
+            HttpRequest yanelRequest = (HttpRequest)request;
+            if (yanelRequest.isMultipartRequest()) {
+                Enumeration parameters = yanelRequest.getFileNames();
+                if (parameters.hasMoreElements()) {
+                    String name = yanelRequest.getFilesystemName((String) parameters.nextElement());
+                    return name;
+                }
+            } else {
+                log.error("this is NOT a multipart request");
+            }
+        } else {
+            log.error("this is NOT a HttpRequest");
+        }
+        return null;
+    }
     /**
      *
      */
@@ -400,7 +418,7 @@
      *
      */
     public String getMimeTypeBySuffix(String suffix) {
-        // TODO: use MimeTypeUtil 
+        // TODO: use MimeTypeUtil
         if (suffix.equals("html")) {
             return "text/html";
         } else if (suffix.equals("htm")) {
@@ -452,7 +470,7 @@
             return "application/octet-stream";
         }
     }
-    
+
     /**
      *
      */

Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-11-22 07:44:43 UTC (rev 29119)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-11-22 08:34:09 UTC (rev 29120)
@@ -141,7 +141,7 @@
             }
             return null;
         }
-        
+
         Node node;
         if (revisionName != null) {
             node = repo.getNode(getPath()).getRevision(revisionName);
@@ -253,13 +253,13 @@
     public RevisionInformation[] getRevisions() throws Exception {
         Revision[] revisions = getRealm().getRepository().getNode(getPath()).getRevisions();
         RevisionInformation[] revisionInfos = new RevisionInformation[revisions.length];
-       
+
         for (int i = 0; i < revisions.length; i++) {
             revisionInfos[i] = new RevisionInformation(revisions[i]);
         }
-        return revisionInfos; 
+        return revisionInfos;
     }
-    
+
     public void checkin(String comment) throws Exception {
         Node node = getRealm().getRepository().getNode(getPath());
         Revision revision = node.checkin(comment);
@@ -270,7 +270,7 @@
         }
         /*
         if (node.isCheckedOut()) {
-            String checkoutUserID = node.getCheckoutUserID(); 
+            String checkoutUserID = node.getCheckoutUserID();
             if (checkoutUserID.equals(userID)) {
                 node.checkin();
             } else {
@@ -287,7 +287,7 @@
         node.checkout(userID);
         /*
         if (node.isCheckedOut()) {
-            String checkoutUserID = node.getCheckoutUserID(); 
+            String checkoutUserID = node.getCheckoutUserID();
             if (checkoutUserID.equals(userID)) {
                 log.warn("Resource " + getPath() + " is already checked out by this user: " + checkoutUserID);
             } else {
@@ -298,7 +298,7 @@
         }
         */
     }
-    
+
     public void cancelCheckout() throws Exception {
         Node node = getRealm().getRepository().getNode(getPath());
         node.cancelCheckout();
@@ -393,6 +393,10 @@
         return map;
     }
 
+    public String getCreateName(String suggestedName) {
+        return suggestedName;
+    }
+
     /**
      *
      */
@@ -423,7 +427,7 @@
     public void setProperty(String name, Object value) {
         log.warn("Not implemented yet!");
     }
-    
+
     /**
      * Create introspection for XHTML documents used by the creator (WARNING: Mime type is hardcoded!)
      * @param name
@@ -449,7 +453,7 @@
         sb.append("\n  </edit>");
         sb.append("\n  </resource>");
         sb.append("\n</introspection>");
-        
+
         return sb.toString();
     }
 
@@ -473,7 +477,7 @@
         sb.append("</edit>");
 
         sb.append(getWorkflowIntrospection());
-        
+
         sb.append("</resource>");
         sb.append("</introspection>");
         return sb.toString();
@@ -490,7 +494,7 @@
     public String[] getLanguages() throws TranslationException {
         return getTranslationManager().getLanguages(this);
     }
-    
+
     public Resource getTranslation(String language) throws TranslationException {
         return getTranslationManager().getTranslation(this, language);
     }
@@ -510,11 +514,11 @@
     /************************************************
      * Workflow                                     *
      ************************************************/
-    
+
     public void doTransition(String transitionID, String revision) throws WorkflowException {
         WorkflowHelper.doTransition(this, transitionID, revision);
     }
-    
+
     public View getLiveView(String viewid) throws Exception {
         return WorkflowHelper.getLiveView(this, viewid);
     }
@@ -530,7 +534,7 @@
     public void setWorkflowVariable(String name, String value) throws WorkflowException {
         WorkflowHelper.setWorkflowVariable(this, name, value);
     }
-    
+
     public void removeWorkflowVariable(String name) throws WorkflowException {
         WorkflowHelper.removeWorkflowVariable(this, name);
     }
@@ -546,7 +550,7 @@
     public Date getWorkflowDate(String revision) throws WorkflowException {
         return WorkflowHelper.getWorkflowDate(this, revision);
     }
-    
+
     public String getWorkflowIntrospection() throws WorkflowException {
         return WorkflowHelper.getWorkflowIntrospection(this);
     }



More information about the Yanel-commits mailing list