ported to liferay 6.2
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@126340 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7db93411b5
commit
1c1b765ea4
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/social-profile-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/social-profile-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/social-profile-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/social-profile-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
<dependent-module archiveName="session-checker-0.5.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="social-profile"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="liferay.portlet" version="6.0"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
</faceted-project>
|
||||
|
|
24
pom.xml
24
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>social-profile</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>gCube Social Profile Portlet</name>
|
||||
<description>
|
||||
Social Profile
|
||||
|
@ -30,7 +30,7 @@
|
|||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
|
||||
<liferay.version>6.2.5</liferay.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
@ -72,8 +72,10 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
|
@ -112,20 +114,26 @@
|
|||
<artifactId>gwt-jsonmaker</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<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>wsmail-widget</artifactId> -->
|
||||
<!-- <version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||
<!-- <scope>compile</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<version>${liferay.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -8,7 +8,6 @@ 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;
|
||||
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
|
@ -286,7 +285,8 @@ public class DisplayProfile extends Composite {
|
|||
GWT.runAsync(new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
new MailForm(listToLogin);
|
||||
//TODO:
|
||||
// new MailForm(listToLogin);
|
||||
}
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("Could not load this component: " + reason.getMessage());
|
||||
|
|
|
@ -34,13 +34,16 @@ 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.communitymanager.SiteManagerUtil;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.socialprofile.client.SocialService;
|
||||
import org.gcube.portlets.user.socialprofile.shared.UserContext;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.json.simple.parser.ContainerFactory;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -128,16 +131,17 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
String thumbnailURL = "images/Avatar_default.png";
|
||||
if (isWithinPortal()) {
|
||||
try {
|
||||
com.liferay.portal.model.User user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
||||
thumbnailURL = user.isMale() ? "/image/user_male_portrait?img_id="+user.getPortraitId() : "/image/user_female_portrait?img_id="+user.getPortraitId();
|
||||
fullName = user.getFirstName() + " " + user.getLastName();
|
||||
email = user.getEmailAddress();
|
||||
UserManager um = new LiferayUserManager();
|
||||
GCubeUser user = um.getUserByUsername(username);
|
||||
thumbnailURL = user.getUserAvatarURL();
|
||||
fullName = user.getFullname();
|
||||
email = user.getEmail();
|
||||
HashMap<String, String> vreNames = new HashMap<String, String>();
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), "", true, false, vreNames);
|
||||
User theUser = OrganizationsUtil.validateUser(username);
|
||||
String headline = theUser.getJobTitle();
|
||||
String company = theUser.getOpenId();
|
||||
String summary = getSummary(theUser);
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmail(), "", true, false, vreNames);
|
||||
|
||||
String headline = user.getJobTitle();
|
||||
String company = user.getLocation_industry();
|
||||
String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId()));
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope());
|
||||
|
||||
|
@ -168,19 +172,19 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
|
||||
if (isWithinPortal()) {
|
||||
|
||||
com.liferay.portal.model.User user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
||||
thumbnailURL = user.isMale() ? "/image/user_male_portrait?img_id="+user.getPortraitId() : "/image/user_female_portrait?img_id="+user.getPortraitId();
|
||||
fullName = user.getFirstName() + " " + user.getLastName();
|
||||
email = user.getEmailAddress();
|
||||
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
||||
String accountURL = themeDisplay.getURLMyAccount().toString();
|
||||
UserManager um = new LiferayUserManager();
|
||||
GCubeUser user = um.getUserByUsername(username);
|
||||
thumbnailURL = user.getUserAvatarURL();
|
||||
fullName = user.getFullname();
|
||||
email = user.getEmail();
|
||||
// ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
||||
String accountURL = "TODO"; //TODO: //themeDisplay.getURLMyAccount().toString();
|
||||
HashMap<String, String> vreNames = new HashMap<String, String>();
|
||||
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, false, vreNames);
|
||||
User theUser = OrganizationsUtil.validateUser(session.getUsername());
|
||||
String headline = theUser.getJobTitle();
|
||||
String company = theUser.getOpenId();
|
||||
String summary = getSummary(theUser);
|
||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmail(), accountURL, true, false, vreNames);
|
||||
String headline = user.getJobTitle();
|
||||
String company = user.getLocation_industry();
|
||||
String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId()));
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope() );
|
||||
}
|
||||
|
@ -203,8 +207,8 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
}
|
||||
|
||||
|
||||
private String getSummary(User theUser) {
|
||||
String toReturn = escapeHtml(theUser.getComments());
|
||||
private String transformSummary(String professionalBackground) {
|
||||
String toReturn = escapeHtml(professionalBackground);
|
||||
// replace all the line breaks by <br/>
|
||||
toReturn = toReturn.replaceAll("(\r\n|\n)"," <br/> ");
|
||||
// then replace all the double spaces by the html version
|
||||
|
@ -216,9 +220,8 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
public Boolean saveHeadline(String newHeadline) {
|
||||
com.liferay.portal.model.User user;
|
||||
try {
|
||||
user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
user.setJobTitle(escapeHtml(newHeadline));
|
||||
return (UserLocalServiceUtil.updateUser(user) != null);
|
||||
//TODO:
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
@ -229,9 +232,8 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
public Boolean saveIsti(String institution) {
|
||||
com.liferay.portal.model.User user;
|
||||
try {
|
||||
user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
user.setOpenId(escapeHtml(institution));
|
||||
return (UserLocalServiceUtil.updateUser(user) != null);
|
||||
//TODO:
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
@ -417,7 +419,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
if (isWithinPortal()) {
|
||||
_log.debug("LinkedIn Profile gotten correctly for " + getASLSession().getUsername() + " attempting to write into DB ...");
|
||||
com.liferay.portal.model.User user;
|
||||
user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
user = UserLocalServiceUtil.getUserByScreenName(SiteManagerUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
//headline
|
||||
if (headline.compareTo("") != 0) {
|
||||
String checkedHeadline = headline;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<!-- Other module inherits -->
|
||||
<!-- inherits GCUBE Widgets -->
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' />
|
||||
<!-- <inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' /> -->
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
||||
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
.user-details {
|
||||
padding: 5px;
|
||||
}
|
||||
.user-photo {
|
||||
img.user-photo {
|
||||
display: block;
|
||||
padding: 2px;
|
||||
border: 1px solid #E6E6E6;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.0.0//EN" "http://www.liferay.com/dtd/liferay-display_6_0_0.dtd">
|
||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||
|
||||
<display>
|
||||
<category name="gCube Social Apps">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_0_0.dtd">
|
||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||
|
||||
<liferay-portlet-app>
|
||||
<portlet>
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<portlet-app
|
||||
version="2.0"
|
||||
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||
>
|
||||
version="2.0">
|
||||
<portlet>
|
||||
<portlet-name>SocialProfile</portlet-name>
|
||||
<display-name>User Profile</display-name>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
|
@ -15,23 +15,23 @@
|
|||
<url-pattern>/socialprofile/socialService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>mailWisdgetServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.wsmail.server.WsMailServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<!-- <servlet> -->
|
||||
<!-- <servlet-name>mailWisdgetServlet</servlet-name> -->
|
||||
<!-- <servlet-class>org.gcube.portlets.widgets.wsmail.server.WsMailServiceImpl</servlet-class> -->
|
||||
<!-- </servlet> -->
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>mailWisdgetServlet</servlet-name>
|
||||
<url-pattern>/socialprofile/mailWisdgetServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>workspaceServiceImpl</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>workspaceServiceImpl</servlet-name>
|
||||
<url-pattern>/socialprofile/WorkspaceLightService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<!-- <servlet-mapping> -->
|
||||
<!-- <servlet-name>mailWisdgetServlet</servlet-name> -->
|
||||
<!-- <url-pattern>/socialprofile/mailWisdgetServlet</url-pattern> -->
|
||||
<!-- </servlet-mapping> -->
|
||||
<!-- <servlet> -->
|
||||
<!-- <servlet-name>workspaceServiceImpl</servlet-name> -->
|
||||
<!-- <servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class> -->
|
||||
<!-- </servlet> -->
|
||||
<!-- <servlet-mapping> -->
|
||||
<!-- <servlet-name>workspaceServiceImpl</servlet-name> -->
|
||||
<!-- <url-pattern>/socialprofile/WorkspaceLightService</url-pattern> -->
|
||||
<!-- </servlet-mapping> -->
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>SocialProfile.html</welcome-file>
|
||||
|
|
Loading…
Reference in New Issue