Ported to GWT 2.8.2

Fix for Incident #11187 citing a people (with '@') in comments is not working anymore</Change>
Feature #11189: Social-Networking - citing a people (with '@') in comments loses the focus.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@164785 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-03-07 14:28:17 +00:00
parent 509ee88dfc
commit 0d40b1562d
11 changed files with 291 additions and 207 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/news-feed-2.5.1-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/news-feed-2.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/news-feed-2.5.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/news-feed-2.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -39,5 +39,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/news-feed-2.5.1-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/news-feed-2.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -5,6 +5,9 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <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"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="gcube-widgets-2.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="news-feed"/> <property name="context-root" value="news-feed"/>
</wb-module> </wb-module>

View File

@ -1,14 +1,23 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.news-feed.2-5-1" <Changeset component="org.gcube.portlets-user.news-feed.2-6-0"
date="2018-02-14"> date="2018-03-07">
<Change>Ported to GWT 2.8.2</Change>
<Change>Fix for Incident #11187 citing a people (with '@') in comments
is not working anymore</Change>
<Change>
Feature #11189: Social-Networking - citing a people (with '@')
in comments loses the focus.
</Change>
<Change>Support for ticket #11139</Change> <Change>Support for ticket #11139</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portlets-user.news-feed.2-5-0" <Changeset component="org.gcube.portlets-user.news-feed.2-5-0"
date="2017-11-13"> date="2017-11-13">
<Change>fixes for Incident #10262: Cannot see who liked posts on VREs <Change>fixes for Incident #10262: Cannot see who liked posts on VREs
of Parthenos</Change> of Parthenos
</Change>
<Change>Feature #10242: add comment taking up to 3 seconds sometime to <Change>Feature #10242: add comment taking up to 3 seconds sometime to
be delivered in the UI now shows a loader</Change> be delivered in the UI now shows a loader
</Change>
<Change>Ported to GWT 2.8.1</Change> <Change>Ported to GWT 2.8.1</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portlets-user.news-feed.2-3-0" <Changeset component="org.gcube.portlets-user.news-feed.2-3-0"

