Foren

Portlet Mover Across pages

thumbnail
Sandeep Nair, geändert vor 11 Jahren.

Portlet Mover Across pages

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Hi,

I had seen this post recently in which there was a discussion going on about how to move portlet across pages, withing same or different /community or organization.

I have tried to achieve the same using a hook cum portlet. Using this plugin you can move the portlet across pages from Configuration option of the portlet.

Steps

Download the plugin from here and deploy it

Once the portlet cum hook is deployed, click on the configuration of any portlet you wish to move. Click on Sharing Tab and then click the newly available Copy Portlet option.

This should bring you to a screen as shown below. It has two select boxes. First one to select the group(This will show all the organizations or communities) and second drop down will show list of pages both public and private available under the selected organization or community.


Once you select the group and page option, click on ok and this should copy the portlet to selected page's first column if the user has permission or it will not(no error message is given).

What is being done in code?
The code is nothing but a struts-action hook in large which just sends the necessary parameter to identify the target page and place the portlet on the same.

Hindrance
Initially my idea was just to create a hook and I thought I can handle everything in that. But I struggled using the serveResource phase in custom struts action. It first complained about having no path and then later on with null portletConfig. So I decided to add a portlet to the hook and use the serveResource of the portlet.

Right now when I select a group(Org/Community) I am getting the layout names using ajax. Somehow when I use LanguageUtil.get in the portlet, it is not able to resolve the key which is part of portal. So I had to hardcode Public and private strings.

As I told in first point my initial idea was to do everything in hook and later on decided to add the portlet.So it was hook first and then portlet. This on initial deployment would give NoClassDef exception for MVCPortlet(Classloader issue), which on next deployment would go away. So then i had to repackage it as portlet and add hook code into it.

Links
Download URL
Liferay Repository URL

Regards,
Sandeep Nair
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Thanks for the portlet Sandeep. Will make may work much easier. Hope it'll be added in as a regular function in future versions of liferay. emoticon
thumbnail
Sandeep Nair, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Thanks Hitoshi & Ravi emoticon
thumbnail
Ravi Kumar Gupta, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste Beiträge
Sandeep, I tried and it works perfectly.. emoticon
thumbnail
Sandeep Nair, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Thanks Ravi for testing it out emoticon
Thanks Nagendra emoticon
thumbnail
Ravi Kumar Gupta, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste Beiträge
Thanks for this Sandeep.. emoticon I'll try it emoticon
thumbnail
Nagendra Kumar Busam, geändert vor 11 Jahren.

RE: Portlet Mover Across pages

Liferay Master Beiträge: 678 Beitrittsdatum: 07.07.09 Neueste Beiträge
Thanks for sharing, Really good use case emoticon