Scott Gray wrote: > On 10/03/2010, at 9:48 AM, Adam Heath wrote: > >> [email protected] wrote: >>> Author: jleroux >>> Date: Wed Mar 10 16:12:30 2010 >>> New Revision: 921421 >>> >>> URL: http://svn.apache.org/viewvc?rev=921421&view=rev >>> Log: >>> You can't use double quote in tooltips. I tried to find a quick way to >>> allow this in MacroFormRenderer.appendTooltip() but gave up, too narrow >>> need. >>> >>> Modified: >>> ofbiz/trunk/framework/example/config/ExampleUiLabels.xml >>> >>> Modified: ofbiz/trunk/framework/example/config/ExampleUiLabels.xml >>> URL: >>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/config/ExampleUiLabels.xml?rev=921421&r1=921420&r2=921421&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/framework/example/config/ExampleUiLabels.xml (original) >>> +++ ofbiz/trunk/framework/example/config/ExampleUiLabels.xml Wed Mar 10 >>> 16:12:30 2010 >>> @@ -97,7 +97,7 @@ >>> </property> >>> <property key="ExampleDateField10Tooltip"> >>> <value xml:lang="en">Same as above, uses the nowTimestamp variable >>> (always available in the form context) to set the default value to >>> now</value> >>> - <value xml:lang="fr">La même chose mais la variable nowTimestamp >>> (toujours disponible dans context) est utilisée pour affecter la valeur >>> par défaut à "maintenant"</value> >>> + <value xml:lang="fr">La même chose mais la variable nowTimestamp >>> (toujours disponible dans context) est utilisée pour affecter la valeur >>> par défaut à 'maintenant'</value> >>> <value xml:lang="it">Lo stesso di sopra, usare la variabile >>> nowTimestamp (sempre disponibile nel contesto della form) per impostare il >>> valore di default ad adesso</value> >>> <value xml:lang="zh">åŒä¸Šï¼Œä½¿ç”¨nowTimstampå˜é‡(在表å•ä¸ >>> 总是å¯ç”¨çš„)æ¥æŠŠç¼ºçœå€¼è®¾ç½®ä¸ºçŽ°åœ¨</value> >>> </property> >> tooltip.replaceAll("\"", """), also handling any other weird html >> characters, like < or > or &. > > It would probably be easiest to just encode the tooltip string before > generating the macro call. There are examples of that all over. > tooltip = encode(tooltip, modelFormField, context);
That's what I mean, I went and looked at the method he referenced, to know what the variable name was. I also looked at the macro files themselves, and they will work if passed this encoded string value. However, from a perfectionist standpoint, it doesn't sit well with me. What happens if these macros use a string from a map, that is already encoded, then try to double-encode it? Ideally, MacroFormRenderer is calling freemarker. So it should use freemarker encodings of special characters. Freemarker should then decode said special markup, so that the macros it ends up calling can do what they need for it.
