Skip to content

Instantly share code, notes, and snippets.

@evaldeslacasa
Created January 28, 2015 22:42
Show Gist options
  • Save evaldeslacasa/e13da74b5c48dceb57ca to your computer and use it in GitHub Desktop.
Save evaldeslacasa/e13da74b5c48dceb57ca to your computer and use it in GitHub Desktop.
Add pop up URLs for each user displayed in a search container column text (URLs stored in an arraylist)
<%
List<String> popUpURLs = new ArrayList();
for(String userId:userIds){
User user = UserLocalServiceUtil.getUser(Long.valueOf(userId));
%>
<portlet:renderURL var="viewUserPopUp" windowState="pop_up">
<portlet:param name="userId"
value="<%=String.valueOf(user.getUserId())%>" />
<portlet:param name="page" value="display_user" />
</portlet:renderURL>
<%
String popUpURL = "javascript:openSizedPopup('"
+ viewUserPopUp + "','User Details',640)";
popUpURLs.add(popUpURL);
}
%>
<liferay-ui:search-container-column-text
buffer="buffer"
name="User Name"
orderable="<%= true %>"
orderableProperty="userName" >
<%
for(int i=0; i<userIdsArray.length; i++){
String userId = userIdsArray[i];
User student = UserLocalServiceUtil.getUser(Long.valueOf(userId));
buffer.append("<span class=\"user-name\" id=\"");
buffer.append(userId);
buffer.append("\">");
buffer.append("<a href=\"" + popUpURLs.get(i) + "\">");
buffer.append(LanguageUtil.get(pageContext,user.getFullName()));
buffer.append("</a>");
buffer.append("</span>");
if(i < (userIdsArray.length-1)){
buffer.append("<br/>");
}
}
%>
</liferay-ui:search-container-column-text>
@evaldeslacasa
Copy link
Author

Liferay includes the javascript:openSizedPopup(url,title,width) for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment