You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/03/23 09:25:40 UTC

svn commit: r521619 - in /ofbiz/trunk/applications: content/webapp/content/WEB-INF/actions/print/ content/webapp/content/WEB-INF/actions/print/findPrinters.bsh order/webapp/ordermgr/order/findOrders.ftl order/widget/ordermgr/OrderViewScreens.xml

Author: jacopoc
Date: Fri Mar 23 01:25:39 2007
New Revision: 521619

URL: http://svn.apache.org/viewvc?view=rev&rev=521619
Log:
Added script to select all the printers available in the server.

Added:
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh   (with props)
Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
    ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml

Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh?view=auto&rev=521619
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh (added)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh Fri Mar 23 01:25:39 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.PrintServiceAttribute;
+import javax.print.attribute.standard.PrinterName;
+
+import javolution.util.FastList;
+
+List printers = FastList.newInstance();
+PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
+if (services.length > 0) {
+    for (int i = 0; i < services.length; i++) {
+        PrintServiceAttribute attr = services[i].getAttribute(PrinterName.class);
+        printers.add(((PrinterName)attr).getValue());
+    }
+}
+context.put("printers", printers);

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=521619&r1=521618&r2=521619
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl Fri Mar 23 01:25:39 2007
@@ -406,6 +406,12 @@
            <option value="<@o...@ofbizUrl>">${uiLabelMap.OrderPickOrders}</option>
            <option value="<@o...@ofbizUrl>">${uiLabelMap.CommonPrint}</option>
         </select>
+        <select name="printerName" class="selectBox">
+           <option value="javascript:void();">&nbsp;</option>
+           <#list printers as printer>
+           <option value="${printer}">${printer}</option>
+           </#list>
+        </select>
         <a href="javascript:runAction();" class="buttontext">${uiLabelMap.OrderRunAction}</a>
       </div>
 

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?view=diff&rev=521619&r1=521618&r2=521619
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Fri Mar 23 01:25:39 2007
@@ -176,6 +176,7 @@
                 <set field="titleProperty" value="OrderFindOrder"/>
                 <set field="headerItem" value="findorders"/>
                 <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh"/>
+                <script location="component://content/webapp/content/WEB-INF/actions/print/findPrinters.bsh"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrderViewDecorator">