【发布时间】:2012-06-18 07:05:42
【问题描述】:
我正在尝试在我的自定义 portlet 的 conf 中添加一个选项卡,在本地导入/导出和权限旁边。
喜欢这张图片:http://imageshack.us/photo/my-images/716/sampledn.png/
此选项卡必须允许更改定义某些变量的 conf.properties 中的参数值。
我该怎么做?
问候。
【问题讨论】:
我正在尝试在我的自定义 portlet 的 conf 中添加一个选项卡,在本地导入/导出和权限旁边。
喜欢这张图片:http://imageshack.us/photo/my-images/716/sampledn.png/
此选项卡必须允许更改定义某些变量的 conf.properties 中的参数值。
我该怎么做?
问候。
【问题讨论】:
是的,您可以首先将其添加到您的 portlet.xml 作为“portlet”节点的子节点:
<init-param>
<name>config-jsp</name>
<value>/html/config.jsp</value>
</init-param>
您需要在 liferay-portlet.xml 中将其添加为“portlet”节点的子节点:
<configuration-action-class>com.yourportlet.action.ConfigurationActionImpl</configuration-action-class>
然后您需要在您在 XML 中指定的目录中创建这些文件,并且您的 ConfigurationActionImpl 应该实现 ConfigurationAction 接口,因此框架如下所示:
public class ConfigurationActionImpl implements ConfigurationAction {
@Override
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
return "/html/config.jsp";
}
如果这有帮助或者您还有其他问题,请告诉我! :)
【讨论】:
将编辑模式添加到您的 portlet.xml:
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode> <!-- add this line -->
</supports>
然后您将在菜单中看到首选项选项。覆盖 portlet 类中的 doEdit 方法以呈现编辑模式的内容。
编辑:
更高级的解决方案:
您可以通过钩子更改门户jsp来添加另一个选项卡。你需要改变的jsp是:
/html/portlet/portlet_configuration/tabs1.jsp
请注意,这将更改所有 portlet 的配置窗口。
【讨论】: