Skip to content
Browse files

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...
1 parent 200ba16 commit 9e0df870ad5afbe1fe10195e66d9843338fc7acb @JacquesLeRoux JacquesLeRoux committed Dec 30, 2012
View
2 applications/product/script/org/ofbiz/product/category/CategoryServices.xml
@@ -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">
View
2 applications/product/servicedef/services_view.xml
@@ -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>
View
7 framework/common/script/org/ofbiz/common/CommonServices.xml
@@ -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>
View
7 framework/common/servicedef/services.xml
@@ -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>
View
7 framework/common/webcommon/WEB-INF/common-controller.xml
@@ -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 -->
View
2 ...ebcommon/includes/WindowSetIntervalJs.ftl → ...mmon/webcommon/includes/WindowClockJs.ftl
@@ -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>
View
4 framework/common/widget/CommonScreens.xml
@@ -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">
View
1 framework/images/webapp/images/date.format-1.2.3-min.js
@@ -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)};
View
19 ...bapp/images/getDependentDropdownValues.js → ...images/webapp/images/miscAjaxFunctions.js
@@ -123,9 +123,28 @@ function getServiceResult(request, params){
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'];
+}
View
4 framework/webtools/widget/ServiceScreens.xml
@@ -49,15 +49,15 @@ 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>
<decorator-screen name="CommonServiceDecorator" location="${parameters.mainDecoratorLocation}">
<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"/>
View
2 specialpurpose/ecommerce/widget/CommonScreens.xml
@@ -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>

0 comments on commit 9e0df87

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