我有一个名为Skills in liferay 6.2用户配置文件的自定义字段(即当您单击我的帐户 - >详细信息部分时)。目前,此技能字段接受多个文本值并显示为纯文本条目。我想要显示作为标签输入的每项技能。是否有任何可用的UI组件来执行此任务?我检查了Liferay文档上的标签管理。他们建议从Admin-> content部分添加标签。不过,我想在用户输入技能值时即时创建标签。在Liferay用户portlet中添加自定义字段值作为标签
0
A
回答
0
我的方法是使用liferay ui资产标签选择器。它提供了UI组件分配和显示标签
<label>Skills</label>
<liferay-ui:asset-tags-selector
className="<%= User.class.getName() %>"
classPK="<%= selUser != null ? selUser.getUserId() : 0 %>"
/>
1
如果我得到你的权利,你希望用户输入的技能要创建作为门户网站的标签。
为此,您需要创建用于创建用户帐户的自定义CreateAccountAction
。
这是通过使用Liferay Extension Plugin项目在Liferay中扩展addUser()
方法完成的。
则扩展addUser()
方法里面添加逻辑来创建AssetCategory
,AssetVocabulary
和标签
这里是一个可能的方法来创建技能标签的例子
protected AssetCategory addAssetCategory(long userId,
long parentCategoryId, String title, long vocabularyId,
ServiceContext serviceContext) throws Exception {
Map<Locale, String> titleMap = new HashMap<Locale, String>();
setLocalizedValue(titleMap, title);
return AssetCategoryLocalServiceUtil.addCategory(userId,
parentCategoryId, titleMap, null, vocabularyId, null,
serviceContext);
}
protected AssetVocabulary addAssetVocabulary(long userId, String title,
ServiceContext serviceContext) throws Exception {
Map<Locale, String> titleMap = new HashMap<Locale, String>();
setLocalizedValue(titleMap, title);
return AssetVocabularyLocalServiceUtil.addVocabulary(userId,
StringPool.BLANK, titleMap, null, null, serviceContext);
}
确保您使用serviceContext.setAddGroupPermissions(true)
和serviceContext.setAddGuestPermissions(true)
在调用方法之前确保获得适当的权限
相关问题
- 1. 在Liferay中获取自定义用户字段值(expando)
- 2. Liferay自定义登录Portlet
- 3. Liferay:自定义在portlet部署期间添加的web.xml HeaderFilter
- 4. 的Liferay:自定义角色添加特定的Portlet
- 5. 在插件中添加自定义字段标签
- 6. @ Html.DropDownListFor,如何在选项标签中添加自定义字段?
- 7. Liferay是否可以将自定义资源操作添加到我的portlet中?
- 8. 在Wordpress中添加自定义标签
- 9. 显示的Portlet的自定义页面作为Liferay的启动
- 10. 如何向Liferay添加自定义方法和字段用户模型类
- 11. Liferay 6.2 portlet自定义角色
- 12. Liferay的7 - 嵌入自定义portlet到
- 13. 在工具栏中添加自定义标签不起作用
- 14. 在fosuserbundle中添加自定义字段
- 15. 在liferay中动态添加portlet
- 16. 在django中添加自定义用户注册字段
- 17. Liferay 7:如何在许多自定义Portlet中引用用户类
- 18. 添加自定义字段为标题在STOMP消息
- 19. 如何在自定义主题中添加自定义字段
- 20. Liferay用户CSV导出中的自定义字段具有空值
- 21. 在Liferay中显示真/假自定义字段为复选框
- 22. 在自定义标签中添加不同尺寸的字体
- 23. 向django中的用户添加自定义字段
- 24. WordPress:禁用添加自定义字段
- 25. 如何在Joomla 1.5中为用户添加自定义字段(如Company :)?
- 26. 在Liferay中添加用户字段时出现问题
- 27. BlackBerry的自定义标签字段
- 28. 在liferay中的portlet之间发送自定义对象
- 29. 如何自定义开箱的portlet在Liferay中7
- 30. Liferay:用户特定的portlet首选项
创建ServiceContext像这样 'ServiceContext serviceContext = ServiceContextFactory.getInstance(BlogsEntry.class.getName(),portletRequest);' –
其实我使用Bootstrap标签输入插件来解决当时的这些问题。感谢这些评论,如果我们再次需要这些要求,我会再检查它 – user596502
没问题。很高兴能贡献。 –