lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting HTMLFormSaveAction.java
Date Wed, 13 Aug 2003 00:51:32 GMT
michi       2003/08/12 17:51:31

  Modified:    src/java/org/apache/lenya/cms/cocoon/acting
                        HTMLFormSaveAction.java
  Log:
  insert and delete added
  
  Revision  Changes    Path
  1.6       +19 -24    cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/HTMLFormSaveAction.java
  
  Index: HTMLFormSaveAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/HTMLFormSaveAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HTMLFormSaveAction.java	12 Aug 2003 23:58:27 -0000	1.5
  +++ HTMLFormSaveAction.java	13 Aug 2003 00:51:31 -0000	1.6
  @@ -106,7 +106,10 @@
   
           getLogger().error(".act(): File: " + file.getAbsolutePath());
   
  -        if(request.getParameter("save") != null) {
  +        if(request.getParameter("cancel") != null) {
  +            getLogger().error(".act(): Cancel editing");
  +            return null;
  +        } else {
               if(file.isFile()) {
                   getLogger().error(".act(): Save modifications to " + file.getAbsolutePath());
   
  @@ -117,16 +120,27 @@
                       while (params.hasMoreElements()) {
                           String name = (String) params.nextElement();
                           getLogger().debug(".act(): Parameter: " + name + " (" + request.getParameter(name)
 + ")");
  -                        if (name.indexOf("element.") == 0) {
  +                        if (name.indexOf("element.") == 0) { // Update Element
                               String xpath = name.substring(8, name.indexOf("["));
                               String tagID = name.substring(name.indexOf("[") + 1, name.indexOf("]"));
                               xpath = xpath + "[@tagID=\"" + tagID + "\"]";
  -                            getLogger().error(".act(): XPath: " + xpath);
  +                            getLogger().error(".act() Update Element: XPath: " + xpath);
                               setNodeValue(document, request.getParameter(name), xpath);
  +                        } else if (name.equals("insert")) { // Insert Element
  +                            getLogger().error(".act(): Insert Element: " + request.getParameter("insert"));
  +                        } else if (name.equals("delete")) { // Delete Element
  +                            getLogger().error(".act(): Delete Element: " + request.getParameter("delete"));
                           }
                       }
  +
                       DocumentHelper.writeDocument(document, file);
  -                    return null;
  +
  +                    if(request.getParameter("save") != null) {
  +                        getLogger().error(".act(): Save");
  +                        return null;
  +                    } else {
  +                        return new HashMap();
  +                    }
                   } catch (Exception e) {
                       getLogger().error(".act(): Exception: " + e.getMessage(), e);
                       return new HashMap();
  @@ -135,25 +149,6 @@
                   getLogger().error(".act(): No such file: " + file.getAbsolutePath());
                   return new HashMap();
               }
  -        } else if(request.getParameter("insert") != null) {
  -            getLogger().error(".act(): Insert");
  -            Enumeration params = request.getParameterNames();
  -            while (params.hasMoreElements()) {
  -                String name = (String) params.nextElement();
  -                getLogger().error(".act(): Parameter: " + name + " (" + request.getParameter(name)
 + ")");
  -            }
  -            return new HashMap();
  -        } else if(request.getParameter("delete") != null) {
  -            getLogger().error(".act(): Delete");
  -            Enumeration params = request.getParameterNames();
  -            while (params.hasMoreElements()) {
  -                String name = (String) params.nextElement();
  -                getLogger().error(".act(): Parameter: " + name + " (" + request.getParameter(name)
 + ")");
  -            }
  -            return new HashMap();
  -        } else { // cancel
  -            getLogger().error(".act(): Cancel editing");
  -            return null;
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message