Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
I discovered while using trunk demo that getServerTimestampAsLong is …
Browse files Browse the repository at this point in the history
…not enough. Because Javascript always creates the dates without taking into account the TimeZone. I mean there are OOTB no ways to do otherwise and date.format.js does not help. This makes sense from a HTTP client perspective, but nowadays it's really aging with Ajax, etc.

Fortunately there is a miraculous script which helps much: date.timezone.js. I have introduced it with a getServerTimeZone service. I tested locally by setting another timezone on another machine and it worked. I will now test it on trunk, I don't expect any issues

I also cleaned the NOTICE for famfamfam




git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1432577 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
JacquesLeRoux committed Jan 13, 2013
1 parent b72977f commit 3bbe965
Show file tree
Hide file tree
Showing 54 changed files with 23,989 additions and 41 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ ofbiz/trunk/applications/product/lib/dozer-4.2.1.jar
ofbiz/trunk/applications/product/lib/watermarker-0.0.4.jar
ofbiz/trunk/applications/content/template/docbook/extensions/webhelpindexer.jar
ofbiz/trunk/specialpurpose/googlecheckout/lib/checkout-sdk-0.8.8.jar
ofbiz/trunk/framework/images/webapp/images/date/timezones*
=========================================================================
Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -1235,7 +1236,7 @@ ofbiz/trunk/framework/images/webapp/images/jquery/*
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/jquery.hotkeys-0.7.9.min.js
ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/WebPosHotkeys.js
ofbiz/trunk/applications/content/template/docbook/webhelp/*
ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3.js
ofbiz/trunk/framework/images/webapp/images/date/date.format-1.2.3*.js
=========================================================================
The MIT License

Expand Down Expand Up @@ -2802,10 +2803,9 @@ OF SUCH DAMAGES.
Web-based Help from DocBook XML license
David Cramer <dcramer AT motive DOT com><david AT thingbag DOT net>
Kasun Gajasinghe <kasunbg AT gmail DOT com>
Copyright � 2008-2010 Kasun Gajasinghe, David Cramer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the Software), to deal in the Software without restriction,
and associated documentation files (the Software), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
Expand Down
45 changes: 28 additions & 17 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -350,40 +350,51 @@ Extreme! Lab (http://www.extreme.indiana.edu/).
== jline Notice ==
=========================================================================

This product includes software developed by Marc Prud'hommeaux
<mwp1@cornell.edu>
This product includes software developed by Marc Prud'hommeaux
<mwp1@cornell.edu>
=========================================================================
== FamFamFam Notice ==
=========================================================================

This product includes images delevoped by Mark James <mjames@gmail.com>
Birmingham, UK. www.famfamfam.com

Creative Commons Attribution 2.5 License.
Creative Commons Attribution 2.5 License Generic.
http://creativecommons.org/licenses/by/2.5/

You are free:

* to Share — to copy, distribute and transmit the work
* to Remix — to adapt the work
* to Share — to copy, distribute and transmit the work
* to Remix — to adapt the work
* to make commercial use of the work

Under the following conditions:

* Attribution. You must attribute the work in the manner specified
by the author or licensor (but not in any way that suggests that
they endorse you or your use of the work).
* For any reuse or distribution, you must make clear to
others the license terms of this work. The best way to do
this is with a link to this web page.
* Any of the above conditions can be waived if you get
* For any reuse or distribution, you must make clear to
* Attribution — You must attribute the work in the manner specified
by the author or licensor (but not in any way that suggests that
they endorse you or your use of the work).
* Waiver — Any of the above conditions can be waived if you get
permission from the copyright holder.
* Nothing in this license impairs or restricts the
* For any reuse or distribution, you must make clear to
author's moral rights.
* Public Domain — Where the work or any of its elements is in the
public domain under applicable law, that status is in no way
affected by the license.
* Other Rights — In no way are any of the following rights affected
by the license:
* Your fair dealing or fair use rights, or other applicable copyright
exceptions and limitations;
* The author's moral rights;
* Rights other persons may have either in the work itself or in how
the work is used, such as publicity or privacy rights.
* Notice — For any reuse or distribution, you must make clear to others
the license terms of this work. The best way to do this is with a link to
this web page.
=========================================================================

This product includes software developed by Steven Levithan
(http://blog.stevenlevithan.com/archives/date-time-format). MIT license
=========================================================================


This product includes software developed by Matthew Eernisse (mde@fleegix.org)
and Open Source Applications Foundation. Licensed under the ASL2
https://github.com/mde/timezone-js
=========================================================================
14 changes: 10 additions & 4 deletions framework/common/script/org/ofbiz/common/CommonServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,19 @@ under the License.
<field-to-result field="exist"/>
</simple-method>

<simple-method method-name="getServerTimestamp" login-required="false">
<now field="serverTimestamp" type="java.sql.Timestamp"/>
<field-to-result field="serverTimestamp"/>
</simple-method>

<simple-method method-name="getServerTimeZone" login-required="false">
<set field="serverTimeZone" value="${util:defaultTimeZone()}" type="String"/>
<field-to-result field="serverTimeZone"/>
</simple-method>

<simple-method method-name="getServerTimestampAsLong" login-required="false">
<now field="serverTimestamp" type="java.lang.Long"/>
<field-to-result field="serverTimestamp"/>
</simple-method>

<simple-method method-name="getServerTimestamp" login-required="false">
<now field="serverTimestamp" type="java.sql.Timestamp"/>
<field-to-result field="serverTimestamp"/>
</simple-method>
</simple-methods>
15 changes: 10 additions & 5 deletions framework/common/servicedef/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -781,16 +781,21 @@ under the License.
<attribute name="geoList" mode="OUT" type="java.util.List"/>
</service>

<service name="getServerTimestampAsLong" engine="simple" auth="false"
location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerTimestampAsLong">
<attribute name="serverTimestamp" mode="OUT" type="Long"/>
</service>

<service name="getServerTimestamp" engine="simple" auth="false"
location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerTimestamp">
<attribute name="serverTimestamp" mode="OUT" type="TimeStamp"/>
</service>

<service name="getServerTimeZone" engine="simple" auth="false"
location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerTimeZone">
<attribute name="serverTimeZone" mode="OUT" type="String"/>
</service>

<service name="getServerTimestampAsLong" engine="simple" auth="false"
location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerTimestampAsLong">
<attribute name="serverTimestamp" mode="OUT" type="Long"/>
</service>

<service name="createJsLanguageFileMapping" engine="java" auth="false" use-transaction="false"
location="org.ofbiz.common.JsLanguageFileMappingCreator" invoke="createJsLanguageFileMapping">
<description>Create or update the JsLanguageFilesMapping.java. You still need to compile thereafter</description>
Expand Down
15 changes: 11 additions & 4 deletions framework/common/webcommon/WEB-INF/common-controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,23 @@ under the License.
<response name="error" type="request" value="json"/>
</request-map>

<request-map uri="getServerTimestampAsLong">
<request-map uri="getServerTimestamp">
<security https="true" auth="true"/>
<event type="service" invoke="getServerTimestampAsLong"/>
<event type="service" invoke="getServerTimestamp"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>

<request-map uri="getServerTimestamp">
<request-map uri="getServerTimeZone">
<security https="true" auth="true"/>
<event type="service" invoke="getServerTimestamp"/>
<event type="service" invoke="getServerTimeZone"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>

<request-map uri="getServerTimestampAsLong">
<security https="true" auth="true"/>
<event type="service" invoke="getServerTimestampAsLong"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>
Expand Down
12 changes: 8 additions & 4 deletions framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ under the License.
jQuery(document).ready(function() {
window.setInterval(function(){clock()}, 1000);
var serverTimestamp = 0;
var date
var date;
function clock() {
if (jQuery("#${clockField}").text() === "${uiLabelMap.CommonServerHour}:") {
serverTimestamp = getServerTimestamp("getServerTimestampAsLong");
date = new Date(serverTimestamp);
serverTimestamp = getServiceResult("getServerTimestampAsLong")['serverTimestamp'];
serverTimeZone = getServiceResult("getServerTimeZone")['serverTimeZone'];;
initTimeZone();
date = new timezoneJS.Date(serverTimestamp, serverTimeZone);
} else {
date.setSeconds(date.getSeconds() + 1);
}
jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + dateFormat(date, "yyyy-mm-dd HH:MM:ss"));
// dateFormat does not respect the timezone :/ Fortunately toString is what we want :)
//jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + dateFormat(date, "yyyy-mm-dd HH:MM:ss"));
jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + date.toString());
}
})
</script>
3 changes: 2 additions & 1 deletion framework/common/widget/CommonScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ under the License.
<!-- jQuery CSSs -->
<set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/date.format-1.2.3-min.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/GooglemapMarkers.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/date/date.format-1.2.3-min.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/date/timezones/date.timezone-min.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
<set field="layoutSettings.javaScripts[]" value="/images/selectMultipleRelatedValues.js" global="true" />
<set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" global="true" />
Expand Down
1 change: 1 addition & 0 deletions framework/images/webapp/images/date/date.timezone-min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 3bbe965

Please sign in to comment.