Author: jleroux Date: Fri Jan 7 20:40:31 2011 New Revision: 1056497 URL: http://svn.apache.org/viewvc?rev=1056497&view=rev Log: 3 patches from Sascha Rodekamp "Localisation of labels in javascript" (https://issues.apache.org/jira/browse/OFBIZ-3964) - OFBIZ-3964
This cames from Adam's advice: http://markmail.org/message/kai5lfvlnsz7xwki Sascha comes to this solution The Idea is to have a method which takes a JSON Object with uiLabel Resources and label entries and returns the resolved labels in a JSON Object which can be used directly in the JS Code. The advantage of this way, is that we have only one Ajax request which reads all labels. The alternative is an Ajax request for each label, which simplify the request (because you haven't to create a complex JSON Object) but is very expansive. * Replaces all JS alerts with the new fancy error boxes * Adds a few uiLabels I simply fixed some typos. I did not test all cases but did a good review. Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml ofbiz/trunk/applications/content/data/TemplateData.xml ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl ofbiz/trunk/applications/content/webapp/content/content/DisplayContentNav.ftl ofbiz/trunk/applications/content/webapp/content/content/nav.ftl ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/inlineProductDetail.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js ofbiz/trunk/applications/product/webapp/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl ofbiz/trunk/framework/common/config/CommonUiLabels.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl ofbiz/trunk/framework/example/config/ExampleUiLabels.xml ofbiz/trunk/framework/example/widget/example/FormWidgetExampleForms.xml ofbiz/trunk/framework/images/webapp/images/fieldlookup.js ofbiz/trunk/framework/images/webapp/images/selectall.js ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/configproductdetail.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutreview.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/quickAnonCheckoutReview.ftl Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original) +++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Fri Jan 7 20:40:31 2011 @@ -5487,4 +5487,12 @@ <value xml:lang="zh">ç½ç«å 容</value> <value xml:lang="zh_TW">ç¶²ç«å §å®¹</value> </property> + <property key="ErrorLoadingContent"> + <value xml:lang="de">Ein Fehler beim Laden des Inhaltes ist aufgetrete!</value> + <value xml:lang="en">An error occured loading content!</value> + </property> + <property key="CannotFindCmsform"> + <value xml:lang="de">Die CMS Form kann nicht gefunden werden!</value> + <value xml:lang="en">Cannot find the cmsform!</value> + </property> </resource> Modified: ofbiz/trunk/applications/content/data/TemplateData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/TemplateData.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/data/TemplateData.xml (original) +++ ofbiz/trunk/applications/content/data/TemplateData.xml Fri Jan 7 20:40:31 2011 @@ -146,7 +146,7 @@ under the License. <#if autoUserLogin?has_content>document.loginform.PASSWORD.focus();</#if> <#if !autoUserLogin?has_content>document.loginform.USERNAME.focus();</#if> function requery() { - alert("REQUERY" + document.sectionform.sectionId.value); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}", "${uiLabelMap.CommonRequery}: " + document.sectionform.sectionId.value)); } </script> ]]></textData> Modified: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl (original) +++ ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl Fri Jan 7 20:40:31 2011 @@ -122,7 +122,7 @@ var rawdata = [ type: 'POST', data: {"contentId" : contentId}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -137,7 +137,7 @@ var rawdata = [ data: {contentId: contentId, contentAssocTypeId: 'TREE_CHILD'}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -151,7 +151,7 @@ var rawdata = [ type: 'POST', data: {contentId: contentId}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -165,7 +165,7 @@ var rawdata = [ type: 'POST', data: {contentIdTo: contentIdTo}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -180,7 +180,7 @@ var rawdata = [ type: 'POST', data: {contentId : contentId, contentIdTo : contentIdTo, contentAssocTypeId : contentAssocTypeId, fromDate : fromDate}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { location.reload(); @@ -197,7 +197,7 @@ var rawdata = [ rename: 'Y' }, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -211,7 +211,7 @@ var rawdata = [ url: url, type: 'POST', error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); Modified: ofbiz/trunk/applications/content/webapp/content/content/DisplayContentNav.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/DisplayContentNav.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/content/DisplayContentNav.ftl (original) +++ ofbiz/trunk/applications/content/webapp/content/content/DisplayContentNav.ftl Fri Jan 7 20:40:31 2011 @@ -124,7 +124,7 @@ var rawdata = [ type: 'POST', data: {"contentId" : contentId}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -139,7 +139,7 @@ var rawdata = [ data: { contentId: contentId, contentAssocTypeId: 'TREE_CHILD'}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -153,7 +153,7 @@ var rawdata = [ type: 'POST', data: {contentId: contentId}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -167,7 +167,7 @@ var rawdata = [ type: 'POST', data: {contentIdTo: contentIdTo}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -182,7 +182,7 @@ var rawdata = [ type: 'POST', data: {contentId : contentId, contentIdTo : contentIdTo, contentAssocTypeId : contentAssocTypeId, fromDate : fromDate}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { location.reload(); @@ -199,7 +199,7 @@ var rawdata = [ rename: 'Y' }, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); @@ -213,7 +213,7 @@ var rawdata = [ url: url, type: 'POST', error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#Document').html(msg); Modified: ofbiz/trunk/applications/content/webapp/content/content/nav.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/nav.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/content/nav.ftl (original) +++ ofbiz/trunk/applications/content/webapp/content/content/nav.ftl Fri Jan 7 20:40:31 2011 @@ -77,7 +77,7 @@ var rawdata = [ type: 'POST', data: {"dataCategoryId" : dataCategoryId}, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#cmscontent').html(msg); Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl (original) +++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl Fri Jan 7 20:40:31 2011 @@ -50,7 +50,7 @@ if (form != null) { ajaxSubmitForm(form, "<#if content?has_content>${content.contentId!}</#if>"); } else { - alert("Cannot find the cmsform!"); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CannotFindCmsform}"); } return false; Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl (original) +++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl Fri Jan 7 20:40:31 2011 @@ -344,7 +344,7 @@ var rawdata_errors = [ type: 'POST', data: ctx, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#cmscontent').html(msg); @@ -378,7 +378,7 @@ function callMetaInfo(contentId) { type: 'POST', data: ctx, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#cmscontent').html(msg); @@ -399,7 +399,7 @@ function callMetaInfo(contentId) { type: 'POST', data: ctx, error: function(msg) { - alert("An error occured loading content! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.ErrorLoadingContent} : " + msg); }, success: function(msg) { jQuery('#cmscontent').html(msg); @@ -436,7 +436,7 @@ function callMetaInfo(contentId) { type: 'POST', data: jQuery(form).serialize(), error: function(msg) { - alert("An error occurred."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonUnspecifiedErrorOccurred}"); }, success: function(msg) { callPathAlias(contentId); @@ -454,7 +454,7 @@ function callMetaInfo(contentId) { type: 'POST', data: {"pathAlias" : pathAlias, "webSiteId" : webSiteId}, error: function(msg) { - alert("An error occured! : " + msg); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonUnspecifiedErrorOccurred} : " + msg); }, success: function(msg) { callPathAlias(contentId); @@ -478,7 +478,7 @@ function callMetaInfo(contentId) { } }, error: function(msg) { - alert("An error occurred submitting form."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonErrorSubmittingForm} : " + msg); } }); } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl Fri Jan 7 20:40:31 2011 @@ -84,7 +84,7 @@ function gwAll(e) { } } if (cartSize > passed && selectedValue != "NO^") { - alert("${uiLabelMap.OrderSelectedGiftNotAvailableForAll}"); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.OrderSelectedGiftNotAvailableForAll}"); } cform.submit(); } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl Fri Jan 7 20:40:31 2011 @@ -69,7 +69,7 @@ ${virtualJavaScript?if_exists} if (detailImageUrl == "_NONE_") { hack = document.createElement('span'); hack.innerHTML="${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"; - alert(hack.innerHTML); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"); return; } detailImageUrl = detailImageUrl.replace(/\&\#47;/g, "/"); @@ -468,7 +468,7 @@ function getConfigDetails() { <div>${question.description?if_exists}</div> <#assign instructions = question.content.get("INSTRUCTIONS")?if_exists> <#if instructions?has_content> - <a href="javascript:alert('${instructions}');" class="buttontext">Instructions</a> + <a href="javascript:showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${instructions}");" class="buttontext">Instructions</a> </#if> <#assign image = question.content.get("IMAGE_URL")?if_exists> <#if image?has_content> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/inlineProductDetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/inlineProductDetail.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/inlineProductDetail.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/inlineProductDetail.ftl Fri Jan 7 20:40:31 2011 @@ -37,7 +37,7 @@ ${virtualJavaScript?if_exists} if (window[fieldName] == "_NONE_") { hack = document.createElement('span'); hack.innerHTML="${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"; - alert(hack.innerHTML); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"); return; } window[fieldName] = window[fieldName].replace(/\&\#47;/g, "/"); @@ -163,7 +163,7 @@ ${virtualJavaScript?if_exists} if (element.name.substring(0, index) == fieldName) { if (element.value == '' || element.value == 'NULL') { option.checked = false; - alert('Please select all features first'); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonPleaseSelectAllFeaturesFirst}"); return false; } } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl Fri Jan 7 20:40:31 2011 @@ -82,7 +82,7 @@ ${virtualJavaScript?if_exists} } function addItem() { if (document.addform.add_product_id.value == 'NULL') { - alert("Please select all of the required options."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonPleaseSelectAllRequiredOptions}"); return; } else { if (isVirtual(document.addform.add_product_id.value)) { @@ -107,7 +107,7 @@ ${virtualJavaScript?if_exists} if (detailImageUrl == "_NONE_") { hack = document.createElement('span'); hack.innerHTML="${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"; - alert(hack.innerHTML); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"); return; } detailImageUrl = detailImageUrl.replace(/\&\#47;/g, "/"); @@ -190,23 +190,27 @@ ${virtualJavaScript?if_exists} msg[0]="Please use correct date format [yyyy-mm-dd]"; var y=x.split("-"); - if(y.length!=3){ alert(msg[0]);return false; } - if((y[2].length>2)||(parseInt(y[2])>31)) { alert(msg[0]); return false; } + if(y.length!=3){ showAlert(msg[0]);return false; } + if((y[2].length>2)||(parseInt(y[2])>31)) { showAlert(msg[0]); return false; } if(y[2].length==1){ y[2]="0"+y[2]; } - if((y[1].length>2)||(parseInt(y[1])>12)){ alert(msg[0]); return false; } + if((y[1].length>2)||(parseInt(y[1])>12)){ showAlert(msg[0]); return false; } if(y[1].length==1){ y[1]="0"+y[1]; } - if(y[0].length>4){ alert(msg[0]); return false; } + if(y[0].length>4){ showAlert(msg[0]); return false; } if(y[0].length<4) { if(y[0].length==2) { y[0]="20"+y[0]; } else { - alert(msg[0]); + showAlert(msg[0]); return false; } } return (y[0]+"-"+y[1]+"-"+y[2]); } + function showAlert(msg) { + showErrorAlert("${uiLabelMap.CommonErrorMessage2}",msg); + } + function additemSubmit(){ <#if product.productTypeId?if_exists == "ASSET_USAGE"> newdatevalue = validate(document.addform.reservStart.value); @@ -456,7 +460,7 @@ ${virtualJavaScript?if_exists} <div id="addCart2" style="display:block;> <span style="white-space: nowrap;"><b>${uiLabelMap.CommonQuantity}:</b></span> <input type="text" size="5" value="1" disabled="disabled"/> - <a href="javascript:alert('Please select all features first');" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a> + <a href="javascript:showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonPleaseSelectAllFeaturesFirst}");" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a> </div> </#if> Modified: ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js Fri Jan 7 20:40:31 2011 @@ -18,13 +18,21 @@ under the License. * */ /** - * + * **/ +var uiLabelJsonObject = null; jQuery(document).ready(function() { + + var labelObject = { + "CommonUiLabels" : ["CommonUpload", "CommonSave", "CommonCompleted"], + }; + + uiLabelJsonObjects = getJSONuiLabels(labelObject); + jQuery("#uploadPartyContent").bind("submit", uploadPartyContent); jQuery("#uploadPartyContent").bind("submit", getUploadProgressStatus); jQuery("#progress_bar").progressbar({value: 0}); - + }); function uploadPartyContent(event){ @@ -42,17 +50,17 @@ function uploadPartyContent(event){ function uploadCompleted(){ var iframePartyContentList = jQuery("#target_upload").contents().find("#partyContentList").html(); - + // update partyContentList - copy the Data from the iFrame partyContentList to the page partyContentList jQuery("#partyContentList").html(iframePartyContentList); - - jQuery('#progressBarSavingMsg').html("Saving complete!"); + + jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[2]); // reset progressbar jQuery("#progress_bar").progressbar("option", "value", 0); - + // remove iFrame jQuery("#target_upload").remove(); - return; + return; } function checkIframeStatus() { @@ -73,7 +81,7 @@ function checkIframeStatus() { } function getUploadProgressStatus(event){ - jQuery('#uploadPartyContent').append("<span id='progressBarSavingMsg' class='label'>Uploading...</span>"); + jQuery('#uploadPartyContent').append("<span id='progressBarSavingMsg' class='label'>" + uiLabelJsonObjects.CommonUiLabels[0] + "...</span>"); var i=0; jQuery.fjTimer({ interval: 1000, @@ -93,9 +101,9 @@ function getUploadProgressStatus(event){ } else { var readPercent = data.readPercent; jQuery("#progress_bar").progressbar("option", "value", readPercent); - jQuery('#progressBarSavingMsg').html("Uploading... (" + readPercent + "%)"); + jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[0] + "... (" + readPercent + "%)"); if(readPercent > 99){ - jQuery('#progressBarSavingMsg').html("Saving..."); + jQuery('#progressBarSavingMsg').html(uiLabelJsonObjects.CommonUiLabels[1] + "..."); // stop the fjTimer timerId.stop(); // call the upload complete method to do final stuff Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl (original) +++ ofbiz/trunk/applications/product/webapp/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl Fri Jan 7 20:40:31 2011 @@ -56,18 +56,18 @@ under the License. <#elseif ProductReceiveInventoryAgainstPurchaseOrderProductNotFound?exists> <div class="errorMessage"> <#assign uiLabelWithVar=uiLabelMap.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound?interpret><@uiLabelWithVar/> - <script type="text/javascript">window.onload=function(){alert('<@uiLabelWithVar/>')};</script> + <script type="text/javascript">window.onload=function(){showErrorAlert("${uiLabelMap.CommonErrorMessage2}","<@uiLabelWithVar/>");};</script> </div> <#elseif ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive?exists> <div class="errorMessage"> <#assign uiLabelWithVar=uiLabelMap.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive?interpret><@uiLabelWithVar/> - <script type="text/javascript">window.onload=function(){alert('<@uiLabelWithVar/>')};</script> + <script type="text/javascript">window.onload=function(){showErrorAlert("${uiLabelMap.CommonErrorMessage2}","<@uiLabelWithVar/>");};</script> </div> </#if> <#if ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder?exists> <div class="errorMessage" style="color:green"> <#assign uiLabelWithVar=uiLabelMap.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder?interpret><@uiLabelWithVar/> - <script type="text/javascript">window.onload=function(){alert('<@uiLabelWithVar/>')};</script> + <script type="text/javascript">window.onload=function(){showErrorAlert("${uiLabelMap.CommonErrorMessage2}","<@uiLabelWithVar/>");};</script> </div> </#if> </#if> Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Fri Jan 7 20:40:31 2011 @@ -11411,4 +11411,28 @@ <value xml:lang="zh_CN">䏿</value> <value xml:lang="zh_TW">䏿</value> </property> + <property key="CommonRequery"> + <value xml:lang="de">Erneute Abfrage</value> + <value xml:lang="en">Requery</value> + </property> + <property key="CommonUnspecifiedErrorOccurred"> + <value xml:lang="de">Ein unbestimmter Fehler ist aufgetreten!</value> + <value xml:lang="en">An unspecified error occurred!</value> + </property> + <property key="CommonErrorSubmittingForm"> + <value xml:lang="de">Ein Fehler beim abschicken der Form ist aufgetreten.</value> + <value xml:lang="en">An error occurred submitting form.</value> + </property> + <property key="CommonPleaseSelectAllFeaturesFirst"> + <value xml:lang="de">Bitte wählen Sie erst alle Merkmale aus.</value> + <value xml:lang="en">Please select all features first.</value> + </property> + <property key="CommonPleaseSelectAllRequiredOptions"> + <value xml:lang="de">Bitte selektieren Sie alle benötigten Optionen.</value> + <value xml:lang="en">Please select all of the required options.</value> + </property> + <property key="CommonAddressNotFound"> + <value xml:lang="de">Die Adresse wurde nicht gefunden.</value> + <value xml:lang="en">Address not found.</value> + </property> </resource> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Fri Jan 7 20:40:31 2011 @@ -22,19 +22,27 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; +import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javolution.util.FastMap; +import net.sf.json.JSON; +import net.sf.json.JSONArray; import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.entity.Delegator; @@ -251,10 +259,16 @@ public class CommonEvents { // create a JSON Object for return JSONObject json = JSONObject.fromObject(attrMap); + writeJSONtoResponse(json, response); + + return "success"; + } + + private static void writeJSONtoResponse(JSON json, HttpServletResponse response) { String jsonStr = json.toString(); if (jsonStr == null) { Debug.logError("JSON Object was empty; fatal error!", module); - return "success"; + return; } // set the X-JSON content type @@ -275,7 +289,85 @@ public class CommonEvents { } catch (IOException e) { Debug.logError(e, module); } + } + + + public static String getJSONuiLabelArray(HttpServletRequest request, HttpServletResponse response) { + String requiredLabels = request.getParameter("requiredLabels"); + + JSONObject uiLabelObject = null; + if (UtilValidate.isNotEmpty(requiredLabels)) { + uiLabelObject = new JSONObject(); + // Transform JSON String to Object + uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels); + } + + JSONObject jsonUiLabel = new JSONObject(); + Locale locale = request.getLocale(); + if(!uiLabelObject.isEmpty()) { + Set<String> resourceSet = UtilGenerics.checkSet(uiLabelObject.keySet()); + // Iterate over the resouce set + for (String resource : resourceSet) { + JSONArray labels = uiLabelObject.getJSONArray(resource); + if (labels.isEmpty() || labels == null) { + continue; + } + + // Iterate over the uiLabel List + Iterator jsonLabelIterator = labels.iterator(); + JSONArray resourceLabelList = new JSONArray(); + while(jsonLabelIterator.hasNext()) { + String label = (String) jsonLabelIterator.next(); + String receivedLabel = UtilProperties.getMessage(resource, label, locale); + if (UtilValidate.isNotEmpty(receivedLabel)) { + resourceLabelList.add(receivedLabel); + } + } + jsonUiLabel.element(resource, resourceLabelList); + } + } + + writeJSONtoResponse(jsonUiLabel, response); + return "success"; + } + + public static String getJSONuiLabel(HttpServletRequest request, HttpServletResponse response) { + String requiredLabels = request.getParameter("requiredLabel"); + + JSONObject uiLabelObject = null; + if (UtilValidate.isNotEmpty(requiredLabels)) { + uiLabelObject = new JSONObject(); + // Transform JSON String to Object + uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels); + } + + JSONArray jsonUiLabel = new JSONArray(); + Locale locale = request.getLocale(); + if(!uiLabelObject.isEmpty()) { + Set<String> resourceSet = UtilGenerics.checkSet(uiLabelObject.keySet()); + // Iterate over the resource set + // here we need a keySet because we don't now which label resource to load + // the key set should have the size one, if greater or empty error should returned + if (UtilValidate.isEmpty(resourceSet)) { + Debug.logError("No resource and labels found", module); + return "error"; + } else if (resourceSet.size() > 1) { + Debug.logError("More than one resource found, please use the method: getJSONuiLabelArray", module); + return "error"; + } + + for (String resource : resourceSet) { + String label = uiLabelObject.getString(resource); + if (UtilValidate.isEmail(label)) { + continue; + } + + String receivedLabel = UtilProperties.getMessage(resource, label, locale); + jsonUiLabel.add(receivedLabel); + } + } + writeJSONtoResponse(jsonUiLabel, response); return "success"; } } 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=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original) +++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Fri Jan 7 20:40:31 2011 @@ -210,7 +210,21 @@ under the License. <response name="success" type="request" value="json"/> <response name="error" type="request" value="json"/> </request-map> - + + <!-- Common JavaScript uiLabel Request, to receive uiLabels within regular JS Code --> + <request-map uri="getJSONuiLabelArray"> + <security https="true" auth="false"/> + <event type="java" path="org.ofbiz.common.CommonEvents" invoke="getJSONuiLabelArray"/> + <response name="success" type="none" /> + <response name="error" type="none" /> + </request-map> + <request-map uri="getJSONuiLabel"> + <security https="true" auth="false"/> + <event type="java" path="org.ofbiz.common.CommonEvents" invoke="getJSONuiLabel"/> + <response name="success" type="none" /> + <response name="error" type="none" /> + </request-map> + <!-- Check if an UomConversion exists --> <request-map uri="checkUomConversion"> <security https="true" auth="false"/> Modified: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Fri Jan 7 20:40:31 2011 @@ -81,7 +81,7 @@ under the License. var geocoder = new GClientGeocoder(); var map = new GMap2(document.getElementById("<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>")); geocoder.getLatLng("${pointAddress}", function(point) { - if (!point) { alert("Address not found");} + if (!point) { showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonAddressNotFound}");} map.setUIToDefault(); map.setCenter(point, 13); map.addOverlay(new GMarker(point)); Modified: ofbiz/trunk/framework/example/config/ExampleUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/config/ExampleUiLabels.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/example/config/ExampleUiLabels.xml (original) +++ ofbiz/trunk/framework/example/config/ExampleUiLabels.xml Fri Jan 7 20:40:31 2011 @@ -749,4 +749,8 @@ <value xml:lang="th">à¸à¸¹à¸¥à¸±à¸à¸©à¸à¸°à¸à¸±à¸§à¸à¸¢à¹à¸²à¸</value> <value xml:lang="zh">æ¥æ¾æ ·ä¾ç¹å¾</value> </property> + <property key="YouChangedTheSelectBoxValue"> + <value xml:lang="de">Sie haben den Wert in der Select Box geändert.</value> + <value xml:lang="en">You have changed the value in the select box</value> + </property> </resource> Modified: ofbiz/trunk/framework/example/widget/example/FormWidgetExampleForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/FormWidgetExampleForms.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/FormWidgetExampleForms.xml (original) +++ ofbiz/trunk/framework/example/widget/example/FormWidgetExampleForms.xml Fri Jan 7 20:40:31 2011 @@ -161,7 +161,7 @@ under the License. <field name="field8" title="${uiLabelMap.ExampleDropDownField8Title}" event="onchange" - action="return alert('You have changed the value in the select box');" + action="return showErrorAlert('${uiLabelMap.CommonErrorMessage2}','${uiLabelMap.YouChangedTheSelectBoxValue}');" tooltip="${uiLabelMap.ExampleDropDownField8Tooltip}"> <drop-down> <option key="Y" description="${uiLabelMap.CommonY}"/> Modified: ofbiz/trunk/framework/images/webapp/images/fieldlookup.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/fieldlookup.js?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/trunk/framework/images/webapp/images/fieldlookup.js Fri Jan 7 20:40:31 2011 @@ -125,18 +125,19 @@ function lookup_popup2(view_name) { } } } - + var obj_lookupwindow = window.open(getViewNameWithSeparator(view_name) + 'presentation=' + this.presentation + '&id=' + this.id + argString, '_blank', 'width=700,height=550,scrollbars=yes,status=no,resizable=yes,top=' + my + ',left=' + mx + ',dependent=yes,alwaysRaised=yes'); obj_lookupwindow.opener = window; obj_lookupwindow.focus(); } function lookup_error(str_message) { - alert(str_message); + var CommonErrorMessage2 = getJSONuiLabel("CommonUiLabels", "CommonErrorMessage2"); + showErrorAlert(CommonErrorMessage2, str_message); return null; } function getViewNameWithSeparator(view_name) { - var sep = "?"; + var sep = "?"; if (view_name.indexOf("?") >= 0) { sep = "&"; } Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original) +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Jan 7 20:40:31 2011 @@ -768,3 +768,141 @@ function waitSpinnerShow() { function waitSpinnerHide() { jQuery("#wait-spinner").hide() } + +/** + * Reads the requiered uiLabels from the uiLabelXml Files + * @param requiredLabels JSON Object {resource : [label1, label2 ...], resource2 : [label1, label2, ...]} + * @return JSON Object + */ +function getJSONuiLabels(requiredLabels) { + var returnVal = {}; + var requiredLabelsStr = JSON.stringify(requiredLabels) + + if (requiredLabels != null && requiredLabels != "") { + jQuery.ajax({ + url: "getJSONuiLabelArray", + type: "POST", + data: {"requiredLabels" : requiredLabelsStr}, + async: false, + success: function(data) { + returnVal = data; + } + }); + } + + return returnVal; +} + +/** + * Read the requiered uiLabel from the uiLabelXml Resource + * @param uiResource String + * @param errUiLabel String + * @returns String with Label + */ +function getJSONuiLabel(uiResource, errUiLabel) { + requiredLabel = {}; + requiredLabel[uiResource] = errUiLabel; + + var returnVal = ""; + var requiredLabelStr = JSON.stringify(requiredLabel) + + if (requiredLabel != null && requiredLabel != "") { + jQuery.ajax({ + url: "getJSONuiLabel", + type: "POST", + data: {"requiredLabel" : requiredLabelStr}, + async: false, + success: function(data) { + returnVal = data[0]; + } + }); + } + return returnVal; +} + +/** + * Opens an alert alert box with an i18n error message + * @param errBoxTitleResource String - Can be empty + * @param errBoxTitleLabel String - Can be empty + * @param uiResource String - Required + * @param errUiLabel String - Required + */ +function showErrorAlertLoadUiLabel(errBoxTitleResource, errBoxTitleLabel, uiResource, errUiLabel) { + if (uiResource == null || uiResource == "" || uiResource == undefined || errUiLabel == null || errUiLabel == "" || errUiLabel == undefined) { + // No Label Information are set, Error Msg Box can't be created + return; + } + + var labels = {}; + var useTitle = false; + // title can only be set when the resource and the label are set + if (errBoxTitleResource != null && errBoxTitleResource != "" && errBoxTitleLabel != null && errBoxTitleLabel != "") { + // create the JSON Object + if (errBoxTitleResource == uiResource) { + labels[errBoxTitleResource] = [errBoxTitleLabel, errUiLabel]; + } else { + labels[errBoxTitleResource] = [errBoxTitleLabel]; + labels[uiResource] = [errUiLabel]; + } + useTitle = true; + } else { + labels[uiResource] = [errUiLabel]; + } + // request the labels + labels = getJSONuiLabels(labels); + + var errMsgBox = jQuery("#contentarea").after(jQuery("<div id='errorAlertBox'></div>")); + + if (errMsgBox.length) { + errMsgBox.dialog({ + modal: true, + title: function() { + if (useTitle) { + return labels[errBoxTitleResource][0] + } else { + return "" + } + }, + open : function() { + var positionInArray = 0; + if (errBoxTitleResource == uiResource) { + positionInArray = 1; + } + errMsgBox.html(labels[uiResource][positionInArray]); + }, + buttons: { + Ok: function() { + errMsgBox.remove(); + jQuery( this ).dialog( "close" ); + } + } + }); + } +} + +/** + * Opens an alert alert box. This function is for a direct call from the ftl files where you can direcetly resolve youre labels + * @param errBoxTitle String - Can be empty + * @param errMessage String - Required - i18n Error Message + */ +function showErrorAlert(errBoxTitle, errMessage) { + if (errMessage == null || errMessage == "" || errMessage == undefined ) { + // No Error Message Information is set, Error Msg Box can't be created + return; + } + + var errMsgBox = jQuery("#contentarea").after(jQuery("<div id='errorAlertBox'>" + errMessage + "</div>")); + + if (errMsgBox.length) { + errMsgBox.dialog({ + modal: true, + title: errBoxTitle, + buttons: { + Ok: function() { + errMsgBox.remove(); + jQuery( this ).dialog( "close" ); + } + } + }); + } +} \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/config/EcommerceUiLabels.xml Fri Jan 7 20:40:31 2011 @@ -3886,6 +3886,10 @@ <value xml:lang="zh">ä½ å å¼ç礼å塿</value> <value xml:lang="zh_TW">ä½ éæ°è¼å ¥ç¦®å塿</value> </property> + <property key="EcommerceYourOrderIsBeingProcessed"> + <value xml:lang="de">Ihre Bestellung wird verarbeitet, dies kann einige Minuten dauern...</value> + <value xml:lang="en">Your order is being processed, this may take a moment...</value> + </property> <property key="EcommerceYourPinNumber"> <value xml:lang="da">Deres PIN kode</value> <value xml:lang="de">Ihre Pin-Nummer</value> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl Fri Jan 7 20:40:31 2011 @@ -85,7 +85,7 @@ function gwAll(e) { } } if (cartSize > passed && selectedValue != "NO^") { - alert("${uiLabelMap.EcommerceSelectedGiftWrap}"); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.EcommerceSelectedGiftWrap}"); } cform.submit(); } Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/configproductdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/configproductdetail.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/configproductdetail.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/configproductdetail.ftl Fri Jan 7 20:40:31 2011 @@ -69,7 +69,7 @@ ${virtualJavaScript?if_exists} if (detailImageUrl == "_NONE_") { hack = document.createElement('span'); hack.innerHTML="${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"; - alert(hack.innerHTML); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"); return; } detailImageUrl = detailImageUrl.replace(/\&\#47;/g, "/"); @@ -468,7 +468,7 @@ function getConfigDetails(event) { <div>${question.description?if_exists}</div> <#assign instructions = question.content.get("INSTRUCTIONS")?if_exists> <#if instructions?has_content> - <a href="javascript:alert('${instructions}');" class="buttontext">Instructions</a> + <a href="javascript:showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${instructions}");" class="buttontext">Instructions</a> </#if> <#assign image = question.content.get("IMAGE_URL")?if_exists> <#if image?string?has_content> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl Fri Jan 7 20:40:31 2011 @@ -83,7 +83,7 @@ ${virtualVariantJavaScript?if_exists} } function addItem() { if (document.addform.add_product_id.value == 'NULL') { - alert("Please select all of the required options."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonPleaseSelectAllRequiredOptions}"); return; } else { if (isVirtual(document.addform.add_product_id.value)) { @@ -113,7 +113,7 @@ ${virtualVariantJavaScript?if_exists} if (detailImageUrl == "_NONE_") { hack = document.createElement('span'); hack.innerHTML="${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"; - alert(hack.innerHTML); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonNoDetailImageAvailableToDisplay}"); return; } detailImageUrl = detailImageUrl.replace(/\&\#47;/g, "/"); @@ -196,23 +196,27 @@ ${virtualVariantJavaScript?if_exists} msg[0]="Please use correct date format [yyyy-mm-dd]"; var y=x.split("-"); - if(y.length!=3){ alert(msg[0]);return false; } - if((y[2].length>2)||(parseInt(y[2])>31)) { alert(msg[0]); return false; } + if(y.length!=3){ showAlert(msg[0]);return false; } + if((y[2].length>2)||(parseInt(y[2])>31)) { showAlert(msg[0]); return false; } if(y[2].length==1){ y[2]="0"+y[2]; } - if((y[1].length>2)||(parseInt(y[1])>12)){ alert(msg[0]); return false; } + if((y[1].length>2)||(parseInt(y[1])>12)){ showAlert(msg[0]); return false; } if(y[1].length==1){ y[1]="0"+y[1]; } - if(y[0].length>4){ alert(msg[0]); return false; } + if(y[0].length>4){ showAlert(msg[0]); return false; } if(y[0].length<4) { if(y[0].length==2) { y[0]="20"+y[0]; } else { - alert(msg[0]); + showAlert(msg[0]); return false; } } return (y[0]+"-"+y[1]+"-"+y[2]); } + function showAlert(msg){ + showErrorAlert("${uiLabelMap.CommonErrorMessage2}", msg); + } + function additemSubmit(){ <#if product.productTypeId?if_exists == "ASSET_USAGE"> newdatevalue = validate(document.addform.reservStart.value); @@ -577,7 +581,7 @@ ${virtualVariantJavaScript?if_exists} <div id="addCart2" style="display:block;"> <span style="white-space: nowrap;"><strong>${uiLabelMap.CommonQuantity}:</strong></span> <input type="text" size="5" value="1" disabled="disabled" /> - <a href="javascript:alert('Please select all features first');" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a> + <a href="javascript:showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonPleaseSelectAllFeaturesFirst}");" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddToCart}</span></a> </div> </#if> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js Fri Jan 7 20:40:31 2011 @@ -185,13 +185,14 @@ function getServerError(data) { if (data._ERROR_MESSAGE_LIST_ != undefined) { serverErrorHash = data._ERROR_MESSAGE_LIST_; - alert(serverErrorHash); + var CommonErrorMessage2 = getJSONuiLabel("CommonUiLabels", "CommonErrorMessage2"); + showErrorAlert(CommonErrorMessage2, serverErrorHash); jQuery.each(serverErrorHash, function(error, message){ if (error != undefined) { serverError += message; } }); - + if (serverError == "") { serverError = serverErrorHash; } Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutreview.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutreview.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutreview.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutreview.ftl Fri Jan 7 20:40:31 2011 @@ -28,7 +28,7 @@ under the License. document.${parameters.formNameValue}.processButton.disabled=true; document.${parameters.formNameValue}.submit(); } else { - alert("You order is being processed, this may take a moment."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.YoureOrderIsBeingProcessed}"); } } // --> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/quickAnonCheckoutReview.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/quickAnonCheckoutReview.ftl?rev=1056497&r1=1056496&r2=1056497&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/quickAnonCheckoutReview.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/quickAnonCheckoutReview.ftl Fri Jan 7 20:40:31 2011 @@ -28,7 +28,7 @@ under the License. document.${parameters.formNameValue}.processButton.disabled=true; document.${parameters.formNameValue}.submit(); } else { - alert("You order is being processed, this may take a moment."); + showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.YoureOrderIsBeingProcessed}"); } }