Rendering a portlet with different layout context of current page

Why I want to render portlet(s) from different page context?

A user can belong to multiple organizations and communities. Each organization or community has its public and private pages which holding set of portlets. Those portlets was acting in the context of current organization or community. The idea is to enable a portlet mirrored into a specified page so a user can aggregate portlets from different pages into one page and each portlet acts just like in its original page. For example, a user has joined 10 communities and each of those community has its own messageboard portlet. The user might create a private page for holding all messageboard portlets from 10 communities into it, so he/she can participate the discussion with all communities without going to each community one by one.

How does the portlet work in different page ?

Organization, Sub-Organization and Communities are the mechanism for grouping users. Although them are structured in kind of hierarchical, pages holding in each node are exclusive to others. A user can only be at one of the node in term of scope for the data of applications running on the node. There was a variable "scopeGroupId" heavily used in the system but not a only variable used by application to distinguish current context. Mixing of themeDisplay, portletDisplay and plid (PageLayout, I guessed) are also used for getting data, such as portlet preference, permission.

 

How to make portlets from different node co-exist in one page ?

When a portlet was added into a page, the portlet id was add into "typeSetting" of a layout.
Here is the value of "typeSetting" for guest home page

column-1=ExpressLoginPortlet_WAR_expressloginportlet,
layout-template-id=2_columns_ii
sitemap-changefreq=daily
column-2=56_INSTANCE_X5oI,
sitemap-include=1

Or friends page of social networking sample users.

column-1=121,6_WAR_wolportlet layout-template-id=2_columns_ii column-2=searchandinvite_WAR_searchandinviteportlet,4_WAR_wolportlet,

 

As you can see, there is only the portletId and the the Layout itself indicating which node the portlet is on.

If the portletId can be extended to including Layout information, and make it equivalent to the symbolic link of the unix file system for the real portlet on other page. When handling a portlet including render and processAction, if the portlet is a symbolic link, some of needed context will be stored in portlet object and used instead of current page context.

LR is adding the layoutId for getting the primary key of a portlet referring to resource and permission, so I am trying to use the same format for a portlet link from other page. Following is the example of two portlet symboliclink in a user's  private page. The page contains a blog portlet from "guest" community and a wiki portlet from community "developer".

The value of typeSettings of "myPage"

column-1=10839_LAYOUT_33, layout-template-id=2_columns_ii column-2=10907_LAYOUT_36,

更多博文

博客