Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1426904 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 9e0df870ad5afbe1fe10195e66d9843338fc7acb 1 parent 200ba16
Jacques Le Roux authored
2  applications/product/script/org/ofbiz/product/category/CategoryServices.xml
@@ -847,7 +847,7 @@ under the License.
847 847 </simple-method>
848 848
849 849 <!-- To help dynamically populate a products dropdown given a product category id from a change in another dropdown, possibly sorted on sequenceNum -->
850   - <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues.js" login-required="false">
  850 + <simple-method method-name="getAssociatedProductsList" short-description="Set the product options for selected product category, mostly used by getDependentDropdownValues" login-required="false">
851 851 <set field="parameters.categoryId" from-field="parameters.productCategoryId"/>
852 852 <set-service-fields service-name="getProductCategoryMembers" map="parameters" to-map="getProductCategoryMembersMap"/>
853 853 <call-service service-name="getProductCategoryMembers" in-map-name="getProductCategoryMembersMap">
2  applications/product/servicedef/services_view.xml
@@ -119,7 +119,7 @@ under the License.
119 119
120 120 <service name="getAssociatedProductsList" engine="simple" auth="false"
121 121 location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="getAssociatedProductsList">
122   - <description>Set the product options for selected product category, mostly used by getDependentDropdownValues.js</description>
  122 + <description>Set the product options for selected product category, mostly used by getDependentDropdownValues</description>
123 123 <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
124 124 <attribute name="products" mode="OUT" type="java.util.List"/>
125 125 </service>
7 framework/common/script/org/ofbiz/common/CommonServices.xml
@@ -345,5 +345,10 @@ under the License.
345 345 </else>
346 346 </if-not-empty>
347 347 <field-to-result field="exist"/>
348   - </simple-method>
  348 + </simple-method>
  349 +
  350 + <simple-method method-name="getServerHour" login-required="false">
  351 + <set field="nowDateString" value="${groovy:org.ofbiz.base.util.UtilDateTime.nowDateString('yyyy-MM-dd HH:mm:ss')}"/>
  352 + <field-to-result field="nowDateString"/>
  353 + </simple-method>
349 354 </simple-methods>
7 framework/common/servicedef/services.xml
@@ -780,7 +780,12 @@ under the License.
780 780 <attribute name="geoAssocTypeId" mode="IN" type="String"/>
781 781 <attribute name="geoList" mode="OUT" type="java.util.List"/>
782 782 </service>
783   -
  783 +
  784 + <service name="getServerHour" engine="simple" auth="false"
  785 + location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getServerHour">
  786 + <attribute name="nowDateString" mode="OUT" type="String"/>
  787 + </service>
  788 +
784 789 <service name="createJsLanguageFileMapping" engine="java" auth="false" use-transaction="false"
785 790 location="org.ofbiz.common.JsLanguageFileMappingCreator" invoke="createJsLanguageFileMapping">
786 791 <description>Create or update the JsLanguageFilesMapping.java. You still need to compile thereafter</description>
7 framework/common/webcommon/WEB-INF/common-controller.xml
@@ -253,6 +253,13 @@ under the License.
253 253 <response name="error" type="request" value="json"/>
254 254 </request-map>
255 255
  256 + <request-map uri="getServerHour">
  257 + <security https="true" auth="true"/>
  258 + <event type="service" invoke="getServerHour"/>
  259 + <response name="success" type="request" value="json"/>
  260 + <response name="error" type="request" value="json"/>
  261 + </request-map>
  262 +
256 263 <!--========================== AJAX events =====================-->
257 264
258 265 <!-- View Mappings -->
2  ...common/webcommon/includes/WindowSetIntervalJs.ftl → ...ework/common/webcommon/includes/WindowClockJs.ftl
@@ -20,7 +20,7 @@ under the License.
20 20 jQuery(document).ready(function() {
21 21 window.setInterval(function(){clock()}, 1000);
22 22 function clock() {
23   - jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + new Date().format("yyyy-mm-dd HH:MM:ss"));
  23 + jQuery("#${clockField}").text("${uiLabelMap.CommonServerHour}: " + getServerHour("getServerHour"));
24 24 }
25 25 })
26 26 </script>
4 framework/common/widget/CommonScreens.xml
@@ -154,10 +154,10 @@ under the License.
154 154 <!-- jQuery CSSs -->
155 155 <set field="layoutSettings.styleSheets[+0]" value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" global="true" />
156 156 <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true" />
157   - <set field="layoutSettings.javaScripts[]" value="/images/date.format-1.2.3" global="true" />
  157 + <set field="layoutSettings.javaScripts[]" value="/images/date.format-1.2.3-min.js" global="true" />
158 158 <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true" />
159 159 <set field="layoutSettings.javaScripts[]" value="/images/GooglemapMarkers.js" global="true" />
160   - <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
  160 + <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
161 161 <set field="layoutSettings.javaScripts[]" value="/images/selectMultipleRelatedValues.js" global="true" />
162 162 <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" global="true" />
163 163 <service service-name="getVisualThemeResources">
1  framework/images/webapp/images/date.format-1.2.3-min.js
... ... @@ -0,0 +1 @@
  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)};
19 ...mages/webapp/images/getDependentDropdownValues.js → framework/images/webapp/images/miscAjaxFunctions.js
@@ -123,9 +123,28 @@ function getServiceResult(request, params){
123 123 return data;
124 124 }
125 125
  126 +//*** calls any service already mounted as an event
  127 +function getServiceResult(request){
  128 + var data;
  129 + jQuery.ajax({
  130 + type: 'POST',
  131 + url: request,
  132 + async: false,
  133 + cache: false,
  134 + success: function(result){
  135 + data = result;
  136 + }
  137 + });
  138 + return data;
  139 +}
  140 +
126 141 //*** checkUomConversion returns true if an UomConversion exists
127 142 function checkUomConversion(request, params){
128 143 data = getServiceResult(request, params);
129 144 return data['exist'];
130 145 }
131 146
  147 +function getServerHour(request){
  148 + data = getServiceResult(request);
  149 + return data['nowDateString'];
  150 +}
4 framework/webtools/widget/ServiceScreens.xml
@@ -49,7 +49,7 @@ under the License.
49 49 <set field="tabButtonItem" value="findJob"/>
50 50 <set field="jobCtx" from-field="parameters"/>
51 51 <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 -->
52   - <!-- field for WindowSetIntervalJs.ftl -->
  52 + <!-- fields for WindowClockJs.ftl -->
53 53 <set field="clockField" value="FindJobs_clock_title"/>
54 54 </actions>
55 55 <widgets>
@@ -57,7 +57,7 @@ under the License.
57 57 <decorator-section name="body">
58 58 <section>
59 59 <widgets>
60   - <platform-specific><html><html-template location="component://common/webcommon/includes/WindowSetIntervalJs.ftl"/></html></platform-specific>
  60 + <platform-specific><html><html-template location="component://common/webcommon/includes/WindowClockJs.ftl"/></html></platform-specific>
61 61 <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
62 62 <decorator-section name="search-options">
63 63 <include-form name="FindJobs" location="component://webtools/widget/ServiceForms.xml"/>
2  specialpurpose/ecommerce/widget/CommonScreens.xml
@@ -63,7 +63,7 @@ under the License.
63 63 <entity-and list="webAnalyticsConfigs" entity-name="WebAnalyticsConfig">
64 64 <field-map field-name="webSiteId"/>
65 65 </entity-and>
66   - <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true" />
  66 + <set field="layoutSettings.javaScripts[]" value="/images/miscAjaxFunctions.js" global="true" />
67 67 </actions>
68 68 <widgets>
69 69 <section>

0 comments on commit 9e0df87

Please sign in to comment.
Something went wrong with that request. Please try again.