留言板

[SOLVED] Ability to push and remove portlets to user private pages ...

thumbnail
Imtiaz Ahmed,修改在14 年前。

[SOLVED] Ability to push and remove portlets to user private pages ...

Junior Member 帖子: 57 加入日期: 08-1-2 最近的帖子
Hi All,

Hope you are doing well. I have a question:

I am using Liferay 5.2.1. I have setup user private pages using a lar as a default template. Now, if I want to push a new portlet into their private pages , how can i do that without regenerating their private pages which will remove all the customizations they've made. I want to retain all the customizations my users have made to their private pages and still be able to add and remove portlets to them.

Any help will be appreciated.

Thanks,
Imtiaz
thumbnail
Lisa Simpson,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
ASFAIK, you would need ot do that by adding a page to the LAR with just that page and that template in it and pushing that out.
thumbnail
Imtiaz Ahmed,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Junior Member 帖子: 57 加入日期: 08-1-2 最近的帖子
Thanks for your reply Lisa I really appreciate that. Can you please detail it out from me. From what I've understood, I need to change my default template by adding another portlet to the existing ones and export another lar. Now, how do i push that lar to the users because, default lar is only used once when the pages are created if the user doesn't have one. For instance, if the user is logging in the first time, liferay creates his private pages, are you saying that if I change that default lar, liferay will itself adust the existing pages of the users.

If this is not the case, can you please give me detailed steps to achieve that if possible.


Thanks,
Imtiaz
thumbnail
Lisa Simpson,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Managing+End-User+Pages
thumbnail
Imtiaz Ahmed,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Junior Member 帖子: 57 加入日期: 08-1-2 最近的帖子
Thanks for the link but this article only applies to the Public pages of users and also it specifies how a user can change its pages. I wanna know how an administrator can change the private pages of all the users. I being an administrator want to push or remove a portlet from the user's private pages. And also not just one user's page, all of my users' pages.
thumbnail
Olaf Kock,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Though not a solution to your problem, I've had the same problem a while back, but I haven't solved it yet (it's not a priority problem for us currently (and luckily)).

I believe the 'easiest' options (for certain values of 'easy') would be
  • to learn how the pages are represented in the database and go for this
  • to change the pages through the API
  • to update the LAR and delete the user's communities so that the LAR will be copied during the next visit, just as if it was done for the first time
thumbnail
Imtiaz Ahmed,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Junior Member 帖子: 57 加入日期: 08-1-2 最近的帖子
Thanks for your reply but the problem is if I delete the community and recreate upon re-login, it will take away the customization of the users also which in my case is not acceptable. I've searched the forums and went through the Administrator Guide, but couldn't find anything useful.

We are migrating from Sun portal and does all that. So I am a little skeptical about Liferay regarding this basic feature.

Thanks,
Imtiaz
thumbnail
Lisa Simpson,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
It's not there... And you're not the only one who sees a need for it. Unfortunately, these guys don't think in terms of having to adjust hundreds of user communities or thousands of users. Doing it by hand is just not an acceptable method.
thumbnail
Imtiaz Ahmed,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Junior Member 帖子: 57 加入日期: 08-1-2 最近的帖子
I've solved it using a dirty method.

Now I make a database script to modify typeSetting column of layout table. But to be able to make it effective a server restart is required :s.

It's not much of a solution but works for me at this point in time. Please let me know if somebody has a better working solution.

Thanks,
Imtiaz
thumbnail
Minhchau Dang,修改在14 年前。

RE: Ability to push and remove portlets to user private pages based on org

Liferay Master 帖子: 598 加入日期: 07-10-22 最近的帖子
This shouldn't be difficult to do with a plugins SDK hook (though the solution is more roundabout than what an EXT customization would look like).

In a hook startup action, add some code which registers a MessageListener to a custom destination for the message bus.

Inside of the MessageListener for this custom destination, assume that the message contains the plid of a layout that was updated, and the group id for the user group corresponding to this layout. With this, you can retrieve the layout that was updated and the members of the corresponding user group.

Get the friendlyURL for the layout that was updated. For each member of the user group, retrieve their personal page with the same friendlyURL (if it does not exist, then create it). Compare the layout type settings for their personal page with the layout type settings of the layout that was updated and modify the layout type settings to include any portlets that are missing. Then update the user layout in the database.

The above logic is completely trivial (and extremely fast) if you disallow end-users from modifying the pages that are created by user group templates, since you can just run a SQL query using DBUtil.getInstance().runSQL() and then make a call to flush the layout cache.

To actually get this listener to do something (since a MessageListener that never receives messages will do nothing), create a ModelListener that listens to updates to the Layout table. Inside of this model listener's onAfterCreate and onAfterUpdate methods, check to see if the group corresponding to the layout is a user group. If it is, broadcast a message to the previously-noted custom destination containing the plid and the group id for the user group corresponding to this layout.

Basically what will happen once all of this is in place is that every time a user group layout is updated, the MessageListener will be notified, and the pages for all members of that user group will be updated asynchronously.

If you expect that people will touch the pages often over a short period of time (or you expect that there will be a lot of users in a given user group), you may want to add something to your message to keep things ordered, like a timestamp for when when everything occurs. That way, you can check against that timestamp in your MessageListener so that your solution is thread-safe.
Mohammed Shamshuddin,修改在12 年前。

RE: Ability to push and remove portlets to user private pages based on org

New Member 帖子: 4 加入日期: 11-10-25 最近的帖子
It's awesome , thank you very much Minhchau Dang. I have implemented it ,but bit different way.