Adding custom filter for asset publisher portlet?

半城伤御伤魂 提交于 2019-12-12 01:51:58

问题


We have created a new template and structure with custom attributes for submitting web content. The structure has few list attributes like:

<dynamic-element name='size' type='list' index-type='' repeatable='false'>
<meta-data>…</meta-data>
<dynamic-element name='Less_than_5_000' type='Less_than_5_000' index-type=''     repeatable='false'>  </dynamic-element>
<dynamic-element name='5_000_to_10_000_employees' type='5_000_to_10_000_employees' index-type='' repeatable='false'> </dynamic-element>
<dynamic-element name='10_000_to_20_000_employess' type='10_000_to_20_000_employess' index-type='' repeatable='false'></dynamic-element>
</dynamic-element>
<dynamic-element name='location' type='list' index-type='' repeatable='false'>
<meta-data>…</meta-data>
<dynamic-element name='Central_West' type='Central_West' index-type='' repeatable='false'>  </dynamic-element>
<dynamic-element name='South' type='South' index-type='' repeatable='false'>      </dynamic-element>

To display these contents I am using Asset-publisher, category navigation and tags portlet. This requires categories creation and assignment when content is published. The Asset publisher portlet provides capability to filter content on the basis of categories and does not support filtering based on custom attributes like one defined in structure above. Is there a way to display content based on custom attributed defined in structure using asset publisher? For example can we – a. Display all contents where employees are “Less than 5000”? b. Display all contents where employees are “Less than 5000” and Location is “South”?


回答1:


I completely don't understand what you're trying to do with that structure, e.g. the type "Less_than_5_000" IMHO shows some wrong understanding of structures: Rather have a field "companySize", maybe as an option list.

If you need more pointers on finding your content, there's a nice blog post on how to use the Templates to interface with Liferay's API, also you might want to think about automatically tagging/categorizing your content based on some criteria - e.g. by overriding the Web Content Services: Whenever an article is stored you could run your own code and categorize the article automatically in order to use the stock AssetPublisher.

Also, of course, you could customize AssetPublisher or provide a simple portlet that does exactly what you want: Make it as simple as possible to meet exactly your needs. Should be a small & easy to maintain portlet that filters the articles you need, utilizing Liferay's API.



来源:https://stackoverflow.com/questions/6347829/adding-custom-filter-for-asset-publisher-portlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!