留言板

Portlet Mover Across pages

thumbnail
Sandeep Nair,修改在12 年前。

Portlet Mover Across pages

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
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,修改在12 年前。

RE: Portlet Mover Across pages

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
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,修改在12 年前。

RE: Portlet Mover Across pages

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
Thanks Hitoshi & Ravi emoticon
thumbnail
Ravi Kumar Gupta,修改在11 年前。

RE: Portlet Mover Across pages

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
Sandeep, I tried and it works perfectly.. emoticon
thumbnail
Sandeep Nair,修改在11 年前。

RE: Portlet Mover Across pages

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
Thanks Ravi for testing it out emoticon
Thanks Nagendra emoticon
thumbnail
Ravi Kumar Gupta,修改在12 年前。

RE: Portlet Mover Across pages

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
Thanks for this Sandeep.. emoticon I'll try it emoticon
thumbnail
Nagendra Kumar Busam,修改在12 年前。

RE: Portlet Mover Across pages

Liferay Master 帖子: 678 加入日期: 09-7-7 最近的帖子
Thanks for sharing, Really good use case emoticon