svn commit: r1124153 - in /ofbiz/trunk: applications/content/widget/content/ framework/common/webcommon/WEB-INF/ framework/common/webcommon/WEB-INF/actions/includes/ framework/common/widget/

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

svn commit: r1124153 - in /ofbiz/trunk: applications/content/widget/content/ framework/common/webcommon/WEB-INF/ framework/common/webcommon/WEB-INF/actions/includes/ framework/common/widget/

hansbak-2
Author: hansbak
Date: Wed May 18 09:53:07 2011
New Revision: 1124153

URL: http://svn.apache.org/viewvc?rev=1124153&view=rev
Log:
add a lookup locale function

Added:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy   (with props)
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=1124153&r1=1124152&r2=1124153&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentForms.xml Wed May 18 09:53:07 2011
@@ -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>
 
@@ -191,6 +194,9 @@ under the License.
                 </sub-hyperlink>
             </lookup>
         </field>
+        <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
+        </field>
         <field name="mimeTypeId">
             <drop-down allow-empty="true">
                 <entity-options description="${mimeTypeId} - ${description}" entity-name="MimeType" key-field-name="mimeTypeId">

Modified: ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml?rev=1124153&r1=1124152&r2=1124153&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/DataResourceForms.xml Wed May 18 09:53:07 2011
@@ -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,6 +193,9 @@ under the License.
                 <list-options list-name="dataCategoryList"  key-name="dataCategoryId"  description="${categoryName}"/>
             </drop-down>
         </field>
+        <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
+        </field>
         <field name="mimeTypeId">
             <drop-down allow-empty="true">
                 <entity-options description="${mimeTypeId} - ${description}" entity-name="MimeType" key-field-name="mimeTypeId">
@@ -256,6 +262,9 @@ under the License.
                 <list-options list-name="dataCategoryList"  key-name="dataCategoryId"  description="${categoryName}"/>
             </drop-down>
         </field>
+        <field name="localeString">
+            <lookup target-form-name="LookupLocale"></lookup>
+        </field>
         <field name="mimeTypeId">
             <drop-down allow-empty="true">
                 <entity-options description="${mimeTypeId} - ${description}" entity-name="MimeType" key-field-name="mimeTypeId">

Added: 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?rev=1124153&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy (added)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy Wed May 18 09:53:07 2011
@@ -0,0 +1,37 @@
+/*
+ * 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 java.util.List;
+import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.string.*;
+import org.ofbiz.base.util.UtilMisc;
+
+locales = [] as LinkedList;
+availableLocales = UtilMisc.availableLocales()
+
+if (availableLocales) {
+    availableLocales.each { availableLocale ->
+        locale = [:];
+        locale.localeName = availableLocale.getDisplayName(availableLocale);
+        locale.localeString = availableLocale.toString();
+        locales.add(locale);
+    }
+}
+
+context.locales = locales;

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetLocaleList.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=1124153&r1=1124152&r2=1124153&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Wed May 18 09:53:07 2011
@@ -205,6 +205,7 @@ 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 -->
@@ -276,5 +277,6 @@ under the License.
     <view-map name="viewBlocked" type="screen" page="component://common/widget/CommonScreens.xml#viewBlocked"/>
     
     <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="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=1124153&r1=1124152&r2=1124153&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/LookupForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/LookupForms.xml Wed May 18 09:53:07 2011
@@ -114,4 +114,12 @@ under the License.
             <hyperlink also-hidden="false" target-type="plain" description="${portalPageId}" target="javascript:set_value('${portalPageId}')"/>
         </field>
     </form>
+    
+    <form name="LookupLocale" 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=1124153&r1=1124152&r2=1124153&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/LookupScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/LookupScreens.xml Wed May 18 09:53:07 2011
@@ -225,4 +225,24 @@ 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.CommonLanguageTitle}"/>
+                <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"/>
+                <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-results">
+                        <include-form name="LookupLocale" location="component://common/widget/LookupForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>