svn commit: r1835628 - in /ofbiz/ofbiz-framework/trunk: framework/common/groovyScripts/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ themes/common-theme/webapp/common/js/util/ themes/common-theme/widget/

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

svn commit: r1835628 - in /ofbiz/ofbiz-framework/trunk: framework/common/groovyScripts/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ themes/common-theme/webapp/common/js/util/ themes/common-theme/widget/

jleroux@apache.org
Author: jleroux
Date: Wed Jul 11 11:16:07 2018
New Revision: 1835628

URL: http://svn.apache.org/viewvc?rev=1835628&view=rev
Log:
Improved: Rename the misnamed setUserLocale.js to setUserTimeZone.js
(OFBIZ-)

At the same time renames setLocaleFromBrowser to SetTimeZoneFromBrowser
everywhere it's needed
And adds a documentation about the auth mismatch as suggested by Mathieu

Added:
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy
      - copied, changed from r1835616, ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy
    ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserTimeZone.js
      - copied, changed from r1835616, ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserLocale.js
Removed:
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy
    ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserLocale.js
Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml
    ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/ofbiz-framework/trunk/themes/common-theme/widget/CommonScreens.xml

Copied: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy (from r1835616, ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy)
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy?p2=ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy&p1=ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy&r1=1835616&r2=1835628&rev=1835628&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetTimeZoneFromBrowser.groovy Wed Jul 11 11:16:07 2018
@@ -19,7 +19,7 @@
 
 import org.apache.ofbiz.service.ServiceUtil
 
-public Map setLocaleFromBrowser() {
+public Map SetTimeZoneFromBrowser() {
     Map results = ServiceUtil.returnSuccess()
     userLogin = from("UserLogin").where("userLoginId", parameters.userLogin.userLoginId).queryFirst();
     if (userLogin) {

Modified: ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml?rev=1835628&r1=1835627&r2=1835628&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml Wed Jul 11 11:16:07 2018
@@ -943,7 +943,7 @@ under the License.
         <auto-attributes include="pk" mode="IN"/>
     </service>
 
-    <service name="setLocaleFromBrowser" engine="groovy" location="component://common/groovyScripts/SetLocaleFromBrowser.groovy" invoke="setLocaleFromBrowser" auth="true">
+    <service name="SetTimeZoneFromBrowser" engine="groovy" location="component://common/groovyScripts/SetTimeZoneFromBrowser.groovy" invoke="SetTimeZoneFromBrowser" auth="true">
         <description>Set locale from browser.</description>
         <attribute name="localeName" type="String" mode="IN" optional="true"/>
     </service>

Modified: ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1835628&r1=1835627&r2=1835628&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Wed Jul 11 11:16:07 2018
@@ -300,10 +300,11 @@ under the License.
         <response name="error" type="none" />
     </request-map>
 
-    <!-- Set local from user's browser -->
-    <request-map uri="setLocaleFromBrowser">
+    <!-- Set TimeZone from user's browser -->
+    <!-- the auth setting is inconsistent with the one in the service for a good reason, see OFBIZ-10471 for an explanation -->
+    <request-map uri="SetTimeZoneFromBrowser">
         <security https="false" auth="false"/>
-        <event type="service" invoke="setLocaleFromBrowser"/>
+        <event type="service" invoke="SetTimeZoneFromBrowser"/>
         <response name="success" type="request" value="json"/>
         <response name="error" type="request" value="json"/>
     </request-map>

Copied: ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserTimeZone.js (from r1835616, ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserLocale.js)
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserTimeZone.js?p2=ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserTimeZone.js&p1=ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserLocale.js&r1=1835616&r2=1835628&rev=1835628&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserLocale.js (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/setUserTimeZone.js Wed Jul 11 11:16:07 2018
@@ -18,11 +18,11 @@ under the License.
 */
 
 // Only once by session
-if (sessionStorage.getItem("setLocaleFromBrowser") === null || sessionStorage.getItem("setLocaleFromBrowser") !== "done") {
-    sessionStorage.setItem("setLocaleFromBrowser", "done");
+if (sessionStorage.getItem("SetTimeZoneFromBrowser") === null || sessionStorage.getItem("SetTimeZoneFromBrowser") !== "done") {
+    sessionStorage.setItem("SetTimeZoneFromBrowser", "done");
     var timezone = moment.tz.guess();
     $.ajax({
-        url: "setLocaleFromBrowser",
+        url: "SetTimeZoneFromBrowser",
         type: "POST",
         async: false,
         data: "localeName=" + timezone,

Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/widget/CommonScreens.xml?rev=1835628&r1=1835627&r2=1835628&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/widget/CommonScreens.xml (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/widget/CommonScreens.xml Wed Jul 11 11:16:07 2018
@@ -132,7 +132,7 @@ under the License.
                 <set field="layoutSettings.javaScripts[]" value="/common/js/jquery/plugins/jquery-jgrowl/jquery.jgrowl-1.4.6.min.js" global="true"/>
                 <set field="layoutSettings.styleSheets[+0]" value="/common/js/jquery/plugins/jquery-jgrowl/jquery.jgrowl-1.4.6.min.css" global="true" />
                 <!-- Set default user locale from browser -->
-                <set field="layoutSettings.javaScripts[+0]" value="/common/js/util/setUserLocale.js"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/common/js/util/setUserTimeZone.js"/>
                 <set field="layoutSettings.javaScripts[+0]" value="/common/js/plugins/moment-timezone/moment-timezone-with-data.min.js" global="true"/>
                 <set field="layoutSettings.javaScripts[+0]" value="/common/js/plugins/moment-timezone/moment-with-locales.min.js" global="true"/>
             </actions>