minor fixes

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/user-statistics@130549 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-19 14:25:41 +00:00
parent 8b140a9310
commit b48848f9df
1 changed files with 15 additions and 7 deletions

View File

@ -159,8 +159,10 @@ public class StatisticsPanel extends Composite {
//show loader, waiting for the answer coming by the server //show loader, waiting for the answer coming by the server
showLoader(); showLoader();
// does the profile belong to someone? (when we are on a profile page of someone other, we need /* 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) / 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(); final String userid = getUserToShowId();
// request user's information // request user's information
@ -187,10 +189,8 @@ public class StatisticsPanel extends Composite {
} }
// is a user profile page? // is a user profile page? or a vre/home one (this portlet can be also deployed in a vre)
final boolean isProfilePage = final boolean isProfilePage = isProfilePage();
Window.Location.getHref().endsWith("profile")
|| Window.Location.getHref().contains("profile?");
// check which kind of information we have to show // check which kind of information we have to show
isRoot = information.isRoot(); 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 // 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 the user is visiting his profile from within a vre, the checkbox WON'T be shown.
if(information.isOwner() && getUserToShowId() == null && isProfilePage){ if(information.isOwner() && getUserToShowId() == null && isProfilePage){
@ -801,4 +800,13 @@ public class StatisticsPanel extends Composite {
String encodedUserId = Window.Location.getParameter(encodedOid); String encodedUserId = Window.Location.getParameter(encodedOid);
return Encoder.decode(encodedUserId); 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?");
}
} }