我想在Liferay 6.2中自定义“用户编辑”页面。
首先,我想在用户编辑屏幕(http://i.imgur.com/dshV5cJ.png)右侧的栏中添加一个新部分。我已经意识到像属性
users.form.add.main = customportlet
当我单击新创建的部分时,它将打开一个空白页面。如何在此处添加内容(数据将存储在单独的表中)?
我知道我可以通过配置简单地创建自定义字段,但是我想以这种方式实现。
您正在寻找的是一个钩子。
您将文件WEB-INF/liferay-hook.xml
用作部署描述符:
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<portal-properties>portal.properties</portal-properties>
<language-properties>Language.properties</language-properties>
<custom-jsp-dir>/WEB-INF/custom_jsps</custom-jsp-dir>
</hook>
然后您在文件中定义其他部分WEB-INF/classes/portal.properties
:
# users.form.add.main is for the creation of a user only
# I guess you mean the user edit screen:
users.form.update.main=my-section
在以下部分中将您的部分实现为JSP文件WEB-INF/custom_jsps/html/portlet/users_admin/user/my-section.jsp
:
<%@include file="/html/portlet/users_admin/init.jsp" %>
<h3><liferay-ui:message key="my-section" /></h3>
<%-- Implement your section --%>
并在以下部分标记您的部分WEB-INF/classes/Language.properties
:
my-section = My Section
而已。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句