Update of 
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard
In directory james.mmbase.org:/tmp/cvs-serv17834

Modified Files:
        Wizard.java 
Log Message:
  MMB-1698


See also: 
http://cvs.mmbase.org/viewcvs/applications/editwizard/src/org/mmbase/applications/editwizard
See also: http://www.mmbase.org/jira/browse/MMB-1698


Index: Wizard.java
===================================================================
RCS file: 
/var/cvs/applications/editwizard/src/org/mmbase/applications/editwizard/Wizard.java,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- Wizard.java 4 Sep 2008 05:58:11 -0000       1.169
+++ Wizard.java 9 Oct 2008 14:21:30 -0000       1.170
@@ -33,6 +33,7 @@
 import java.util.*;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import javax.xml.transform.TransformerException;
 
@@ -45,7 +46,7 @@
  * @author Pierre van Rooden
  * @author Hillebrand Gelderblom
  * @since MMBase-1.6
- * @version $Id: Wizard.java,v 1.169 2008/09/04 05:58:11 michiel Exp $
+ * @version $Id: Wizard.java,v 1.170 2008/10/09 14:21:30 michiel Exp $
  *
  */
 public class Wizard implements org.mmbase.util.SizeMeasurable, 
java.io.Serializable {
@@ -56,6 +57,8 @@
     public static final String PUBLIC_ID_EDITWIZARD_1_0_FAULT = "-//MMBase/DTD 
editwizard 1.0//EN";
     public static final String DTD_EDITWIZARD_1_0       = 
"wizard-schema_1_0.dtd";
 
+    public static final String RESPONSE_KEY = "org.mmbase.editwizard.response";
+
 
     static {
         EntityResolver.registerPublicID(PUBLIC_ID_EDITWIZARD_1_0, 
DTD_EDITWIZARD_1_0, Wizard.class);
@@ -1099,7 +1102,7 @@
                                 String fname = Utils.getAttribute(field, 
"name", null);
 
                                 if (fname != null) {
-                                    throw new WizardException("Perhaps the 
field with name '" + fname + "' does not exist?");
+                                    throw new WizardException("Perhaps the 
field with name '" + fname + "' does not exist (no data node found with " + 
xpath + ")?");
                                 }
                             }
                         }
@@ -1164,31 +1167,36 @@
         List<URL> result = new ArrayList<URL>();
 
         Document targetdoc = node.getOwnerDocument();
-
         /// resolve blocks
         NodeList blocks= Utils.selectNodeList(node,
                                               "//blocks");
         if (blocks != null) {
+            log.debug("" + Collections.list(request.getAttributeNames()));
+            HttpServletResponse response = (HttpServletResponse) 
request.getAttribute(RESPONSE_KEY);
+
             for (int i = 0; i < blocks.getLength(); i++) {
                 Element blockElement = (Element) blocks.item(i);
                 Node parent = blockElement.getParentNode();
+                log.debug("Resolving blocks " + XMLWriter.write(blockElement));
 
                 for (Block.Type bt : 
ComponentRepository.getInstance().getBlockClassification(blockElement.getAttribute("classification")))
 {
                     String render = 
blockElement.getAttribute("render").toUpperCase();
                     if ("".equals(render)) render = "BODY";
 
                     for (Block b : bt.getBlocks()) {
-                        log.info("Including " + b);
                         Renderer body = 
b.getRenderer(Renderer.Type.valueOf(render));
                         if (! 
body.equals(Renderer.Type.valueOf(render).getEmpty(b))) {
                             Parameters params = b.createParameters();
+                            log.debug("Including " + b + " " + params);
 
                             params.setIfDefined(Parameter.REQUEST, request);
+                            params.setIfDefined(Parameter.RESPONSE, response);
 
                             Framework fw = Framework.getInstance();
                             if (fw == null) throw new WizardException("No 
MMBase Framework found");
                             Parameters frameworkParams = fw.createParameters();
                             frameworkParams.setIfDefined(Parameter.REQUEST, 
request);
+                            frameworkParams.setIfDefined(Parameter.RESPONSE, 
response);
                             try {
                                 Document doc = 
org.mmbase.framework.Utils.renderToXml(fw, body, params, frameworkParams, 
WindowState.NORMAL, Wizard.class);
                                 
parent.insertBefore(targetdoc.importNode(doc.getDocumentElement(), true), 
blockElement);
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to