Fórum

How to use Category Selection from Add Web Content?

thumbnail
Christian Schulze, modificado 12 Anos atrás.

How to use Category Selection from Add Web Content?

Junior Member Postagens: 87 Data de Entrada: 19/11/09 Postagens Recentes
Hello,
I want to use the Selection of Categories which I see in the Create New Web Content view. All I found was this in edit_view.jsp inside portal-web/docroot/html/portlet/journal :

<aui:input classPK="<%= classPK %>" name="categories" type="assetCategories" />


But that didn't work, because I miss some js-Code or Scripplet to generate the Tree or so.

How can't I get a Category-Tree and the need js-Dialog to select it?

regards
Chris
thumbnail
Mayur Patel, modificado 12 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
Hi Christian,

That is very interesting !!!

If you want to use that in custom portlet then you can directly use <liferay-ui:asset-categories-selector> tag in custom portlet

<aui:input classPK="<%= classPK %>" name="categories" type="assetCategories" />


This will go in to the Page.jsp inside /portal-web/docroot/html/taglib/aui/input/page.jsp and that will check for type assetCategories

    <c:when test="<%= (model != null) &amp;&amp; type.equals(&quot;assetCategories&quot;) %>">
		<liferay-ui:asset-categories-selector className="<%= model.getName() %>" classPK="<%= _getClassPK(bean, classPK) %>" contentCallback="<%= portletResponse.getNamespace() + &quot;getSuggestionsContent&quot; %>" />
	</c:when>


Take a look at logic of asset-categories-selector also /portal-web/docroot/html/taglib/ui/asset_categories_selector/page.jsp,

The tag <liferay-ui:asset-categories-selector> uses
AssetCategoryServiceUtil.getCategories(className, classPK) to get the list of categories and populates the curCategoryIds from this list.

You can refer the same in my blog

See Asset Framework also.

Thanks,
Mayur
thumbnail
Christian Schulze, modificado 12 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Junior Member Postagens: 87 Data de Entrada: 19/11/09 Postagens Recentes
Thanks, thats very helpfull.

But one question remain, it is possible to set the Focus to one AssetVocabulary? In this example I see all Vocabularys.

regards
Chris
thumbnail
Mayur Patel, modificado 12 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
Thanks for reply,

Thats right, you can focus on asset-vocabulary.

<liferay-ui:asset-categories-selector curCategoryIds="<%= Validator.isNull(vManag) ? &quot;&quot; : categoryIds %>" />

Here,
categoryIds - set category Ids for which you want set Focus for particular items if its empty then it will not focus any items

For that Particular content you may be storing CategoryIds in Database, so you need to fetch all Ids for that particular content and set it here

Tell me if you can face any other Issues emoticon

Regards,
Mayur
thumbnail
Christian Schulze, modificado 12 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Junior Member Postagens: 87 Data de Entrada: 19/11/09 Postagens Recentes
I think we speak about different things.

In your blog I see only that you select the currentCategoryIds with this.
But I need to Focus on an exact AssetVocabulary in the Select-Dialog, so that there are only the AssetCategory under this exact AssetVocabulary.
thumbnail
Mayur Patel, modificado 12 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
I'm not sure about that,I cant find any other attributes which focus AssetVocabulary,
May be you need to do some coding and you need to filter out curCategoryIds for that particular AssetVocabulary and pass it.

If you have any other idea then you can share that will be great !!!
thumbnail
Sagar A Vyas, modificado 10 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Liferay Master Postagens: 679 Data de Entrada: 17/04/09 Postagens Recentes
Mayur Patel:
Hi Christian,

That is very interesting !!!

If you want to use that in custom portlet then you can directly use <liferay-ui:asset-categories-selector> tag in custom portlet

<aui:input classPK="<%= classPK %>" name="categories" type="assetCategories" />


This will go in to the Page.jsp inside /portal-web/docroot/html/taglib/aui/input/page.jsp and that will check for type assetCategories

    <c:when test="<%= (model != null) &amp;&amp; type.equals(&quot;assetCategories&quot;) %>">
		<liferay-ui:asset-categories-selector className="<%= model.getName() %>" classPK="<%= _getClassPK(bean, classPK) %>" contentCallback="<%= portletResponse.getNamespace() + &quot;getSuggestionsContent&quot; %>" />
	</c:when>


Take a look at logic of asset-categories-selector also /portal-web/docroot/html/taglib/ui/asset_categories_selector/page.jsp,

The tag <liferay-ui:asset-categories-selector> uses
AssetCategoryServiceUtil.getCategories(className, classPK) to get the list of categories and populates the curCategoryIds from this list.

Refer this to implement Asset Category Functionality in your portlet,

See Asset Framework also.

Thanks,
Mayur



Thanks Mayur your input is really helps lot.

Nice detailed forum .Good Job.

Thanks,
Sagar Vyas
thumbnail
Mayur Patel, modificado 10 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
Thanks a lot Sagar emoticon
Javier Vera, modificado 9 Anos atrás.

RE: How to use Category Selection from Add Web Content?

New Member Postagens: 18 Data de Entrada: 01/08/14 Postagens Recentes
Mayur Patel:
Thanks a lot Sagar emoticon



hey, its been quite a long time since someone seems to have googled this question. i wonder where is your blog? i saw your name all over the net about Liferay however your blog is empty. You gone mad about Liferay? emoticon
peace
thumbnail
Mayur Patel, modificado 9 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
Actually, I have removed the blog as it was not well formatted. I will post very soon here.

Thanks.
thumbnail
Mayur Patel, modificado 9 Anos atrás.

RE: How to use Category Selection from Add Web Content?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
Sorry for the late reply.

Refer this blog

Thanks.