For example, you could try the following (untested!) code for CSV exports: Index: framework/widget/templates/csvFormMacroLibrary.ftl =================================================================== --- framework/widget/templates/csvFormMacroLibrary.ftl (revision 920353) +++ framework/widget/templates/csvFormMacroLibrary.ftl (working copy) @@ -113,7 +113,7 @@ <#macro renderFieldGroupClose style id title></#macro> <#macro renderHyperlinkTitle name title showSelectAll="N"></#macro> -<#macro renderSortField style title linkUrl ajaxEnabled></#macro> +<#macro renderSortField style title linkUrl ajaxEnabled><@renderField title /></#macro> <#macro formatBoundaryComment boundaryType widgetType widgetName></#macro> <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description><@renderField description /></#macro> <#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc linkUrl targetWindow description confirmation><@renderField description /></#macro>
Jacopo On Mar 8, 2010, at 4:45 PM, Jacopo Cappellato wrote: > Hi Erwan, > > could we discuss this a bit? Maybe there is a better solution for this. > > Jacopo > > On Mar 8, 2010, at 4:36 PM, er...@apache.org wrote: > >> Author: erwan >> Date: Mon Mar 8 15:36:04 2010 >> New Revision: 920359 >> >> URL: http://svn.apache.org/viewvc?rev=920359&view=rev >> Log: >> When making CSV or PDF exports, and having sort-field as table headers, the >> descriptions weren't displayed in the exported documents. >> >> Modified: >> >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> >> Modified: >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> (original) >> +++ >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> Mon Mar 8 15:36:04 2010 >> @@ -95,6 +95,7 @@ >> protected HttpServletResponse response; >> protected boolean javaScriptEnabled = false; >> protected boolean renderPagination = true; >> + protected String contentType; >> >> public MacroFormRenderer(String macroLibraryPath, Appendable writer, >> HttpServletRequest request, HttpServletResponse response) throws >> TemplateException, IOException { >> macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); >> @@ -108,6 +109,11 @@ >> internalEncoder = StringUtil.getEncoder("string"); >> } >> >> + public MacroFormRenderer(String macroLibraryPath, Appendable writer, >> HttpServletRequest request, HttpServletResponse response, String >> contentType) throws TemplateException, IOException { >> + this(macroLibraryPath, writer, request, response); >> + this.contentType = contentType; >> + } >> + >> public boolean getRenderPagination() { >> return this.renderPagination; >> } >> @@ -2605,7 +2611,7 @@ >> sr.append(title); >> sr.append("\" />"); >> executeMacro(sr.toString()); >> - } else if (modelFormField.isSortField()) { >> + } else if (modelFormField.isSortField() && >> !"text/csv".equals(this.getContentType()) && >> !"application/pdf".equals(this.getContentType())) { >> renderSortField (writer, context, modelFormField, titleText); >> } else if (modelFormField.isRowSubmit()) { >> StringWriter sr = new StringWriter(); >> @@ -2954,4 +2960,12 @@ >> sr.append("\" />"); >> executeMacro(sr.toString()); >> } >> + >> + public void setContentType(String contentType){ >> + this.contentType = contentType; >> + } >> + >> + public String getContentType(){ >> + return this.contentType; >> + } >> } >> >> Modified: >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> (original) >> +++ >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> Mon Mar 8 15:36:04 2010 >> @@ -88,7 +88,7 @@ >> } >> >> ScreenStringRenderer screenStringRenderer = new >> MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".name"), UtilProperties.getPropertyValue("widget", getName() + >> ".screenrenderer"), writer); >> - FormStringRenderer formStringRenderer = new >> MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".formrenderer"), writer, request, response); >> + FormStringRenderer formStringRenderer = new >> MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".formrenderer"), writer, request, response, contentType); >> TreeStringRenderer treeStringRenderer = new >> MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".treerenderer"), writer); >> // TODO: uncomment these lines when the renderers are implemented >> //MenuStringRenderer menuStringRenderer = new >> MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".menurenderer"), writer); >> >> Modified: >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> (original) >> +++ >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> Mon Mar 8 15:36:04 2010 >> @@ -68,7 +68,7 @@ >> Writer writer = new StringWriter(); >> try { >> ScreenStringRenderer screenStringRenderer = new >> MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".name"), UtilProperties.getPropertyValue("widget", getName() + >> ".screenrenderer"), writer); >> - FormStringRenderer formStringRenderer = new >> MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".formrenderer"), writer, request, response); >> + FormStringRenderer formStringRenderer = new >> MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".formrenderer"), writer, request, response, contentType); >> // TODO: uncomment these lines when the renderers are implemented >> //TreeStringRenderer treeStringRenderer = new >> MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".treerenderer"), writer); >> //MenuStringRenderer menuStringRenderer = new >> MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + >> ".menurenderer"), writer); >> >> >