svn commit: r522021 - in /ofbiz/trunk/applications: content/ content/config/ content/output/ content/servicedef/ content/src/org/ofbiz/content/output/ content/src/org/ofbiz/content/print/ manufacturing/webapp/manufacturing/WEB-INF/actions/bom/ order/se...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r522021 - in /ofbiz/trunk/applications: content/ content/config/ content/output/ content/servicedef/ content/src/org/ofbiz/content/output/ content/src/org/ofbiz/content/print/ manufacturing/webapp/manufacturing/WEB-INF/actions/bom/ order/se...

jacopoc
Author: jacopoc
Date: Sat Mar 24 06:17:36 2007
New Revision: 522021

URL: http://svn.apache.org/viewvc?view=rev&rev=522021
Log:
Misc improvements to the service to send print streams to printers from screen definitions.
Added new service to generate file version of the screens; the files are created in the applications/content/output folder but this is configurable thru the config file in the content component.
An example of its usage is in the 'find orders' screen.


Added:
    ofbiz/trunk/applications/content/output/
    ofbiz/trunk/applications/content/servicedef/services_output.xml
      - copied, changed from r521981, ofbiz/trunk/applications/content/servicedef/services_print.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/output/
    ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java
Removed:
    ofbiz/trunk/applications/content/servicedef/services_print.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/print/
Modified:
    ofbiz/trunk/applications/content/config/ContentUiLabels.properties
    ofbiz/trunk/applications/content/config/content.properties
    ofbiz/trunk/applications/content/ofbiz-component.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl

Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.properties?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/content/config/ContentUiLabels.properties (original)
+++ ofbiz/trunk/applications/content/config/ContentUiLabels.properties Sat Mar 24 06:17:36 2007
@@ -30,6 +30,7 @@
 ContentWebSites=WebSites
 ContentCategory=Category
 ContentCharacterSet=Character Set
+ContentCreateFile=Create File
 ContentDataResource=DataResource
 ContentDataResourceAttribute=Attribute
 ContentDataResourceHtml=Html

Modified: ofbiz/trunk/applications/content/config/content.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/content.properties?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/content/config/content.properties (original)
+++ ofbiz/trunk/applications/content/config/content.properties Sat Mar 24 06:17:36 2007
@@ -35,3 +35,6 @@
 # user level content uploading (relative to ofbiz.home)
 content.upload.path.prefix=/applications/content/uploads
 content.upload.max.files=250
+
+# content output folder (relative to ofbiz.home)
+content.output.path=applications/content/output

Modified: ofbiz/trunk/applications/content/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/ofbiz-component.xml?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/content/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/content/ofbiz-component.xml Sat Mar 24 06:17:36 2007
@@ -48,7 +48,7 @@
     <service-resource type="model" loader="main" location="servicedef/services_contenttypes.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_data.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_email.xml"/>
-    <service-resource type="model" loader="main" location="servicedef/services_print.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services_output.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_survey.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_commevent.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_website.xml"/>

Copied: ofbiz/trunk/applications/content/servicedef/services_output.xml (from r521981, ofbiz/trunk/applications/content/servicedef/services_print.xml)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_output.xml?view=diff&rev=522021&p1=ofbiz/trunk/applications/content/servicedef/services_print.xml&r1=521981&p2=ofbiz/trunk/applications/content/servicedef/services_output.xml&r2=522021
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_print.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_output.xml Sat Mar 24 06:17:36 2007
@@ -20,16 +20,26 @@
 
 <services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">
-    <description>Content Component Print Services</description>
+    <description>Content Component Output Services</description>
     <vendor>OFBiz</vendor>
 
     <service name="sendPrintFromScreen" max-retry="0" engine="java"
-        location="org.ofbiz.content.print.PrintServices" invoke="sendPrintFromScreen">
+        location="org.ofbiz.content.output.OutputServices" invoke="sendPrintFromScreen">
         <description>Send Print From Screen Widget Service</description>
         <attribute name="screenLocation" type="String" mode="IN" optional="false"/>
         <attribute name="screenContext" type="Map" mode="IN" optional="true"/>
         <attribute name="contentType" type="String" mode="IN" optional="true"/>
         <attribute name="printerName" type="String" mode="IN" optional="true"/>
+    </service>
+
+    <service name="createFileFromScreen" max-retry="0" engine="java"
+        location="org.ofbiz.content.output.OutputServices" invoke="createFileFromScreen">
+        <description>Create a File From Screen Widget Service</description>
+        <attribute name="screenLocation" type="String" mode="IN" optional="false"/>
+        <attribute name="screenContext" type="Map" mode="IN" optional="true"/>
+        <attribute name="contentType" type="String" mode="IN" optional="true"/>
+        <attribute name="filePath" type="String" mode="IN" optional="true"/>
+        <attribute name="fileName" type="String" mode="IN" optional="false"/>
     </service>
 
 </services>

