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>
<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"
date="2013-01-13">
<Change>First Release</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-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>

View File

@ -68,6 +68,8 @@ public class SocialProfile implements EntryPoint {
socialService.getUserContext(getUserToShowId(), new AsyncCallback<UserContext>() {
@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) {

View File

@ -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

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.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 <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
* prevent cross-site script vulnerabilities.

View File

@ -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;
}

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

View File

@ -8,7 +8,7 @@
>
<portlet>
<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>
<init-param>
<name>view-jsp</name>
@ -19,9 +19,9 @@
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Social Profile</title>
<short-title>Social Profile</short-title>
<keywords>Social Profile</keywords>
<title>User Profile</title>
<short-title>User Profile</short-title>
<keywords>User Profile</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>