[ https://issues.apache.org/jira/browse/OFBIZ-2988?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Antivackis updated OFBIZ-2988: -------------------------------------- Attachment: Patch-OFBIZ-2988.txt > Improving the ContentMapFacade class in order to filter and sort results > ------------------------------------------------------------------------ > > Key: OFBIZ-2988 > URL: https://issues.apache.org/jira/browse/OFBIZ-2988 > Project: OFBiz > Issue Type: Improvement > Components: content > Affects Versions: SVN trunk > Reporter: Patrick Antivackis > Priority: Minor > Attachments: Patch-OFBIZ-2988.txt > > > Today's ContentMapFacade.class is mapped in the content application to the > ${thisContent} variable in Freemarker templates. > Using {$thisContent.subcontent_all} return all the "subcontents" associated > with thisContent sorting by -fromDate. > (in fact you usually use it like > <#list thisContent.subcontent_all as contentItem> > ${contentItem} > </#list> > ) > Using {$thisContent.subcontent.foo} return all the first "subcontent" > associated with thisContent and mapped by foo mapKey (first sorted by > -fromDate). > Unfortunatelly this facade don't bring any filter or sorting options. > I updated this class in order to allow to : > - sort the subcontents (both sucontent_all or subcontent.foo) by whatever > field of the ContentAssocViewTo view. For this you need to write in the > Freemarker template ${thisContent.setSortOrder(sortString)} before using the > sucontent_all or subcontent .foo operations. > - filter the output of subcontent_all by mapKey. For this you need to write > in the Freemarker template ${thisContent.setMapKeyFilter(mapKeyString)} > before using the subcontent_all operation. > - filter the output of subcontent_all or subcontent.foo by statusId of the > content. For this you need to write in the Freemarker template > ${thisContent.setStatusFilter(CONTENT_STATUS)} before using the > sbucontent_all or subcontent.foo operations. > Examples : > ${thisContent.setSortOrder("+caSequenceNum, -fromDate")} > <#list thisContent.subcontent_all as contentItem> > ${contentItem} > </#list> > will display all subcontents ordered by caSequenceNum ASC, fromDate DESC > ${thisContent.setSortOrder("+caSequenceNum, -fromDate")} > ${thisContent.setMapKeyFilter("wideImage")} > <#list thisContent.subcontent_all as contentItem> > ${contentItem} > </#list> > will display all subcontents that are mapped with the key wideImade and > ordered by caSequenceNum ASC, fromDate DESC > ${thisContent.setSortOrder("+caSequenceNum, -fromDate")} > ${thisContent.setMapKeyFilter("wideImage")} > ${thisContent.setStatusFilter("CTNT_PUBLISHED")} > <#list thisContent.subcontent_all as contentItem> > ${contentItem} > </#list> > will display all subcontents that are mapped with the key wideImade and that > are in the status PUblished and ordered by caSequenceNum ASC, fromDate DESC -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.