组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Sandeep Nair
Portlet Mover Across pages
2012年4月10日 上午12:28
答复

Sandeep Nair

等级: Liferay Legend

帖子: 1721

加入日期: 2008年11月5日

最近的帖子

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
2012年4月22日 上午4:59
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

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
2012年4月22日 上午5:03
答复

Ravi Kumar Gupta

等级: Liferay Legend

帖子: 1303

加入日期: 2009年6月23日

最近的帖子

Thanks for this Sandeep.. emoticon I'll try it emoticon
Sandeep Nair
RE: Portlet Mover Across pages
2012年4月22日 下午10:48
答复

Sandeep Nair

等级: Liferay Legend

帖子: 1721

加入日期: 2008年11月5日

最近的帖子

Thanks Hitoshi & Ravi emoticon
Nagendra Kumar Busam
RE: Portlet Mover Across pages
2012年4月25日 上午7:50
答复

Nagendra Kumar Busam

等级: Liferay Master

帖子: 653

加入日期: 2009年7月7日

最近的帖子

Thanks for sharing, Really good use case emoticon
Ravi Kumar Gupta
RE: Portlet Mover Across pages
2012年4月27日 上午1:42
答复

Ravi Kumar Gupta

等级: Liferay Legend

帖子: 1303

加入日期: 2009年6月23日

最近的帖子

Sandeep, I tried and it works perfectly.. emoticon
Sandeep Nair
RE: Portlet Mover Across pages
2012年4月27日 上午2:39
答复

Sandeep Nair

等级: Liferay Legend

帖子: 1721

加入日期: 2008年11月5日

最近的帖子

Thanks Ravi for testing it out emoticon
Thanks Nagendra emoticon