87
pom.xml
View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>news-feed</artifactId> <artifactId>news-feed</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.5.1-SNAPSHOT</version> <version>2.6.0-SNAPSHOT</version>
<name>gCube News Feed Portlet</name> <name>gCube News Feed Portlet</name>
<description> <description>
@ -25,7 +25,7 @@
</scm> </scm>
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwtVersion>2.8.1</gwtVersion> <gwtVersion>2.8.2</gwtVersion>
<guavaVersion>18.0</guavaVersion> <guavaVersion>18.0</guavaVersion>
<distroDirectory>distro</distroDirectory> <distroDirectory>distro</distroDirectory>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
@ -37,6 +37,7 @@
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
@ -52,25 +53,37 @@
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId> <artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-codeserver</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId> <artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency> <dependency>
<groupId>xml-apis</groupId> <groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId> <artifactId>xml-apis</artifactId>
@ -105,9 +118,30 @@
<artifactId>aslsocial</artifactId> <artifactId>aslsocial</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>gwt-jsonmaker</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId> <artifactId>social-networking-library</artifactId>
<version>[1.16.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -187,7 +221,7 @@
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId> <artifactId>common-scope-maps</artifactId>
<scope>provided</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
@ -202,18 +236,7 @@
<version>1.0.3</version> <version>1.0.3</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.gwt-jsonmaker/gwt-jsonmaker -->
<dependency>
<groupId>org.gwt-jsonmaker</groupId>
<artifactId>gwt-jsonmaker</artifactId>
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.eliasbalasis</groupId>
<artifactId>tibcopagebus4gwt</artifactId>
<version>1.2.0</version>
</dependency>
<dependency> <dependency>
<groupId>commons-validator</groupId> <groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId> <artifactId>commons-validator</artifactId>
@ -223,6 +246,18 @@
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
</dependency> </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.2</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.liferay.portal</groupId> <groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId> <artifactId>portal-service</artifactId>
@ -238,16 +273,6 @@
<artifactId>portlet-api</artifactId> <artifactId>portlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>

View File

@ -1,72 +1,61 @@
package org.gcube.portlets.user.newsfeed.client; package org.gcube.portlets.user.newsfeed.client;
import org.gcube.portal.databook.shared.ClientFeed; import org.gcube.portal.databook.shared.ClientPost;
import org.gcube.portal.databook.shared.ClientFeed.ClientFeedJsonizer; import org.gcube.portal.databook.shared.JSON;
import org.gcube.portlets.user.newsfeed.client.event.PageBusEvents;
import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
import org.jsonmaker.gwt.client.Jsonizer;
import org.jsonmaker.gwt.client.base.Defaults;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapter;
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusEvent;
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusListener;
/** /**
* Entry point classes define <code>onModuleLoad()</code>. *
* @author Massimiliano Assante, CNR-ISTI
*
* This class uses Liferay's Client-side+Inter-Portlet-Communication for displaying post created in the Share Updates portlet
* @see https://web.liferay.com/community/wiki/-/wiki/Main/Client-side+Inter-Portlet-Communication+%28IPC%29%20using+Java+Script
*
*/ */
public class NewsFeed implements EntryPoint { public class NewsFeed implements EntryPoint {
private final String UNIQUE_DIV = "newsfeedDIV"; private final String UNIQUE_DIV = "newsfeedDIV";
final public static PageBusAdapter pageBusAdapter = new PageBusAdapter();
NewsFeedPanel mainPanel;
private NewsFeedPanel mainPanel;
public void onModuleLoad() { private static NewsFeedPanel instance;
init();
}
public void init() {
mainPanel = new NewsFeedPanel();
public static NewsFeedPanel getInstance() {
if (instance == null) {
instance = new NewsFeedPanel();
}
return instance;
}
public void onModuleLoad() {
injectLiferayIPCEventReceiver();
exportReceiveEventJavascriptFunction();
mainPanel = getInstance();
RootPanel.get(UNIQUE_DIV).add(mainPanel); RootPanel.get(UNIQUE_DIV).add(mainPanel);
ClientFeed notification = new ClientFeed();
//Subscribe to message and associate subsequent receptions with custom subscriber data
try {
pageBusAdapter.PageBusSubscribe(PageBusEvents.newPostCreated, null, null, notification, (Jsonizer)GWT.create(ClientFeedJsonizer.class));
}
catch (PageBusAdapterException e1) {
e1.printStackTrace();
}
pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener() {
@Override
public void onPageBusSubscriptionCallback(PageBusEvent event) {
if(event.getSubject().equals(this.getName())){
// translate JavaScript message contents and subscriber data to their Java equivalents
try {
ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class));
mainPanel.addJustAddedFeed(feed);
// alert the User statistics portlet to increment the number of user's posts
pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER);
} catch (PageBusAdapterException e) {
e.printStackTrace();
}
}
}
@Override
public String getName() {
return PageBusEvents.newPostCreated;
}
});
} }
/**
* this is a JSNI method that injects the Liferay Javascript function listening for events from ShareUpdates
*/
public static native void injectLiferayIPCEventReceiver() /*-{
$wnd.Liferay.on('newPostCreated',function(event) {
$wnd.handleReceiveEvent(event.payload);
});
}-*/;
/**
* this is a JSNI method mapping the Javascript function handleReceiveEvent to the Java method handleReceiveEvent
*/
public static native void exportReceiveEventJavascriptFunction()/*-{
$wnd.handleReceiveEvent = @org.gcube.portlets.user.newsfeed.client.NewsFeed::handleReceiveEvent(*);
}-*/;
/**
* the Java method handleReceiveEvent
* @param jsonizedClientPostInstance the jsonized {@link ClientPost} sent by ShareUpdates
*/
public static void handleReceiveEvent(String jsonizedClientPostInstance) {
ClientPost cp = (ClientPost) JSON.parse(jsonizedClientPostInstance);
getInstance().addJustAddedFeed(cp);
}
} }

View File

@ -8,7 +8,8 @@ import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.portal.databook.client.GCubeSocialNetworking; import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder; import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.Attachment; import org.gcube.portal.databook.shared.Attachment;
import org.gcube.portal.databook.shared.ClientFeed; import org.gcube.portal.databook.shared.ClientAttachment;
import org.gcube.portal.databook.shared.ClientPost;
import org.gcube.portal.databook.shared.Comment; import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.EnhancedFeed; import org.gcube.portal.databook.shared.EnhancedFeed;
import org.gcube.portal.databook.shared.Feed; import org.gcube.portal.databook.shared.Feed;
@ -18,7 +19,6 @@ import org.gcube.portal.databook.shared.PrivacyLevel;
import org.gcube.portal.databook.shared.ShowUserStatisticAction; import org.gcube.portal.databook.shared.ShowUserStatisticAction;
import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portal.databook.shared.UserInfo;
import org.gcube.portlets.user.newsfeed.client.FilterType; import org.gcube.portlets.user.newsfeed.client.FilterType;
import org.gcube.portlets.user.newsfeed.client.NewsFeed;
import org.gcube.portlets.user.newsfeed.client.NewsService; import org.gcube.portlets.user.newsfeed.client.NewsService;
import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync; import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync;
import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent; import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent;
@ -33,7 +33,6 @@ import org.gcube.portlets.user.newsfeed.client.event.EditCommentEvent;
import org.gcube.portlets.user.newsfeed.client.event.EditCommentEventHandler; import org.gcube.portlets.user.newsfeed.client.event.EditCommentEventHandler;
import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent; import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent;
import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEventHandler; import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEventHandler;
import org.gcube.portlets.user.newsfeed.client.event.PageBusEvents;
import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEvent; import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEvent;
import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEventHandler; import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEventHandler;
import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent; import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent;
@ -60,7 +59,6 @@ import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent;
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler; import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler;
import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent; import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent;
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean; import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
import org.jsonmaker.gwt.client.base.Defaults;
import com.github.gwtbootstrap.client.ui.Row; import com.github.gwtbootstrap.client.ui.Row;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
@ -84,7 +82,6 @@ import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
/** /**
* *
* @author Massimiliano Assante, ISTI-CNR * @author Massimiliano Assante, ISTI-CNR
@ -762,35 +759,35 @@ public class NewsFeedPanel extends Composite {
newsPanel.insert(tt, 0); //insert in the view newsPanel.insert(tt, 0); //insert in the view
allUpdates.add(0, feed); //insert in the model allUpdates.add(0, feed); //insert in the model
//timer for the transition // //timer for the transition
Timer t = new Timer() { // Timer t = new Timer() {
@Override // @Override
public void run() { // public void run() {
tt.setcontentAreaStyle("visible"); // tt.setcontentAreaStyle("visible");
//
// alert the user-statistics portlet to update statistics in case // // alert the user-statistics portlet to update statistics in case
// one or more feed belongs to user himself // // one or more feed belongs to user himself
if(tt.isUser()){ // if(tt.isUser()){
try{ // try{
//
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER);
//
int numComments = tt.numberOfComments(); // int numComments = tt.numberOfComments();
int numLikes = tt.numberOfLikes(); // int numLikes = tt.numberOfLikes();
//
for(int i = 0; i < numComments; i++) // for(int i = 0; i < numComments; i++)
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
//
for(int i = 0; i < numLikes; i++) // for(int i = 0; i < numLikes; i++)
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER);
//
}catch (PageBusAdapterException ex) { // }catch (PageBusAdapterException ex) {
GWT.log(ex.toString()); // GWT.log(ex.toString());
} // }
} // }
} // }
}; // };
t.schedule(100); // t.schedule(100);
} }
//after that I remove the ($updatesNo) from Window Title //after that I remove the ($updatesNo) from Window Title
String currTitle = Document.get().getTitle(); String currTitle = Document.get().getTitle();
@ -804,35 +801,42 @@ public class NewsFeedPanel extends Composite {
* @param thumbURL * @param thumbURL
* @param description * @param description
*/ */
public void addJustAddedFeed(ClientFeed cFeed) { public void addJustAddedFeed(ClientPost cFeed) {
// build up the feed // build up the feed
Feed feed = new Feed( Feed feed = new Feed(
cFeed.getKey(), cFeed.key,
FeedType.SHARE, FeedType.SHARE,
cFeed.getUserid(), cFeed.userid,
cFeed.getTime(), cFeed.time,
"", "",
cFeed.getUri(), cFeed.uri,
cFeed.getLinkUrlThumbnail(), cFeed.linkUrlThumbnail,
cFeed.getDescription(), cFeed.description,
PrivacyLevel.CONNECTION, PrivacyLevel.CONNECTION,
cFeed.getFullName(), cFeed.fullName,
cFeed.getEmail(), cFeed.email,
cFeed.getThumbnailURL(), cFeed.thumbnailURL,
cFeed.getLinkTitle(), cFeed.linkTitle,
cFeed.getLinkDescription(), cFeed.linkDescription,
cFeed.getLinkHost()); cFeed.linkHost);
// set multi-attachments property // set multi-attachments property
boolean multiAttachments = cFeed.getAttachments() != null; boolean multiAttachments = (cFeed.attachments != null) ? cFeed.attachments.length > 0 : false;
feed.setMultiFileUpload(multiAttachments); feed.setMultiFileUpload(multiAttachments);
//false because he could not have liked this yet and true because is the current user's //false because he could not have liked this yet and true because is the current user's
EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); EnhancedFeed toAdd = new EnhancedFeed(feed, false, true);
// be careful when converting from List<> to ArrayList<> ... ArrayList<Attachment> attachments = null;
ArrayList<Attachment> attachments = multiAttachments ? new ArrayList<Attachment>(cFeed.getAttachments()) : null; if (multiAttachments) {
attachments = new ArrayList<>(cFeed.attachments.length);
for (int i = 0; i <cFeed.attachments.length; i++) {
ClientAttachment ca = cFeed.attachments[i];
attachments.add(new Attachment(ca.id, ca.uri, ca.name, ca.description, ca.thumbnailURL, ca.mimeType));
}
}
toAdd.setAttachments(attachments); toAdd.setAttachments(attachments);
// build up the post template // build up the post template
@ -1227,17 +1231,17 @@ public class NewsFeedPanel extends Composite {
doShowSessionExpired(); doShowSessionExpired();
} else{ } else{
// alert the User statistics portlet to increment the number of likes got // // alert the User statistics portlet to increment the number of likes got
if(owner.isUser()){ // if(owner.isUser()){
try { // try {
NewsFeed.pageBusAdapter.PageBusPublish( // NewsFeed.pageBusAdapter.PageBusPublish(
PageBusEvents.likesIncrement // PageBusEvents.likesIncrement
, "" // , ""
, Defaults.STRING_JSONIZER); // , Defaults.STRING_JSONIZER);
} catch (PageBusAdapterException ex) { // } catch (PageBusAdapterException ex) {
GWT.log(ex.toString()); // GWT.log(ex.toString());
} // }
} // }
} }
} }
@ -1255,16 +1259,16 @@ public class NewsFeedPanel extends Composite {
}else{ }else{
// alert the User statistics portlet to decrement the number of likes got // alert the User statistics portlet to decrement the number of likes got
if(owner.isUser()){ // if(owner.isUser()){
try { // try {
NewsFeed.pageBusAdapter.PageBusPublish( // NewsFeed.pageBusAdapter.PageBusPublish(
PageBusEvents.likesDecrement // PageBusEvents.likesDecrement
, "" // , ""
, Defaults.STRING_JSONIZER); // , Defaults.STRING_JSONIZER);
} catch (PageBusAdapterException ex) { // } catch (PageBusAdapterException ex) {
GWT.log(ex.toString()); // GWT.log(ex.toString());
} // }
} // }
} }
} }
@ -1320,14 +1324,14 @@ public class NewsFeedPanel extends Composite {
owner.updateCommentsNumberCount(); owner.updateCommentsNumberCount();
owner.showAddCommentForm(false); owner.showAddCommentForm(false);
if(owner.isUser()){ // if(owner.isUser()){
// alert the User statistics portlet to increment the number of comments got // // alert the User statistics portlet to increment the number of comments got
try { // try {
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
} catch (PageBusAdapterException e) { // } catch (PageBusAdapterException e) {
GWT.log(e.toString()); // GWT.log(e.toString());
} // }
} // }
} }
} }
else { else {
@ -1403,14 +1407,14 @@ public class NewsFeedPanel extends Composite {
doShowComments(owner, false); doShowComments(owner, false);
owner.updateCommentsNumberCount(); owner.updateCommentsNumberCount();
if(owner.isUser()){ // if(owner.isUser()){
// alert the User statistics portlet to decrement the number of comments got // // alert the User statistics portlet to decrement the number of comments got
try { // try {
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
} catch (PageBusAdapterException ex) { // } catch (PageBusAdapterException ex) {
GWT.log(ex.toString()); // GWT.log(ex.toString());
} // }
} // }
} else } else
Window.alert("Comment could not be deleted, please try again in a short while."); Window.alert("Comment could not be deleted, please try again in a short while.");
} }
@ -1433,23 +1437,23 @@ public class NewsFeedPanel extends Composite {
toDelete.removeFromParent(); toDelete.removeFromParent();
if(toDelete.isUser()){ if(toDelete.isUser()){
try{ // try{
// alert the User statistics portlet to decrement the number of user's posts // // alert the User statistics portlet to decrement the number of user's posts
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postDecrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postDecrement, "", Defaults.STRING_JSONIZER);
//
// alert the same portlet to decrement the number of likes/replies, if any // // alert the same portlet to decrement the number of likes/replies, if any
int numComments = toDelete.numberOfComments(); // int numComments = toDelete.numberOfComments();
int numLikes = toDelete.numberOfLikes(); // int numLikes = toDelete.numberOfLikes();
//
for(int i = 0; i < numComments; i++) // for(int i = 0; i < numComments; i++)
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
//
for(int i = 0; i < numLikes; i++) // for(int i = 0; i < numLikes; i++)
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesDecrement, "", Defaults.STRING_JSONIZER); // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesDecrement, "", Defaults.STRING_JSONIZER);
//
}catch (PageBusAdapterException ex) { // }catch (PageBusAdapterException ex) {
GWT.log(ex.toString()); // GWT.log(ex.toString());
} // }
} }
} else } else
Window.alert("Feed could not be deleted, please try again in a short while."); Window.alert("Feed could not be deleted, please try again in a short while.");

View File

@ -73,8 +73,13 @@ public class SuperPosedTextArea extends TextArea {
this.addKeyPressHandler(new KeyPressHandler() { this.addKeyPressHandler(new KeyPressHandler() {
@Override @Override
public void onKeyPress(KeyPressEvent event) { public void onKeyPress(KeyPressEvent event) {
if (pickUserDlg != null) if (pickUserDlg != null) {
pickUserDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), getAbsoluteTop()+getOffsetHeight(), getText()); int top = getAbsoluteTop();
int offset = getOffsetHeight();
int y = getAbsoluteTop()+getOffsetHeight();
GWT.log("top=" + top + " - offset = " +offset);
pickUserDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), y, getText());
}
} }
}); });
this.addFocusHandler(new FocusHandler() { this.addFocusHandler(new FocusHandler() {

View File

@ -104,7 +104,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
private ElasticSearchClient escl; private ElasticSearchClient escl;
private final static int MAX_FEEDS_NO = 30; private final static int MAX_FEEDS_NO = 30;
public void init() { public void init() {
store = new DBCassandraAstyanaxImpl(); store = new DBCassandraAstyanaxImpl();
try { try {
@ -972,8 +972,16 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
} }
} }
} else { //is a VRE } else { //is a VRE
users.addAll(um.listUsersByGroup(currentGroupId)); if (isWithinPortal()) {
teams = new LiferayRoleManager().listTeamsByGroup(currentGroupId); users.addAll(um.listUsersByGroup(currentGroupId));
teams = new LiferayRoleManager().listTeamsByGroup(currentGroupId);
} else {
List<GCubeUser> forDev = new ArrayList<>();
for (int i = 0; i < 10; i++) {
forDev.add(new GCubeUser(1L, "username"+i, "email", "firstName"+i, "middleNam", "lastName"+i, "fullname test"+i, 0L, "url", true, "jobTitle", null));
}
users.addAll(forDev);
}
} }
} catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault | VirtualGroupNotExistingException e) { } catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault | VirtualGroupNotExistingException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -1,11 +1,11 @@
package org.gcube.portlets.user.newsfeed.shared; package org.gcube.portlets.user.newsfeed.shared;
import java.io.Serializable;
import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portal.databook.shared.UserInfo;
import com.google.gwt.user.client.rpc.IsSerializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class UserSettings implements Serializable { public class UserSettings implements IsSerializable {
private UserInfo userInfo; private UserInfo userInfo;
private int refreshingTimeInMillis; private int refreshingTimeInMillis;
private String currentScope; private String currentScope;

View File

@ -0,0 +1,40 @@
# gCube Portal custom log4j Logger
#Author: Massimiliano Assante, ISTI-CNR
log4j.rootLogger=INFO, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=[PORTAL] %-4r [%t] %-5p %c %x - %m%n
# Display any warnings generated by our code
#log4j.category.org.globus=WARN
# Comment out the line below if you want to log every authorization
# decision the notification consumer makes.
#log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=ERROR
log4j.logger.org.gcube=TRACE, GCUBE
log4j.appender.GCUBE.threshold=DEBUG
log4j.appender.GCUBE=org.apache.log4j.ConsoleAppender
log4j.appender.GCUBE.layout=org.apache.log4j.PatternLayout
log4j.appender.GCUBE.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %
m%n
log4j.logger.org.apache.jasper.compiler.TldLocationsCache.level=ERROR, CA
#AVOID LOGGING EHCACHE Hearbeat problem
log4j.logger.net.sf.ehcache.distribution.PayloadUtil=OFF, CA
log4j.logger.org.gcube.portal.notifications=INFO, CA
log4j.logger.org.gcube.common.scope.impl=INFO, CA
log4j.logger.org.gcube.common.core.utils.events=INFO, CA
log4j.logger.org.gcube.portlets.user.homelibrary=INFO CA
log4j.logger.org.gcube.common.resources.kxml=ERROR, CA
log4j.logger.org.gcube.application.aquamaps.enhabling.Impl.ISCrawler=ERROR, CA
log4j.logger.com.netflix.astyanax.connectionpool.impl=ERROR, CA
log4j.logger.org.gcube.common.scope.impl=INFO, CA
log4j.logger.com.couchbase.client=ERROR, CA
log4j.logger.org.gcube.smartgears.handlers=INFO, CA
log4j.logger.org.gcube.informationsystem.publisher=INFO, CA
log4j.logger.org.gcube.application.framework.core.session=INFO, CA

View File

@ -7,10 +7,11 @@
<!-- <set-property name="user.agent" value="safari" /> --> <!-- <set-property name="user.agent" value="safari" /> -->
<!-- Other module inherits --> <!-- Other module inherits -->
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" /> <!-- <inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" /> -->
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" /> <inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
<inherits <!-- <inherits -->
name="net.eliasbalasis.tibcopagebus4gwt.testsubscriber.TestSubscriber" /> <!-- name="net.eliasbalasis.tibcopagebus4gwt.testsubscriber.TestSubscriber" /> -->
<inherits name="com.google.gwt.json.JSON" />
<inherits name="com.github.gwtbootstrap.Bootstrap" /> <inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- inherits gCube Widgets Library --> <!-- inherits gCube Widgets Library -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' /> <inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />