Author: hansbak
Date: Wed Jun 20 03:17:59 2012
New Revision: 1351928

URL: http://svn.apache.org/viewvc?rev=1351928&view=rev
Log:
re-installed locale lookup with an appropriate fix: adding the locale search

Added:
    
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
      - copied, changed from r1351613, 
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
Modified:
    ofbiz/trunk/applications/content/widget/content/ContentForms.xml
    ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml
    ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/trunk/framework/common/widget/LookupForms.xml
    ofbiz/trunk/framework/common/widget/LookupScreens.xml

Modified: ofbiz/trunk/applications/content/widget/content/ContentForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentForms.xml?rev=1351928&r1=1351927&r2=1351928&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentForms.xml Wed Jun 20 
03:17:59 2012
@@ -58,12 +58,15 @@ under the License.
         </field>
         <field name="createdByUserLogin" position="2"><lookup 
target-form-name="LookupUserLoginAndPartyDetails"/></field>
         <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
+        </field>
+        <!--<field name="localeString">
             <drop-down allow-empty="true">
                 <entity-options entity-name="CountryCode" 
description="${countryName} [${countryCode}]" key-field-name="countryCode">
                     <entity-order-by field-name="countryName"/>
                 </entity-options>
             </drop-down>
-        </field>
+        </field>-->
         <field name="searchButton" title="${uiLabelMap.CommonFind}" 
widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
@@ -187,11 +190,7 @@ under the License.
             </lookup>
         </field>
         <field name="localeString">
-            <drop-down allow-empty="true">
-                <entity-options entity-name="CountryCode" 
description="${countryName} [${countryCode}]" key-field-name="countryCode">
-                    <entity-order-by field-name="countryName"/>
-                </entity-options>
-            </drop-down>
+            <lookup target-form-name="LookupLocale"></lookup>
         </field>
         <field name="mimeTypeId" encode-output="false">
             <drop-down allow-empty="true">

Modified: ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml?rev=1351928&r1=1351927&r2=1351928&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml 
(original)
+++ ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml Wed 
Jun 20 03:17:59 2012
@@ -49,12 +49,15 @@ under the License.
             </drop-down>
         </field>
         <field name="localeString" position="2">
+            <lookup target-form-name="LookupLocale"></lookup>
+        </field>
+        <!--<field name="localeString" position="2">
             <drop-down allow-empty="true">
                 <entity-options entity-name="CountryCode" 
description="${countryName} [${countryCode}]" key-field-name="countryCode">
                     <entity-order-by field-name="countryName"/>
                 </entity-options>
             </drop-down>
-        </field>
+        </field>-->
         <field name="createdByUserLogin" position="1"><lookup 
target-form-name="LookupPerson"/></field>
         <field name="dataCategoryId" position="2">
             <drop-down allow-empty="true">
@@ -190,12 +193,8 @@ under the License.
                 <list-options list-name="dataCategoryList"  
key-name="dataCategoryId"  description="${categoryName}"/>
             </drop-down>
         </field>
-        <field name="localeString" position="2">
-            <drop-down allow-empty="true">
-                <entity-options entity-name="CountryCode" 
description="${countryName} [${countryCode}]" key-field-name="countryCode">
-                    <entity-order-by field-name="countryName"/>
-                </entity-options>
-            </drop-down>
+        <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
         </field>
         <field name="mimeTypeId"  encode-output="false">
             <drop-down allow-empty="true">
@@ -263,12 +262,8 @@ under the License.
                 <list-options list-name="dataCategoryList"  
key-name="dataCategoryId"  description="${categoryName}"/>
             </drop-down>
         </field>
-        <field name="localeString" position="2">
-            <drop-down allow-empty="true">
-                <entity-options entity-name="CountryCode" 
description="${countryName} [${countryCode}]" key-field-name="countryCode">
-                    <entity-order-by field-name="countryName"/>
-                </entity-options>
-            </drop-down>
+        <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
         </field>
         <field name="mimeTypeId" encode-output="false">
             <drop-down allow-empty="true">

Copied: 
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
 (from r1351613, 
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy)
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy?p2=ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy&p1=ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy&r1=1351613&r2=1351928&rev=1351928&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
 (original)
+++ 
ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
 Wed Jun 20 03:17:59 2012
@@ -25,12 +25,26 @@ import org.ofbiz.base.util.UtilMisc;
 locales = [] as LinkedList;
 availableLocales = UtilMisc.availableLocales()
 
+// Debug.logInfo(parameters.localeString + "==" +  parameters.localeName);
+
 if (availableLocales) {
     availableLocales.each { availableLocale ->
         locale = [:];
         locale.localeName = availableLocale.getDisplayName(availableLocale);
         locale.localeString = availableLocale.toString();
-        locales.add(locale);
+        if (UtilValidate.isNotEmpty(parameters.localeString)) {
+            if 
(locale.localeString.toUpperCase().contains(parameters.localeString.toUpperCase()))
 {
+                locales.add(locale);
+            }
+        }
+        if (UtilValidate.isNotEmpty(parameters.localeName)) {
+            if 
(locale.localeName.toUpperCase().contains(parameters.localeName.toUpperCase())) 
{
+                locales.add(locale);
+            }
+        }
+        if (UtilValidate.isEmpty(parameters.localeString) && 
UtilValidate.isEmpty(parameters.localeName)) {
+            locales.add(locale);
+        }
     }
 }
 

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1351928&r1=1351927&r2=1351928&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml 
(original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Wed 
Jun 20 03:17:59 2012
@@ -207,7 +207,8 @@ under the License.
     <!-- Lookup requests -->
     <request-map uri="LookupGeo"><security https="true" auth="true"/><response 
name="success" type="view" value="LookupGeo"/></request-map>
     <request-map uri="LookupGeoName"><security https="true" 
auth="true"/><response name="success" type="view" 
value="LookupGeoName"/></request-map>
-
+    <request-map uri="LookupLocale"><security https="true" 
auth="true"/><response name="success" type="view" 
value="LookupLocale"/></request-map>
+    
     <!--========================== AJAX events =====================-->
     <!-- Get states related to a country -->
     <request-map uri="getAssociatedStateList">
@@ -279,4 +280,5 @@ under the License.
     
     <view-map name="LookupGeo" type="screen" 
page="component://common/widget/LookupScreens.xml#LookupGeo"/>
     <view-map name="LookupGeoName" type="screen" 
page="component://common/widget/LookupScreens.xml#LookupGeoName"/>
+    <view-map name="LookupLocale" type="screen" 
page="component://common/widget/LookupScreens.xml#LookupLocale"/>
 </site-conf>

Modified: ofbiz/trunk/framework/common/widget/LookupForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/LookupForms.xml?rev=1351928&r1=1351927&r2=1351928&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/LookupForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/LookupForms.xml Wed Jun 20 03:17:59 2012
@@ -115,4 +115,17 @@ under the License.
         </field>
     </form>
 
+    <form name="LookupLocale" type="single" target="LookupLocale">
+        <field name="localeString"><text-find hide-options="true"/></field>
+        <field name="localeName" 
title="${uiLabelMap.CommonLanguageTitle}"><text-find 
hide-options="true"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit 
button-type="button"/></field>
+    </form>
+
+    <form name="ListLocales" type="list" list-name="locales" 
paginate-target="LookupLocale"
+        odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
+        <field name="localeString" widget-style="buttontext">
+            <hyperlink also-hidden="false" target-type="plain" 
description="${localeString}" target="javascript:set_value('${localeString}', 
'${localeName}')"/>
+        </field>
+        <field name="localeName" 
title="${uiLabelMap.CommonLanguageTitle}"><display/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/framework/common/widget/LookupScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/LookupScreens.xml?rev=1351928&r1=1351927&r2=1351928&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/LookupScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/LookupScreens.xml Wed Jun 20 03:17:59 
2012
@@ -225,4 +225,28 @@ under the License.
             </widgets>
         </section>
     </screen>
+
+    <screen name="LookupLocale">
+        <section>
+            <actions>
+                <property-map resource="SecurityUiLabels" 
map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" 
global="true"/>
+                <set field="title" value="${uiLabelMap.CommonLookupLocale}"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" 
type="Integer" default-value="0"/>
+                <set field="viewSize" from-field="parameters.VIEW_SIZE" 
type="Integer" default-value="20"/>
+                <set field="inputFields" from-field="parameters"/>
+                <script 
location="component://common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="LookupDecorator" 
location="component://common/widget/CommonScreens.xml">
+                    <decorator-section name="search-options">
+                        <include-form name="LookupLocale" 
location="component://common/widget/LookupForms.xml"/>
+                    </decorator-section>
+                    <decorator-section name="search-results">
+                        <include-form name="ListLocales" 
location="component://common/widget/LookupForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>


Reply via email to