diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java index 5d95aae..38dab29 100644 --- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java +++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java @@ -159,8 +159,10 @@ public class StatisticsPanel extends Composite { //show loader, waiting for the answer coming by the server showLoader(); - // does the profile belong to someone? (when we are on a profile page of someone other, we need - // to retrieve the statistics of that person) + /* does the profile belong to someone? (when we are on a profile page of someone other, we need + / to retrieve the statistics of that person).. if it is null or empty, the current user's information + / will be retrieved. + */ final String userid = getUserToShowId(); // request user's information @@ -187,10 +189,8 @@ public class StatisticsPanel extends Composite { } - // is a user profile page? - final boolean isProfilePage = - Window.Location.getHref().endsWith("profile") - || Window.Location.getHref().contains("profile?"); + // is a user profile page? or a vre/home one (this portlet can be also deployed in a vre) + final boolean isProfilePage = isProfilePage(); // check which kind of information we have to show isRoot = information.isRoot(); @@ -461,7 +461,6 @@ public class StatisticsPanel extends Composite { }); - // check if we need to show the checkbox to allow the user's profile owner to edit privacy options // If the user is visiting his profile from within a vre, the checkbox WON'T be shown. if(information.isOwner() && getUserToShowId() == null && isProfilePage){ @@ -801,4 +800,13 @@ public class StatisticsPanel extends Composite { String encodedUserId = Window.Location.getParameter(encodedOid); return Encoder.decode(encodedUserId); } + + /** + * The user-statistics can be deployed in a vre, within the home or in a profile page + * @return true if the current page is a profile page, false otherwise + */ + private boolean isProfilePage() { + return Window.Location.getHref().endsWith("profile") + || Window.Location.getHref().contains("profile?"); + } }