Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Sandeep Nair
Portlet Mover Across pages
10. April 2012 00:28
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1691

Eintrittsdatum: 5. November 2008

Neue 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
Hitoshi Ozawa
RE: Portlet Mover Across pages
22. April 2012 04:59
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7990

Eintrittsdatum: 23. März 2010

Neue 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
Ravi Kumar Gupta
RE: Portlet Mover Across pages
22. April 2012 05:03
Antwort

Ravi Kumar Gupta

Rang: Liferay Legend

Nachrichten: 1137

Eintrittsdatum: 23. Juni 2009

Neue Beiträge

Thanks for this Sandeep.. emoticon I'll try it emoticon
Sandeep Nair
RE: Portlet Mover Across pages
22. April 2012 22:48
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1691

Eintrittsdatum: 5. November 2008

Neue Beiträge

Thanks Hitoshi & Ravi emoticon
Nagendra Kumar Busam
RE: Portlet Mover Across pages
25. April 2012 07:50
Antwort

Nagendra Kumar Busam

Rang: Liferay Master

Nachrichten: 598

Eintrittsdatum: 7. Juli 2009

Neue Beiträge

Thanks for sharing, Really good use case emoticon
Ravi Kumar Gupta
RE: Portlet Mover Across pages
27. April 2012 01:42
Antwort

Ravi Kumar Gupta

Rang: Liferay Legend

Nachrichten: 1137

Eintrittsdatum: 23. Juni 2009

Neue Beiträge

Sandeep, I tried and it works perfectly.. emoticon
Sandeep Nair
RE: Portlet Mover Across pages
27. April 2012 02:39
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1691

Eintrittsdatum: 5. November 2008

Neue Beiträge

Thanks Ravi for testing it out emoticon
Thanks Nagendra emoticon