Just update it from JavaScript. There is no need to get the time from
the server after the page loads.
-Adrian
On 1/13/2013 11:28 AM, Jacques Le Roux wrote:
Done at r1432567+1432591
I want to use the same concept to update the date+time every minute in backend
footer when applicable, what do you think?
Jacques
From: "Jacques Le Roux" <jacques.le.r...@les7arts.com>
I just discovered today while using trunk demo that this does not work
properly, because of how Javascript create the dates. I will need to pass the
TimeZone also.
Jacques
From: <jler...@apache.org>
Author: jleroux
Date: Wed Jan 2 15:05:17 2013
New Revision: 1427819
URL: http://svn.apache.org/viewvc?rev=1427819&view=rev
Log:
At Adrian's request: clarify getServerTimestamp service with now a new
getServerTimestampAsLong specific to the webtools jobs list
Modified:
ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
ofbiz/trunk/framework/common/servicedef/services.xml
ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
ofbiz/trunk/framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl
Modified:
ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml?rev=1427819&r1=1427818&r2=1427819&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
(original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Wed
Jan 2 15:05:17 2013
@@ -347,9 +347,13 @@ under the License.
<field-to-result field="exist"/>
</simple-method>
- <simple-method method-name="getServerTimestamp" login-required="false">
+ <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>
Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1427819&r1=1427818&r2=1427819&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Wed Jan 2 15:05:17
2013
@@ -781,9 +781,14 @@ 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="Long"/>
+ <attribute name="serverTimestamp" mode="OUT" type="TimeStamp"/>
</service>
<service name="createJsLanguageFileMapping" engine="java" auth="false" use-transaction="false"
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=1427819&r1=1427818&r2=1427819&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
(original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Wed
Jan 2 15:05:17 2013
@@ -253,6 +253,13 @@ under the License.
<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>
+
<request-map uri="getServerTimestamp">
<security https="true" auth="true"/>
<event type="service" invoke="getServerTimestamp"/>
Modified:
ofbiz/trunk/framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl?rev=1427819&r1=1427818&r2=1427819&view=diff
==============================================================================
---
ofbiz/trunk/framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl
(original)
+++
ofbiz/trunk/framework/common/webcommon/includes/ServerHour24HourFormatJs.ftl
Wed Jan 2 15:05:17 2013
@@ -23,7 +23,7 @@ jQuery(document).ready(function() {
var date
function clock() {
if (jQuery("#${clockField}").text() === "${uiLabelMap.CommonServerHour}:")
{
- serverTimestamp = getServerTimestamp("getServerTimestamp");
+ serverTimestamp = getServerTimestamp("getServerTimestampAsLong");
date = new Date(serverTimestamp);
} else {
date.setSeconds(date.getSeconds() + 1);