svn commit: r734037 - in /ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/facility/ webapp/facility/facility/ widget/facility/

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

svn commit: r734037 - in /ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/facility/ webapp/facility/facility/ widget/facility/

hansbak-2
Author: hansbak
Date: Mon Jan 12 21:35:40 2009
New Revision: 734037

URL: http://svn.apache.org/viewvc?rev=734037&view=rev
Log:
with one facility, show edit screen directly, without find. With 1-10 facilities show dropdown selection screen, with > 10 show original find screen

Added:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy   (with props)
Modified:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy
    ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
    ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy?rev=734037&r1=734036&r2=734037&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy Mon Jan 12 21:35:40 2009
@@ -19,7 +19,7 @@
 
 import org.ofbiz.entity.condition.*;
 
-facilityId = request.getParameter("facilityId");
+facilityId = parameters.facilityId;
 if (!facilityId && request.getAttribute("facilityId")) {
   facilityId = request.getAttribute("facilityId");
 }

Added: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy?rev=734037&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy (added)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy Mon Jan 12 21:35:40 2009
@@ -0,0 +1,33 @@
+/*
+ * 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 org.ofbiz.base.util.*
+
+findResult = delegator.findAll("Facility");
+findResultSize = findResult.size();
+if(findResultSize == 1) {
+ context.showScreen = "one";
+ context.facility = findResult.get(0);
+ context.parameters.facilityId = context.facility.facilityId;
+}
+if((findResultSize > 1 ) && (findResultSize <= 10)) {
+ context.showScreen = "ten";
+} else if((findResultSize > 10 ) || (findResultSize <= 0)) {
+ context.showScreen = "more";
+}
+
\ No newline at end of file

Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml?rev=734037&r1=734036&r2=734037&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/facility/FacilityForms.xml Mon Jan 12 21:35:40 2009
@@ -40,6 +40,16 @@
         <field name="description"><display/></field>
         <on-event-update-area event-type="paginate" area-id="search-results" area-target="FacilitySearchResults"/>
     </form>
+    
+    <form name="FindFacility10" type="single" target="EditFacility"
+        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+        <field name="facilityId">
+            <drop-down allow-empty="false">
+                <entity-options description="${facilityName}" entity-name="Facility" key-field-name="facilityId"/>
+            </drop-down>
+        </field>
+        <field name="selectButton"><submit button-type="button"/></field>
+    </form>
 
     <form name="FindFacilityOptions" extends="lookupFacility" extends-resource="component://product/webapp/facility/lookup/FieldLookupForms.xml" target="FindFacility">
         <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>

Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?rev=734037&r1=734036&r2=734037&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Mon Jan 12 21:35:40 2009
@@ -26,6 +26,7 @@
             <actions>
                 <set field="titleProperty" value="ProductFindFacilities"/>
                 <set field="headerItem" value="facility"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -35,8 +36,36 @@
                                 <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
                             </condition>
                             <widgets>
-                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
-                                    <decorator-section name="menu-bar">
+                                <section>
+                                    <condition>
+                                        <if-compare field-name="showScreen" value="one" operator="equals"/>
+                                    </condition>
+                                    <actions>
+                                        <script location="component://product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy"/>
+                                    </actions>
+                                    <widgets>
+                                        <section>
+                                            <condition>
+                                                <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
+                                            </condition>
+                                            <widgets>
+                                                <include-menu name="FacilityTabBar" location="component://product/widget/facility/Menus.xml"/>
+                                                <platform-specific>
+                                                    <html><html-template location="component://product/webapp/facility/facility/EditFacility.ftl"/></html>
+                                                </platform-specific>
+                                            </widgets>
+                                            <fail-widgets>
+                                                <label style="h3">${uiLabelMap.ProductFacilityViewPermissionError}</label>
+                                            </fail-widgets>
+                                        </section>
+                                    </widgets>
+                                </section>
+                                <section>
+                                    <condition>
+                                        <if-compare field-name="showScreen" value="ten" operator="equals"/>
+                                    </condition>
+                                    <widgets>
+                                        <label text="Facility Selection" style="h1"/>
                                         <section>
                                             <condition>
                                                 <if-service-permission service-name="facilityGenericPermission" main-action="CREATE"/>
@@ -45,14 +74,34 @@
                                                 <container style="button-bar"><link target="EditFacility" text="${uiLabelMap.ProductCreateNewFacility}" style="buttontext"/></container>
                                             </widgets>
                                         </section>
-                                    </decorator-section>
-                                    <decorator-section name="search-options">
-                                        <include-form name="FindFacilityOptions" location="component://product/webapp/facility/facility/FacilityForms.xml"/>
-                                    </decorator-section>
-                                    <decorator-section name="search-results">
-                                        <include-screen name="FacilitySearchResults"/>
-                                    </decorator-section>
-                                </decorator-screen>
+                                        <include-form name="FindFacility10" location="component://product/webapp/facility/facility/FacilityForms.xml"/>
+                                    </widgets>
+                                </section>
+                                <section>
+                                    <condition>
+                                        <if-compare field-name="showScreen" value="more" operator="equals"/>
+                                    </condition>
+                                    <widgets>
+                                        <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
+                                            <decorator-section name="menu-bar">
+                                                <section>
+                                                    <condition>
+                                                        <if-service-permission service-name="facilityGenericPermission" main-action="CREATE"/>
+                                                    </condition>
+                                                    <widgets>
+                                                        <container style="button-bar"><link target="EditFacility" text="${uiLabelMap.ProductCreateNewFacility}" style="buttontext"/></container>
+                                                    </widgets>
+                                                </section>
+                                            </decorator-section>
+                                            <decorator-section name="search-options">
+                                                <include-form name="FindFacilityOptions" location="component://product/webapp/facility/facility/FacilityForms.xml"/>
+                                            </decorator-section>
+                                            <decorator-section name="search-results">
+                                                <include-screen name="FacilitySearchResults"/>
+                                            </decorator-section>
+                                        </decorator-screen>
+                                    </widgets>
+                                </section>
                             </widgets>
                             <fail-widgets>
                                 <label style="h3">${uiLabelMap.ProductFacilityViewPermissionError}</label>