diff --git a/distro/changelog.xml b/distro/changelog.xml index 3790d6b..3f16a47 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,18 +1,24 @@ + + Added professional background feature and added import profile from LinkedIn or manual option + + + Adapted to the new portal gCore Free + + + Ported to GWT 251 + + + Added editing features for Professional Headline, Photo and + Company + + First Release - - Added editing features for Professional Headline, Photo and Company - - - Ported to GWT 251 - - - Adapted to the new portal gCore Free - diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java index edd6592..536fd21 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/SocialProfile.java @@ -68,6 +68,8 @@ public class SocialProfile implements EntryPoint { socialService.getUserContext(getUserToShowId(), new AsyncCallback() { @Override public void onSuccess(UserContext result) { + if (!result.isInfrastructure()) + RootPanel.get("SocialProfileDiv").setStyleName("frame-social"); mainPanel.add(dispProfile); dispProfile.show(result); if (result.getSummary() != null && result.getSummary().compareTo("") != 0) { diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java index 8de2f75..1a198f1 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/client/ui/DisplayProfile.java @@ -33,8 +33,10 @@ import com.google.gwt.user.client.ui.Widget; public class DisplayProfile extends Composite { protected final static String HEADLINE_TEXT = "Professional Headline"; protected final static String HEADLINE_ERROR = "Your Headline please"; - protected final static String ISTI_TEXT = "Company"; + protected final static String ISTI_TEXT = "Location and/or industry"; protected final static String ISTI_ERROR = "Your Company please"; + private final static String OAUTH2_SERVICE = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code"; + private final static String EDIT_PROFILE_LR_URL = "/group/control_panel/manage?p_p_id=2#_LFR_FN_comments"; private final static String D4S_APP_ID = "77n7r4c9nwuwk2"; private static DisplayProfileUiBinder uiBinder = GWT @@ -107,13 +109,13 @@ public class DisplayProfile extends Composite { institutionLabel.setText(isti); editHeadline.setStyleName("editImage"); - editHeadline.setTitle("Edit your Professional Headline"); + editHeadline.setTitle("Edit your Professional Headline (e.g. Researcher at University of ..."); editIsti.setStyleName("editImage"); - editIsti.setTitle("Edit your Company"); + editIsti.setTitle("Edit location or industry"); - headlineBox.setMaxLength(70); - institutionBox.setMaxLength(70); + headlineBox.setMaxLength(100); + institutionBox.setMaxLength(100); messageButton.removeFromParent(); currHeadLine = head; @@ -126,7 +128,7 @@ public class DisplayProfile extends Composite { editButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { - Location.assign("/group/control_panel/manage?p_p_id=2#_LFR_FN_comments"); + Location.assign(EDIT_PROFILE_LR_URL); } }); @@ -135,7 +137,6 @@ public class DisplayProfile extends Composite { //TODO: make it a runtime resource @Override public void onClick(ClickEvent event) { - String OAUTH2_SERVICE = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code"; String controlSequence = getRandomString(); //needed to prevent Cross Site Request Forgery attacks diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java b/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java index e000850..bf58e3a 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/server/SocialServiceImpl.java @@ -32,6 +32,8 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.resources.gcore.ServiceEndpoint.Property; import org.gcube.common.resources.gcore.utils.XPathHelper; import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.common.scope.impl.ScopeBean; +import org.gcube.common.scope.impl.ScopeBean.Type; import org.gcube.portal.custom.communitymanager.OrganizationsUtil; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portal.databook.shared.UserInfo; @@ -75,7 +77,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer if (user == null) { _log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL"); user = getDevelopmentUser(); - SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube"); + SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec"); } return SessionManager.getInstance().getASLSession(sessionID, user); } @@ -134,7 +136,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer String company = theUser.getOpenId(); String summary = getSummary(theUser); - return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true); + return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope()); } catch (Exception e) { e.printStackTrace(); @@ -149,7 +151,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames); return new UserContext(user, "", "", "" + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam." - + "", session.getScopeName(), true); + + "", session.getScopeName(), true, isInfrastructureScope() ); } } @@ -177,7 +179,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer String company = theUser.getOpenId(); String summary = getSummary(theUser); - return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true); + return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope() ); } else { _log.info("Returning test USER"); @@ -188,7 +190,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames); return new UserContext(user, "", "", "" + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam." - + "", session.getScopeName(), true); + + "", session.getScopeName(), true, isInfrastructureScope() ); } } catch (Exception e) { @@ -465,7 +467,14 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer } else return null; } - + /** + * Indicates whether the scope is the whole infrastructure. + * @return true if it is, false otherwise. + */ + private boolean isInfrastructureScope() { + ScopeBean scope = new ScopeBean(getASLSession().getScope()); + return scope.is(Type.INFRASTRUCTURE); + } /** * Escape an html string. Escaping data received from the client helps to * prevent cross-site script vulnerabilities. diff --git a/src/main/java/org/gcube/portlets/user/socialprofile/shared/UserContext.java b/src/main/java/org/gcube/portlets/user/socialprofile/shared/UserContext.java index d21c570..c0e7421 100644 --- a/src/main/java/org/gcube/portlets/user/socialprofile/shared/UserContext.java +++ b/src/main/java/org/gcube/portlets/user/socialprofile/shared/UserContext.java @@ -11,14 +11,15 @@ public class UserContext implements Serializable { private String institution; private String summary; private String currentScope; - boolean isOwner; + private boolean isInfrastructure; + private boolean isOwner; public UserContext() { super(); } public UserContext(UserInfo userInfo, String headline, String institution, - String summary, String currentScope, boolean isOwner) { + String summary, String currentScope, boolean isOwner, boolean isInfrastructure) { super(); this.userInfo = userInfo; this.headline = headline; @@ -26,6 +27,7 @@ public class UserContext implements Serializable { this.summary = summary; this.currentScope = currentScope; this.isOwner = isOwner; + this.isInfrastructure = isInfrastructure; } @@ -67,6 +69,14 @@ public class UserContext implements Serializable { public void setSummary(String summary) { this.summary = summary; } + + public boolean isInfrastructure() { + return isInfrastructure; + } + + public void setInfrastructure(boolean isInfrastructure) { + this.isInfrastructure = isInfrastructure; + } diff --git a/src/main/webapp/SocialProfile.css b/src/main/webapp/SocialProfile.css index 71d0602..2785970 100644 --- a/src/main/webapp/SocialProfile.css +++ b/src/main/webapp/SocialProfile.css @@ -1,4 +1,12 @@ - +.frame-social { + padding: 10px; + margin: 5px 0 0 10px; + background-color: #FFF; + border-radius: 6px !important; + -moz-border-radius: 6px !important; + -webkit-border-radius: 6px !important; + border: 1px solid #DBDBDB; +} .profile-section { margin: 0px 5px 5px; @@ -49,6 +57,7 @@ border: 1px solid #999 !important; cursor: text !important; opacity: 1.0 !important; + width: 250px; } .headline { diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml index c58bb49..098d012 100644 --- a/src/main/webapp/WEB-INF/portlet.xml +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -8,7 +8,7 @@ > SocialProfile - Social Profile + User Profile org.gcube.portlets.user.socialprofile.server.portlet.SocialProfilePortlet view-jsp @@ -19,9 +19,9 @@ text/html - Social Profile - Social Profile - Social Profile + User Profile + User Profile + User Profile administrator