On 12/30/2012 5:10 PM, Jacques Le Roux wrote:
From: "Adrian Crum" <adrian.c...@sandglass-software.com>
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, jler...@apache.org 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 via email to