updated for displaying the background summary
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@98905 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b7de7ce4bd
commit
c38ed814d1
14
.classpath
14
.classpath
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/social-profile-0.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/social-profile-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -24,16 +24,16 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/social-profile-0.4.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/social-profile-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/social-profile/target/social-profile-0.4.0-SNAPSHOT
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/social-profile/target/social-profile-1.0.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#Thu Jan 31 19:07:16 CET 2013
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<dependent-module archiveName="wsmail-widget-1.7.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/wsmail-widget/wsmail-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="session-checker-0.2.5-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="workspace-light-tree-2.13.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree/workspace-light-tree">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="java" version="1.6"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
</faceted-project>
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>social-profile</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>0.4.0-SNAPSHOT</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>gCube Social Profile Portlet</name>
|
||||
<description>
|
||||
Social Profile
|
||||
|
@ -27,9 +27,8 @@
|
|||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.5.1</gwtVersion>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<maven.compiler.source>1.6</maven.compiler.source>
|
||||
<maven.compiler.target>1.6</maven.compiler.target>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -86,11 +85,13 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>wsmail-widget</artifactId>
|
||||
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-light-tree</artifactId>
|
||||
<version>[2.13.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
|
@ -159,8 +160,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- SA Plugin -->
|
||||
|
|
|
@ -1,19 +1,57 @@
|
|||
package org.gcube.portlets.user.socialprofile.client;
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.client.util.Encoder;
|
||||
import org.gcube.portlets.user.socialprofile.client.ui.DisplayProfile;
|
||||
import org.gcube.portlets.user.socialprofile.client.ui.DisplaySummary;
|
||||
import org.gcube.portlets.user.socialprofile.shared.UserContext;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
*/
|
||||
public class SocialProfile implements EntryPoint {
|
||||
private final SocialServiceAsync socialService = GWT.create(SocialService.class);
|
||||
|
||||
private VerticalPanel mainPanel = new VerticalPanel();
|
||||
private DisplayProfile dispProfile = new DisplayProfile();
|
||||
|
||||
public void onModuleLoad() {
|
||||
socialService.getUserContext(getUserToShowId(), new AsyncCallback<UserContext>() {
|
||||
@Override
|
||||
public void onSuccess(UserContext result) {
|
||||
mainPanel.add(dispProfile);
|
||||
dispProfile.show(result);
|
||||
if (result.getSummary() != null && result.getSummary().compareTo("") != 0) {
|
||||
mainPanel.add(new DisplaySummary(result.getSummary()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
mainPanel.add(dispProfile);
|
||||
dispProfile.showError(caught.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
RootPanel.get("SocialProfileDiv").add(mainPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
* decode the userid from the location param
|
||||
* @return the decoded (base64) userid
|
||||
*/
|
||||
public void onModuleLoad() {
|
||||
RootPanel.get("SocialProfileDiv").add(new DisplayProfile());
|
||||
public static String getUserToShowId() {
|
||||
String encodedOid = Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID);
|
||||
if (Window.Location.getParameter(encodedOid) == null)
|
||||
return null;
|
||||
String encodedUserId = Window.Location.getParameter(encodedOid);
|
||||
return Encoder.decode(encodedUserId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package org.gcube.portlets.user.socialprofile.client.ui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.client.util.Encoder;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.socialprofile.client.SocialProfile;
|
||||
import org.gcube.portlets.user.socialprofile.client.SocialService;
|
||||
import org.gcube.portlets.user.socialprofile.client.SocialServiceAsync;
|
||||
import org.gcube.portlets.user.socialprofile.shared.UserContext;
|
||||
|
@ -15,10 +13,12 @@ import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.Window.Location;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -65,6 +65,7 @@ public class DisplayProfile extends Composite {
|
|||
@UiField Button cancelIsti;
|
||||
|
||||
@UiField Button messageButton;
|
||||
@UiField Button editButton;
|
||||
|
||||
private String currHeadLine;
|
||||
private String currInstitution;
|
||||
|
@ -74,62 +75,65 @@ public class DisplayProfile extends Composite {
|
|||
public DisplayProfile() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
avatarImage.setUrl(loading);
|
||||
mainPanel.addStyleName("framed");
|
||||
mainPanel.addStyleName("profile-section");
|
||||
savingHeadline.setUrl(savingImage);
|
||||
socialService.getUserContext(getUserToShowId(), new AsyncCallback<UserContext>() {
|
||||
@Override
|
||||
public void onSuccess(UserContext result) {
|
||||
myUserInfo = result.getUserInfo();
|
||||
avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAccountURL());
|
||||
avatarImage.setSize("100px", "100px");
|
||||
avatarImage.setUrl(myUserInfo.getAvatarId());
|
||||
userFullName.setText(myUserInfo.getFullName());
|
||||
|
||||
if (getUserToShowId() == null) { //its him seeing his profile
|
||||
|
||||
String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? HEADLINE_TEXT : result.getHeadline();
|
||||
String isti = (result.getInstitution() == null ||result.getInstitution().compareTo("") == 0) ? ISTI_TEXT : result.getInstitution();
|
||||
headlineLabel.setText(head);
|
||||
institutionLabel.setText(isti);
|
||||
|
||||
editHeadline.setStyleName("editImage");
|
||||
editHeadline.setTitle("Edit your Professional Headline");
|
||||
|
||||
editIsti.setStyleName("editImage");
|
||||
editIsti.setTitle("Edit your Company");
|
||||
|
||||
headlineBox.setMaxLength(70);
|
||||
institutionBox.setMaxLength(70);
|
||||
|
||||
messageButton.removeFromParent();
|
||||
currHeadLine = head;
|
||||
if (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) {
|
||||
headlineLabel.getElement().getStyle().setOpacity(0.5);
|
||||
institutionLabel.getElement().getStyle().setOpacity(0.5);
|
||||
}
|
||||
} else { //its someone else
|
||||
String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? "" : result.getHeadline();
|
||||
String isti = (result.getInstitution() == null || result.getInstitution().compareTo("") == 0) ? "" : result.getInstitution();
|
||||
headlineLabel.setText(head);
|
||||
institutionLabel.setText(isti);
|
||||
|
||||
avatarImage.getElement().getParentElement().setAttribute("href", "");
|
||||
avatarImage.setTitle(myUserInfo.getFullName());
|
||||
messageButton.setText("Private Message");
|
||||
messageButton.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Failure: " + caught.getMessage());
|
||||
avatarImage.setSize("100px", "100px");
|
||||
avatarImage.setUrl(avatar_default);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
public void show(UserContext result) {
|
||||
|
||||
myUserInfo = result.getUserInfo();
|
||||
avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAccountURL());
|
||||
avatarImage.setSize("100px", "100px");
|
||||
avatarImage.setUrl(myUserInfo.getAvatarId());
|
||||
userFullName.setText(myUserInfo.getFullName());
|
||||
|
||||
if (SocialProfile.getUserToShowId() == null) { //its him seeing his profile
|
||||
|
||||
String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? HEADLINE_TEXT : result.getHeadline();
|
||||
String isti = (result.getInstitution() == null ||result.getInstitution().compareTo("") == 0) ? ISTI_TEXT : result.getInstitution();
|
||||
headlineLabel.setText(head);
|
||||
institutionLabel.setText(isti);
|
||||
|
||||
editHeadline.setStyleName("editImage");
|
||||
editHeadline.setTitle("Edit your Professional Headline");
|
||||
|
||||
editIsti.setStyleName("editImage");
|
||||
editIsti.setTitle("Edit your Company");
|
||||
|
||||
headlineBox.setMaxLength(70);
|
||||
institutionBox.setMaxLength(70);
|
||||
|
||||
messageButton.removeFromParent();
|
||||
currHeadLine = head;
|
||||
if (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) {
|
||||
headlineLabel.getElement().getStyle().setOpacity(0.5);
|
||||
institutionLabel.getElement().getStyle().setOpacity(0.5);
|
||||
}
|
||||
|
||||
editButton.setVisible(true);
|
||||
editButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Location.assign("/group/control_panel/manage?p_p_id=2");
|
||||
}
|
||||
});
|
||||
|
||||
} else { //its someone else
|
||||
String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? "" : result.getHeadline();
|
||||
String isti = (result.getInstitution() == null || result.getInstitution().compareTo("") == 0) ? "" : result.getInstitution();
|
||||
headlineLabel.setText(head);
|
||||
institutionLabel.setText(isti);
|
||||
|
||||
avatarImage.getElement().getParentElement().setAttribute("href", "");
|
||||
avatarImage.setTitle(myUserInfo.getFullName());
|
||||
messageButton.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("editHeadline")
|
||||
void onEditHeadlineClick(ClickEvent e) {
|
||||
headlineLabel.setVisible(false);
|
||||
|
@ -238,7 +242,7 @@ public class DisplayProfile extends Composite {
|
|||
@UiHandler("messageButton")
|
||||
void onSendPrivateMessageClick(ClickEvent e) {
|
||||
final List<String> listToLogin = new ArrayList<String>();
|
||||
listToLogin.add(getUserToShowId() );
|
||||
listToLogin.add(SocialProfile.getUserToShowId() );
|
||||
GWT.runAsync(new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
@ -266,19 +270,13 @@ public class DisplayProfile extends Composite {
|
|||
institutionLabel.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if it has to show just one feed
|
||||
* @return
|
||||
*/
|
||||
private String getUserToShowId() {
|
||||
String encodedOid = Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID);
|
||||
if (Window.Location.getParameter(encodedOid) == null)
|
||||
return null;
|
||||
String encodedUserId = Window.Location.getParameter(encodedOid);
|
||||
return Encoder.decode(encodedUserId);
|
||||
public void showError(String message) {
|
||||
Window.alert("Failure: " + message);
|
||||
avatarImage.setSize("100px", "100px");
|
||||
avatarImage.setUrl(avatar_default);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape an html string. Escaping data received from the client helps to
|
||||
* prevent cross-site script vulnerabilities.
|
||||
|
@ -293,4 +291,6 @@ public class DisplayProfile extends Composite {
|
|||
return html.replaceAll("&", "&").replaceAll("<", "<")
|
||||
.replaceAll(">", ">");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="user-details">
|
||||
<g:Button ui:field="messageButton" visible="false"></g:Button>
|
||||
<g:Button ui:field="messageButton" visible="false">Private Message</g:Button>
|
||||
<g:Button ui:field="editButton" visible="false">Complete your profile</g:Button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.portlets.user.socialprofile.client.ui;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DisplaySummary extends Composite {
|
||||
|
||||
private static DisplaySummaryUiBinder uiBinder = GWT
|
||||
.create(DisplaySummaryUiBinder.class);
|
||||
|
||||
interface DisplaySummaryUiBinder extends UiBinder<Widget, DisplaySummary> {
|
||||
}
|
||||
|
||||
@UiField HTML summary;
|
||||
|
||||
public DisplaySummary(String summaryText) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
summary.setHTML(summaryText);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<g:HTMLPanel styleName="profile-section">
|
||||
<div class="profile-section-title" width="100%;" align="left">
|
||||
<span>Professional Background</span>
|
||||
</div>
|
||||
<div width="100%;" align="left">
|
||||
<g:HTML ui:field="summary" styleName="summary"></g:HTML>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -86,7 +86,12 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
email = user.getEmailAddress();
|
||||
HashMap<String, String> vreNames = new HashMap<String, String>();
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), "", true, false, vreNames);
|
||||
return new UserContext(userInfo, getHeadline(username), getInstitution(username), session.getScopeName(), true);
|
||||
User theUser = OrganizationsUtil.validateUser(username);
|
||||
String headline = theUser.getJobTitle();
|
||||
String company = theUser.getOpenId();
|
||||
String summary = getSummary(theUser);
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -99,7 +104,9 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
//fakeVreNames.put("/gcube/devNext/NexNext","NexNext");
|
||||
|
||||
UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
return new UserContext(user, null, "Institution", session.getScopeName(), true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +129,12 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
HashMap<String, String> vreNames = new HashMap<String, String>();
|
||||
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, false, vreNames);
|
||||
return new UserContext(userInfo, getHeadline(session.getUsername()), getInstitution(session.getUsername()), session.getScopeName(), true);
|
||||
User theUser = OrganizationsUtil.validateUser(session.getUsername());
|
||||
String headline = theUser.getJobTitle();
|
||||
String company = theUser.getOpenId();
|
||||
String summary = getSummary(theUser);
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true);
|
||||
}
|
||||
else {
|
||||
_log.info("Returning test USER");
|
||||
|
@ -131,7 +143,9 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
//fakeVreNames.put("/gcube/devNext/NexNext","NexNext");
|
||||
|
||||
UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
return new UserContext(user, "", "", session.getScopeName(), true);
|
||||
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);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -140,14 +154,14 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
return new UserContext();
|
||||
}
|
||||
|
||||
private String getHeadline(String userid) throws PortalException, SystemException {
|
||||
User user = OrganizationsUtil.validateUser(userid);
|
||||
return user.getJobTitle();
|
||||
}
|
||||
|
||||
private String getInstitution(String userid) throws PortalException, SystemException {
|
||||
User user = OrganizationsUtil.validateUser(userid);
|
||||
return user.getComments();
|
||||
private String getSummary(User theUser) {
|
||||
String toReturn = escapeHtml(theUser.getComments());
|
||||
// replace all the line breaks by <br/>
|
||||
toReturn = toReturn.replaceAll("(\r\n|\n)"," <br/> ");
|
||||
// then replace all the double spaces by the html version
|
||||
toReturn = toReturn.replaceAll("\\s\\s"," ");
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,7 +182,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
com.liferay.portal.model.User user;
|
||||
try {
|
||||
user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
user.setComments(escapeHtml(institution));
|
||||
user.setOpenId(escapeHtml(institution));
|
||||
return (UserLocalServiceUtil.updateUser(user) != null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -9,22 +9,26 @@ public class UserContext implements Serializable {
|
|||
private UserInfo userInfo;
|
||||
private String headline;
|
||||
private String institution;
|
||||
private String summary;
|
||||
private String currentScope;
|
||||
boolean isOwner;
|
||||
|
||||
public UserContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public UserContext(UserInfo userInfo, String headline, String institution,
|
||||
String currentScope, boolean isOwner) {
|
||||
String summary, String currentScope, boolean isOwner) {
|
||||
super();
|
||||
this.userInfo = userInfo;
|
||||
this.headline = headline;
|
||||
this.institution = institution;
|
||||
this.summary = summary;
|
||||
this.currentScope = currentScope;
|
||||
this.isOwner = isOwner;
|
||||
}
|
||||
|
||||
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
@ -55,6 +59,15 @@ public class UserContext implements Serializable {
|
|||
public void setOwner(boolean isOwner) {
|
||||
this.isOwner = isOwner;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<!-- To Comment out -->
|
||||
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
|
||||
<set-property name="user.agent" value="gecko1_8" />
|
||||
<!-- Other module inherits -->
|
||||
<!-- inherits GCUBE Widgets -->
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
|
|
@ -1,13 +1,34 @@
|
|||
.framed {
|
||||
margin: 0 0 10px;
|
||||
padding: 10px;
|
||||
margin: 0px 5px;
|
||||
|
||||
|
||||
.profile-section {
|
||||
margin: 0px 5px 5px;
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
background: #FFF;
|
||||
border-radius: 6px !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
border: 1px solid #DBDBDB;
|
||||
border-bottom: 1px #CCC solid;
|
||||
}
|
||||
|
||||
.profile-section-title {
|
||||
padding: 1px 5px;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.summary {
|
||||
padding: 1px 5px 5px;
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #333;
|
||||
word-wrap: break-word;
|
||||
-ms-word-break: break-all;
|
||||
/* Non standard for webkit */
|
||||
word-break: break-word;
|
||||
-webkit-hyphens: auto;
|
||||
-moz-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.user-details {
|
||||
padding: 5px;
|
||||
}
|
||||
|
@ -18,7 +39,7 @@
|
|||
}
|
||||
|
||||
.full-name {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
|
@ -31,13 +52,13 @@
|
|||
}
|
||||
|
||||
.headline {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
.institution {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #444444;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue