added descriptors for SA

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@99614 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-09-09 12:48:47 +00:00
parent 800609161c
commit 7d97a0c112
7 changed files with 69 additions and 32 deletions

View File

@ -1,18 +1,24 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlet.user.socialprofile.1-0-0"
date="2014-09-09">
<Change>Added professional background feature and added import profile from LinkedIn or manual option</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-4-0"
date="2014-06-09">
<Change>Adapted to the new portal gCore Free</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-3-0"
date="2013-07-18">
<Change>Ported to GWT 251</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-2-0"
date="2013-07-18">
<Change>Added editing features for Professional Headline, Photo and
Company
</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-1-0" <Changeset component="org.gcube.portlet.user.socialprofile.0-1-0"
date="2013-01-13"> date="2013-01-13">
<Change>First Release</Change> <Change>First Release</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-2-0"
date="2013-07-18">
<Change>Added editing features for Professional Headline, Photo and Company</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-3-0"
date="2013-07-18">
<Change>Ported to GWT 251</Change>
</Changeset>
<Changeset component="org.gcube.portlet.user.socialprofile.0-4-0"
date="2014-06-09">
<Change>Adapted to the new portal gCore Free</Change>
</Changeset>
</ReleaseNotes> </ReleaseNotes>

View File

@ -68,6 +68,8 @@ public class SocialProfile implements EntryPoint {
socialService.getUserContext(getUserToShowId(), new AsyncCallback<UserContext>() { socialService.getUserContext(getUserToShowId(), new AsyncCallback<UserContext>() {
@Override @Override
public void onSuccess(UserContext result) { public void onSuccess(UserContext result) {
if (!result.isInfrastructure())
RootPanel.get("SocialProfileDiv").setStyleName("frame-social");
mainPanel.add(dispProfile); mainPanel.add(dispProfile);
dispProfile.show(result); dispProfile.show(result);
if (result.getSummary() != null && result.getSummary().compareTo("") != 0) { if (result.getSummary() != null && result.getSummary().compareTo("") != 0) {

View File

@ -33,8 +33,10 @@ import com.google.gwt.user.client.ui.Widget;
public class DisplayProfile extends Composite { public class DisplayProfile extends Composite {
protected final static String HEADLINE_TEXT = "Professional Headline"; protected final static String HEADLINE_TEXT = "Professional Headline";
protected final static String HEADLINE_ERROR = "Your Headline please"; 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"; 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 final static String D4S_APP_ID = "77n7r4c9nwuwk2";
private static DisplayProfileUiBinder uiBinder = GWT private static DisplayProfileUiBinder uiBinder = GWT
@ -107,13 +109,13 @@ public class DisplayProfile extends Composite {
institutionLabel.setText(isti); institutionLabel.setText(isti);
editHeadline.setStyleName("editImage"); 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.setStyleName("editImage");
editIsti.setTitle("Edit your Company"); editIsti.setTitle("Edit location or industry");
headlineBox.setMaxLength(70); headlineBox.setMaxLength(100);
institutionBox.setMaxLength(70); institutionBox.setMaxLength(100);
messageButton.removeFromParent(); messageButton.removeFromParent();
currHeadLine = head; currHeadLine = head;
@ -126,7 +128,7 @@ public class DisplayProfile extends Composite {
editButton.addClickHandler(new ClickHandler() { editButton.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { 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 //TODO: make it a runtime resource
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
String OAUTH2_SERVICE = "https://www.linkedin.com/uas/oauth2/authorization?response_type=code";
String controlSequence = getRandomString(); String controlSequence = getRandomString();
//needed to prevent Cross Site Request Forgery attacks //needed to prevent Cross Site Request Forgery attacks

View File

@ -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.ServiceEndpoint.Property;
import org.gcube.common.resources.gcore.utils.XPathHelper; import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider; 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.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portal.databook.shared.UserInfo;
@ -75,7 +77,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
if (user == null) { if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL"); _log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
user = getDevelopmentUser(); user = getDevelopmentUser();
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube"); SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec");
} }
return SessionManager.getInstance().getASLSession(sessionID, user); return SessionManager.getInstance().getASLSession(sessionID, user);
} }
@ -134,7 +136,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
String company = theUser.getOpenId(); String company = theUser.getOpenId();
String summary = getSummary(theUser); 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) { } catch (Exception e) {
e.printStackTrace(); 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); UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
return new UserContext(user, "", "", "" 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." + "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 company = theUser.getOpenId();
String summary = getSummary(theUser); 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 { else {
_log.info("Returning test USER"); _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); UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
return new UserContext(user, "", "", "" 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." + "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) { } catch (Exception e) {
@ -465,7 +467,14 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
} }
else return null; else return null;
} }
/**
* Indicates whether the scope is the whole infrastructure.
* @return <code>true</code> if it is, <code>false</code> 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 * Escape an html string. Escaping data received from the client helps to
* prevent cross-site script vulnerabilities. * prevent cross-site script vulnerabilities.

View File

@ -11,14 +11,15 @@ public class UserContext implements Serializable {
private String institution; private String institution;
private String summary; private String summary;
private String currentScope; private String currentScope;
boolean isOwner; private boolean isInfrastructure;
private boolean isOwner;
public UserContext() { public UserContext() {
super(); super();
} }
public UserContext(UserInfo userInfo, String headline, String institution, public UserContext(UserInfo userInfo, String headline, String institution,
String summary, String currentScope, boolean isOwner) { String summary, String currentScope, boolean isOwner, boolean isInfrastructure) {
super(); super();
this.userInfo = userInfo; this.userInfo = userInfo;
this.headline = headline; this.headline = headline;
@ -26,6 +27,7 @@ public class UserContext implements Serializable {
this.summary = summary; this.summary = summary;
this.currentScope = currentScope; this.currentScope = currentScope;
this.isOwner = isOwner; this.isOwner = isOwner;
this.isInfrastructure = isInfrastructure;
} }
@ -67,6 +69,14 @@ public class UserContext implements Serializable {
public void setSummary(String summary) { public void setSummary(String summary) {
this.summary = summary; this.summary = summary;
} }
public boolean isInfrastructure() {
return isInfrastructure;
}
public void setInfrastructure(boolean isInfrastructure) {
this.isInfrastructure = isInfrastructure;
}

View File

@ -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 { .profile-section {
margin: 0px 5px 5px; margin: 0px 5px 5px;
@ -49,6 +57,7 @@
border: 1px solid #999 !important; border: 1px solid #999 !important;
cursor: text !important; cursor: text !important;
opacity: 1.0 !important; opacity: 1.0 !important;
width: 250px;
} }
.headline { .headline {

View File

@ -8,7 +8,7 @@
> >
<portlet> <portlet>
<portlet-name>SocialProfile</portlet-name> <portlet-name>SocialProfile</portlet-name>
<display-name>Social Profile</display-name> <display-name>User Profile</display-name>
<portlet-class>org.gcube.portlets.user.socialprofile.server.portlet.SocialProfilePortlet</portlet-class> <portlet-class>org.gcube.portlets.user.socialprofile.server.portlet.SocialProfilePortlet</portlet-class>
<init-param> <init-param>
<name>view-jsp</name> <name>view-jsp</name>
@ -19,9 +19,9 @@
<mime-type>text/html</mime-type> <mime-type>text/html</mime-type>
</supports> </supports>
<portlet-info> <portlet-info>
<title>Social Profile</title> <title>User Profile</title>
<short-title>Social Profile</short-title> <short-title>User Profile</short-title>
<keywords>Social Profile</keywords> <keywords>User Profile</keywords>
</portlet-info> </portlet-info>
<security-role-ref> <security-role-ref>
<role-name>administrator</role-name> <role-name>administrator</role-name>