Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jonathan Pecoraro
Render Edit Account Portlet From Custom Portlet
May 24, 2011 6:02 PM
Answer

Jonathan Pecoraro

Rank: New Member

Posts: 11

Join Date: January 17, 2011

Recent Posts

Hello,

I need some help rendering one of Liferay's built-in portlets from my own portlet. The liferay-portlet.xml file does not seem to set up a friendly URL link to this portlet and I can't really use IPC because I can't see any events that this portlet listens for.

This is what is set up:
I have a custom portlet that displays all deactivated users. From that portlet I provide the user with the ability to Activate and Delete the selected user. This is all working properly.

This is the problem:
I would like to add the ability to edit the selected user. I need to set up a link that renders the administrator's Edit Account page from within my portlet. For clarification, the page I'm trying to render is found like this: from the dockbar, select Manage --> Control Panel --> Users. Then either select Edit from the actions menu or click the link on a user's name. Here is some code from the JSP where I'm trying to link to the Edit Account page:

 1
 2<liferay-ui:icon-menu>
 3    <c:if test="<%= permissionChecker.hasPermission(groupId, name, primaryKey, ActionKeys.UPDATE) %>">
 4        <portlet:actionURL name="activateUser" var="activateURL">
 5            <portlet:param name="resourcePrimaryKey" value="<%= primaryKey %>" />
 6        </portlet:actionURL>
 7       
 8        <liferay-ui:icon image="activate" url="<%= activateURL %>" />
 9
10<%--
11This section is commented out. I would like to put the edit link here. This section holds some different attempts that have been tried.   
12        <%
13        long myAccountPlId = PortalUtil.getPlidFromPortletId(groupId, PortletKeys.ENTERPRISE_ADMIN_USERS);
14        PortletURL editURL = PortletURLFactoryUtil.create(request, PortletKeys.MY_ACCOUNT, myAccountPlId, PortletRequest.RENDER_PHASE);
15        editURL.setParameter("struts_action", "/my_account/edit_user");
16        editURL.setParameter("redirect", redirect);
17        editURL.setParameter("p_u_i_d", String.valueOf(currentUser.getUserId()));
18        %>
19               
20        <portlet:renderURL var="editURL">
21            <portlet:param name="jspPage" value="/enterprise_admin_users/edit_user" />
22            <portlet:param name="redirect" value="<%= redirect %>" />
23            <portlet:param name="p_u_i_d" value="<%= String.valueOf(currentUser.getUserId()) %>" />
24        </portlet:renderURL>       
25
26        <liferay-ui:icon image="edit" url="<%= editURL %>" />
27        <a href="<%= editURL %>">Edit</a>
28--%>
29
30    </c:if>
31    <c:if test="<%= permissionChecker.hasPermission(groupId, name, primaryKey, ActionKeys.DELETE) %>">   
32        <portlet:actionURL name="deleteUser" var="deleteURL">
33            <portlet:param name="resourcePrimaryKey" value="<%= primaryKey %>" />
34        </portlet:actionURL>
35       
36        <liferay-ui:icon-delete url="<%= deleteURL.toString() %>" />
37    </c:if>
38</liferay-ui:icon-menu>


Thank you in advance.


A picture of the portlet is attached.
Attachment

Attachments: viewDeactivatedUsers.jpg (32.6k)
Corné Aussems
RE: Render Edit Account Portlet From Custom Portlet
May 26, 2011 2:15 PM
Answer

Corné Aussems

Rank: Liferay Legend

Posts: 1285

Join Date: October 3, 2006

Recent Posts

The Action you are looking for is this taken from user_action.jsp
1
2        <portlet:renderURL var="editUserURL">
3            <portlet:param name="struts_action" value="/enterprise_admin/edit_user" />
4            <portlet:param name="redirect" value="<%= redirect %>" />
5            <portlet:param name="p_u_i_d" value="<%= String.valueOf(userId) %>" />
6        </portlet:renderURL>


But i think you only will be able to access this when you are building your porltet into Liferay as opposed to a Plugin
Jonathan Pecoraro
RE: Render Edit Account Portlet From Custom Portlet
May 27, 2011 9:37 PM
Answer

Jonathan Pecoraro

Rank: New Member

Posts: 11

Join Date: January 17, 2011

Recent Posts

Thank you Corné,

You are correct, I'm not able to render the Edit Account portlet from within my protlet plugin by using the method above.
Tanaji Londhe
RE: Render Edit Account Portlet From Custom Portlet
April 1, 2013 3:34 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Jonathan,
Did you get the solution for edit particular user. I am having same requirement.
I want to create url for particular user in jsp page.