Add conf menu to portlet

I am trying to add a tab to the config of my user portlet, next to import / export natives and permissions.

Like in the picture: http://imageshack.us/photo/my-images/716/sampledn.png/

This tab was supposed to allow changing the value of the parameter in conf.properties, which define some variable.

How can i do this?

Sincerely.

+4
source share
2 answers

You can do this by first adding this to your .xml portlet as a child of the node portlet:

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

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 these files in the directories that you specified in your XML, and your ConfigurationActionImpl must implement the ConfigurationAction interface so that the skeleton looks 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 other questions! :)

+8
source

Add editing mode to the .xml portlet:

  <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> <portlet-mode>edit</portlet-mode> <!-- add this line --> </supports> 

Then you will see the settings option in the menu. Override the doEdit method in your portlet class to display the contents of the edit mode.

EDIT:

More advanced solution:

You can add another tab by changing the jsp portal via hook. The jsp you need to change is:

/html/portlet/portlet_configuration/tabs1.jsp

Note that this will change the configuration window for all portlets.

+1
source

All Articles