You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2013/06/02 10:07:45 UTC

Re: svn commit: r1427819 - in /ofbiz/trunk/framework/common: script/org/ofbiz/common/CommonServices.xml servicedef/services.xml webcommon/WEB-INF/common-controller.xml webcommon/includes/ServerHour24HourFormatJs.ftl

I thought about that and checked this preferred solution.
It's not a big deal but sometimes, when the server is slow or whatnot, you get a small delay (can be 1 second or maybe more sometimes)
Easy to compare using 
    watch --interval=1 'date' 
on server terminal

Jacques

From: "Jacques Le Roux" <ja...@les7arts.com>
> Yes, that's how it works in the jobs list. 
> OK, I will do when I will get a chance
> 
> Thanks
> 
> Jacques
> 
> From: "Adrian Crum" <ad...@sandglass-software.com>
>> 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" <ja...@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: <jl...@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);
>>>>>
>>>>>
>>
>