Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common...

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

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common...

Adrian Crum-3
What is this commit supposed to do?

The getServerHour service name is misleading - it actually returns the
server date/time.

Keep in mind there is a Mini-language element called <now>. Your service
is unnecessarily complicated.

-Adrian

On 12/30/2012 7:33 AM, [hidden email] wrote:

> Author: jleroux
> Date: Sun Dec 30 07:33:26 2012
> New Revision: 1426904
>
> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
> Log:
> Complete the work on server hour for the webtools job list.
> * Now uses real server hour
> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js, that it is really
> * Introduces a minimized version of date.format: date.format-1.2.3-min.js
>
> Added:
>      ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>        - copied, changed from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>      ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js   (with props)
>      ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>        - copied, changed from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
> Removed:
>      ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>      ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
> Modified:
>      ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>      ofbiz/trunk/applications/product/servicedef/services_view.xml
>      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/widget/CommonScreens.xml
>      ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>      ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>
> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original)
> +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Sun Dec 30 07:33:26 2012
> @@ -847,7 +847,7 @@ under the License.
>       </simple-method>
>  
>       <!-- To help dynamically populate a products dropdown given a product category id from a change in another dropdown, possibly sorted on sequenceNum -->
> -    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues.js" login-required="false">
> +    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues" login-required="false">
>           <set field="parameters.categoryId" from-field="parameters.productCategoryId"/>
>           <set-service-fields service-name="getProductCategoryMembers" map="parameters" to-map="getProductCategoryMembersMap"/>
>           <call-service service-name="getProductCategoryMembers" in-map-name="getProductCategoryMembersMap">
>
> Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/servicedef/services_view.xml (original)
> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml Sun Dec 30 07:33:26 2012
> @@ -119,7 +119,7 @@ under the License.
>      
>       <service name="getAssociatedProductsList" engine="simple" auth="false"
>           location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="getAssociatedProductsList">
> -        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues.js</description>
> +        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues</description>
>           <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
>           <attribute name="products" mode="OUT" type="java.util.List"/>
>       </service>
>
> 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=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
> +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Sun Dec 30 07:33:26 2012
> @@ -345,5 +345,10 @@ under the License.
>               </else>
>           </if-not-empty>
>           <field-to-result field="exist"/>
> -    </simple-method>
> +    </simple-method>
> +
> +    <simple-method method-name="getServerHour" login-required="false">
> +        <set field="nowDateString" value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss')}"/>
> +        <field-to-result field="nowDateString"/>
> +    </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=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30 07:33:26 2012
> @@ -780,7 +780,12 @@ under the License.
>           <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>           <attribute name="geoList" mode="OUT" type="java.util.List"/>
>       </service>
> -
> +
> +    <service name="getServerHour" engine="simple" auth="false"
> +        location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerHour">
> +        <attribute name="nowDateString" mode="OUT" type="String"/>
> +    </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>
>
> 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=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Sun Dec 30 07:33:26 2012
> @@ -253,6 +253,13 @@ under the License.
>           <response name="error" type="request" value="json"/>
>       </request-map>
>      
> +    <request-map uri="getServerHour">
> +        <security https="true" auth="true"/>
> +        <event type="service" invoke="getServerHour"/>
> +        <response name="success" type="request" value="json"/>
> +        <response name="error" type="request" value="json"/>
> +    </request-map>
> +
>       <!--========================== AJAX events =====================-->
>  
>       <!-- View Mappings -->
>
> Copied: ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl (from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl (original)
> +++ ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl Sun Dec 30 07:33:26 2012
> @@ -20,7 +20,7 @@ under the License.
>   jQuery(document).ready(function() {
>     window.setInterval(function(){clock()}, 1000);
>     function clock() {
> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + getServerHour("getServerHour"));
>     }
>   })
>   </script>
> \ No newline at end of file
>
> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>                   <service service-name="getVisualThemeResources">
>
> Added: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js (added)
> +++ ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js Sun Dec 30 07:33:26 2012
> @@ -0,0 +1 @@
> +var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),yyyy
>   :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov
>   ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
> \ No newline at end of file
>
> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
> ------------------------------------------------------------------------------
>      svn:eol-style = native
>
> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
> ------------------------------------------------------------------------------
>      svn:keywords = Date Rev Author URL Id
>
> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
> ------------------------------------------------------------------------------
>      svn:mime-type = text/plain
>
> Copied: ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js (from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original)
> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js Sun Dec 30 07:33:26 2012
> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>       return data;
>   }
>  
> +//*** calls any service already mounted as an event
> +function getServiceResult(request){
> +    var data;
> +    jQuery.ajax({
> +        type: 'POST',
> +        url: request,
> +        async: false,
> +        cache: false,
> +        success: function(result){
> +            data = result;
> +        }
> +    });
> +    return data;
> +}
> +
>   //*** checkUomConversion returns true if an UomConversion exists
>   function checkUomConversion(request, params){
>       data = getServiceResult(request, params);
>       return data['exist'];
>   }
>  
> +function getServerHour(request){
> +    data = getServiceResult(request);
> +    return data['nowDateString'];
> +}
> \ No newline at end of file
>
> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec 30 07:33:26 2012
> @@ -49,7 +49,7 @@ under the License.
>                   <set field="tabButtonItem" value="findJob"/>
>                   <set field="jobCtx" from-field="parameters"/>
>                   <set field="dummy" value="${groovy: if ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/> <!--  To more easily see current pending jobs and possibly cancel some others -->
> -                <!-- field for WindowSetIntervalJs.ftl -->
> +                <!-- fields for WindowClockJs.ftl -->
>                   <set field="clockField" value="FindJobs_clock_title"/>
>               </actions>
>               <widgets>
> @@ -57,7 +57,7 @@ under the License.
>                       <decorator-section name="body">
>                           <section>
>                               <widgets>
> -                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
> +                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>                                   <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
>                                       <decorator-section name="search-options">
>                                           <include-form name="FindJobs" location="component://webtools/widget/ServiceForms.xml"/>
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
> @@ -63,7 +63,7 @@ under the License.
>                   <entity-and list="webAnalyticsConfigs" entity-name="WebAnalyticsConfig">
>                       <field-map field-name="webSiteId"/>
>                   </entity-and>
> -                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
> +                <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
>               </actions>
>               <widgets>
>                  <section>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
From: "Adrian Crum" <[hidden email]>
> What is this commit supposed to do?

Get the server hour, which can be different from your local machine.
 
> The getServerHour service name is misleading - it actually returns the
> server date/time.

Yes, that's wanted. To compare with the jobs times which are server related.

> Keep in mind there is a Mini-language element called <now>. Your service
> is unnecessarily complicated.

I know about <now>. I needed to format the date. It was the simpler way I found

Jacques

> -Adrian
>
> On 12/30/2012 7:33 AM, [hidden email] wrote:
>> Author: jleroux
>> Date: Sun Dec 30 07:33:26 2012
>> New Revision: 1426904
>>
>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>> Log:
>> Complete the work on server hour for the webtools job list.
>> * Now uses real server hour
>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js, that it is really
>> * Introduces a minimized version of date.format: date.format-1.2.3-min.js
>>
>> Added:
>>      ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>        - copied, changed from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>      ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js   (with props)
>>      ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>        - copied, changed from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>> Removed:
>>      ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>      ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>> Modified:
>>      ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>      ofbiz/trunk/applications/product/servicedef/services_view.xml
>>      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/widget/CommonScreens.xml
>>      ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>      ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>
>> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original)
>> +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Sun Dec 30 07:33:26 2012
>> @@ -847,7 +847,7 @@ under the License.
>>       </simple-method>
>>  
>>       <!-- To help dynamically populate a products dropdown given a product category id from a change in another dropdown, possibly sorted on sequenceNum -->
>> -    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues.js" login-required="false">
>> +    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues" login-required="false">
>>           <set field="parameters.categoryId" from-field="parameters.productCategoryId"/>
>>           <set-service-fields service-name="getProductCategoryMembers" map="parameters" to-map="getProductCategoryMembersMap"/>
>>           <call-service service-name="getProductCategoryMembers" in-map-name="getProductCategoryMembersMap">
>>
>> Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml (original)
>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml Sun Dec 30 07:33:26 2012
>> @@ -119,7 +119,7 @@ under the License.
>>      
>>       <service name="getAssociatedProductsList" engine="simple" auth="false"
>>           location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="getAssociatedProductsList">
>> -        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues.js</description>
>> +        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues</description>
>>           <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
>>           <attribute name="products" mode="OUT" type="java.util.List"/>
>>       </service>
>>
>> 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=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
>> +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Sun Dec 30 07:33:26 2012
>> @@ -345,5 +345,10 @@ under the License.
>>               </else>
>>           </if-not-empty>
>>           <field-to-result field="exist"/>
>> -    </simple-method>
>> +    </simple-method>
>> +
>> +    <simple-method method-name="getServerHour" login-required="false">
>> +        <set field="nowDateString" value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss')}"/>
>> +        <field-to-result field="nowDateString"/>
>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30 07:33:26 2012
>> @@ -780,7 +780,12 @@ under the License.
>>           <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>>           <attribute name="geoList" mode="OUT" type="java.util.List"/>
>>       </service>
>> -
>> +
>> +    <service name="getServerHour" engine="simple" auth="false"
>> +        location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerHour">
>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>> +    </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>
>>
>> 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=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
>> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Sun Dec 30 07:33:26 2012
>> @@ -253,6 +253,13 @@ under the License.
>>           <response name="error" type="request" value="json"/>
>>       </request-map>
>>      
>> +    <request-map uri="getServerHour">
>> +        <security https="true" auth="true"/>
>> +        <event type="service" invoke="getServerHour"/>
>> +        <response name="success" type="request" value="json"/>
>> +        <response name="error" type="request" value="json"/>
>> +    </request-map>
>> +
>>       <!--========================== AJAX events =====================-->
>>  
>>       <!-- View Mappings -->
>>
>> Copied: ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl (from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl (original)
>> +++ ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl Sun Dec 30 07:33:26 2012
>> @@ -20,7 +20,7 @@ under the License.
>>   jQuery(document).ready(function() {
>>     window.setInterval(function(){clock()}, 1000);
>>     function clock() {
>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + getServerHour("getServerHour"));
>>     }
>>   })
>>   </script>
>> \ No newline at end of file
>>
>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>                   <service service-name="getVisualThemeResources">
>>
>> Added: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>> ==============================================================================
>> --- ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js (added)
>> +++ ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js Sun Dec 30 07:33:26 2012
>> @@ -0,0 +1 @@
>> +var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
> yyy
>>   :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
> "Nov
>>   ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
>> \ No newline at end of file
>>
>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>> ------------------------------------------------------------------------------
>>      svn:eol-style = native
>>
>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>> ------------------------------------------------------------------------------
>>      svn:keywords = Date Rev Author URL Id
>>
>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>> ------------------------------------------------------------------------------
>>      svn:mime-type = text/plain
>>
>> Copied: ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js (from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original)
>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js Sun Dec 30 07:33:26 2012
>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>       return data;
>>   }
>>  
>> +//*** calls any service already mounted as an event
>> +function getServiceResult(request){
>> +    var data;
>> +    jQuery.ajax({
>> +        type: 'POST',
>> +        url: request,
>> +        async: false,
>> +        cache: false,
>> +        success: function(result){
>> +            data = result;
>> +        }
>> +    });
>> +    return data;
>> +}
>> +
>>   //*** checkUomConversion returns true if an UomConversion exists
>>   function checkUomConversion(request, params){
>>       data = getServiceResult(request, params);
>>       return data['exist'];
>>   }
>>  
>> +function getServerHour(request){
>> +    data = getServiceResult(request);
>> +    return data['nowDateString'];
>> +}
>> \ No newline at end of file
>>
>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec 30 07:33:26 2012
>> @@ -49,7 +49,7 @@ under the License.
>>                   <set field="tabButtonItem" value="findJob"/>
>>                   <set field="jobCtx" from-field="parameters"/>
>>                   <set field="dummy" value="${groovy: if ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/> <!--  To more easily see current pending jobs and possibly cancel some others -->
>> -                <!-- field for WindowSetIntervalJs.ftl -->
>> +                <!-- fields for WindowClockJs.ftl -->
>>                   <set field="clockField" value="FindJobs_clock_title"/>
>>               </actions>
>>               <widgets>
>> @@ -57,7 +57,7 @@ under the License.
>>                       <decorator-section name="body">
>>                           <section>
>>                               <widgets>
>> -                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>> +                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>                                   <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
>>                                       <decorator-section name="search-options">
>>                                           <include-form name="FindJobs" location="component://webtools/widget/ServiceForms.xml"/>
>>
>> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original)
>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>> @@ -63,7 +63,7 @@ under the License.
>>                   <entity-and list="webAnalyticsConfigs" entity-name="WebAnalyticsConfig">
>>                       <field-map field-name="webSiteId"/>
>>                   </entity-and>
>> -                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
>> +                <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
>>               </actions>
>>               <widgets>
>>                  <section>
>>
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Adrian Crum-3
On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
> From: "Adrian Crum" <[hidden email]>
>> What is this commit supposed to do?
> Get the server hour, which can be different from your local machine.
>  
>> The getServerHour service name is misleading - it actually returns the
>> server date/time.
> Yes, that's wanted. To compare with the jobs times which are server related.

