From e24e5ee7450d2d24b25fba8e4bf918b8c05c6206 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 24 Feb 2017 16:32:50 +0000 Subject: [PATCH] the list of the Sites now depends on the portal (virtualhost) git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/liferay62-plugins/social-dockbar-hook@144285 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 8 +--- .../WEB-INF/liferay-plugin-package.properties | 2 +- .../portlet/dockbar/custom_dockbar_view.jspf | 2 + .../html/taglib/ui/my_sites/page.jsp | 48 ++++++++++++++----- 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.classpath b/.classpath index 0f4a4c2..763377f 100644 --- a/.classpath +++ b/.classpath @@ -11,13 +11,7 @@ - - - - - - - + diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties index f954efb..d1b1773 100644 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -1,6 +1,6 @@ name=social-dockbar-hook module-group-id=liferay -module-incremental-version=3 +module-incremental-version=4 tags= short-description= change-log= diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf index b038226..c55ac32 100644 --- a/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf @@ -175,6 +175,7 @@ if (themeDisplay.isSignedIn()) { }); +
<% } %> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp b/src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp index 5709b8f..e12fc8e 100644 --- a/src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp +++ b/src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp @@ -16,6 +16,10 @@ <%@page import="java.util.ArrayList"%> <%@ include file="/html/taglib/init.jsp"%> +<%@ page import="org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager" %> +<%@ page import="org.gcube.vomanagement.usermanagement.model.VirtualGroup" %> +<%@ page import="org.gcube.vomanagement.usermanagement.util.ManagementUtils" %> +<%@ page import="java.util.Collections" %> <% String[] classNames = (String[]) request @@ -31,31 +35,49 @@ if (max <= 0) { max = PropsValues.MY_SITES_MAX_ELEMENTS; } +/* EDIT For Custom Go To Panel */ + Set customSiteGroups = new HashSet(); + List mySiteGroups = new ArrayList(); boolean isAdmin = false, isSiteAdmin = false; + //get the list of VREs available on this virtual host (customSiteGroups) + String serverName = request.getServerName(); + LiferayGroupManager gm = new LiferayGroupManager(); + List currSiteVirtualGroups = gm.getVirtualGroups(ManagementUtils.getSiteGroupIdFromServletRequest(serverName)); + for (Group userGroup : user.getMySiteGroups(classNames, includeControlPanel, max)) { + if (userGroup.getChildren(true).isEmpty() && userGroup.getParentGroup() != null && (userGroup.getFriendlyURL().compareTo("/data-e-infrastructure-gateway") != 0) ) { + for (VirtualGroup currSiteVGroup : currSiteVirtualGroups) { + List vGroups = gm.getVirtualGroups(userGroup.getGroupId()); + for (VirtualGroup virtualGroup : vGroups) { + if (virtualGroup.getName().compareTo(currSiteVGroup.getName()) == 0) { + customSiteGroups.add(userGroup); + } + } + } + } + } + //if the user is administrator we add the VOs and Root VO for (Role role : user.getRoles()) { if ("Administrator".equals(role.getName())) { isAdmin = true; - mySiteGroups = user.getMySiteGroups(classNames, - includeControlPanel, max); + for (Group site: user.getMySiteGroups(classNames, includeControlPanel, max)) { + //if is not a VRE + if (! site.getChildren(true).isEmpty() && (site.getFriendlyURL().compareTo("/data-e-infrastructure-gateway") != 0) ) + customSiteGroups.add(site); + } break; } } + //copy the set into the expected list + mySiteGroups.addAll(customSiteGroups); + + Collections.sort(mySiteGroups); + - if (! isAdmin) { - try { - for (Group group : user.getMySiteGroups(classNames, includeControlPanel, max)) { - if (group.getChildren(true).isEmpty() && (group.getFriendlyURL().compareTo("/data-e-infrastructure-gateway") != 0) ) { - mySiteGroups.add(group); - } - } - } catch (SystemException e1) { - e1.printStackTrace(); - } - } + /*End Edit */ %>