svn commit: r1535984 - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ applications/order/webapp/ordermgr/entry/catalog/ applications/product/src/org/ofbiz/product/price...

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

svn commit: r1535984 - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ applications/order/webapp/ordermgr/entry/catalog/ applications/product/src/org/ofbiz/product/price...

jleroux@apache.org
Author: jleroux
Date: Sat Oct 26 12:47:04 2013
New Revision: 1535984

URL: http://svn.apache.org/r1535984
Log:
Merges trunk HEAD

Modified:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/   (props changed)
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/price/PriceServices.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/servicedef/services_email.xml
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/NotificationServices.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/dtd/site-conf.xsd
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/cart/microcart.ftl
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl

Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1535431-1535982

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Sat Oct 26 12:47:04 2013
@@ -39,7 +39,7 @@ viewIndex = parameters.VIEW_INDEX;
 currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
 
 // set the default view size
-defaultViewSize = request.getAttribute("defaultViewSize") ?: 20;
+defaultViewSize = request.getAttribute("defaultViewSize") ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20");
 context.defaultViewSize = defaultViewSize;
 
 // set the limit view

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy Sat Oct 26 12:47:04 2013
@@ -539,10 +539,10 @@ if (product) {
                         BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price");
                         // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants.
                         virtualVariantPriceList.add(virtualPriceMap);
-                        variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ");
+                        variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ");
                     } else {
                         virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
-                        variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ");
+                        variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; ");
                     }
                 }
                 variantPriceJS.append(" } ");

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl Sat Oct 26 12:47:04 2013
@@ -44,29 +44,22 @@ under the License.
     <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize - 1)?double / viewSize?double)>
       <#if (viewIndexMax?int > 0)>
         <div class="product-prevnext">
-            <#-- Start Page Select Drop-Down -->
-            <#-- select name="pageSelect" onchange="window.location=this[this.selectedIndex].value;">
-                <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-                <#list 0..viewIndexMax as curViewNum>
-                     <option value="<@ofbizCatalogAltUrl productCategoryId=productCategoryId viewSize=viewSize viewIndex=(curViewNum?int + 1)/>">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-                </#list>
-            </select -->
             <select name="pageSelect" onchange="callDocumentByPaginate(this[this.selectedIndex].value);">
-                <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax + 1}</option>
-                <#list 0..viewIndexMax as curViewNum>
-                     <option value="${productCategoryId}~${viewSize}~${curViewNum?int}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-                </#list>
+                <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int + 1} ${uiLabelMap.CommonOf} ${viewIndexMax}</option>
+                <#if (viewIndex?int > 1)>
+                    <#list 0..viewIndexMax as curViewNum>
+                         <option value="${productCategoryId}~${viewSize}~${curViewNum?int}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
+                    </#list>
+                </#if>
             </select>
             <#-- End Page Select Drop-Down -->
             <#if (viewIndex?int > 0)>
-                <#-- a href="<@ofbizUrl>category/~category_id=${productCategoryId}/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int - 1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a --> |
                 <a href="javascript: void(0);" onclick="callDocumentByPaginate('${productCategoryId}~${viewSize}~${viewIndex?int - 1}');" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
             </#if>
             <#if ((listSize?int - viewSize?int) > 0)>
                 <span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
             </#if>
             <#if highIndex?int < listSize?int>
-             <#-- | <a href="<@ofbizUrl>category/~category_id=${productCategoryId}/~VIEW_SIZE=${viewSize}/~VIEW_INDEX=${viewIndex?int + 1}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a -->
              | <a href="javascript: void(0);" onclick="callDocumentByPaginate('${productCategoryId}~${viewSize}~${viewIndex?int + 1}');" class="buttontext">${uiLabelMap.CommonNext}</a>
             </#if>
         </div>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/price/PriceServices.java Sat Oct 26 12:47:04 2013
@@ -268,7 +268,6 @@ public class PriceServices {
                     List<GenericValue> variantAssocList = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", product.get("productId"), "productAssocTypeId", "PRODUCT_VARIANT"), UtilMisc.toList("-fromDate"), true));
                     BigDecimal minDefaultPrice = null;
                     List<GenericValue> variantProductPrices = null;
-                    String variantProductId = null;
                     for (GenericValue variantAssoc: variantAssocList) {
                         String curVariantProductId = variantAssoc.getString("productIdTo");
                         List<GenericValue> curVariantPriceList = EntityUtil.filterByDate(delegator.findByAnd("ProductPrice", UtilMisc.toMap("productId", curVariantProductId), UtilMisc.toList("-fromDate"), true), nowTimestamp);
@@ -284,7 +283,6 @@ public class PriceServices {
                                     if (salesDiscontinuationDate == null || salesDiscontinuationDate.after(nowTimestamp)) {
                                         minDefaultPrice = curDefaultPrice;
                                         variantProductPrices = curVariantPriceList;
-                                        variantProductId = curVariantProductId;
                                         // Debug.logInfo("Found new lowest price " + minDefaultPrice + " for variant with ID " + variantProductId, module);
                                     }
                                 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/servicedef/services_email.xml?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/servicedef/services_email.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/servicedef/services_email.xml Sat Oct 26 12:47:04 2013
@@ -110,6 +110,7 @@ under the License.
         <attribute name="xslfoAttachScreenLocationList" type="List" mode="IN" optional="true"/>
         <attribute name="attachmentNameList" type="List" mode="IN" optional="true"/>
         <attribute name="bodyParameters" type="Map" mode="IN" optional="true"/>
+        <!-- FIXME: webSiteId should not be optional, async service can't construct valid URLs without it -->
         <attribute name="webSiteId" type="String" mode="IN" optional="true"/>
         <attribute name="subject" type="String" mode="OUT" optional="true"/>
         <attribute name="body" type="String" mode="OUT" optional="false"/>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/NotificationServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/NotificationServices.java?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/NotificationServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/NotificationServices.java Sat Oct 26 12:47:04 2013
@@ -253,7 +253,10 @@ public class NotificationServices {
         // If the baseUrl was not specified we can do a best effort instead
         if (!context.containsKey("baseUrl")) {
             try {
-                WebappInfo webAppInfo = WebAppUtil.getWebappInfoFromWebsiteId(webSiteId);
+                WebappInfo webAppInfo = null;
+                if (webSiteId != null) {
+                    webAppInfo = WebAppUtil.getWebappInfoFromWebsiteId(webSiteId);
+                }
                 OfbizUrlBuilder builder = OfbizUrlBuilder.from(webAppInfo, delegator);
                 StringBuilder newURL = new StringBuilder();
                 builder.buildHostPart(newURL, "", false);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy Sat Oct 26 12:47:04 2013
@@ -76,7 +76,7 @@ if (searchFields && fieldValue) {
 }
 
 /* the following is part of an attempt to handle additional parameters that are passed in from other form fields at run-time,
- * but that is not supported by the scrip.aculo.us Ajax.Autocompleter, but this is still useful to pass parameters from the
+ * but that is not supported by the Jquery Autocompleter, but this is still useful to pass parameters from the
  * lookup screen definition:
  */
 def conditionFields = context.conditionFields;
@@ -102,9 +102,9 @@ if (orExprs && entityName && displayFiel
     if (context.andCondition && context.andCondition instanceof EntityCondition) {
         mainAndConds.add(context.andCondition);
     }
-    
-    def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND);    
-    
+
+    def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND);
+
     String viewSizeStr = context.autocompleterViewSize;
     if (viewSizeStr == null) {
         viewSizeStr = UtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize");
@@ -113,7 +113,7 @@ if (orExprs && entityName && displayFiel
     EntityFindOptions findOptions = new EntityFindOptions();
     findOptions.setMaxRows(autocompleterViewSize);
     findOptions.setDistinct(searchDistinct);
-    
+
     autocompleteOptions = delegator.findList(entityName, entityConditionList, displayFieldsSet, StringUtil.toList(displayFields), findOptions, false);
     if (autocompleteOptions) {
         context.autocompleteOptions = autocompleteOptions;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/dtd/site-conf.xsd
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/dtd/site-conf.xsd?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/dtd/site-conf.xsd (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/dtd/site-conf.xsd Sat Oct 26 12:47:04 2013
@@ -59,7 +59,17 @@ under the License.
     <xs:element name="description" type="xs:string"/>
     <xs:element name="owner" type="xs:string"/>
     <xs:element name="errorpage" type="xs:string"/>
-    <xs:element name="status-code" type="xs:string"/>
+    <xs:element name="status-code" type="xs:string">
+        <xs:annotation>
+            <xs:documentation>
+                A redirection HTTP status-code
+                If set it will override, for this whole controller, the default status-code sets in requestHandler.properties
+                
+                Most possible redirection status-codes are 301, 303 and 307.
+                302 (the Java default) is not recommended for SEO reasons, 301 is preferred.
+            </xs:documentation>
+        </xs:annotation>
+    </xs:element>
     <xs:element name="handler">
         <xs:annotation>
             <xs:documentation>
@@ -648,11 +658,11 @@ under the License.
             <xs:annotation>
                 <xs:documentation>
                     A redirection HTTP status-code
-                    If set it will override (cascading) the default status-code sets in requestHandler.properties
-                    and the possible status-code sets at the controller level (inclusive included controllers)
+                    If set it will override, for this request, the default status-code sets in requestHandler.properties
+                    and the possible status-code sets at the controller level (included controllers inclusive)
                     
                     Most possible redirection status-codes are 301, 303 and 307.
-                    302 (the Java default) is not recommended for SEO reasons.
+                    302 (the Java default) is not recommended for SEO reasons, 301 is preferred.
                 </xs:documentation>
             </xs:annotation>
         </xs:attribute>        

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java Sat Oct 26 12:47:04 2013
@@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletReq
 
 import org.ofbiz.base.component.ComponentConfig.WebappInfo;
 import org.ofbiz.base.util.Assert;
-import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
@@ -45,8 +44,7 @@ public final class OfbizUrlBuilder {
     public static final String module = OfbizUrlBuilder.class.getName();
 
     /**
-     * Returns an <code>OfbizUrlBuilder</code> instance. The instance can be reused in
-     * the supplied request.
+     * Returns an <code>OfbizUrlBuilder</code> instance.
      *
      * @param request
      * @throws GenericEntityException
@@ -54,22 +52,25 @@ public final class OfbizUrlBuilder {
      */
     public static OfbizUrlBuilder from(HttpServletRequest request) throws GenericEntityException, WebAppConfigurationException {
         Assert.notNull("request", request);
-        WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_");
-        if (webSiteProps == null) {
-            webSiteProps = WebSiteProperties.from(request);
-            request.setAttribute("_WEBSITE_PROPS_", webSiteProps);
+        OfbizUrlBuilder builder = (OfbizUrlBuilder) request.getAttribute("_OFBIZ_URL_BUILDER_");
+        if (builder == null) {
+            WebSiteProperties webSiteProps = WebSiteProperties.from(request);
+            URL url = ConfigXMLReader.getControllerConfigURL(request.getServletContext());
+            ControllerConfig config = ConfigXMLReader.getControllerConfig(url);
+            String servletPath = (String) request.getAttribute("_CONTROL_PATH_");
+            builder = new OfbizUrlBuilder(config, webSiteProps, servletPath);
+            request.setAttribute("_OFBIZ_URL_BUILDER_", builder);
         }
-        URL url = ConfigXMLReader.getControllerConfigURL(request.getServletContext());
-        ControllerConfig config = ConfigXMLReader.getControllerConfig(url);
-        String servletPath = (String) request.getAttribute("_CONTROL_PATH_");
-        return new OfbizUrlBuilder(config, webSiteProps, servletPath);
+        return builder;
     }
 
     /**
      * Returns an <code>OfbizUrlBuilder</code> instance. Use this method when you
      * don't have a <code>HttpServletRequest</code> object - like in scheduled jobs.
      *
-     * @param webAppInfo
+     * @param webAppInfo Optional - if <code>null</code>, the builder can only build the host part,
+     * and that will be based only on the settings in <code>url.properties</code> (the WebSite
+     * entity will be ignored).
      * @param delegator
      * @throws WebAppConfigurationException
      * @throws IOException
@@ -77,20 +78,24 @@ public final class OfbizUrlBuilder {
      * @throws GenericEntityException
      */
     public static OfbizUrlBuilder from(WebappInfo webAppInfo, Delegator delegator) throws WebAppConfigurationException, IOException, SAXException, GenericEntityException {
-        Assert.notNull("webAppInfo", webAppInfo, "delegator", delegator);
         WebSiteProperties webSiteProps = null;
-        String webSiteId = WebAppUtil.getWebSiteId(webAppInfo);
-        if (webSiteId != null) {
-            GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
-            if (webSiteValue != null) {
-                webSiteProps = WebSiteProperties.from(webSiteValue);
+        ControllerConfig config = null;
+        String servletPath = null;
+        if (webAppInfo != null) {
+            Assert.notNull("delegator", delegator);
+            String webSiteId = WebAppUtil.getWebSiteId(webAppInfo);
+            if (webSiteId != null) {
+                GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
+                if (webSiteValue != null) {
+                    webSiteProps = WebSiteProperties.from(webSiteValue);
+                }
             }
+            config = ConfigXMLReader.getControllerConfig(webAppInfo);
+            servletPath = WebAppUtil.getControlServletPath(webAppInfo);
         }
         if (webSiteProps == null) {
             webSiteProps = WebSiteProperties.defaults();
         }
-        ControllerConfig config = ConfigXMLReader.getControllerConfig(webAppInfo);
-        String servletPath = WebAppUtil.getControlServletPath(webAppInfo);
         return new OfbizUrlBuilder(config, webSiteProps, servletPath);
     }
 
@@ -140,7 +145,10 @@ public final class OfbizUrlBuilder {
         if (queryIndex != -1) {
             requestMapUri = requestMapUri.substring(0, queryIndex);
         }
-        RequestMap requestMap = config.getRequestMapMap().get(requestMapUri);
+        RequestMap requestMap = null;
+        if (config != null) {
+            requestMap = config.getRequestMapMap().get(requestMapUri);
+        }
         if (requestMap != null) {
             makeSecure = requestMap.securityHttps;
         }
@@ -178,6 +186,9 @@ public final class OfbizUrlBuilder {
      * @throws IOException
      */
     public void buildPathPart(Appendable buffer, String url) throws WebAppConfigurationException, IOException {
+        if (servletPath == null) {
+            throw new IllegalStateException("Servlet path is unknown");
+        }
         buffer.append(servletPath);
         if (!url.startsWith("/")) {
             buffer.append("/");

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Sat Oct 26 12:47:04 2013
@@ -20,6 +20,7 @@ package org.ofbiz.webapp.control;
 
 import static org.ofbiz.base.util.UtilGenerics.checkMap;
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
@@ -49,6 +50,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.webapp.OfbizUrlBuilder;
 import org.ofbiz.webapp.event.EventFactory;
 import org.ofbiz.webapp.event.EventHandler;
 import org.ofbiz.webapp.event.EventHandlerException;
@@ -1125,16 +1127,13 @@ public class RequestHandler {
     }
 
     public String makeLink(HttpServletRequest request, HttpServletResponse response, String url, boolean fullPath, boolean secure, boolean encode) {
-        WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_");
-        if (webSiteProps == null) {
-            try {
-                webSiteProps = WebSiteProperties.from(request);
-                request.setAttribute("_WEBSITE_PROPS_", webSiteProps);
-            } catch (GenericEntityException e) {
-                // If the entity engine is throwing exceptions, then there is no point in continuing.
-                Debug.logError(e, "Exception thrown while getting web site properties: ", module);
-                return null;
-            }
+        WebSiteProperties webSiteProps = null;
+        try {
+            webSiteProps = WebSiteProperties.from(request);
+        } catch (GenericEntityException e) {
+            // If the entity engine is throwing exceptions, then there is no point in continuing.
+            Debug.logError(e, "Exception thrown while getting web site properties: ", module);
+            return null;
         }
         String requestUri = RequestHandler.getRequestUri(url);
         ConfigXMLReader.RequestMap requestMap = null;
@@ -1147,35 +1146,36 @@ public class RequestHandler {
                 return null;
             }
         }
-        StringBuilder newURL = new StringBuilder();
         boolean didFullSecure = false;
         boolean didFullStandard = false;
         if (requestMap != null && (webSiteProps.getEnableHttps() || fullPath || secure)) {
             if (Debug.verboseOn()) Debug.logVerbose("In makeLink requestUri=" + requestUri, module);
             if (secure || (webSiteProps.getEnableHttps() && requestMap.securityHttps && !request.isSecure())) {
-                String server = webSiteProps.getHttpsHost();
-                if (server.isEmpty()) {
-                    server = request.getServerName();
-                }
-                newURL.append("https://");
-                newURL.append(server);
-                if (!webSiteProps.getHttpsPort().isEmpty()) {
-                    newURL.append(":").append(webSiteProps.getHttpsPort());
-                }
                 didFullSecure = true;
             } else if (fullPath || (webSiteProps.getEnableHttps() && !requestMap.securityHttps && request.isSecure())) {
-                String server = webSiteProps.getHttpHost();
-                if (server.isEmpty()) {
-                    server = request.getServerName();
-                }
-                newURL.append("http://");
-                newURL.append(server);
-                if (!webSiteProps.getHttpPort().isEmpty()) {
-                    newURL.append(":").append(webSiteProps.getHttpPort());
-                }
                 didFullStandard = true;
             }
         }
+        StringBuilder newURL = new StringBuilder(250);
+        if (didFullSecure || didFullStandard) {
+            // Build the scheme and host part
+            try {
+                OfbizUrlBuilder builder = OfbizUrlBuilder.from(request);
+                builder.buildHostPart(newURL, url, didFullSecure);
+            } catch (GenericEntityException e) {
+                // If the entity engine is throwing exceptions, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while getting web site properties: ", module);
+                return null;
+            } catch (WebAppConfigurationException e) {
+                // If we can't read the controller.xml file, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while parsing controller.xml file: ", module);
+                return null;
+            } catch (IOException e) {
+                // If we can't write to StringBuilder, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while writing to StringBuilder: ", module);
+                return null;
+            }
+        }
         // create the path to the control servlet
         String controlPath = (String) request.getAttribute("_CONTROL_PATH_");
         newURL.append(controlPath);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Sat Oct 26 12:47:04 2013
@@ -53,17 +53,24 @@ public final class WebSiteProperties {
      */
     public static WebSiteProperties from(HttpServletRequest request) throws GenericEntityException {
         Assert.notNull("request", request);
-        Delegator delegator = (Delegator) request.getAttribute("delegator");
-        if (delegator != null) {
-            String webSiteId = WebSiteWorker.getWebSiteId(request);
-            if (webSiteId != null) {
-                GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
-                if (webSiteValue != null) {
-                    return from(webSiteValue);
+        WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_");
+        if (webSiteProps == null) {
+            Delegator delegator = (Delegator) request.getAttribute("delegator");
+            if (delegator != null) {
+                String webSiteId = WebSiteWorker.getWebSiteId(request);
+                if (webSiteId != null) {
+                    GenericValue webSiteValue = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
+                    if (webSiteValue != null) {
+                        webSiteProps = from(webSiteValue);
+                    }
                 }
             }
-        }        
-        return new WebSiteProperties();
+            if (webSiteProps == null) {
+                webSiteProps = new WebSiteProperties();
+            }
+            request.setAttribute("_WEBSITE_PROPS_", webSiteProps);
+        }
+        return webSiteProps;
     }
 
     /**

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/cart/microcart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/cart/microcart.ftl?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/cart/microcart.ftl (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/cart/microcart.ftl Sat Oct 26 12:47:04 2013
@@ -37,7 +37,11 @@ under the License.
       <li><a href="<@ofbizUrl>view/showcart</@ofbizUrl>">[${uiLabelMap.OrderViewCart}]</a></li>
       <#if (shoppingCartSize > 0)>
             <#if !initialLocaleComplete?exists || initialLocaleComplete?length == 2 >
-                <#assign initialLocaleComplete = "en_US">
+                <#if initialLocaleComplete?exists && initialLocaleComplete?length == 2  && initialLocaleComplete == "fr">
+                    <#assign initialLocaleComplete = "fr_FR"><#-- same idea can be used with other default locale -->
+                <#else>
+                    <#assign initialLocaleComplete = "en_US">
+                </#if>                              
             </#if>          
           <li id="quickCheckoutEnabled"><a href="<@ofbizUrl>quickcheckout</@ofbizUrl>">[${uiLabelMap.OrderCheckoutQuick}]</a></li>
           <li id="quickCheckoutDisabled" style="display:none" class="disabled">[${uiLabelMap.OrderCheckoutQuick}]</li>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl?rev=1535984&r1=1535983&r2=1535984&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl Sat Oct 26 12:47:04 2013
@@ -54,31 +54,31 @@ under the License.
 </script>
 <br />
 <#macro paginationControls>
-    <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize)?double / viewSize?double)>
-      <#if (viewIndexMax?int >= 1)>
-        <div class="product-prevnext">
-            <#-- Start Page Select Drop-Down -->
-            <select name="pageSelect" onchange="callDocumentByPaginate(this[this.selectedIndex].value);">
-                <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax}</option>
-                <#if (viewIndex?int > 1)>
-                    <#list 0..viewIndexMax as curViewNum>
-                         <option value="${shoppingListId?if_exists}~${viewSize}~${curViewNum?int + 1}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
-                    </#list>
-                </#if>
-            </select>
-            <#-- End Page Select Drop-Down -->
-            
+  <#assign viewIndexMax = Static["java.lang.Math"].ceil((listSize)?double / viewSize?double)>
+  <#if (viewIndexMax?int > 0)>
+    <div class="product-prevnext">
+        <#-- Start Page Select Drop-Down -->
+        <select name="pageSelect" onchange="callDocumentByPaginate(this[this.selectedIndex].value);">
+            <option value="#">${uiLabelMap.CommonPage} ${viewIndex?int} ${uiLabelMap.CommonOf} ${viewIndexMax}</option>
             <#if (viewIndex?int > 1)>
-                <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int - 1}');" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
-            </#if>
-            <#if ((listSize?int - viewSize?int) > 0)>
-                <span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
+                <#list 0..viewIndexMax as curViewNum>
+                     <option value="${shoppingListId?if_exists}~${viewSize}~${curViewNum?int + 1}">${uiLabelMap.CommonGotoPage} ${curViewNum + 1}</option>
+                </#list>
             </#if>
-            <#if highIndex?int < listSize?int>
-             | <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int + 1}');" class="buttontext">${uiLabelMap.CommonNext}</a>
-            </#if>
-        </div>
-    </#if>
+        </select>
+        <#-- End Page Select Drop-Down -->
+        
+        <#if (viewIndex?int > 1)>
+            <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int - 1}');" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+        </#if>
+        <#if ((listSize?int - viewSize?int) > 0)>
+            <span>${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span>
+        </#if>
+        <#if highIndex?int < listSize?int>
+         | <a href="javascript: void(0);" onclick="callDocumentByPaginate('${shoppingListId?if_exists}~${viewSize}~${viewIndex?int + 1}');" class="buttontext">${uiLabelMap.CommonNext}</a>
+        </#if>
+    </div>
+</#if>
 </#macro>
 
 <div class="screenlet">