A misleading service name is wanted??!! Please don't do that.

>
>> Keep in mind there is a Mini-language element called <now>. Your service
>> is unnecessarily complicated.
> I know about <now>. I needed to format the date. It was the simpler way I found

The service engine will format the date.

>
> Jacques
>
>> -Adrian
>>
>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>> Author: jleroux
>>> Date: Sun Dec 30 07:33:26 2012
>>> New Revision: 1426904
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>> Log:
>>> Complete the work on server hour for the webtools job list.
>>> * Now uses real server hour
>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js, that it is really
>>> * Introduces a minimized version of date.format: date.format-1.2.3-min.js
>>>
>>> Added:
>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>         - copied, changed from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js   (with props)
>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>         - copied, changed from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>> Removed:
>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>> Modified:
>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>       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/widget/CommonScreens.xml
>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>
>>> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original)
>>> +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Sun Dec 30 07:33:26 2012
>>> @@ -847,7 +847,7 @@ under the License.
>>>        </simple-method>
>>>    
>>>        <!-- To help dynamically populate a products dropdown given a product category id from a change in another dropdown, possibly sorted on sequenceNum -->
>>> -    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues.js" login-required="false">
>>> +    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues" login-required="false">
>>>            <set field="parameters.categoryId" from-field="parameters.productCategoryId"/>
>>>            <set-service-fields service-name="getProductCategoryMembers" map="parameters" to-map="getProductCategoryMembersMap"/>
>>>            <call-service service-name="getProductCategoryMembers" in-map-name="getProductCategoryMembersMap">
>>>
>>> Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml (original)
>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml Sun Dec 30 07:33:26 2012
>>> @@ -119,7 +119,7 @@ under the License.
>>>        
>>>        <service name="getAssociatedProductsList" engine="simple" auth="false"
>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="getAssociatedProductsList">
>>> -        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues.js</description>
>>> +        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues</description>
>>>            <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
>>>            <attribute name="products" mode="OUT" type="java.util.List"/>
>>>        </service>
>>>
>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
>>> +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Sun Dec 30 07:33:26 2012
>>> @@ -345,5 +345,10 @@ under the License.
>>>                </else>
>>>            </if-not-empty>
>>>            <field-to-result field="exist"/>
>>> -    </simple-method>
>>> +    </simple-method>
>>> +
>>> +    <simple-method method-name="getServerHour" login-required="false">
>>> +        <set field="nowDateString" value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss')}"/>
>>> +        <field-to-result field="nowDateString"/>
>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30 07:33:26 2012
>>> @@ -780,7 +780,12 @@ under the License.
>>>            <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>>>            <attribute name="geoList" mode="OUT" type="java.util.List"/>
>>>        </service>
>>> -
>>> +
>>> +    <service name="getServerHour" engine="simple" auth="false"
>>> +        location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerHour">
>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>> +    </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>
>>>
>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
>>> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Sun Dec 30 07:33:26 2012
>>> @@ -253,6 +253,13 @@ under the License.
>>>            <response name="error" type="request" value="json"/>
>>>        </request-map>
>>>        
>>> +    <request-map uri="getServerHour">
>>> +        <security https="true" auth="true"/>
>>> +        <event type="service" invoke="getServerHour"/>
>>> +        <response name="success" type="request" value="json"/>
>>> +        <response name="error" type="request" value="json"/>
>>> +    </request-map>
>>> +
>>>        <!--========================== AJAX events =====================-->
>>>    
>>>        <!-- View Mappings -->
>>>
>>> Copied: ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl (from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl (original)
>>> +++ ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl Sun Dec 30 07:33:26 2012
>>> @@ -20,7 +20,7 @@ under the License.
>>>    jQuery(document).ready(function() {
>>>      window.setInterval(function(){clock()}, 1000);
>>>      function clock() {
>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + getServerHour("getServerHour"));
>>>      }
>>>    })
>>>    </script>
>>> \ No newline at end of file
>>>
>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>                    <service service-name="getVisualThemeResources">
>>>
>>> Added: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js (added)
>>> +++ ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js Sun Dec 30 07:33:26 2012
>>> @@ -0,0 +1 @@
>>> +var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>> yyy
>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>> "Nov
>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
>>> \ No newline at end of file
>>>
>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>> ------------------------------------------------------------------------------
>>>       svn:eol-style = native
>>>
>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>> ------------------------------------------------------------------------------
>>>       svn:keywords = Date Rev Author URL Id
>>>
>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>> ------------------------------------------------------------------------------
>>>       svn:mime-type = text/plain
>>>
>>> Copied: ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js (from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original)
>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js Sun Dec 30 07:33:26 2012
>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>        return data;
>>>    }
>>>    
>>> +//*** calls any service already mounted as an event
>>> +function getServiceResult(request){
>>> +    var data;
>>> +    jQuery.ajax({
>>> +        type: 'POST',
>>> +        url: request,
>>> +        async: false,
>>> +        cache: false,
>>> +        success: function(result){
>>> +            data = result;
>>> +        }
>>> +    });
>>> +    return data;
>>> +}
>>> +
>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>    function checkUomConversion(request, params){
>>>        data = getServiceResult(request, params);
>>>        return data['exist'];
>>>    }
>>>    
>>> +function getServerHour(request){
>>> +    data = getServiceResult(request);
>>> +    return data['nowDateString'];
>>> +}
>>> \ No newline at end of file
>>>
>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec 30 07:33:26 2012
>>> @@ -49,7 +49,7 @@ under the License.
>>>                    <set field="tabButtonItem" value="findJob"/>
>>>                    <set field="jobCtx" from-field="parameters"/>
>>>                    <set field="dummy" value="${groovy: if ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/> <!--  To more easily see current pending jobs and possibly cancel some others -->
>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>> +                <!-- fields for WindowClockJs.ftl -->
>>>                    <set field="clockField" value="FindJobs_clock_title"/>
>>>                </actions>
>>>                <widgets>
>>> @@ -57,7 +57,7 @@ under the License.
>>>                        <decorator-section name="body">
>>>                            <section>
>>>                                <widgets>
>>> -                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>> +                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>                                    <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
>>>                                        <decorator-section name="search-options">
>>>                                            <include-form name="FindJobs" location="component://webtools/widget/ServiceForms.xml"/>
>>>
>>> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original)
>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>>> @@ -63,7 +63,7 @@ under the License.
>>>                    <entity-and list="webAnalyticsConfigs" entity-name="WebAnalyticsConfig">
>>>                        <field-map field-name="webSiteId"/>
>>>                    </entity-and>
>>> -                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
>>> +                <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
>>>                </actions>
>>>                <widgets>
>>>                   <section>
>>>
>>>
>>
>>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
From: "Adrian Crum" <[hidden email]>

> On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
>> From: "Adrian Crum" <[hidden email]>
>>> What is this commit supposed to do?
>> Get the server hour, which can be different from your local machine.
>>  
>>> The getServerHour service name is misleading - it actually returns the
>>> server date/time.
>> Yes, that's wanted. To compare with the jobs times which are server related.
>
> A misleading service name is wanted??!! Please don't do that.

What would you prefer? GetServerDateTime?

>>
>>> Keep in mind there is a Mini-language element called <now>. Your service
>>> is unnecessarily complicated.
>> I know about <now>. I needed to format the date. It was the simpler way I found
>
> The service engine will format the date.

I don't want the ms, less legible, useless for humans, at least in this case...

Jacques
 

