Author: jleroux
Date: Sat Sep 26 10:25:20 2015 New Revision: 1705406 URL: http://svn.apache.org/viewvc?rev=1705406&view=rev Log: "Applied fix from trunk for revision: 1705405" ------------------------------------------------------------------------ r1705405 | jleroux | 2015-09-26 12:24:02 +0200 (sam. 26 sept. 2015) | 1 ligne I missed some cases, if ever you spot some others or typos please let me know ------------------------------------------------------------------------ Modified: ofbiz/branches/release14.12/ (props changed) ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl ofbiz/branches/release14.12/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryServices.java ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java ofbiz/branches/release14.12/applications/product/webapp/catalog/category/EditCategoryRollup.ftl ofbiz/branches/release14.12/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredCategoryDetail.ftl ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredNavBar.ftl ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategoryLink.ftl Propchange: ofbiz/branches/release14.12/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Sep 26 10:25:20 2015 @@ -8,4 +8,4 @@ /ofbiz/branches/json-integration-refactoring:1634077-1635900 /ofbiz/branches/multitenant20100310:921280-927264 /ofbiz/branches/release13.07:1547657 -/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604,1664696,1665154,1665162,1665535,1666404,1666511,1666633,1666836,1666939,1666949,1666958,1667055,1667253,1667483,1667492,1667774,1668207, 1668214,1668236,1668246,1668258,1668263,1668265,1668270,1668277,1668314,1668657,1669317,1669588,1672427,1672430,1672846,1672853,1672856,1672862,1672873,1673764,1674447,1674464,1674491,1674496,1674908,1676674,1677123,1677597,1677769-1677770,1678294,1678882,1678911,1679689,1679697,1679709,1679720,1679728,1679732,1679957,1680155,1680288,1680304,1680671,1680675,1680733,1680840,1680881,1682272,1682295,1682415,1682633,1683998,1684094,1686360,1686536,1686545,1686566,1686569,1686574,1686583,1686635,1686651,1686970,1687427,1688772,1690086,1690581,1692357,1692458,1692600,1692604,1693393,1693579,1695017,1696234,1697590,1697647,1697993,1698259,1698261,1698263,1701164,1701441,1701819,1701825,1701936,1702002,1702548,1702704,1703121,1703586,1703945,1703954,1703965,1703971,1703976-1703977,1703981,1704000,1704014,1704018,1704036,1704043,1704052,1704082,1704140,1704230,1705004,1705329 +/ofbiz/trunk:1649072,1649083-1649084,1649086,1649090,1649096,1649230,1649238-1649239,1649248,1649272,1649275,1649280-1649281,1649283,1649285-1649286,1649291,1649329,1649331,1649384,1649393,1649666,1649742,1650240,1650348,1650357,1650583,1650642,1650678,1650821,1650882,1650887,1650938,1651593,1652312,1652361,1652638,1652641,1652672,1652688,1652706,1652725,1652731,1652739,1652852,1653248,1653296,1653456,1653597,1653614,1654175,1654273,1654509,1654670,1654672-1654673,1654683-1654684,1654824,1655046,1655668,1655979,1656014,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1659965,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661760,1661778,1661853,1661862,1661873,1661940,1661951,1661977,1662119-1662120,1662361,1662500,1662812,1662919,1663202,1663912,1663979,1664602,1664604,1664696,1665154,1665162,1665535,1666404,1666511,1666633,1666836,1666939,1666949,1666958,1667055,1667253,1667483,1667492,1667774,1668207, 1668214,1668236,1668246,1668258,1668263,1668265,1668270,1668277,1668314,1668657,1669317,1669588,1672427,1672430,1672846,1672853,1672856,1672862,1672873,1673764,1674447,1674464,1674491,1674496,1674908,1676674,1677123,1677597,1677769-1677770,1678294,1678882,1678911,1679689,1679697,1679709,1679720,1679728,1679732,1679957,1680155,1680288,1680304,1680671,1680675,1680733,1680840,1680881,1682272,1682295,1682415,1682633,1683998,1684094,1686360,1686536,1686545,1686566,1686569,1686574,1686583,1686635,1686651,1686970,1687427,1688772,1690086,1690581,1692357,1692458,1692600,1692604,1693393,1693579,1695017,1696234,1697590,1697647,1697993,1698259,1698261,1698263,1701164,1701441,1701819,1701825,1701936,1702002,1702548,1702704,1703121,1703586,1703945,1703954,1703965,1703971,1703976-1703977,1703981,1704000,1704014,1704018,1704036,1704043,1704052,1704082,1704140,1704230,1705004,1705329,1705405 Modified: ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl (original) +++ ofbiz/branches/release14.12/applications/order/webapp/ordermgr/entry/catalog/categorydetail.ftl Sat Sep 26 10:25:20 2015 @@ -68,8 +68,8 @@ under the License. <#if productCategory??> - <#assign categoryName = categoryContentWrapper.get("CATEGORY_NAME")!/> - <#assign categoryDescription = categoryContentWrapper.get("DESCRIPTION")!/> + <#assign categoryName = categoryContentWrapper.get("CATEGORY_NAME", "html")!/> + <#assign categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")!/> <#if categoryName?has_content> <h1>${categoryName}</h1> </#if> @@ -90,7 +90,7 @@ under the License. <#if searchInCategory?default("Y") == "Y"> <a href="<@ofbizUrl>advancedsearch?SEARCH_CATEGORY_ID=${productCategory.productCategoryId}</@ofbizUrl>" class="buttontext">${uiLabelMap.ProductSearchInCategory}</a> </#if> - <#assign longDescription = categoryContentWrapper.get("LONG_DESCRIPTION")!/> + <#assign longDescription = categoryContentWrapper.get("LONG_DESCRIPTION", "html")!/> <#assign categoryImageUrl = categoryContentWrapper.get("CATEGORY_IMAGE_URL", "url")!/> <#if categoryImageUrl?string?has_content || longDescription?has_content> <div> Modified: ofbiz/branches/release14.12/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original) +++ ofbiz/branches/release14.12/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Sat Sep 26 10:25:20 2015 @@ -19,24 +19,35 @@ package org.ofbiz.party.content; -import org.ofbiz.content.content.ContentWrapper; -import org.ofbiz.content.content.ContentWorker; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.GeneralRuntimeException; +import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.cache.UtilCache; -import org.ofbiz.base.util.*; -import org.ofbiz.entity.GenericValue; +import org.ofbiz.content.content.ContentWorker; +import org.ofbiz.content.content.ContentWrapper; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; -import org.ofbiz.entity.model.ModelUtil; -import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.service.LocalDispatcher; -import javax.servlet.http.HttpServletRequest; -import java.util.*; -import java.io.Writer; -import java.io.IOException; -import java.io.StringWriter; - import javolution.util.FastList; import javolution.util.FastMap; @@ -70,12 +81,12 @@ public class PartyContentWrapper impleme } // interface implementation - public String get(String contentTypeId, boolean useCache) { - return getPartyContentAsText(party, contentTypeId, locale, mimeTypeId, party.getDelegator(), dispatcher, useCache); + public String get(String contentTypeId, boolean useCache, String encoderType) { + return getPartyContentAsText(party, contentTypeId, locale, mimeTypeId, party.getDelegator(), dispatcher, useCache, encoderType); } - public StringUtil.StringWrapper get(String contentTypeId) { - return StringUtil.makeStringWrapper(get(contentTypeId, true)); + public StringUtil.StringWrapper get(String contentTypeId, String encoderType) { + return StringUtil.makeStringWrapper(get(contentTypeId, true, encoderType)); } public String getId(String contentTypeId) { @@ -96,35 +107,36 @@ public class PartyContentWrapper impleme } } - public String getContent(String contentId, boolean useCache) { - return getPartyContentAsText(party, contentId, null, locale, mimeTypeId, party.getDelegator(), dispatcher, useCache); + public String getContent(String contentId, boolean useCache, String encoderType) { + return getPartyContentAsText(party, contentId, null, locale, mimeTypeId, party.getDelegator(), dispatcher, useCache, encoderType); } - public String getContent(String contentId) { - return getContent(contentId, true); + public String getContent(String contentId, String encoderType) { + return getContent(contentId, true, encoderType); } // static methods - public static String getPartyContentAsText(GenericValue party, String partyContentId, HttpServletRequest request) { + public static String getPartyContentAsText(GenericValue party, String partyContentId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getPartyContentAsText(party, partyContentId, null, UtilHttp.getLocale(request), "text/html", party.getDelegator(), dispatcher, true); + return getPartyContentAsText(party, partyContentId, null, UtilHttp.getLocale(request), "text/html", party.getDelegator(), dispatcher, true,encoderType); } - public static String getPartyContentAsText(GenericValue party, String partyContentId, Locale locale, LocalDispatcher dispatcher) { - return getPartyContentAsText(party, partyContentId, null, locale, null, null, dispatcher, true); + public static String getPartyContentAsText(GenericValue party, String partyContentId, Locale locale, LocalDispatcher dispatcher, String encoderType) { + return getPartyContentAsText(party, partyContentId, null, locale, null, null, dispatcher, true, encoderType); } public static String getPartyContentAsText(GenericValue party, String partyContentTypeId, - Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache) { - return getPartyContentAsText(party, null, partyContentTypeId, locale, mimeTypeId, delegator, dispatcher, useCache); + Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache, String encoderType) { + return getPartyContentAsText(party, null, partyContentTypeId, locale, mimeTypeId, delegator, dispatcher, useCache, encoderType); } public static String getPartyContentAsText(GenericValue party, String contentId, String partyContentTypeId, - Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache) { + Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache, String encoderType) { if (party == null) { return null; } - + + UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder(encoderType); String candidateFieldName = ModelUtil.dbNameToVarName(partyContentTypeId); String cacheKey; if (contentId != null) { @@ -148,19 +160,19 @@ public class PartyContentWrapper impleme String outString = outWriter.toString(); if (outString.length() > 0) { - return partyContentCache.putIfAbsentAndGet(cacheKey, outString); + return partyContentCache.putIfAbsentAndGet(cacheKey, encoder.encode(outString)); } else { String candidateOut = party.getModelEntity().isField(candidateFieldName) ? party.getString(candidateFieldName): ""; - return candidateOut == null ? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } } catch (GeneralException e) { Debug.logError(e, "Error rendering PartyContent, inserting empty String", module); String candidateOut = party.getModelEntity().isField(candidateFieldName) ? party.getString(candidateFieldName): ""; - return candidateOut == null? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } catch (IOException e) { Debug.logError(e, "Error rendering PartyContent, inserting empty String", module); String candidateOut = party.getModelEntity().isField(candidateFieldName) ? party.getString(candidateFieldName): ""; - return candidateOut == null? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } } Modified: ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (original) +++ ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java Sat Sep 26 10:25:20 2015 @@ -31,12 +31,12 @@ import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.GeneralRuntimeException; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilHttp; -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.base.util.GeneralRuntimeException; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.content.content.ContentWorker; import org.ofbiz.content.content.ContentWrapper; import org.ofbiz.entity.Delegator; @@ -77,27 +77,28 @@ public class CategoryContentWrapper impl this.mimeTypeId = "text/html"; } - public StringUtil.StringWrapper get(String prodCatContentTypeId) { - return StringUtil.makeStringWrapper(getProductCategoryContentAsText(productCategory, prodCatContentTypeId, locale, mimeTypeId, productCategory.getDelegator(), dispatcher)); + public StringUtil.StringWrapper get(String prodCatContentTypeId, String encoderType) { + return StringUtil.makeStringWrapper(getProductCategoryContentAsText(productCategory, prodCatContentTypeId, locale, mimeTypeId, productCategory.getDelegator(), dispatcher, encoderType)); } - public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, HttpServletRequest request) { + public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html", productCategory.getDelegator(), dispatcher); + return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, UtilHttp.getLocale(request), "text/html", productCategory.getDelegator(), dispatcher, encoderType); } - public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, LocalDispatcher dispatcher) { - return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, locale, null, null, dispatcher); + public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { + return getProductCategoryContentAsText(productCategory, prodCatContentTypeId, locale, null, null, dispatcher, encoderType); } - public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher) { + public static String getProductCategoryContentAsText(GenericValue productCategory, String prodCatContentTypeId, Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, String encoderType) { String candidateFieldName = ModelUtil.dbNameToVarName(prodCatContentTypeId); + UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder(encoderType); try { Writer outWriter = new StringWriter(); getProductCategoryContentAsText(null, productCategory, prodCatContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { - return outString; + return encoder.encode(outString); } else { return null; } Modified: ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/category/CategoryServices.java Sat Sep 26 10:25:20 2015 @@ -492,8 +492,8 @@ public class CategoryServices { CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(cate, request); String title = null; - if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField))) { - title = categoryContentWrapper.get(catNameField)+" "+"["+catId+"]"; + if (UtilValidate.isNotEmpty(categoryContentWrapper.get(catNameField, "html"))) { + title = new StringBuffer(categoryContentWrapper.get(catNameField, "html").toString()).append(" [").append(catId).append("]").toString(); dataMap.put("title", title); } else { title = catId.toString(); Modified: ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/product/ProductEvents.java Sat Sep 26 10:25:20 2015 @@ -1097,7 +1097,7 @@ public class ProductEvents { compareList.add(product); } session.setAttribute("productCompareList", compareList); - String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request); + String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request, "html"); String eventMsg = UtilProperties.getMessage("ProductUiLabels", "ProductAddToCompareListSuccess", UtilMisc.toMap("name", productName), UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", eventMsg); return "success"; @@ -1134,7 +1134,7 @@ public class ProductEvents { } } session.setAttribute("productCompareList", compareList); - String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request); + String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request, "html"); String eventMsg = UtilProperties.getMessage("ProductUiLabels", "ProductRemoveFromCompareListSuccess", UtilMisc.toMap("name", productName), UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", eventMsg); return "success"; Modified: ofbiz/branches/release14.12/applications/product/webapp/catalog/category/EditCategoryRollup.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/webapp/catalog/category/EditCategoryRollup.ftl?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/product/webapp/catalog/category/EditCategoryRollup.ftl (original) +++ ofbiz/branches/release14.12/applications/product/webapp/catalog/category/EditCategoryRollup.ftl Sat Sep 26 10:25:20 2015 @@ -58,7 +58,7 @@ under the License. <a href="<@ofbizUrl>EditCategory?productCategoryId=${curCategory.productCategoryId}</@ofbizUrl>" > <#assign catContentWrapper = Static["org.ofbiz.product.category.CategoryContentWrapper"].makeCategoryContentWrapper(curCategory, request)!> <#if catContentWrapper?has_content> - ${catContentWrapper.get("CATEGORY_NAME")!catContentWrapper.get("DESCRIPTION")!curCategory.categoryName!curCategory.description!} + ${catContentWrapper.get("CATEGORY_NAME", "html")!catContentWrapper.get("DESCRIPTION", "html")!curCategory.categoryName!curCategory.description!} <#else> ${curCategory.categoryName!curCategory.description!} </#if> @@ -166,7 +166,7 @@ under the License. <a href="<@ofbizUrl>EditCategory?productCategoryId=${curCategory.productCategoryId}</@ofbizUrl>" > <#assign catContentWrapper = Static["org.ofbiz.product.category.CategoryContentWrapper"].makeCategoryContentWrapper(curCategory, request)!> <#if catContentWrapper?has_content> - ${catContentWrapper.get("CATEGORY_NAME")!catContentWrapper.get("DESCRIPTION")!curCategory.categoryName!curCategory.description!} + ${catContentWrapper.get("CATEGORY_NAME", "html")!catContentWrapper.get("DESCRIPTION", "html")!curCategory.categoryName!curCategory.description!} <#else> ${curCategory.categoryName!curCategory.description!} </#if> @@ -231,4 +231,4 @@ under the License. </table> </div> </div> -</#if> \ No newline at end of file +</#if> Modified: ofbiz/branches/release14.12/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/branches/release14.12/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Sat Sep 26 10:25:20 2015 @@ -18,27 +18,33 @@ *******************************************************************************/ package org.ofbiz.workeffort.content; -import java.util.*; -import java.io.Writer; import java.io.IOException; import java.io.StringWriter; +import java.io.Writer; import java.sql.Timestamp; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; + import javax.servlet.http.HttpServletRequest; -import org.ofbiz.content.content.ContentWrapper; -import org.ofbiz.content.content.ContentWorker; -import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.Delegator; -import org.ofbiz.entity.util.EntityQuery; -import org.ofbiz.entity.model.ModelUtil; -import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.GeneralRuntimeException; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilHttp; -import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.GeneralRuntimeException; -import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.cache.UtilCache; +import org.ofbiz.content.content.ContentWorker; +import org.ofbiz.content.content.ContentWrapper; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.model.ModelUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.LocalDispatcher; import javolution.util.FastMap; import javolution.util.FastList; @@ -72,8 +78,8 @@ public class WorkEffortContentWrapper im } // interface implementation(s) - public String get(String workEffortContentId, boolean useCache) { - return getWorkEffortContentAsText(workEffort, workEffortContentId, locale, mimeTypeId, workEffort.getDelegator(), dispatcher, useCache); + public String get(String workEffortContentId, boolean useCache, String encoderType) { + return getWorkEffortContentAsText(workEffort, workEffortContentId, locale, mimeTypeId, workEffort.getDelegator(), dispatcher, useCache, encoderType); } /** @@ -81,8 +87,8 @@ public class WorkEffortContentWrapper im * @param contentTypeId Type of content to return * @return String containing the content data */ - public StringUtil.StringWrapper get(String contentTypeId) { - return StringUtil.makeStringWrapper(get(contentTypeId, true)); + public StringUtil.StringWrapper get(String contentTypeId, String encoderType) { + return StringUtil.makeStringWrapper(get(contentTypeId, true, encoderType)); } /** @@ -195,35 +201,36 @@ public class WorkEffortContentWrapper im return null; } - public String getContent(String contentId, boolean useCache) { - return getWorkEffortContentAsText(workEffort, contentId, null, locale, mimeTypeId, workEffort.getDelegator(), dispatcher, useCache); + public String getContent(String contentId, boolean useCache, String encoderType) { + return getWorkEffortContentAsText(workEffort, contentId, null, locale, mimeTypeId, workEffort.getDelegator(), dispatcher, useCache, encoderType); } - public String getContent(String contentId) { - return getContent(contentId, true); + public String getContent(String contentId, String encoderType) { + return getContent(contentId, true, encoderType); } // static method helpers - public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, HttpServletRequest request) { + public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, HttpServletRequest request, String encoderType) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, UtilHttp.getLocale(request), "text/html", workEffort.getDelegator(), dispatcher, true); + return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, UtilHttp.getLocale(request), "text/html", workEffort.getDelegator(), dispatcher, true, encoderType); } - public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, Locale locale, LocalDispatcher dispatcher) { - return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, locale, null, null, dispatcher, true); + public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, Locale locale, LocalDispatcher dispatcher, String encoderType) { + return getWorkEffortContentAsText(workEffort, workEffortContentTypeId, locale, null, null, dispatcher, true, encoderType); } public static String getWorkEffortContentAsText(GenericValue workEffort, String workEffortContentTypeId, - Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache) { - return getWorkEffortContentAsText(workEffort, null, workEffortContentTypeId, locale, mimeTypeId, delegator, dispatcher, useCache); + Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache, String encoderType) { + return getWorkEffortContentAsText(workEffort, null, workEffortContentTypeId, locale, mimeTypeId, delegator, dispatcher, useCache, encoderType); } public static String getWorkEffortContentAsText(GenericValue workEffort, String contentId, String workEffortContentTypeId, - Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache) { + Locale locale, String mimeTypeId, Delegator delegator, LocalDispatcher dispatcher, boolean useCache, String encoderType) { if (workEffort == null) { return null; } + UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder(encoderType); String candidateFieldName = ModelUtil.dbNameToVarName(workEffortContentTypeId); String cacheKey; if (contentId != null) { @@ -246,19 +253,19 @@ public class WorkEffortContentWrapper im getWorkEffortContentAsText(contentId, null, workEffort, workEffortContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { - return workEffortContentCache.putIfAbsentAndGet(cacheKey, outString); + return workEffortContentCache.putIfAbsentAndGet(cacheKey, encoder.encode(outString)); } else { String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): ""; - return candidateOut == null? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } } catch (GeneralException e) { Debug.logError(e, "Error rendering WorkEffortContent, inserting empty String", module); String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): ""; - return candidateOut == null? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } catch (IOException e) { Debug.logError(e, "Error rendering WorkEffortContent, inserting empty String", module); String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): ""; - return candidateOut == null? "" : candidateOut; + return candidateOut == null? "" : encoder.encode(candidateOut); } } Modified: ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredCategoryDetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredCategoryDetail.ftl?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredCategoryDetail.ftl (original) +++ ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredCategoryDetail.ftl Sat Sep 26 10:25:20 2015 @@ -44,15 +44,15 @@ under the License. <#if productCategory??> - <#assign categoryName = categoryContentWrapper.get("CATEGORY_NAME")!/> - <#assign categoryDescription = categoryContentWrapper.get("DESCRIPTION")!/> + <#assign categoryName = categoryContentWrapper.get("CATEGORY_NAME", "html")!/> + <#assign categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html")!/> <#if categoryName?has_content> <h1>${categoryName}</h1> </#if> <#if categoryDescription?has_content> <h1>${categoryDescription}</h1> </#if> - <#assign longDescription = categoryContentWrapper.get("LONG_DESCRIPTION")!/> + <#assign longDescription = categoryContentWrapper.get("LONG_DESCRIPTION", "html")!/> <#assign categoryImageUrl = categoryContentWrapper.get("CATEGORY_IMAGE_URL", "url")!/> <#if categoryImageUrl?string?has_content || longDescription?has_content> <div> @@ -104,4 +104,4 @@ under the License. <#else> <hr /> <div>${uiLabelMap.ProductNoProductsInThisCategory}</div> -</#if> \ No newline at end of file +</#if> Modified: ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredNavBar.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredNavBar.ftl?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredNavBar.ftl (original) +++ ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/LayeredNavBar.ftl Sat Sep 26 10:25:20 2015 @@ -26,7 +26,7 @@ under the License. </div> <#escape x as x?xml> <#if productCategory.productCategoryId != currentSearchCategory.productCategoryId> - <#assign currentSearchCategoryName = categoryContentWrapper.get("CATEGORY_NAME")?string /> + <#assign currentSearchCategoryName = categoryContentWrapper.get("CATEGORY_NAME", "html")?string /> <#list searchConstraintStrings as searchConstraintString> <#if searchConstraintString.indexOf(currentSearchCategoryName) != -1> <div id="searchConstraints"> <a href="<@ofbizUrl>category/~category_id=${productCategoryId}?removeConstraint=${searchConstraintString_index}&clearSearch=N<#if previousCategoryId??>&searchCategoryId=${previousCategoryId}</#if></@ofbizUrl>" class="buttontext">X</a><#noescape> ${searchConstraintString}</#noescape></div> @@ -45,7 +45,7 @@ under the License. <ul> <#list subCategoryList as category> <#assign subCategoryContentWrapper = category.categoryContentWrapper /> - <#assign categoryName = subCategoryContentWrapper.get("CATEGORY_NAME")!?string /> + <#assign categoryName = subCategoryContentWrapper.get("CATEGORY_NAME", "html")!?string /> <li><a href="<@ofbizUrl>category/~category_id=${productCategoryId}?SEARCH_CATEGORY_ID${index}=${category.productCategoryId}&searchCategoryId=${category.productCategoryId}&clearSearch=N</@ofbizUrl>">${categoryName!} (${category.count})</li> </#list> </ul> @@ -72,4 +72,4 @@ under the License. </div> </#if> </div> -</#if> \ No newline at end of file +</#if> Modified: ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategoryLink.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategoryLink.ftl?rev=1705406&r1=1705405&r2=1705406&view=diff ============================================================================== --- ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategoryLink.ftl (original) +++ ofbiz/branches/release14.12/specialpurpose/ecommerce/webapp/ecommerce/catalog/ProductCategoryLink.ftl Sat Sep 26 10:25:20 2015 @@ -34,9 +34,9 @@ under the License. <#assign linkUrl = requestAttributes._REQUEST_HANDLER_.makeLink(request, response, "category/~category_id=" + productCategoryLink.linkInfo) + "/~pcategory=" + productCategoryId/> <#assign linkProductCategory = delegator.findOne("ProductCategory", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", productCategoryLink.linkInfo), true)/> <#assign linkCategoryContentWrapper = Static["org.ofbiz.product.category.CategoryContentWrapper"].makeCategoryContentWrapper(linkProductCategory, request)/> - <#assign titleText = productCategoryLink.titleText?default(linkCategoryContentWrapper.get("CATEGORY_NAME"))!/> + <#assign titleText = productCategoryLink.titleText?default(linkCategoryContentWrapper.get("CATEGORY_NAME", "html"))!/> <#assign imageUrl = productCategoryLink.imageUrl?default(linkCategoryContentWrapper.get("CATEGORY_IMAGE_URL", "url"))!/> - <#assign detailText = productCategoryLink.detailText?default(linkCategoryContentWrapper.get("DESCRIPTION"))!/> + <#assign detailText = productCategoryLink.detailText?default(linkCategoryContentWrapper.get("DESCRIPTION", "html"))!/> </#if> <div class="productcategorylink"> |
Free forum by Nabble | Edit this page |