4

我正在尝试在我的自定义 portlet 的 conf 中添加一个选项卡,在本地导入/导出和权限旁边。

就像这张图片:http: //imageshack.us/photo/my-images/716/sampledn.png/

此选项卡必须允许更改定义某些变量的 conf.properties 中的参数值。

我怎样才能做到这一点?

问候。

4

2 回答 2

8

Yup you can do it by first of all adding this to your portlet.xml as a child of the "portlet" node:

    <init-param>
        <name>config-jsp</name>
        <value>/html/config.jsp</value>
    </init-param>

The in your liferay-portlet.xml you need to add this as a child of the "portlet" node:

<configuration-action-class>com.yourportlet.action.ConfigurationActionImpl</configuration-action-class>

Then you need to create this files in the directories you've specified in your XML, and your ConfigurationActionImpl should implement the ConfigurationAction interface so the skeleton would look like this:

public class ConfigurationActionImpl implements ConfigurationAction {

@Override
public String render(PortletConfig config, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {                   
    return "/html/config.jsp";
}

Let me know if this helps or you have any other questions! :)

于 2012-06-18T13:32:46.747 回答
1

将编辑模式添加到您的 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 的配置窗口。

于 2012-06-18T07:19:08.123 回答