Added: ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java?view=auto&rev=522021
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java (added)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java Sat Mar 24 06:17:36 2007
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.content.output;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.MimeConstants;
+import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.collections.MapStack;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.webapp.view.ApacheFopFactory;
+import org.ofbiz.widget.fo.FoFormRenderer;
+import org.ofbiz.widget.html.HtmlScreenRenderer;
+import org.ofbiz.widget.screen.ScreenRenderer;
+import org.xml.sax.SAXException;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URI;
+import java.net.URL;
+import java.sql.Timestamp;
+import java.util.*;
+
+import javax.print.Doc;
+import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
+import javax.print.SimpleDoc;
+import javax.print.PrintException;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.PrintServiceAttribute;
+import javax.print.attribute.PrintServiceAttributeSet;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.HashPrintServiceAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.PrinterName;
+import javax.print.attribute.standard.PrinterURI;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+
+/**
+ * Email Services
+ */
+public class OutputServices {
+
+    public final static String module = OutputServices.class.getName();
+
+    protected static final HtmlScreenRenderer htmlScreenRenderer = new HtmlScreenRenderer();
+    protected static final FoFormRenderer foFormRenderer = new FoFormRenderer();
+    
+    public static Map sendPrintFromScreen(DispatchContext dctx, Map serviceContext) {
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        Locale locale = (Locale) serviceContext.get("locale");
+        String screenLocation = (String) serviceContext.remove("screenLocation");
+        Map screenContext = (Map) serviceContext.remove("screenContext");
+        String contentType = (String) serviceContext.remove("contentType");
+        String printerName = (String) serviceContext.remove("printerName");
+        
+        if (UtilValidate.isEmpty(screenContext)) {
+            screenContext = FastMap.newInstance();
+        }
+        screenContext.put("locale", locale);
+        if (UtilValidate.isEmpty(contentType)) {
+            contentType = "application/postscript";
+        }
+
+        try {
+            
+            MapStack screenContextTmp = MapStack.create();
+            screenContextTmp.put("locale", locale);
+
+            Writer writer = new StringWriter();
+            // substitute the freemarker variables...
+            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, htmlScreenRenderer);
+            screensAtt.populateContextForService(dctx, screenContext);
+            screenContextTmp.putAll(screenContext);
+            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
+            screensAtt.render(screenLocation);
+
+            // create the in/output stream for the generation
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            FopFactory fopFactory = ApacheFopFactory.instance();
+            Fop fop = fopFactory.newFop(contentType, baos);
+            TransformerFactory transFactory = TransformerFactory.newInstance();
+            Transformer transformer = transFactory.newTransformer();
+
+            Reader reader = new StringReader(writer.toString());
+            Source src = new StreamSource(reader);
+            Result res = new SAXResult(fop.getDefaultHandler());
+
+            // Start XSLT transformation and FOP processing
+            transformer.transform(src, res);
+            // and generate the stream
+            baos.flush();
+            baos.close();
+
+            // We don't want to cache the images that get loaded by the FOP engine
+            fopFactory.getImageFactory().clearCaches();
+
+            // Print is sent
+            DocFlavor psInFormat = new DocFlavor.INPUT_STREAM(contentType);
+            InputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            
+            Doc myDoc = new SimpleDoc(bais, psInFormat, null);
+            PrintServiceAttributeSet psaset = new HashPrintServiceAttributeSet();
+            if (UtilValidate.isNotEmpty(printerName)) {
+                try {
+                    URI printerUri = new URI(printerName);
+                    PrinterURI printerUriObj = new PrinterURI(printerUri);
+                    psaset.add(printerUriObj);
+                } catch (URISyntaxException ue) {
+                    Debug.logWarning(ue, "Invalid URI for printer [" + printerName + "]", module);
+                }
+            }
+            //PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, psaset); // TODO: selecting the printer by URI seems to not work
+            PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, null);
+            PrintService printer = null;
+            if (services.length > 0) {
+                if (UtilValidate.isNotEmpty(printerName)) {
+                    String sPrinterName = null;
+                    for (int i = 0; i < services.length; i++) {
+                        PrintServiceAttribute attr = services[i].getAttribute(PrinterName.class);
+                        sPrinterName = ((PrinterName)attr).getValue();
+                        if (sPrinterName.toLowerCase().indexOf(printerName.toLowerCase()) >= 0) {
+                            printer = services[i];
+                            Debug.logInfo("Printer with name [" + sPrinterName +"] selected", module);
+                            break;
+                        }
+                    }
+                }
+                if (UtilValidate.isEmpty(printer)) {
+                    printer = services[0];
+                }
+            }
+            if (UtilValidate.isNotEmpty(printer)) {
+                PrintRequestAttributeSet praset = new HashPrintRequestAttributeSet();
+                praset.add(new Copies(1));
+                DocPrintJob job = printer.createPrintJob();
+                job.print(myDoc, praset);
+            } else {
+                String errMsg = "No printer found with name: " + printerName;
+                Debug.logError(errMsg, module);
+                return ServiceUtil.returnError(errMsg);
+            }
+
+        } catch (PrintException pe) {
+            String errMsg = "Error printing [" + contentType + "]: " + pe.toString();
+            Debug.logError(pe, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (GeneralException ge) {
+            String errMsg = "Error rendering [" + contentType + "]: " + ge.toString();
+            Debug.logError(ge, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (IOException ie) {
+            String errMsg = "Error rendering [" + contentType + "]: " + ie.toString();
+            Debug.logError(ie, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (FOPException fe) {
+            String errMsg = "Error rendering [" + contentType + "]: " + fe.toString();
+            Debug.logError(fe, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (TransformerConfigurationException tce) {
+            String errMsg = "FOP TransformerConfiguration Exception: " + tce.toString();
+            return ServiceUtil.returnError(errMsg);
+        } catch (TransformerException te) {
+            String errMsg = "FOP transform failed: " + te.toString();
+            return ServiceUtil.returnError(errMsg);
+        } catch (SAXException se) {
+            String errMsg = "Error rendering [" + contentType + "]: " + se.toString();
+            Debug.logError(se, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (ParserConfigurationException pe) {
+            String errMsg = "Error rendering [" + contentType + "]: " + pe.toString();
+            Debug.logError(pe, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
+
+        Map result = ServiceUtil.returnSuccess();
+        return result;
+    }
+
+    public static Map createFileFromScreen(DispatchContext dctx, Map serviceContext) {
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        Locale locale = (Locale) serviceContext.get("locale");
+        String screenLocation = (String) serviceContext.remove("screenLocation");
+        Map screenContext = (Map) serviceContext.remove("screenContext");
+        String contentType = (String) serviceContext.remove("contentType");
+        String filePath = (String) serviceContext.remove("filePath");
+        String fileName = (String) serviceContext.remove("fileName");
+        
+        if (UtilValidate.isEmpty(screenContext)) {
+            screenContext = FastMap.newInstance();
+        }
+        screenContext.put("locale", locale);
+        if (UtilValidate.isEmpty(contentType)) {
+            contentType = "application/pdf";
+        }
+
+        try {
+            MapStack screenContextTmp = MapStack.create();
+            screenContextTmp.put("locale", locale);
+
+            Writer writer = new StringWriter();
+            // substitute the freemarker variables...
+            ScreenRenderer screensAtt = new ScreenRenderer(writer, screenContextTmp, htmlScreenRenderer);
+            screensAtt.populateContextForService(dctx, screenContext);
+            screenContextTmp.putAll(screenContext);
+            screensAtt.getContext().put("formStringRenderer", foFormRenderer);
+            screensAtt.render(screenLocation);
+
+            // create the in/output stream for the generation
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+            FopFactory fopFactory = ApacheFopFactory.instance();
+            Fop fop = fopFactory.newFop(contentType, baos);
+            TransformerFactory transFactory = TransformerFactory.newInstance();
+            Transformer transformer = transFactory.newTransformer();
+
+            Reader reader = new StringReader(writer.toString());
+            Source src = new StreamSource(reader);
+            Result res = new SAXResult(fop.getDefaultHandler());
+
+            // Start XSLT transformation and FOP processing
+            transformer.transform(src, res);
+            // and generate the stream
+            baos.flush();
+            baos.close();
+
+            // We don't want to cache the images that get loaded by the FOP engine
+            fopFactory.getImageFactory().clearCaches();
+
+            fileName += UtilDateTime.nowAsString();
+            if ("application/pdf".equals(contentType)) {
+                fileName += ".pdf";
+            } else if ("application/postscript".equals(contentType)) {
+                fileName += ".ps";
+            } else if ("text/plain".equals(contentType)) {
+                fileName += ".txt";
+            }
+            if (UtilValidate.isEmpty(filePath)) {
+                filePath = UtilProperties.getPropertyValue("content.properties", "content.output.path", "/output");
+            }
+            File file = new File(filePath, fileName);
+            
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(baos.toByteArray());
+            fos.close();
+
+        } catch (GeneralException ge) {
+            String errMsg = "Error rendering [" + contentType + "]: " + ge.toString();
+            Debug.logError(ge, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (IOException ie) {
+            String errMsg = "Error rendering [" + contentType + "]: " + ie.toString();
+            Debug.logError(ie, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (FOPException fe) {
+            String errMsg = "Error rendering [" + contentType + "]: " + fe.toString();
+            Debug.logError(fe, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (TransformerConfigurationException tce) {
+            String errMsg = "FOP TransformerConfiguration Exception: " + tce.toString();
+            return ServiceUtil.returnError(errMsg);
+        } catch (TransformerException te) {
+            String errMsg = "FOP transform failed: " + te.toString();
+            return ServiceUtil.returnError(errMsg);
+        } catch (SAXException se) {
+            String errMsg = "Error rendering [" + contentType + "]: " + se.toString();
+            Debug.logError(se, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        } catch (ParserConfigurationException pe) {
+            String errMsg = "Error rendering [" + contentType + "]: " + pe.toString();
+            Debug.logError(pe, errMsg, module);
+            return ServiceUtil.returnError(errMsg);
+        }
+
+        Map result = ServiceUtil.returnSuccess();
+        return result;
+    }
+
+}

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.bsh Sat Mar 24 06:17:36 2007
@@ -66,9 +66,7 @@
                                                                                               "userLogin", userLogin));
                 qoh = (Double)outMap.get("quantityOnHandTotal");
             }
-        } catch(GenericServiceException gse) {
-            System.out.println("ERRORE: " + gse.getMessage());
-        }
+        } catch(GenericServiceException gse) {}
         productsData.add(UtilMisc.toMap("node", node, "unitCost", unitCost, "totalCost", totalCost, "qoh", qoh));
     }
     context.put("productsData", productsData);

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Sat Mar 24 06:17:36 2007
@@ -505,6 +505,11 @@
         <attribute name="screenLocation" type="String" mode="IN" optional="false"/>
         <attribute name="printerName" type="String" mode="IN" optional="true"/>
     </service>
+    <service name="massCreateFileForOrders" engine="java" transaction-timeout="300"
+            location="org.ofbiz.order.order.OrderServices" invoke="massCreateFileForOrders" auth="true">
+        <implements service="massOrderChangeInterface"/>
+        <attribute name="screenLocation" type="String" mode="IN" optional="false"/>
+    </service>
 
     <service name="getNextOrderId" engine="simple"
         location="org/ofbiz/order/order/OrderServices.xml" invoke="getNextOrderId">

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat Mar 24 06:17:36 2007
@@ -3655,6 +3655,35 @@
         return ServiceUtil.returnSuccess();
     }
 
+    public static Map massCreateFileForOrders(DispatchContext dctx, Map context) {
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        String screenLocation = (String) context.get("screenLocation");
+
+        // make the list per facility
+        List orderIds = (List) context.get("orderIdList");
+        Iterator i = orderIds.iterator();
+        while (i.hasNext()) {
+            String orderId = (String) i.next();
+            if (UtilValidate.isEmpty(orderId)) {
+                continue;
+            }
+            Map ctx = FastMap.newInstance();
+            ctx.put("userLogin", userLogin);
+            ctx.put("screenLocation", screenLocation);
+            //ctx.put("contentType", "application/postscript");
+            ctx.put("fileName", "order_" + orderId + "_");
+            ctx.put("screenContext", UtilMisc.toMap("orderId", orderId));
+
+            try {
+                dispatcher.runAsync("createFileFromScreen", ctx);
+            } catch (GenericServiceException e) {
+                Debug.logError(e, module);
+            }
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
     public static Map checkCreateDropShipPurchaseOrders(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();
         LocalDispatcher dispatcher = ctx.getDispatcher();

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Sat Mar 24 06:17:36 2007
@@ -149,6 +149,12 @@
         <response name="success" type="request-redirect" value="findorders"/>
         <response name="error" type="request-redirect" value="findorders"/>
     </request-map>
+    <request-map uri="massCreateFileForOrders">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="massCreateFileForOrders"/>
+        <response name="success" type="request-redirect" value="findorders"/>
+        <response name="error" type="request-redirect" value="findorders"/>
+    </request-map>
 
     <!-- Order Manager Task List Requests -->
     <request-map uri="acceptassignment">

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl?view=diff&rev=522021&r1=522020&r2=522021
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl Sat Mar 24 06:17:36 2007
@@ -405,6 +405,7 @@
            <option value="<@ofbizUrl>massApproveOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderApproveOrder}</option>
            <option value="<@ofbizUrl>massPickOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderPickOrders}</option>
            <option value="<@ofbizUrl>massPrintOrders?hideFields=${requestParameters.hideFields?default('N')}${paramList}</@ofbizUrl>">${uiLabelMap.CommonPrint}</option>
+           <option value="<@ofbizUrl>massCreateFileForOrders?hideFields=${requestParameters.hideFields?default('N')}${paramList}</@ofbizUrl>">${uiLabelMap.ContentCreateFile}</option>
         </select>
         <select name="printerName" class="selectBox">
            <option value="javascript:void();">&nbsp;</option>