From 57e7074ccebf31cba063fbed0b47c4386aa0282b Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 25 Jul 2016 16:13:44 +0000 Subject: [PATCH] added hook for displaying VO and rootVO only to portal Administrators git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/liferay62-plugins/social-dockbar-hook@130788 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../portlet/dockbar/custom_dockbar_view.jspf | 4 +- .../html/taglib/ui/my_sites/page.jsp | 520 ++++++++++++++++++ 2 files changed, 522 insertions(+), 2 deletions(-) create mode 100644 src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp 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 28f98be..05be1b9 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 @@ -21,7 +21,7 @@ }, function(responseText) { }); - //then repeat every 1.5 minutes + //then repeat every 3 minutes setInterval(function() { var username = "<%=themeDisplay.getUser().getScreenName()%>"; var location = window.location.href; @@ -29,7 +29,7 @@ userid : username, location : location }, function(responseText) { }); - }, 90000); + }, 240000); //search box keyboard handlers $('#searchbox').bind("enterKey",function(e){ 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 new file mode 100644 index 0000000..bc88287 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/taglib/ui/my_sites/page.jsp @@ -0,0 +1,520 @@ +<%-- +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +--%> + +<%@page import="java.util.ArrayList"%> +<%@ include file="/html/taglib/init.jsp"%> + +<% + String[] classNames = (String[]) request + .getAttribute("liferay-ui:my_sites:classNames"); + String cssClass = GetterUtil.getString((String) request + .getAttribute("liferay-ui:my_sites:cssClass")); + boolean includeControlPanel = GetterUtil + .getBoolean((String) request + .getAttribute("liferay-ui:my_sites:includeControlPanel")); + int max = GetterUtil.getInteger((String) request + .getAttribute("liferay-ui:my_sites:max")); + + if (max <= 0) { + max = PropsValues.MY_SITES_MAX_ELEMENTS; + } + + List mySiteGroups = new ArrayList(); + + boolean isAdmin = false, isSiteAdmin = false; + + for (Role role : user.getRoles()) { + if ("Administrator".equals(role.getName())) { + isAdmin = true; + mySiteGroups = user.getMySiteGroups(classNames, + includeControlPanel, max); + break; + } + } + + if (! isAdmin) { + for (Group group : user.getMySiteGroups(classNames, includeControlPanel, max)) { + if (group.getChildren(true).isEmpty()) { + mySiteGroups.add(group); + } + } + } +%> + + + + \ No newline at end of file