Foros de discusión

Change user portrait from plugin portlet

thumbnail
Richard Gibson, modificado hace 12 años.

Change user portrait from plugin portlet

Junior Member Mensajes: 30 Fecha de incorporación: 19/02/10 Mensajes recientes
Hi,

I'm trying to use the standard Liferay link to change the current users portrait picture from my plugin portlet.

I have defined the following render URL which targets the Liferay ENTERPRISE_ADMIN portlet:

<liferay-portlet:renderurl portletname="<%=PortletKeys.ENTERPRISE_ADMIN %>" windowstate="<%= LiferayWindowState.POP_UP.toString() %>" var="editPortraitURL">
  <portlet:param name="struts_action" value="/enterprise_admin/edit_user_portrait" />
  <portlet:param name="redirect" value="<%= currentURL %>" />
  <portlet:param name="p_u_i_d" value="${user.userId }" />
  <portlet:param name="portrait_id" value="${user.portraitId }" />
</liferay-portlet:renderurl> 


This is then plugged into the logo-selector tag:

<liferay-ui:logo-selector defaultLogoURL="${portraitURL }" editLogoURL="${editUserPortraitURL }" imageId="${user.portraitId}" logoDisplaySelector=".user-logo" showBackground="${false }" />


When I click the 'change' link under the profile picture I get an error:

Portlet is temporarily unavailable.


Putting a break point on the enterprise admin portlet show that it is never getting called.

Anyone have any ideas what to do next, I don't want to replicate the code in edit_user_portrait in my own code.
thumbnail
Amos Fong, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
Hi Richard,

Is there any errors in the console log?
thumbnail
Richard Gibson, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 30 Fecha de incorporación: 19/02/10 Mensajes recientes
Amos Fong:

Is there any errors in the console log?


No, there is nothing appearing in the console at all when I click this link.
tom aronsons, modificado hace 12 años.

RE: Change user portrait from plugin portlet

New Member Mensajes: 21 Fecha de incorporación: 29/04/11 Mensajes recientes
Did you find an answer? I've tried everything. These things look so obvious that everyone who customize liferay would use it, but seems like no one knows how to do it.
thumbnail
Richard Gibson, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 30 Fecha de incorporación: 19/02/10 Mensajes recientes
No, I didn't find out how to do this, and there were no more suggestions from the Liferay staff.

You are right, these should all be in a common area that anyone developing plugin portlets can call into, not hidden away in the core of Liferay.
thumbnail
Sergio Cabrera, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 68 Fecha de incorporación: 19/12/11 Mensajes recientes
I don't know if you still need it, but it happens the same to me and i got it working changing to my_account:

<liferay-portlet:renderurl portletname="<%=PortletKeys.MY_ACCOUNT %>" windowstate="<%= LiferayWindowState.POP_UP.toString() %>" var="editPortraitURL">
  <portlet:param name="struts_action" value="/my_account/edit_user_portrait" />
  <portlet:param name="redirect" value="<%= currentURL %>" />
  <portlet:param name="p_u_i_d" value="${user.userId }" />
  <portlet:param name="portrait_id" value="${user.portraitId }" />
</liferay-portlet:renderurl> 
thumbnail
Oliver Teichmann, modificado hace 11 años.

RE: Change user portrait from plugin portlet

New Member Mensajes: 3 Fecha de incorporación: 13/04/11 Mensajes recientes
Hi,

how did you provide the changePortrait JavaScript method that is called after the save action?

I get the following error "opener._2_changePortrait is not a function"

The namespace of my_profile is used obviously.
thumbnail
Sergio Cabrera, modificado hace 11 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 68 Fecha de incorporación: 19/12/11 Mensajes recientes
I have this code in the opener:


		function _no_namespace_changePortrait(newPortraitURL, newPortraitId) {
		
			<portlet:namespace />portraitId_var = newPortraitId;
			
			var A = AUI();
	
			A.one('#<portlet:namespace />avatar').attr('src', newPortraitURL);
			A.one('.avatar').attr('src', newPortraitURL);
	
			A.one('#<portlet:namespace />deletePortrait').val(false);
		
		}
thumbnail
Rohit Salecha, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 50 Fecha de incorporación: 21/02/11 Mensajes recientes
for Liferay Alloy UI

http://liferaydemystified.blogspot.com/2011/04/mvcportlet-framework.html

for liferay ui taglib

http://liferaydemystified.blogspot.com/2011/05/liferay-ui-tabs.html
thumbnail
Richard Gibson, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Junior Member Mensajes: 30 Fecha de incorporación: 19/02/10 Mensajes recientes
Thanks for the links, but how do those help with this error?
tom aronsons, modificado hace 12 años.

RE: Change user portrait from plugin portlet

New Member Mensajes: 21 Fecha de incorporación: 29/04/11 Mensajes recientes
I'm wondering if we have to build our portlets in struts extension in order to use pages from liferay core.
thumbnail
jelmer kuperus, modificado hace 12 años.

RE: Change user portrait from plugin portlet

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
I imagine you would have to add the portlet id of the enterprise admin portlet (id 79) to the resource check whitelist

eg add the following line to portal-ext.properties

portlet.add.default.resource.check.whitelist=58,86,87,88,103,113,145,79
tom aronsons, modificado hace 12 años.

RE: Change user portrait from plugin portlet

New Member Mensajes: 21 Fecha de incorporación: 29/04/11 Mensajes recientes
Nope