>>
>> Jacques
>>
>>> -Adrian
>>>
>>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>>> Author: jleroux
>>>> Date: Sun Dec 30 07:33:26 2012
>>>> New Revision: 1426904
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>>> Log:
>>>> Complete the work on server hour for the webtools job list.
>>>> * Now uses real server hour
>>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js, that it is really
>>>> * Introduces a minimized version of date.format: date.format-1.2.3-min.js
>>>>
>>>> Added:
>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>         - copied, changed from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js   (with props)
>>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>         - copied, changed from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>> Removed:
>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>> Modified:
>>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>       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/widget/CommonScreens.xml
>>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>
>>>> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original)
>>>> +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Sun Dec 30 07:33:26 2012
>>>> @@ -847,7 +847,7 @@ under the License.
>>>>        </simple-method>
>>>>    
>>>>        <!-- To help dynamically populate a products dropdown given a product category id from a change in another dropdown, possibly sorted on sequenceNum -->
>>>> -    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues.js" login-required="false">
>>>> +    <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues" login-required="false">
>>>>            <set field="parameters.categoryId" from-field="parameters.productCategoryId"/>
>>>>            <set-service-fields service-name="getProductCategoryMembers" map="parameters" to-map="getProductCategoryMembersMap"/>
>>>>            <call-service service-name="getProductCategoryMembers" in-map-name="getProductCategoryMembersMap">
>>>>
>>>> Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml (original)
>>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml Sun Dec 30 07:33:26 2012
>>>> @@ -119,7 +119,7 @@ under the License.
>>>>        
>>>>        <service name="getAssociatedProductsList" engine="simple" auth="false"
>>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="getAssociatedProductsList">
>>>> -        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues.js</description>
>>>> +        <description>Set the product options for selected product category, mostly used by getDependentDropdownValues</description>
>>>>            <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
>>>>            <attribute name="products" mode="OUT" type="java.util.List"/>
>>>>        </service>
>>>>
>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
>>>> +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Sun Dec 30 07:33:26 2012
>>>> @@ -345,5 +345,10 @@ under the License.
>>>>                </else>
>>>>            </if-not-empty>
>>>>            <field-to-result field="exist"/>
>>>> -    </simple-method>
>>>> +    </simple-method>
>>>> +
>>>> +    <simple-method method-name="getServerHour" login-required="false">
>>>> +        <set field="nowDateString" value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss')}"/>
>>>> +        <field-to-result field="nowDateString"/>
>>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30 07:33:26 2012
>>>> @@ -780,7 +780,12 @@ under the License.
>>>>            <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>>>>            <attribute name="geoList" mode="OUT" type="java.util.List"/>
>>>>        </service>
>>>> -
>>>> +
>>>> +    <service name="getServerHour" engine="simple" auth="false"
>>>> +        location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerHour">
>>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>>> +    </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>
>>>>
>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
>>>> +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Sun Dec 30 07:33:26 2012
>>>> @@ -253,6 +253,13 @@ under the License.
>>>>            <response name="error" type="request" value="json"/>
>>>>        </request-map>
>>>>        
>>>> +    <request-map uri="getServerHour">
>>>> +        <security https="true" auth="true"/>
>>>> +        <event type="service" invoke="getServerHour"/>
>>>> +        <response name="success" type="request" value="json"/>
>>>> +        <response name="error" type="request" value="json"/>
>>>> +    </request-map>
>>>> +
>>>>        <!--========================== AJAX events =====================-->
>>>>    
>>>>        <!-- View Mappings -->
>>>>
>>>> Copied: ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl (from r1426848, ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl (original)
>>>> +++ ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl Sun Dec 30 07:33:26 2012
>>>> @@ -20,7 +20,7 @@ under the License.
>>>>    jQuery(document).ready(function() {
>>>>      window.setInterval(function(){clock()}, 1000);
>>>>      function clock() {
>>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: "  + getServerHour("getServerHour"));
>>>>      }
>>>>    })
>>>>    </script>
>>>> \ No newline at end of file
>>>>
>>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
>>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>>                    <service service-name="getVisualThemeResources">
>>>>
>>>> Added: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js (added)
>>>> +++ ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js Sun Dec 30 07:33:26 2012
>>>> @@ -0,0 +1 @@
>>>> +var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date;if(isNaN(i)){throw SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>>> yyy
>>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>>> "Nov
>>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};
>>>> \ No newline at end of file
>>>>
>>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>> ------------------------------------------------------------------------------
>>>>       svn:eol-style = native
>>>>
>>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>> ------------------------------------------------------------------------------
>>>>       svn:keywords = Date Rev Author URL Id
>>>>
>>>> Propchange: ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>> ------------------------------------------------------------------------------
>>>>       svn:mime-type = text/plain
>>>>
>>>> Copied: ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js (from r1426725, ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original)
>>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js Sun Dec 30 07:33:26 2012
>>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>>        return data;
>>>>    }
>>>>    
>>>> +//*** calls any service already mounted as an event
>>>> +function getServiceResult(request){
>>>> +    var data;
>>>> +    jQuery.ajax({
>>>> +        type: 'POST',
>>>> +        url: request,
>>>> +        async: false,
>>>> +        cache: false,
>>>> +        success: function(result){
>>>> +            data = result;
>>>> +        }
>>>> +    });
>>>> +    return data;
>>>> +}
>>>> +
>>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>>    function checkUomConversion(request, params){
>>>>        data = getServiceResult(request, params);
>>>>        return data['exist'];
>>>>    }
>>>>    
>>>> +function getServerHour(request){
>>>> +    data = getServiceResult(request);
>>>> +    return data['nowDateString'];
>>>> +}
>>>> \ No newline at end of file
>>>>
>>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
>>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec 30 07:33:26 2012
>>>> @@ -49,7 +49,7 @@ under the License.
>>>>                    <set field="tabButtonItem" value="findJob"/>
>>>>                    <set field="jobCtx" from-field="parameters"/>
>>>>                    <set field="dummy" value="${groovy: if ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/> <!--  To more easily see current pending jobs and possibly cancel some others -->
>>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>>> +                <!-- fields for WindowClockJs.ftl -->
>>>>                    <set field="clockField" value="FindJobs_clock_title"/>
>>>>                </actions>
>>>>                <widgets>
>>>> @@ -57,7 +57,7 @@ under the License.
>>>>                        <decorator-section name="body">
>>>>                            <section>
>>>>                                <widgets>
>>>> -                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>>> +                                <platform-specific><html><html-template location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>>                                    <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
>>>>                                        <decorator-section name="search-options">
>>>>                                            <include-form name="FindJobs" location="component://webtools/widget/ServiceForms.xml"/>
>>>>
>>>> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original)
>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Sun Dec 30 07:33:26 2012
>>>> @@ -63,7 +63,7 @@ under the License.
>>>>                    <entity-and list="webAnalyticsConfigs" entity-name="WebAnalyticsConfig">
>>>>                        <field-map field-name="webSiteId"/>
>>>>                    </entity-and>
>>>> -                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
>>>> +                <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
>>>>                </actions>
>>>>                <widgets>
>>>>                   <section>
>>>>
>>>>
>>>
>>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Atul Vani
In reply to this post by Jacques Le Roux
How about "getServerTimestamp", and letting the service do it's own thing,  
while the formatting being handled in ftl. This whole js thing, just adds  
one more request after the dom ready, causing things to slow down, when  
the information can just be supplied along with the rest of the content.  
Just a suggestion, no offense.


On Sun, 30 Dec 2012 23:50:13 +0530, Jacques Le Roux  
<[hidden email]> wrote:

