diff --git a/pom.xml b/pom.xml
index 9f4c32a..5f07325 100644
--- a/pom.xml
+++ b/pom.xml
@@ -161,6 +161,11 @@
callout-tour
[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+
+ org.gcube.common.portal
+ portal-manager
+ provided
+
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 6f41c0d..551cbd8 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
@@ -16,8 +16,10 @@ import org.gcube.portlets.widgets.widgettour.client.extendedclasses.GCubeTour;
import com.ait.toolkit.hopscotch.client.Placement;
import com.ait.toolkit.hopscotch.client.TourStep;
+import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
+import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -73,9 +75,18 @@ public class StatisticsPanel extends Composite {
private final static String PROFILE_STRENGTH_LABEL = "Profile Strength";
/**
- * profile url
+ * improve profile hints
*/
- private final static String profileAccount = "/group/data-e-infrastructure-gateway/profile";
+ public static String IMPROVE_PROFILE_HINT_MESSAGE_ROOT = "You can improve your profile strength by: "
+ + "- adding a job title, your current position or your professional summary;"
+ + "
- adding your contact information (facebook, linkedin, skype, google mail and so on).
";
+
+ /**
+ * improve profile hints
+ */
+ public static final String IMPROVE_PROFILE_HINT_MESSAGE_PROFILE = "You can improve your profile strength by: "
+ + "- adding a job title, your current position or your professional summary;"
+ + "
- adding your contact information (facebook, linkedin, skype, google mail and so on).
";
/**
* profile button label
@@ -249,6 +260,10 @@ public class StatisticsPanel extends Composite {
}
+ // save page landing
+ if(information.getCurrentPageLanding() != null)
+ IMPROVE_PROFILE_HINT_MESSAGE_ROOT += "Go to your profile";
+
// user image
Images image = GWT.create(Images.class);
Image userImage = new Image(image.avatarLoader());
@@ -388,8 +403,13 @@ public class StatisticsPanel extends Composite {
// in case too low information within the user profile
if(profileStrengthInt < profileImproveThreshold && information.isOwner()){
+ // Show an alert block in which underline how he can improve the profile
+ final AlertBlock improveProfileHint = new AlertBlock();
+ improveProfileHint.setType(AlertType.INFO);
+ improveProfileHint.addStyleName("improve-profile-hint-message");
+
final Button improveProfileButton = new Button(IMPROVE_BUTTON_LABEL);
- improveProfileButton.setType(ButtonType.WARNING);
+ improveProfileButton.setType(ButtonType.INFO);
improveProfileButton.setTitle("Improve your profile.");
improveProfileButton.addClickHandler(new ClickHandler() {
@@ -397,8 +417,12 @@ public class StatisticsPanel extends Composite {
@Override
public void onClick(ClickEvent arg0) {
- // redirect
- Window.Location.assign(profileAccount);
+ // set text according current url
+ if(isProfilePage)
+ improveProfileHint.setHTML(IMPROVE_PROFILE_HINT_MESSAGE_PROFILE);
+ else
+ improveProfileHint.setHTML(IMPROVE_PROFILE_HINT_MESSAGE_ROOT);
+ mainPanel.add(improveProfileHint);
}
});
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
index c40ad71..70a79fe 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
@@ -9,6 +9,7 @@ import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
+import org.gcube.common.portal.PortalContext;
import org.gcube.portal.custom.communitymanager.SiteManagerUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
@@ -308,8 +309,13 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
actualVre = temp[temp.length - 1];
}
+
+ // page landing
+ String pageLanding = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest());
- return new UserInformation(isInfrastructure, thumbnailURL, userName, actualVre, isOwner, isProfileShowable);
+ UserInformation bean = new UserInformation(isInfrastructure, thumbnailURL, userName, actualVre, isOwner, isProfileShowable);
+ bean.setCurrentPageLanding(pageLanding);
+ return bean;
}
else return new UserInformation(true, null, userName, vreID, true, true);
}
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/UserInformation.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/UserInformation.java
index 57e432b..824044f 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/UserInformation.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/UserInformation.java
@@ -26,6 +26,8 @@ public class UserInformation implements Serializable {
// If the visiting user is the owner of the page, there is no proble
// if the visiting user is not the owner and the real owner doesn't want
// to show the portlet to the other users, we need to hide the statistics.
+
+ private String currentPageLanding;
public UserInformation(){
super();
@@ -41,7 +43,14 @@ public class UserInformation implements Serializable {
this.isOwner = isOwner;
this.isProfileShowable = isProfileShowable;
}
+
+ public String getCurrentPageLanding() {
+ return currentPageLanding;
+ }
+ public void setCurrentPageLanding(String currentPageLanding) {
+ this.currentPageLanding = currentPageLanding;
+ }
public boolean isRoot() {
return isRoot;
@@ -100,6 +109,7 @@ public class UserInformation implements Serializable {
return "UserInformation [isRoot=" + isRoot + ", urlAvatar=" + urlAvatar
+ ", aslSessionUsername=" + aslSessionUsername + ", actualVre="
+ actualVre + ", isOwner=" + isOwner + ", isProfileShowable="
- + isProfileShowable + "]";
+ + isProfileShowable + ", currentPageLanding="
+ + currentPageLanding + "]";
}
}
diff --git a/src/main/webapp/Statistics.css b/src/main/webapp/Statistics.css
index a934640..a3c557e 100644
--- a/src/main/webapp/Statistics.css
+++ b/src/main/webapp/Statistics.css
@@ -64,4 +64,9 @@
.privacy-checkbox-statistics-style {
margin-top: 10px;
+}
+
+.improve-profile-hint-message {
+ margin-top: 15px !important;
+ padding: 25px !important;
}
\ No newline at end of file