You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/09/01 16:44:19 UTC
svn commit: r1621810 - in /ofbiz/trunk/framework:
entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java
widget/src/org/ofbiz/widget/screen/HtmlWidget.java
Author: jacopoc
Date: Mon Sep 1 14:44:19 2014
New Revision: 1621810
URL: http://svn.apache.org/r1621810
Log:
Removed old and unused experimental class.
Removed:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=1621810&r1=1621809&r2=1621810&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Mon Sep 1 14:44:19 2014
@@ -70,10 +70,6 @@ public class HtmlWidget extends ModelScr
@SuppressWarnings("unchecked")
@Override
public TemplateModel wrap(Object object) throws TemplateModelException {
- /* NOTE: don't use this and the StringHtmlWrapperForFtl or things will be double-encoded
- if (object instanceof GenericValue) {
- return new GenericValueHtmlWrapperForFtl((GenericValue) object, this);
- }*/
// This StringHtmlWrapperForFtl option seems to be the best option
// and handles most things without causing too many problems
if (object instanceof String) {
@@ -153,64 +149,6 @@ public class HtmlWidget extends ModelScr
throw new IllegalArgumentException("Template location is empty");
}
-
- /*
- // =======================================================================
- // Go through the context and find GenericValue objects and wrap them
-
- // NOTE PROBLEM: there are still problems with this as it gets some things
- // but does not get non-entity data including lots of strings
- // directly in the context or things prepared or derived right in
- // the FTL file, like the results of service calls, etc; we could
- // do something more aggressive to encode and wrap EVERYTHING in
- // the context, but I've been thinking that even this is too much
- // overhead and that would be crazy
-
- // NOTE ALTERNATIVE1: considering instead to use the FTL features to wrap
- // everything in an <#escape x as x?html>...</#escape>, but that could
- // cause problems with ${} expansions that have HTML in them, including:
- // included screens (using ${screens.render(...)}), content that should
- // have HTML in it (lots of general, product, category, etc content), etc
-
- // NOTE ALTERNATIVE2: kind of like the "#escape X as x?html" option,
- // implement an FTL *Model class and load it through a ObjectWrapper
- // FINAL NOTE: after testing all of these alternatives, this one seems
- // to behave the best, so going with that for now.
-
- // isolate the scope so these wrapper objects go away after rendering is done
- MapStack<String> contextMs;
- if (!(context instanceof MapStack)) {
- contextMs = MapStack.create(context);
- context = contextMs;
- } else {
- contextMs = UtilGenerics.cast(context);
- }
-
- contextMs.push();
- for (Map.Entry<String, Object> mapEntry: contextMs.entrySet()) {
- Object value = mapEntry.getValue();
- if (value instanceof GenericValue) {
- contextMs.put(mapEntry.getKey(), GenericValueHtmlWrapper.create((GenericValue) value));
- } else if (value instanceof List) {
- if (((List) value).size() > 0 && ((List) value).get(0) instanceof GenericValue) {
- List<GenericValue> theList = (List<GenericValue>) value;
- List<GenericValueHtmlWrapper> newList = FastList.newInstance();
- for (GenericValue gv: theList) {
- newList.add(GenericValueHtmlWrapper.create(gv));
- }
- contextMs.put(mapEntry.getKey(), newList);
- }
- }
- // TODO and NOTE: should get most stuff, but we could support Maps
- // and Lists in Maps and such; that's tricky because we have to go
- // through the entire Map and not just one entry, and we would
- // have to shallow copy the whole Map too
-
- }
- // this line goes at the end of the method, but moved up here to be part of the big comment about this
- contextMs.pop();
- */
-
if (location.endsWith(".ftl")) {
try {
Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));