> From: "Adrian Crum" <[hidden email]>
>> On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
>>> From: "Adrian Crum" <[hidden email]>
>>>> What is this commit supposed to do?
>>> Get the server hour, which can be different from your local machine.
>>>
>>>> The getServerHour service name is misleading - it actually returns the
>>>> server date/time.
>>> Yes, that's wanted. To compare with the jobs times which are server  
>>> related.
>>
>> A misleading service name is wanted??!! Please don't do that.
>
> What would you prefer? GetServerDateTime?
>
>>>
>>>> Keep in mind there is a Mini-language element called <now>. Your  
>>>> service
>>>> is unnecessarily complicated.
>>> I know about <now>. I needed to format the date. It was the simpler  
>>> way I found
>>
>> The service engine will format the date.
>
> I don't want the ms, less legible, useless for humans, at least in this  
> case...
>
> Jacques
>
>>>
>>> Jacques
>>>
>>>> -Adrian
>>>>
>>>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>>>> Author: jleroux
>>>>> Date: Sun Dec 30 07:33:26 2012
>>>>> New Revision: 1426904
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>>>> Log:
>>>>> Complete the work on server hour for the webtools job list.
>>>>> * Now uses real server hour
>>>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js,  
>>>>> that it is really
>>>>> * Introduces a minimized version of date.format:  
>>>>> date.format-1.2.3-min.js
>>>>>
>>>>> Added:
>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>         - copied, changed from r1426848,  
>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js    
>>>>> (with props)
>>>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>         - copied, changed from r1426725,  
>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>> Removed:
>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>> Modified:
>>>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>       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/widget/CommonScreens.xml
>>>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>
>>>>> Modified:  
>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml  
>>>>> (original)
>>>>> +++  
>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -847,7 +847,7 @@ under the License.
>>>>>        </simple-method>
>>>>>
>>>>>        <!-- To help dynamically populate a products dropdown given a  
>>>>> product category id from a change in another dropdown, possibly  
>>>>> sorted on sequenceNum -->
>>>>> -    <simple-method method-name="getAssociatedProductsList"  
>>>>> short-description="Set the product options for selected product  
>>>>> category, mostly used by getDependentDropdownValues.js"  
>>>>> login-required="false">
>>>>> +    <simple-method method-name="getAssociatedProductsList"  
>>>>> short-description="Set the product options for selected product  
>>>>> category, mostly used by getDependentDropdownValues"  
>>>>> login-required="false">
>>>>>            <set field="parameters.categoryId"  
>>>>> from-field="parameters.productCategoryId"/>
>>>>>            <set-service-fields  
>>>>> service-name="getProductCategoryMembers" map="parameters"  
>>>>> to-map="getProductCategoryMembersMap"/>
>>>>>            <call-service service-name="getProductCategoryMembers"  
>>>>> in-map-name="getProductCategoryMembersMap">
>>>>>
>>>>> Modified:  
>>>>> ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml  
>>>>> (original)
>>>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -119,7 +119,7 @@ under the License.
>>>>>
>>>>>        <service name="getAssociatedProductsList" engine="simple"  
>>>>> auth="false"
>>>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml"  
>>>>> invoke="getAssociatedProductsList">
>>>>> -        <description>Set the product options for selected product  
>>>>> category, mostly used by getDependentDropdownValues.js</description>
>>>>> +        <description>Set the product options for selected product  
>>>>> category, mostly used by getDependentDropdownValues</description>
>>>>>            <attribute name="productCategoryId" mode="IN"  
>>>>> type="String" optional="false"/>
>>>>>            <attribute name="products" mode="OUT"  
>>>>> type="java.util.List"/>
>>>>>        </service>
>>>>>
>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml  
>>>>> (original)
>>>>> +++  
>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -345,5 +345,10 @@ under the License.
>>>>>                </else>
>>>>>            </if-not-empty>
>>>>>            <field-to-result field="exist"/>
>>>>> -    </simple-method>
>>>>> +    </simple-method>
>>>>> +
>>>>> +    <simple-method method-name="getServerHour"  
>>>>> login-required="false">
>>>>> +        <set field="nowDateString"  
>>>>> value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd  
>>>>> HH:mm:ss')}"/>
>>>>> +        <field-to-result field="nowDateString"/>
>>>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30  
>>>>> 07:33:26 2012
>>>>> @@ -780,7 +780,12 @@ under the License.
>>>>>            <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>>>>>            <attribute name="geoList" mode="OUT"  
>>>>> type="java.util.List"/>
>>>>>        </service>
>>>>> -
>>>>> +
>>>>> +    <service name="getServerHour" engine="simple" auth="false"
>>>>> +        
>>>>> location="component://common/script/org/ofbiz/common/CommonServices.xml"  
>>>>> invoke="getServerHour">
>>>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>>>> +    </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>
>>>>>
>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml  
>>>>> (original)
>>>>> +++  
>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -253,6 +253,13 @@ under the License.
>>>>>            <response name="error" type="request" value="json"/>
>>>>>        </request-map>
>>>>>
>>>>> +    <request-map uri="getServerHour">
>>>>> +        <security https="true" auth="true"/>
>>>>> +        <event type="service" invoke="getServerHour"/>
>>>>> +        <response name="success" type="request" value="json"/>
>>>>> +        <response name="error" type="request" value="json"/>
>>>>> +    </request-map>
>>>>> +
>>>>>        <!--========================== AJAX events  
>>>>> =====================-->
>>>>>
>>>>>        <!-- View Mappings -->
>>>>>
>>>>> Copied:  
>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl  
>>>>> (from r1426848,  
>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl  
>>>>> (original)
>>>>> +++  
>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -20,7 +20,7 @@ under the License.
>>>>>    jQuery(document).ready(function() {
>>>>>      window.setInterval(function(){clock()}, 1000);
>>>>>      function clock() {
>>>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:  
>>>>> "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:  
>>>>> "  + getServerHour("getServerHour"));
>>>>>      }
>>>>>    })
>>>>>    </script>
>>>>> \ No newline at end of file
>>>>>
>>>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
>>>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30  
>>>>> 07:33:26 2012
>>>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>>>                    <service service-name="getVisualThemeResources">
>>>>>
>>>>> Added:  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js  
>>>>> (added)
>>>>> +++  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -0,0 +1 @@
>>>>> +var dateFormat=function(){var  
>>>>> a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic)  
>>>>> (?:Standard|Daylight|Prevailing)  
>>>>> Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return  
>>>>> f};return function(i,v,q){var  
>>>>> g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object  
>>>>> String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new  
>>>>> Date;if(isNaN(i)){throw SyntaxError("invalid  
>>>>> date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var  
>>>>> t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>>>> yyy
>>>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return  
>>>>> v.replace(a,function(m){return m in  
>>>>> h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd  
>>>>> mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d,  
>>>>> yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d,  
>>>>> yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss  
>>>>> TT  
>>>>> Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>>>> "Nov
>>>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return  
>>>>> dateFormat(this,a,b)};
>>>>> \ No newline at end of file
>>>>>
>>>>> Propchange:  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>> ------------------------------------------------------------------------------
>>>>>       svn:eol-style = native
>>>>>
>>>>> Propchange:  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>> ------------------------------------------------------------------------------
>>>>>       svn:keywords = Date Rev Author URL Id
>>>>>
>>>>> Propchange:  
>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>> ------------------------------------------------------------------------------
>>>>>       svn:mime-type = text/plain
>>>>>
>>>>> Copied:  
>>>>> ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js  
>>>>> (from r1426725,  
>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>>>> ==============================================================================
>>>>> ---  
>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js  
>>>>> (original)
>>>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>>>        return data;
>>>>>    }
>>>>>
>>>>> +//*** calls any service already mounted as an event
>>>>> +function getServiceResult(request){
>>>>> +    var data;
>>>>> +    jQuery.ajax({
>>>>> +        type: 'POST',
>>>>> +        url: request,
>>>>> +        async: false,
>>>>> +        cache: false,
>>>>> +        success: function(result){
>>>>> +            data = result;
>>>>> +        }
>>>>> +    });
>>>>> +    return data;
>>>>> +}
>>>>> +
>>>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>>>    function checkUomConversion(request, params){
>>>>>        data = getServiceResult(request, params);
>>>>>        return data['exist'];
>>>>>    }
>>>>>
>>>>> +function getServerHour(request){
>>>>> +    data = getServiceResult(request);
>>>>> +    return data['nowDateString'];
>>>>> +}
>>>>> \ No newline at end of file
>>>>>
>>>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml  
>>>>> (original)
>>>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec  
>>>>> 30 07:33:26 2012
>>>>> @@ -49,7 +49,7 @@ under the License.
>>>>>                    <set field="tabButtonItem" value="findJob"/>
>>>>>                    <set field="jobCtx" from-field="parameters"/>
>>>>>                    <set field="dummy" value="${groovy: if  
>>>>> ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/>  
>>>>> <!--  To more easily see current pending jobs and possibly cancel  
>>>>> some others -->
>>>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>>>> +                <!-- fields for WindowClockJs.ftl -->
>>>>>                    <set field="clockField"  
>>>>> value="FindJobs_clock_title"/>
>>>>>                </actions>
>>>>>                <widgets>
>>>>> @@ -57,7 +57,7 @@ under the License.
>>>>>                        <decorator-section name="body">
>>>>>                            <section>
>>>>>                                <widgets>
>>>>> -                                
>>>>> <platform-specific><html><html-template  
>>>>> location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>>>> +                                
>>>>> <platform-specific><html><html-template  
>>>>> location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>>>                                    <decorator-screen  
>>>>> name="FindScreenDecorator"  
>>>>> location="component://common/widget/CommonScreens.xml">
>>>>>                                        <decorator-section  
>>>>> name="search-options">
>>>>>                                            <include-form  
>>>>> name="FindJobs"  
>>>>> location="component://webtools/widget/ServiceForms.xml"/>
>>>>>
>>>>> Modified:  
>>>>> ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>> URL:  
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml  
>>>>> (original)
>>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml  
>>>>> Sun Dec 30 07:33:26 2012
>>>>> @@ -63,7 +63,7 @@ under the License.
>>>>>                    <entity-and list="webAnalyticsConfigs"  
>>>>> entity-name="WebAnalyticsConfig">
>>>>>                        <field-map field-name="webSiteId"/>
>>>>>                    </entity-and>
>>>>> -                <set field="layoutSettings.javaScripts[]"  
>>>>> value="/images/getDependentDropdownValues.js" global="true" />
>>>>> +                <set field="layoutSettings.javaScripts[]"  
>>>>> value="/images/miscAjaxFunctions.js" global="true" />
>>>>>                </actions>
>>>>>                <widgets>
>>>>>                   <section>
>>>>>
>>>>>
>>>>
>>>>
>>
>>
>>


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
From: "Atul Vani" <[hidden email]>
> How about "getServerTimestamp", and letting the service do it's own thing,  
> while the formatting being handled in ftl. This whole js thing, just adds  
> one more request after the dom ready, causing things to slow down, when  
> the information can just be supplied along with the rest of the content.  
> Just a suggestion, no offense.

getServerTimestamp instead of getServerHour, yes why not?
I choose hour because that's what I'm really interested in for theUI: the hour, the time, the moment I can compare with the jobs run times.

WindowClockJs.ftl is there because of  window.setInterval() and in the service the beauty of  ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss') is it retrieves the server time and does the formatting in one shoot.
I really don't see how it slow down things. I mean what would you suggest instead?
We need
* a timer => I picked window.setInterval()
* a service to retrieve  the server hour (er... timestamp, which I really don't see like being more clear than hour for the common of mortals, but well...)

Jacques



> On Sun, 30 Dec 2012 23:50:13 +0530, Jacques Le Roux  
> <[hidden email]> wrote:
>
>> From: "Adrian Crum" <[hidden email]>
>>> On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
>>>> From: "Adrian Crum" <[hidden email]>
>>>>> What is this commit supposed to do?
>>>> Get the server hour, which can be different from your local machine.
>>>>
>>>>> The getServerHour service name is misleading - it actually returns the
>>>>> server date/time.
>>>> Yes, that's wanted. To compare with the jobs times which are server  
>>>> related.
>>>
>>> A misleading service name is wanted??!! Please don't do that.
>>
>> What would you prefer? GetServerDateTime?
>>
>>>>
>>>>> Keep in mind there is a Mini-language element called <now>. Your  
>>>>> service
>>>>> is unnecessarily complicated.
>>>> I know about <now>. I needed to format the date. It was the simpler  
>>>> way I found
>>>
>>> The service engine will format the date.
>>
>> I don't want the ms, less legible, useless for humans, at least in this  
>> case...
>>
>> Jacques
>>
>>>>
>>>> Jacques
>>>>
>>>>> -Adrian
>>>>>
>>>>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>>>>> Author: jleroux
>>>>>> Date: Sun Dec 30 07:33:26 2012
>>>>>> New Revision: 1426904
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>>>>> Log:
>>>>>> Complete the work on server hour for the webtools job list.
>>>>>> * Now uses real server hour
>>>>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js,  
>>>>>> that it is really
>>>>>> * Introduces a minimized version of date.format:  
>>>>>> date.format-1.2.3-min.js
>>>>>>
>>>>>> Added:
>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>         - copied, changed from r1426848,  
>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js    
>>>>>> (with props)
>>>>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>         - copied, changed from r1426725,  
>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>> Removed:
>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>> Modified:
>>>>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>       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/widget/CommonScreens.xml
>>>>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>
>>>>>> Modified:  
>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml  
>>>>>> (original)
>>>>>> +++  
>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -847,7 +847,7 @@ under the License.
>>>>>>        </simple-method>
>>>>>>
>>>>>>        <!-- To help dynamically populate a products dropdown given a  
>>>>>> product category id from a change in another dropdown, possibly  
>>>>>> sorted on sequenceNum -->
>>>>>> -    <simple-method method-name="getAssociatedProductsList"  
>>>>>> short-description="Set the product options for selected product  
>>>>>> category, mostly used by getDependentDropdownValues.js"  
>>>>>> login-required="false">
>>>>>> +    <simple-method method-name="getAssociatedProductsList"  
>>>>>> short-description="Set the product options for selected product  
>>>>>> category, mostly used by getDependentDropdownValues"  
>>>>>> login-required="false">
>>>>>>            <set field="parameters.categoryId"  
>>>>>> from-field="parameters.productCategoryId"/>
>>>>>>            <set-service-fields  
>>>>>> service-name="getProductCategoryMembers" map="parameters"  
>>>>>> to-map="getProductCategoryMembersMap"/>
>>>>>>            <call-service service-name="getProductCategoryMembers"  
>>>>>> in-map-name="getProductCategoryMembersMap">
>>>>>>
>>>>>> Modified:  
>>>>>> ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml  
>>>>>> (original)
>>>>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -119,7 +119,7 @@ under the License.
>>>>>>
>>>>>>        <service name="getAssociatedProductsList" engine="simple"  
>>>>>> auth="false"
>>>>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml"  
>>>>>> invoke="getAssociatedProductsList">
>>>>>> -        <description>Set the product options for selected product  
>>>>>> category, mostly used by getDependentDropdownValues.js</description>
>>>>>> +        <description>Set the product options for selected product  
>>>>>> category, mostly used by getDependentDropdownValues</description>
>>>>>>            <attribute name="productCategoryId" mode="IN"  
>>>>>> type="String" optional="false"/>
>>>>>>            <attribute name="products" mode="OUT"  
>>>>>> type="java.util.List"/>
>>>>>>        </service>
>>>>>>
>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml  
>>>>>> (original)
>>>>>> +++  
>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -345,5 +345,10 @@ under the License.
>>>>>>                </else>
>>>>>>            </if-not-empty>
>>>>>>            <field-to-result field="exist"/>
>>>>>> -    </simple-method>
>>>>>> +    </simple-method>
>>>>>> +
>>>>>> +    <simple-method method-name="getServerHour"  
>>>>>> login-required="false">
>>>>>> +        <set field="nowDateString"  
>>>>>> value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd  
>>>>>> HH:mm:ss')}"/>
>>>>>> +        <field-to-result field="nowDateString"/>
>>>>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>>>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30  
>>>>>> 07:33:26 2012
>>>>>> @@ -780,7 +780,12 @@ under the License.
>>>>>>            <attribute name="geoAssocTypeId" mode="IN" type="String"/>
>>>>>>            <attribute name="geoList" mode="OUT"  
>>>>>> type="java.util.List"/>
>>>>>>        </service>
>>>>>> -
>>>>>> +
>>>>>> +    <service name="getServerHour" engine="simple" auth="false"
>>>>>> +        
>>>>>> location="component://common/script/org/ofbiz/common/CommonServices.xml"  
>>>>>> invoke="getServerHour">
>>>>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>>>>> +    </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>
>>>>>>
>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml  
>>>>>> (original)
>>>>>> +++  
>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -253,6 +253,13 @@ under the License.
>>>>>>            <response name="error" type="request" value="json"/>
>>>>>>        </request-map>
>>>>>>
>>>>>> +    <request-map uri="getServerHour">
>>>>>> +        <security https="true" auth="true"/>
>>>>>> +        <event type="service" invoke="getServerHour"/>
>>>>>> +        <response name="success" type="request" value="json"/>
>>>>>> +        <response name="error" type="request" value="json"/>
>>>>>> +    </request-map>
>>>>>> +
>>>>>>        <!--========================== AJAX events  
>>>>>> =====================-->
>>>>>>
>>>>>>        <!-- View Mappings -->
>>>>>>
>>>>>> Copied:  
>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl  
>>>>>> (from r1426848,  
>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl  
>>>>>> (original)
>>>>>> +++  
>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -20,7 +20,7 @@ under the License.
>>>>>>    jQuery(document).ready(function() {
>>>>>>      window.setInterval(function(){clock()}, 1000);
>>>>>>      function clock() {
>>>>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:  
>>>>>> "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>>>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:  
>>>>>> "  + getServerHour("getServerHour"));
>>>>>>      }
>>>>>>    })
>>>>>>    </script>
>>>>>> \ No newline at end of file
>>>>>>
>>>>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
>>>>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 30  
>>>>>> 07:33:26 2012
>>>>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>>>>                    <service service-name="getVisualThemeResources">
>>>>>>
>>>>>> Added:  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js  
>>>>>> (added)
>>>>>> +++  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -0,0 +1 @@
>>>>>> +var dateFormat=function(){var  
>>>>>> a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic)  
>>>>>> (?:Standard|Daylight|Prevailing)  
>>>>>> Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return  
>>>>>> f};return function(i,v,q){var  
>>>>>> g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object  
>>>>>> String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new  
>>>>>> Date;if(isNaN(i)){throw SyntaxError("invalid  
>>>>>> date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var  
>>>>>> t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>>>>> yyy
>>>>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return  
>>>>>> v.replace(a,function(m){return m in  
>>>>>> h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd  
>>>>>> mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d,  
>>>>>> yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d,  
>>>>>> yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss  
>>>>>> TT  
>>>>>> Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>>>>> "Nov
>>>>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return  
>>>>>> dateFormat(this,a,b)};
>>>>>> \ No newline at end of file
>>>>>>
>>>>>> Propchange:  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>> ------------------------------------------------------------------------------
>>>>>>       svn:eol-style = native
>>>>>>
>>>>>> Propchange:  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>> ------------------------------------------------------------------------------
>>>>>>       svn:keywords = Date Rev Author URL Id
>>>>>>
>>>>>> Propchange:  
>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>> ------------------------------------------------------------------------------
>>>>>>       svn:mime-type = text/plain
>>>>>>
>>>>>> Copied:  
>>>>>> ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js  
>>>>>> (from r1426725,  
>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> ---  
>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js  
>>>>>> (original)
>>>>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>>>>        return data;
>>>>>>    }
>>>>>>
>>>>>> +//*** calls any service already mounted as an event
>>>>>> +function getServiceResult(request){
>>>>>> +    var data;
>>>>>> +    jQuery.ajax({
>>>>>> +        type: 'POST',
>>>>>> +        url: request,
>>>>>> +        async: false,
>>>>>> +        cache: false,
>>>>>> +        success: function(result){
>>>>>> +            data = result;
>>>>>> +        }
>>>>>> +    });
>>>>>> +    return data;
>>>>>> +}
>>>>>> +
>>>>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>>>>    function checkUomConversion(request, params){
>>>>>>        data = getServiceResult(request, params);
>>>>>>        return data['exist'];
>>>>>>    }
>>>>>>
>>>>>> +function getServerHour(request){
>>>>>> +    data = getServiceResult(request);
>>>>>> +    return data['nowDateString'];
>>>>>> +}
>>>>>> \ No newline at end of file
>>>>>>
>>>>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml  
>>>>>> (original)
>>>>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun Dec  
>>>>>> 30 07:33:26 2012
>>>>>> @@ -49,7 +49,7 @@ under the License.
>>>>>>                    <set field="tabButtonItem" value="findJob"/>
>>>>>>                    <set field="jobCtx" from-field="parameters"/>
>>>>>>                    <set field="dummy" value="${groovy: if  
>>>>>> ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/>  
>>>>>> <!--  To more easily see current pending jobs and possibly cancel  
>>>>>> some others -->
>>>>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>>>>> +                <!-- fields for WindowClockJs.ftl -->
>>>>>>                    <set field="clockField"  
>>>>>> value="FindJobs_clock_title"/>
>>>>>>                </actions>
>>>>>>                <widgets>
>>>>>> @@ -57,7 +57,7 @@ under the License.
>>>>>>                        <decorator-section name="body">
>>>>>>                            <section>
>>>>>>                                <widgets>
>>>>>> -                                
>>>>>> <platform-specific><html><html-template  
>>>>>> location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>>>>> +                                
>>>>>> <platform-specific><html><html-template  
>>>>>> location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>>>>                                    <decorator-screen  
>>>>>> name="FindScreenDecorator"  
>>>>>> location="component://common/widget/CommonScreens.xml">
>>>>>>                                        <decorator-section  
>>>>>> name="search-options">
>>>>>>                                            <include-form  
>>>>>> name="FindJobs"  
>>>>>> location="component://webtools/widget/ServiceForms.xml"/>
>>>>>>
>>>>>> Modified:  
>>>>>> ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>> URL:  
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml  
>>>>>> (original)
>>>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml  
>>>>>> Sun Dec 30 07:33:26 2012
>>>>>> @@ -63,7 +63,7 @@ under the License.
>>>>>>                    <entity-and list="webAnalyticsConfigs"  
>>>>>> entity-name="WebAnalyticsConfig">
>>>>>>                        <field-map field-name="webSiteId"/>
>>>>>>                    </entity-and>
>>>>>> -                <set field="layoutSettings.javaScripts[]"  
>>>>>> value="/images/getDependentDropdownValues.js" global="true" />
>>>>>> +                <set field="layoutSettings.javaScripts[]"  
>>>>>> value="/images/miscAjaxFunctions.js" global="true" />
>>>>>>                </actions>
>>>>>>                <widgets>
>>>>>>                   <section>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>
>
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Atul Vani
In reply to this post by Jacques Le Roux
The necessity for a service to return the server time makes some sense to  
me, that is the reason I didn't say why do we need a service when the same  
thing can be done in groovy.

However, at present, the service do not find much (any) use. But just for  
the sake of doing things the right way, when we need to show  
(display/render) the server time (in the header or footer, most probably),  
then we should be using this service. And lets hope that in future when  
someone needs to do a "similar thing" then he will be using this service  
too.

By "similar thing", I mean to say that this service is not meant to be  
used to get nowTimestamp for building (lets say) some EntityCondition.  
That's a no-no, but if you need to display server time, or to get the  
server time for some third party integration, or to periodically update a  
page with the current server time (I hate writing this one), then use the  
service.

Now about how things slow down, the more number of requests it needs to  
render a page the slower it will be. It is similar to how it works for  
database connections, the most time consuming part is to create a  
connection. So, it's better to keep alive an existing one, then to create  
multiple. Thanks to Amardeep, Erwan and you that we already got rid of  
some, in OFBIZ-4667. In our case, it does not make sense to use an ajax  
request to separately update the server time after page has loaded, we can  
pull that information from the server along with rest of the data. Well,  
if someone needs to (let say) update the server time every five minutes  
(seconds?) using ajax then he can use this service (not one of the best  
examples, he should use js code instead of periodic ajax requests).

The name "getServerTimestamp" assuming that the service will return  
Timestamp, so that one can use it however he wants and fetch the date time  
information to whatever precision he needs.

On Mon, 31 Dec 2012 11:44:47 +0530, Jacques Le Roux  
<[hidden email]> wrote:

> From: "Atul Vani" <[hidden email]>
>> How about "getServerTimestamp", and letting the service do it's own  
>> thing,
>> while the formatting being handled in ftl. This whole js thing, just  
>> adds
>> one more request after the dom ready, causing things to slow down, when
>> the information can just be supplied along with the rest of the content.
>> Just a suggestion, no offense.
>
> getServerTimestamp instead of getServerHour, yes why not?
> I choose hour because that's what I'm really interested in for theUI:  
> the hour, the time, the moment I can compare with the jobs run times.
>
> WindowClockJs.ftl is there because of  window.setInterval() and in the  
> service the beauty of  
> ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss') is it  
> retrieves the server time and does the formatting in one shoot.
> I really don't see how it slow down things. I mean what would you  
> suggest instead?
> We need
> * a timer => I picked window.setInterval()
> * a service to retrieve  the server hour (er... timestamp, which I  
> really don't see like being more clear than hour for the common of  
> mortals, but well...)
>
> Jacques
>
>
>
>> On Sun, 30 Dec 2012 23:50:13 +0530, Jacques Le Roux
>> <[hidden email]> wrote:
>>
>>> From: "Adrian Crum" <[hidden email]>
>>>> On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
>>>>> From: "Adrian Crum" <[hidden email]>
>>>>>> What is this commit supposed to do?
>>>>> Get the server hour, which can be different from your local machine.
>>>>>
>>>>>> The getServerHour service name is misleading - it actually returns  
>>>>>> the
>>>>>> server date/time.
>>>>> Yes, that's wanted. To compare with the jobs times which are server
>>>>> related.
>>>>
>>>> A misleading service name is wanted??!! Please don't do that.
>>>
>>> What would you prefer? GetServerDateTime?
>>>
>>>>>
>>>>>> Keep in mind there is a Mini-language element called <now>. Your
>>>>>> service
>>>>>> is unnecessarily complicated.
>>>>> I know about <now>. I needed to format the date. It was the simpler
>>>>> way I found
>>>>
>>>> The service engine will format the date.
>>>
>>> I don't want the ms, less legible, useless for humans, at least in this
>>> case...
>>>
>>> Jacques
>>>
>>>>>
>>>>> Jacques
>>>>>
>>>>>> -Adrian
>>>>>>
>>>>>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>>>>>> Author: jleroux
>>>>>>> Date: Sun Dec 30 07:33:26 2012
>>>>>>> New Revision: 1426904
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>>>>>> Log:
>>>>>>> Complete the work on server hour for the webtools job list.
>>>>>>> * Now uses real server hour
>>>>>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js,
>>>>>>> that it is really
>>>>>>> * Introduces a minimized version of date.format:
>>>>>>> date.format-1.2.3-min.js
>>>>>>>
>>>>>>> Added:
>>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>>         - copied, changed from r1426848,
>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> (with props)
>>>>>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>>         - copied, changed from r1426725,
>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>> Removed:
>>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>> Modified:
>>>>>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>>       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/widget/CommonScreens.xml
>>>>>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>>
>>>>>>> Modified:
>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>> (original)
>>>>>>> +++
>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -847,7 +847,7 @@ under the License.
>>>>>>>        </simple-method>
>>>>>>>
>>>>>>>        <!-- To help dynamically populate a products dropdown given  
>>>>>>> a
>>>>>>> product category id from a change in another dropdown, possibly
>>>>>>> sorted on sequenceNum -->
>>>>>>> -    <simple-method method-name="getAssociatedProductsList"
>>>>>>> short-description="Set the product options for selected product
>>>>>>> category, mostly used by getDependentDropdownValues.js"
>>>>>>> login-required="false">
>>>>>>> +    <simple-method method-name="getAssociatedProductsList"
>>>>>>> short-description="Set the product options for selected product
>>>>>>> category, mostly used by getDependentDropdownValues"
>>>>>>> login-required="false">
>>>>>>>            <set field="parameters.categoryId"
>>>>>>> from-field="parameters.productCategoryId"/>
>>>>>>>            <set-service-fields
>>>>>>> service-name="getProductCategoryMembers" map="parameters"
>>>>>>> to-map="getProductCategoryMembersMap"/>
>>>>>>>            <call-service service-name="getProductCategoryMembers"
>>>>>>> in-map-name="getProductCategoryMembersMap">
>>>>>>>
>>>>>>> Modified:
>>>>>>> ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>> (original)
>>>>>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -119,7 +119,7 @@ under the License.
>>>>>>>
>>>>>>>        <service name="getAssociatedProductsList" engine="simple"
>>>>>>> auth="false"
>>>>>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml"
>>>>>>> invoke="getAssociatedProductsList">
>>>>>>> -        <description>Set the product options for selected product
>>>>>>> category, mostly used by  
>>>>>>> getDependentDropdownValues.js</description>
>>>>>>> +        <description>Set the product options for selected product
>>>>>>> category, mostly used by getDependentDropdownValues</description>
>>>>>>>            <attribute name="productCategoryId" mode="IN"
>>>>>>> type="String" optional="false"/>
>>>>>>>            <attribute name="products" mode="OUT"
>>>>>>> type="java.util.List"/>
>>>>>>>        </service>
>>>>>>>
>>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
>>>>>>> (original)
>>>>>>> +++
>>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -345,5 +345,10 @@ under the License.
>>>>>>>                </else>
>>>>>>>            </if-not-empty>
>>>>>>>            <field-to-result field="exist"/>
>>>>>>> -    </simple-method>
>>>>>>> +    </simple-method>
>>>>>>> +
>>>>>>> +    <simple-method method-name="getServerHour"
>>>>>>> login-required="false">
>>>>>>> +        <set field="nowDateString"
>>>>>>> value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd
>>>>>>> HH:mm:ss')}"/>
>>>>>>> +        <field-to-result field="nowDateString"/>
>>>>>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>>>>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30
>>>>>>> 07:33:26 2012
>>>>>>> @@ -780,7 +780,12 @@ under the License.
>>>>>>>            <attribute name="geoAssocTypeId" mode="IN"  
>>>>>>> type="String"/>
>>>>>>>            <attribute name="geoList" mode="OUT"
>>>>>>> type="java.util.List"/>
>>>>>>>        </service>
>>>>>>> -
>>>>>>> +
>>>>>>> +    <service name="getServerHour" engine="simple" auth="false"
>>>>>>> +
>>>>>>> location="component://common/script/org/ofbiz/common/CommonServices.xml"
>>>>>>> invoke="getServerHour">
>>>>>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>>>>>> +    </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>
>>>>>>>
>>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
>>>>>>> (original)
>>>>>>> +++
>>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -253,6 +253,13 @@ under the License.
>>>>>>>            <response name="error" type="request" value="json"/>
>>>>>>>        </request-map>
>>>>>>>
>>>>>>> +    <request-map uri="getServerHour">
>>>>>>> +        <security https="true" auth="true"/>
>>>>>>> +        <event type="service" invoke="getServerHour"/>
>>>>>>> +        <response name="success" type="request" value="json"/>
>>>>>>> +        <response name="error" type="request" value="json"/>
>>>>>>> +    </request-map>
>>>>>>> +
>>>>>>>        <!--========================== AJAX events
>>>>>>> =====================-->
>>>>>>>
>>>>>>>        <!-- View Mappings -->
>>>>>>>
>>>>>>> Copied:
>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>> (from r1426848,
>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>> (original)
>>>>>>> +++
>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -20,7 +20,7 @@ under the License.
>>>>>>>    jQuery(document).ready(function() {
>>>>>>>      window.setInterval(function(){clock()}, 1000);
>>>>>>>      function clock() {
>>>>>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:
>>>>>>> "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>>>>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:
>>>>>>> "  + getServerHour("getServerHour"));
>>>>>>>      }
>>>>>>>    })
>>>>>>>    </script>
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml  
>>>>>>> (original)
>>>>>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec  
>>>>>>> 30
>>>>>>> 07:33:26 2012
>>>>>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>>>>>                    <service service-name="getVisualThemeResources">
>>>>>>>
>>>>>>> Added:
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> (added)
>>>>>>> +++
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -0,0 +1 @@
>>>>>>> +var dateFormat=function(){var
>>>>>>> a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic)
>>>>>>> (?:Standard|Daylight|Prevailing)
>>>>>>> Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return
>>>>>>> f};return function(i,v,q){var
>>>>>>> g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object
>>>>>>> String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new
>>>>>>> Date;if(isNaN(i)){throw SyntaxError("invalid
>>>>>>> date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var
>>>>>>> t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>>>>>> yyy
>>>>>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return
>>>>>>> v.replace(a,function(m){return m in
>>>>>>> h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd
>>>>>>> mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d,
>>>>>>> yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d,
>>>>>>> yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss
>>>>>>> TT
>>>>>>> Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>>>>>> "Nov
>>>>>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return
>>>>>>> dateFormat(this,a,b)};
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Propchange:
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>       svn:eol-style = native
>>>>>>>
>>>>>>> Propchange:
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>       svn:keywords = Date Rev Author URL Id
>>>>>>>
>>>>>>> Propchange:
>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>> ------------------------------------------------------------------------------
>>>>>>>       svn:mime-type = text/plain
>>>>>>>
>>>>>>> Copied:
>>>>>>> ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>> (from r1426725,
>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>> (original)
>>>>>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>>>>>        return data;
>>>>>>>    }
>>>>>>>
>>>>>>> +//*** calls any service already mounted as an event
>>>>>>> +function getServiceResult(request){
>>>>>>> +    var data;
>>>>>>> +    jQuery.ajax({
>>>>>>> +        type: 'POST',
>>>>>>> +        url: request,
>>>>>>> +        async: false,
>>>>>>> +        cache: false,
>>>>>>> +        success: function(result){
>>>>>>> +            data = result;
>>>>>>> +        }
>>>>>>> +    });
>>>>>>> +    return data;
>>>>>>> +}
>>>>>>> +
>>>>>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>>>>>    function checkUomConversion(request, params){
>>>>>>>        data = getServiceResult(request, params);
>>>>>>>        return data['exist'];
>>>>>>>    }
>>>>>>>
>>>>>>> +function getServerHour(request){
>>>>>>> +    data = getServiceResult(request);
>>>>>>> +    return data['nowDateString'];
>>>>>>> +}
>>>>>>> \ No newline at end of file
>>>>>>>
>>>>>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>> (original)
>>>>>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun  
>>>>>>> Dec
>>>>>>> 30 07:33:26 2012
>>>>>>> @@ -49,7 +49,7 @@ under the License.
>>>>>>>                    <set field="tabButtonItem" value="findJob"/>
>>>>>>>                    <set field="jobCtx" from-field="parameters"/>
>>>>>>>                    <set field="dummy" value="${groovy: if
>>>>>>> ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/>
>>>>>>> <!--  To more easily see current pending jobs and possibly cancel
>>>>>>> some others -->
>>>>>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>>>>>> +                <!-- fields for WindowClockJs.ftl -->
>>>>>>>                    <set field="clockField"
>>>>>>> value="FindJobs_clock_title"/>
>>>>>>>                </actions>
>>>>>>>                <widgets>
>>>>>>> @@ -57,7 +57,7 @@ under the License.
>>>>>>>                        <decorator-section name="body">
>>>>>>>                            <section>
>>>>>>>                                <widgets>
>>>>>>> -
>>>>>>> <platform-specific><html><html-template
>>>>>>> location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>>>>>> +
>>>>>>> <platform-specific><html><html-template
>>>>>>> location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>>>>>                                    <decorator-screen
>>>>>>> name="FindScreenDecorator"
>>>>>>> location="component://common/widget/CommonScreens.xml">
>>>>>>>                                        <decorator-section
>>>>>>> name="search-options">
>>>>>>>                                            <include-form
>>>>>>> name="FindJobs"
>>>>>>> location="component://webtools/widget/ServiceForms.xml"/>
>>>>>>>
>>>>>>> Modified:
>>>>>>> ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>> URL:
>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>> (original)
>>>>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>> @@ -63,7 +63,7 @@ under the License.
>>>>>>>                    <entity-and list="webAnalyticsConfigs"
>>>>>>> entity-name="WebAnalyticsConfig">
>>>>>>>                        <field-map field-name="webSiteId"/>
>>>>>>>                    </entity-and>
>>>>>>> -                <set field="layoutSettings.javaScripts[]"
>>>>>>> value="/images/getDependentDropdownValues.js" global="true" />
>>>>>>> +                <set field="layoutSettings.javaScripts[]"
>>>>>>> value="/images/miscAjaxFunctions.js" global="true" />
>>>>>>>                </actions>
>>>>>>>                <widgets>
>>>>>>>                   <section>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>>
>> --
>> Using Opera's revolutionary email client: http://www.opera.com/mail/


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
From: "Atul Vani" <[hidden email]>

> The necessity for a service to return the server time makes some sense to  
> me, that is the reason I didn't say why do we need a service when the same  
> thing can be done in groovy.
>
> However, at present, the service do not find much (any) use. But just for  
> the sake of doing things the right way, when we need to show  
> (display/render) the server time (in the header or footer, most probably),  
> then we should be using this service. And lets hope that in future when  
> someone needs to do a "similar thing" then he will be using this service  
> too.
>
> By "similar thing", I mean to say that this service is not meant to be  
> used to get nowTimestamp for building (lets say) some EntityCondition.  
> That's a no-no, but if you need to display server time, or to get the  
> server time for some third party integration, or to periodically update a  
> page with the current server time (I hate writing this one), then use the  
> service.
>
> Now about how things slow down, the more number of requests it needs to  
> render a page the slower it will be. It is similar to how it works for  
> database connections, the most time consuming part is to create a  
> connection. So, it's better to keep alive an existing one, then to create  
> multiple. Thanks to Amardeep, Erwan and you that we already got rid of  
> some, in OFBIZ-4667. In our case, it does not make sense to use an ajax  
> request to separately update the server time after page has loaded, we can  
> pull that information from the server along with rest of the data.

How? My need it to see the server time updating every second. Why? because I want to be able to monitor when a specific job will fire. A second interval is enough for me, but less will not be.
And seriously is that a big deal on this screen? Of course if the screen is permanently open by many persons for the same serve it begins to be a worry, rarely the case I guess...

>Well,  
> if someone needs to (let say) update the server time every five minutes  
> (seconds?) using ajax then he can use this service (not one of the best  
> examples, he should use js code instead of periodic ajax requests).

How do you get the server time updated with only js and without Ajax?

> The name "getServerTimestamp" assuming that the service will return  
> Timestamp, so that one can use it however he wants and fetch the date time  
> information to whatever precision he needs.

getServerTimestamp I can agree and use

Jacques

> On Mon, 31 Dec 2012 11:44:47 +0530, Jacques Le Roux  
> <[hidden email]> wrote:
>
>> From: "Atul Vani" <[hidden email]>
>>> How about "getServerTimestamp", and letting the service do it's own  
>>> thing,
>>> while the formatting being handled in ftl. This whole js thing, just  
>>> adds
>>> one more request after the dom ready, causing things to slow down, when
>>> the information can just be supplied along with the rest of the content.
>>> Just a suggestion, no offense.
>>
>> getServerTimestamp instead of getServerHour, yes why not?
>> I choose hour because that's what I'm really interested in for theUI:  
>> the hour, the time, the moment I can compare with the jobs run times.
>>
>> WindowClockJs.ftl is there because of  window.setInterval() and in the  
>> service the beauty of  
>> ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss') is it  
>> retrieves the server time and does the formatting in one shoot.
>> I really don't see how it slow down things. I mean what would you  
>> suggest instead?
>> We need
>> * a timer => I picked window.setInterval()
>> * a service to retrieve  the server hour (er... timestamp, which I  
>> really don't see like being more clear than hour for the common of  
>> mortals, but well...)
>>
>> Jacques
>>
>>
>>
>>> On Sun, 30 Dec 2012 23:50:13 +0530, Jacques Le Roux
>>> <[hidden email]> wrote:
>>>
>>>> From: "Adrian Crum" <[hidden email]>
>>>>> On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
>>>>>> From: "Adrian Crum" <[hidden email]>
>>>>>>> What is this commit supposed to do?
>>>>>> Get the server hour, which can be different from your local machine.
>>>>>>
>>>>>>> The getServerHour service name is misleading - it actually returns  
>>>>>>> the
>>>>>>> server date/time.
>>>>>> Yes, that's wanted. To compare with the jobs times which are server
>>>>>> related.
>>>>>
>>>>> A misleading service name is wanted??!! Please don't do that.
>>>>
>>>> What would you prefer? GetServerDateTime?
>>>>
>>>>>>
>>>>>>> Keep in mind there is a Mini-language element called <now>. Your
>>>>>>> service
>>>>>>> is unnecessarily complicated.
>>>>>> I know about <now>. I needed to format the date. It was the simpler
>>>>>> way I found
>>>>>
>>>>> The service engine will format the date.
>>>>
>>>> I don't want the ms, less legible, useless for humans, at least in this
>>>> case...
>>>>
>>>> Jacques
>>>>
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>>> -Adrian
>>>>>>>
>>>>>>> On 12/30/2012 7:33 AM, [hidden email] wrote:
>>>>>>>> Author: jleroux
>>>>>>>> Date: Sun Dec 30 07:33:26 2012
>>>>>>>> New Revision: 1426904
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1426904&view=rev
>>>>>>>> Log:
>>>>>>>> Complete the work on server hour for the webtools job list.
>>>>>>>> * Now uses real server hour
>>>>>>>> * Renames getDependentDropdownValues.js into miscAjaxFunctions.js,
>>>>>>>> that it is really
>>>>>>>> * Introduces a minimized version of date.format:
>>>>>>>> date.format-1.2.3-min.js
>>>>>>>>
>>>>>>>> Added:
>>>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>>>         - copied, changed from r1426848,
>>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>>>       ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> (with props)
>>>>>>>>       ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>>>         - copied, changed from r1426725,
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>>> Removed:
>>>>>>>>       ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>>>       ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>>> Modified:
>>>>>>>>       ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>>>       ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>>>       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/widget/CommonScreens.xml
>>>>>>>>       ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>>>       ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>>> (original)
>>>>>>>> +++
>>>>>>>> ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -847,7 +847,7 @@ under the License.
>>>>>>>>        </simple-method>
>>>>>>>>
>>>>>>>>        <!-- To help dynamically populate a products dropdown given  
>>>>>>>> a
>>>>>>>> product category id from a change in another dropdown, possibly
>>>>>>>> sorted on sequenceNum -->
>>>>>>>> -    <simple-method method-name="getAssociatedProductsList"
>>>>>>>> short-description="Set the product options for selected product
>>>>>>>> category, mostly used by getDependentDropdownValues.js"
>>>>>>>> login-required="false">
>>>>>>>> +    <simple-method method-name="getAssociatedProductsList"
>>>>>>>> short-description="Set the product options for selected product
>>>>>>>> category, mostly used by getDependentDropdownValues"
>>>>>>>> login-required="false">
>>>>>>>>            <set field="parameters.categoryId"
>>>>>>>> from-field="parameters.productCategoryId"/>
>>>>>>>>            <set-service-fields
>>>>>>>> service-name="getProductCategoryMembers" map="parameters"
>>>>>>>> to-map="getProductCategoryMembersMap"/>
>>>>>>>>            <call-service service-name="getProductCategoryMembers"
>>>>>>>> in-map-name="getProductCategoryMembersMap">
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>> ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>>> (original)
>>>>>>>> +++ ofbiz/trunk/applications/product/servicedef/services_view.xml
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -119,7 +119,7 @@ under the License.
>>>>>>>>
>>>>>>>>        <service name="getAssociatedProductsList" engine="simple"
>>>>>>>> auth="false"
>>>>>>>>            location="component://product/script/org/ofbiz/product/category/CategoryServices.xml"
>>>>>>>> invoke="getAssociatedProductsList">
>>>>>>>> -        <description>Set the product options for selected product
>>>>>>>> category, mostly used by  
>>>>>>>> getDependentDropdownValues.js</description>
>>>>>>>> +        <description>Set the product options for selected product
>>>>>>>> category, mostly used by getDependentDropdownValues</description>
>>>>>>>>            <attribute name="productCategoryId" mode="IN"
>>>>>>>> type="String" optional="false"/>
>>>>>>>>            <attribute name="products" mode="OUT"
>>>>>>>> type="java.util.List"/>
>>>>>>>>        </service>
>>>>>>>>
>>>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
>>>>>>>> (original)
>>>>>>>> +++
>>>>>>>> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -345,5 +345,10 @@ under the License.
>>>>>>>>                </else>
>>>>>>>>            </if-not-empty>
>>>>>>>>            <field-to-result field="exist"/>
>>>>>>>> -    </simple-method>
>>>>>>>> +    </simple-method>
>>>>>>>> +
>>>>>>>> +    <simple-method method-name="getServerHour"
>>>>>>>> login-required="false">
>>>>>>>> +        <set field="nowDateString"
>>>>>>>> value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd
>>>>>>>> HH:mm:ss')}"/>
>>>>>>>> +        <field-to-result field="nowDateString"/>
>>>>>>>> +    </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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/framework/common/servicedef/services.xml (original)
>>>>>>>> +++ ofbiz/trunk/framework/common/servicedef/services.xml Sun Dec 30
>>>>>>>> 07:33:26 2012
>>>>>>>> @@ -780,7 +780,12 @@ under the License.
>>>>>>>>            <attribute name="geoAssocTypeId" mode="IN"  
>>>>>>>> type="String"/>
>>>>>>>>            <attribute name="geoList" mode="OUT"
>>>>>>>> type="java.util.List"/>
>>>>>>>>        </service>
>>>>>>>> -
>>>>>>>> +
>>>>>>>> +    <service name="getServerHour" engine="simple" auth="false"
>>>>>>>> +
>>>>>>>> location="component://common/script/org/ofbiz/common/CommonServices.xml"
>>>>>>>> invoke="getServerHour">
>>>>>>>> +        <attribute name="nowDateString" mode="OUT" type="String"/>
>>>>>>>> +    </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>
>>>>>>>>
>>>>>>>> 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=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
>>>>>>>> (original)
>>>>>>>> +++
>>>>>>>> ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -253,6 +253,13 @@ under the License.
>>>>>>>>            <response name="error" type="request" value="json"/>
>>>>>>>>        </request-map>
>>>>>>>>
>>>>>>>> +    <request-map uri="getServerHour">
>>>>>>>> +        <security https="true" auth="true"/>
>>>>>>>> +        <event type="service" invoke="getServerHour"/>
>>>>>>>> +        <response name="success" type="request" value="json"/>
>>>>>>>> +        <response name="error" type="request" value="json"/>
>>>>>>>> +    </request-map>
>>>>>>>> +
>>>>>>>>        <!--========================== AJAX events
>>>>>>>> =====================-->
>>>>>>>>
>>>>>>>>        <!-- View Mappings -->
>>>>>>>>
>>>>>>>> Copied:
>>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>>> (from r1426848,
>>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl)
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl?p2=ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl&p1=ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl&r1=1426848&r2=1426904&rev=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowSetIntervalJs.ftl
>>>>>>>> (original)
>>>>>>>> +++
>>>>>>>> ofbiz/trunk/framework/common/webcommon/includes/WindowClockJs.ftl
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -20,7 +20,7 @@ under the License.
>>>>>>>>    jQuery(document).ready(function() {
>>>>>>>>      window.setInterval(function(){clock()}, 1000);
>>>>>>>>      function clock() {
>>>>>>>> -    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:
>>>>>>>> "  + new Date().format("yyyy-mm-dd HH:MM:ss"));
>>>>>>>> +    jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}:
>>>>>>>> "  + getServerHour("getServerHour"));
>>>>>>>>      }
>>>>>>>>    })
>>>>>>>>    </script>
>>>>>>>> \ No newline at end of file
>>>>>>>>
>>>>>>>> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/framework/common/widget/CommonScreens.xml  
>>>>>>>> (original)
>>>>>>>> +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec  
>>>>>>>> 30
>>>>>>>> 07:33:26 2012
>>>>>>>> @@ -154,10 +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" 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/getDependentDropdownValues.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" />
>>>>>>>>                    <service service-name="getVisualThemeResources">
>>>>>>>>
>>>>>>>> Added:
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js?rev=1426904&view=auto
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> (added)
>>>>>>>> +++
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -0,0 +1 @@
>>>>>>>> +var dateFormat=function(){var
>>>>>>>> a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic)
>>>>>>>> (?:Standard|Daylight|Prevailing)
>>>>>>>> Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return
>>>>>>>> f};return function(i,v,q){var
>>>>>>>> g=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(i)=="[object
>>>>>>>> String]"&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new
>>>>>>>> Date;if(isNaN(i)){throw SyntaxError("invalid
>>>>>>>> date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var
>>>>>>>> t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),y!
>>>>>>> yyy
>>>>>>>>    :p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return
>>>>>>>> v.replace(a,function(m){return m in
>>>>>>>> h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd
>>>>>>>> mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d,
>>>>>>>> yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d,
>>>>>>>> yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss
>>>>>>>> TT
>>>>>>>> Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",!
>>>>>>> "Nov
>>>>>>>>    ","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return
>>>>>>>> dateFormat(this,a,b)};
>>>>>>>> \ No newline at end of file
>>>>>>>>
>>>>>>>> Propchange:
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>       svn:eol-style = native
>>>>>>>>
>>>>>>>> Propchange:
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>       svn:keywords = Date Rev Author URL Id
>>>>>>>>
>>>>>>>> Propchange:
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/date.format-1.2.3-min.js
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>       svn:mime-type = text/plain
>>>>>>>>
>>>>>>>> Copied:
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>>> (from r1426725,
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js)
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js?p2=ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js&p1=ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js&r1=1426725&r2=1426904&rev=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> ---
>>>>>>>> ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
>>>>>>>> (original)
>>>>>>>> +++ ofbiz/trunk/framework/images/webapp/images/miscAjaxFunctions.js
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -123,9 +123,28 @@ function getServiceResult(request, param
>>>>>>>>        return data;
>>>>>>>>    }
>>>>>>>>
>>>>>>>> +//*** calls any service already mounted as an event
>>>>>>>> +function getServiceResult(request){
>>>>>>>> +    var data;
>>>>>>>> +    jQuery.ajax({
>>>>>>>> +        type: 'POST',
>>>>>>>> +        url: request,
>>>>>>>> +        async: false,
>>>>>>>> +        cache: false,
>>>>>>>> +        success: function(result){
>>>>>>>> +            data = result;
>>>>>>>> +        }
>>>>>>>> +    });
>>>>>>>> +    return data;
>>>>>>>> +}
>>>>>>>> +
>>>>>>>>    //*** checkUomConversion returns true if an UomConversion exists
>>>>>>>>    function checkUomConversion(request, params){
>>>>>>>>        data = getServiceResult(request, params);
>>>>>>>>        return data['exist'];
>>>>>>>>    }
>>>>>>>>
>>>>>>>> +function getServerHour(request){
>>>>>>>> +    data = getServiceResult(request);
>>>>>>>> +    return data['nowDateString'];
>>>>>>>> +}
>>>>>>>> \ No newline at end of file
>>>>>>>>
>>>>>>>> Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
>>>>>>>> (original)
>>>>>>>> +++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sun  
>>>>>>>> Dec
>>>>>>>> 30 07:33:26 2012
>>>>>>>> @@ -49,7 +49,7 @@ under the License.
>>>>>>>>                    <set field="tabButtonItem" value="findJob"/>
>>>>>>>>                    <set field="jobCtx" from-field="parameters"/>
>>>>>>>>                    <set field="dummy" value="${groovy: if
>>>>>>>> ('SERVICE_PENDING'.equals(jobCtx.statusId)) jobCtx.jobId = ''}"/>
>>>>>>>> <!--  To more easily see current pending jobs and possibly cancel
>>>>>>>> some others -->
>>>>>>>> -                <!-- field for WindowSetIntervalJs.ftl -->
>>>>>>>> +                <!-- fields for WindowClockJs.ftl -->
>>>>>>>>                    <set field="clockField"
>>>>>>>> value="FindJobs_clock_title"/>
>>>>>>>>                </actions>
>>>>>>>>                <widgets>
>>>>>>>> @@ -57,7 +57,7 @@ under the License.
>>>>>>>>                        <decorator-section name="body">
>>>>>>>>                            <section>
>>>>>>>>                                <widgets>
>>>>>>>> -
>>>>>>>> <platform-specific><html><html-template
>>>>>>>> location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
>>>>>>>> +
>>>>>>>> <platform-specific><html><html-template
>>>>>>>> location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
>>>>>>>>                                    <decorator-screen
>>>>>>>> name="FindScreenDecorator"
>>>>>>>> location="component://common/widget/CommonScreens.xml">
>>>>>>>>                                        <decorator-section
>>>>>>>> name="search-options">
>>>>>>>>                                            <include-form
>>>>>>>> name="FindJobs"
>>>>>>>> location="component://webtools/widget/ServiceForms.xml"/>
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>> ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>>> URL:
>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1426904&r1=1426903&r2=1426904&view=diff
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>>> (original)
>>>>>>>> +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml
>>>>>>>> Sun Dec 30 07:33:26 2012
>>>>>>>> @@ -63,7 +63,7 @@ under the License.
>>>>>>>>                    <entity-and list="webAnalyticsConfigs"
>>>>>>>> entity-name="WebAnalyticsConfig">
>>>>>>>>                        <field-map field-name="webSiteId"/>
>>>>>>>>                    </entity-and>
>>>>>>>> -                <set field="layoutSettings.javaScripts[]"
>>>>>>>> value="/images/getDependentDropdownValues.js" global="true" />
>>>>>>>> +                <set field="layoutSettings.javaScripts[]"
>>>>>>>> value="/images/miscAjaxFunctions.js" global="true" />
>>>>>>>>                </actions>
>>>>>>>>                <widgets>
>>>>>>>>                   <section>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>> --
>>> Using Opera's revolutionary email client: http://www.opera.com/mail/
>
>
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Adrian Crum-3

On 12/31/2012 9:22 AM, Jacques Le Roux wrote:

> From: "Atul Vani" <[hidden email]>
>> The necessity for a service to return the server time makes some sense to
>> me, that is the reason I didn't say why do we need a service when the same
>> thing can be done in groovy.
>>
>> However, at present, the service do not find much (any) use. But just for
>> the sake of doing things the right way, when we need to show
>> (display/render) the server time (in the header or footer, most probably),
>> then we should be using this service. And lets hope that in future when
>> someone needs to do a "similar thing" then he will be using this service
>> too.
>>
>> By "similar thing", I mean to say that this service is not meant to be
>> used to get nowTimestamp for building (lets say) some EntityCondition.
>> That's a no-no, but if you need to display server time, or to get the
>> server time for some third party integration, or to periodically update a
>> page with the current server time (I hate writing this one), then use the
>> service.
>>
>> Now about how things slow down, the more number of requests it needs to
>> render a page the slower it will be. It is similar to how it works for
>> database connections, the most time consuming part is to create a
>> connection. So, it's better to keep alive an existing one, then to create
>> multiple. Thanks to Amardeep, Erwan and you that we already got rid of
>> some, in OFBIZ-4667. In our case, it does not make sense to use an ajax
>> request to separately update the server time after page has loaded, we can
>> pull that information from the server along with rest of the data.
> How? My need it to see the server time updating every second. Why? because I want to be able to monitor when a specific job will fire. A second interval is enough for me, but less will not be.
> And seriously is that a big deal on this screen? Of course if the screen is permanently open by many persons for the same serve it begins to be a worry, rarely the case I guess...
>
>> Well,
>> if someone needs to (let say) update the server time every five minutes
>> (seconds?) using ajax then he can use this service (not one of the best
>> examples, he should use js code instead of periodic ajax requests).
> How do you get the server time updated with only js and without Ajax?

Get the server time once, then update (increment) it with JS.

-Adrian


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Atul Vani
In reply to this post by Jacques Le Roux
Sorry, I mis-interpreted it. Ya, but for what you want I think js  
incrementing is a better solution.

On Mon, 31 Dec 2012 15:06:07 +0530, Adrian Crum  
<[hidden email]> wrote:

>
> On 12/31/2012 9:22 AM, Jacques Le Roux wrote:
>> From: "Atul Vani" <[hidden email]>
>>> The necessity for a service to return the server time makes some sense  
>>> to
>>> me, that is the reason I didn't say why do we need a service when the  
>>> same
>>> thing can be done in groovy.
>>>
>>> However, at present, the service do not find much (any) use. But just  
>>> for
>>> the sake of doing things the right way, when we need to show
>>> (display/render) the server time (in the header or footer, most  
>>> probably),
>>> then we should be using this service. And lets hope that in future when
>>> someone needs to do a "similar thing" then he will be using this  
>>> service
>>> too.
>>>
>>> By "similar thing", I mean to say that this service is not meant to be
>>> used to get nowTimestamp for building (lets say) some EntityCondition.
>>> That's a no-no, but if you need to display server time, or to get the
>>> server time for some third party integration, or to periodically  
>>> update a
>>> page with the current server time (I hate writing this one), then use  
>>> the
>>> service.
>>>
>>> Now about how things slow down, the more number of requests it needs to
>>> render a page the slower it will be. It is similar to how it works for
>>> database connections, the most time consuming part is to create a
>>> connection. So, it's better to keep alive an existing one, then to  
>>> create
>>> multiple. Thanks to Amardeep, Erwan and you that we already got rid of
>>> some, in OFBIZ-4667. In our case, it does not make sense to use an ajax
>>> request to separately update the server time after page has loaded, we  
>>> can
>>> pull that information from the server along with rest of the data.
>> How? My need it to see the server time updating every second. Why?  
>> because I want to be able to monitor when a specific job will fire. A  
>> second interval is enough for me, but less will not be.
>> And seriously is that a big deal on this screen? Of course if the  
>> screen is permanently open by many persons for the same serve it begins  
>> to be a worry, rarely the case I guess...
>>
>>> Well,
>>> if someone needs to (let say) update the server time every five minutes
>>> (seconds?) using ajax then he can use this service (not one of the best
>>> examples, he should use js code instead of periodic ajax requests).
>> How do you get the server time updated with only js and without Ajax?
>
> Get the server time once, then update (increment) it with JS.
>
> -Adrian
>
>


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
Sounds good guys indeed, I will do that

Thanks

Jacques

From: "Atul Vani" <[hidden email]>

> Sorry, I mis-interpreted it. Ya, but for what you want I think js  
> incrementing is a better solution.
>
> On Mon, 31 Dec 2012 15:06:07 +0530, Adrian Crum  
> <[hidden email]> wrote:
>
>>
>> On 12/31/2012 9:22 AM, Jacques Le Roux wrote:
>>> From: "Atul Vani" <[hidden email]>
>>>> The necessity for a service to return the server time makes some sense  
>>>> to
>>>> me, that is the reason I didn't say why do we need a service when the  
>>>> same
>>>> thing can be done in groovy.
>>>>
>>>> However, at present, the service do not find much (any) use. But just  
>>>> for
>>>> the sake of doing things the right way, when we need to show
>>>> (display/render) the server time (in the header or footer, most  
>>>> probably),
>>>> then we should be using this service. And lets hope that in future when
>>>> someone needs to do a "similar thing" then he will be using this  
>>>> service
>>>> too.
>>>>
>>>> By "similar thing", I mean to say that this service is not meant to be
>>>> used to get nowTimestamp for building (lets say) some EntityCondition.
>>>> That's a no-no, but if you need to display server time, or to get the
>>>> server time for some third party integration, or to periodically  
>>>> update a
>>>> page with the current server time (I hate writing this one), then use  
>>>> the
>>>> service.
>>>>
>>>> Now about how things slow down, the more number of requests it needs to
>>>> render a page the slower it will be. It is similar to how it works for
>>>> database connections, the most time consuming part is to create a
>>>> connection. So, it's better to keep alive an existing one, then to  
>>>> create
>>>> multiple. Thanks to Amardeep, Erwan and you that we already got rid of
>>>> some, in OFBIZ-4667. In our case, it does not make sense to use an ajax
>>>> request to separately update the server time after page has loaded, we  
>>>> can
>>>> pull that information from the server along with rest of the data.
>>> How? My need it to see the server time updating every second. Why?  
>>> because I want to be able to monitor when a specific job will fire. A  
>>> second interval is enough for me, but less will not be.
>>> And seriously is that a big deal on this screen? Of course if the  
>>> screen is permanently open by many persons for the same serve it begins  
>>> to be a worry, rarely the case I guess...
>>>
>>>> Well,
>>>> if someone needs to (let say) update the server time every five minutes
>>>> (seconds?) using ajax then he can use this service (not one of the best
>>>> examples, he should use js code instead of periodic ajax requests).
>>> How do you get the server time updated with only js and without Ajax?
>>
>> Get the server time once, then update (increment) it with JS.
>>
>> -Adrian
>>
>>
>
>
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1426904 - in /ofbiz/trunk: applications/product/script/org/ofbiz/product/category/ applications/product/servicedef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/ framework/common/webcommon/WEB-INF/ framework/common

Jacques Le Roux
Administrator
Done at r1427233  

I will certainly add a check box to automatically update the job list, using the selected status...

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Sounds good guys indeed, I will do that
>
> Thanks
>
> Jacques
>
> From: "Atul Vani" <[hidden email]>
>> Sorry, I mis-interpreted it. Ya, but for what you want I think js  
>> incrementing is a better solution.
>>
>> On Mon, 31 Dec 2012 15:06:07 +0530, Adrian Crum  
>> <[hidden email]> wrote:
>>
>>>
>>> On 12/31/2012 9:22 AM, Jacques Le Roux wrote:
>>>> From: "Atul Vani" <[hidden email]>
>>>>> The necessity for a service to return the server time makes some sense  
>>>>> to
>>>>> me, that is the reason I didn't say why do we need a service when the  
>>>>> same
>>>>> thing can be done in groovy.
>>>>>
>>>>> However, at present, the service do not find much (any) use. But just  
>>>>> for
>>>>> the sake of doing things the right way, when we need to show
>>>>> (display/render) the server time (in the header or footer, most  
>>>>> probably),
>>>>> then we should be using this service. And lets hope that in future when
>>>>> someone needs to do a "similar thing" then he will be using this  
>>>>> service
>>>>> too.
>>>>>
>>>>> By "similar thing", I mean to say that this service is not meant to be
>>>>> used to get nowTimestamp for building (lets say) some EntityCondition.
>>>>> That's a no-no, but if you need to display server time, or to get the
>>>>> server time for some third party integration, or to periodically  
>>>>> update a
>>>>> page with the current server time (I hate writing this one), then use  
>>>>> the
>>>>> service.
>>>>>
>>>>> Now about how things slow down, the more number of requests it needs to
>>>>> render a page the slower it will be. It is similar to how it works for
>>>>> database connections, the most time consuming part is to create a
>>>>> connection. So, it's better to keep alive an existing one, then to  
>>>>> create
>>>>> multiple. Thanks to Amardeep, Erwan and you that we already got rid of
>>>>> some, in OFBIZ-4667. In our case, it does not make sense to use an ajax
>>>>> request to separately update the server time after page has loaded, we  
>>>>> can
>>>>> pull that information from the server along with rest of the data.
>>>> How? My need it to see the server time updating every second. Why?  
>>>> because I want to be able to monitor when a specific job will fire. A  
>>>> second interval is enough for me, but less will not be.
>>>> And seriously is that a big deal on this screen? Of course if the  
>>>> screen is permanently open by many persons for the same serve it begins  
>>>> to be a worry, rarely the case I guess...
>>>>
>>>>> Well,
>>>>> if someone needs to (let say) update the server time every five minutes
>>>>> (seconds?) using ajax then he can use this service (not one of the best
>>>>> examples, he should use js code instead of periodic ajax requests).
>>>> How do you get the server time updated with only js and without Ajax?
>>>
>>> Get the server time once, then update (increment) it with JS.
>>>
>>> -Adrian
>>>
>>>
>>
>>
>> --
>> Using Opera's revolutionary email client: http://www.opera.com/mail/
>