integrated session expiration popup
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@94085 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3cacb91ead
commit
ff5badd29f
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/news-feed-1.6.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/news-feed-1.6.4-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"/>
|
||||||
|
@ -31,5 +31,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/news-feed-1.6.3-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/news-feed-1.6.4-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.6.3-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.6.4-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets.user.NewsFeed.1-6-3"
|
||||||
|
date="2014-04-02">
|
||||||
|
<Change>Implemented the autmoatic scroll back in time for feeds</Change>
|
||||||
|
<Change>Fixed double notifications for post owner who commented his post</Change>
|
||||||
|
<Change>Fixed double notifications for post owner who liked his post</Change>
|
||||||
|
<Change>Added session checking popup</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets.user.NewsFeed.1-5-0"
|
<Changeset component="org.gcube.portlets.user.NewsFeed.1-5-0"
|
||||||
date="2014-02-13">
|
date="2014-02-13">
|
||||||
<Change>Moved to Java7</Change>
|
<Change>Moved to Java7</Change>
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -13,7 +13,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>1.6.3-SNAPSHOT</version>
|
<version>1.6.4-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>gCube News Feed Portlet</name>
|
<name>gCube News Feed Portlet</name>
|
||||||
<description>
|
<description>
|
||||||
|
@ -75,7 +75,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>accesslogger</artifactId>
|
<artifactId>accesslogger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
<artifactId>session-checker</artifactId>
|
||||||
|
<version>[0.2.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>aslsocial</artifactId>
|
<artifactId>aslsocial</artifactId>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.gcube.portlets.user.newsfeed.client.templates.TweetTemplate;
|
||||||
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
||||||
import org.gcube.portlets.user.newsfeed.shared.MoreFeedsBean;
|
import org.gcube.portlets.user.newsfeed.shared.MoreFeedsBean;
|
||||||
import org.gcube.portlets.user.newsfeed.shared.UserSettings;
|
import org.gcube.portlets.user.newsfeed.shared.UserSettings;
|
||||||
|
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||||
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
|
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
|
||||||
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent;
|
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;
|
||||||
|
@ -250,7 +251,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
currentScope = result.getCurrentScope();
|
currentScope = result.getCurrentScope();
|
||||||
if (result.getUserInfo().getUsername().equals("test.user")) {
|
if (result.getUserInfo().getUsername().equals("test.user")) {
|
||||||
doStopFeedsTimer();
|
doStopFeedsTimer();
|
||||||
Window.alert("Your Session Expired, please logout and login again");
|
doShowSessionExpired();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (getFeedToShowId() != null) {
|
if (getFeedToShowId() != null) {
|
||||||
|
@ -366,7 +367,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
public void onSuccess(UserSettings result) {
|
public void onSuccess(UserSettings result) {
|
||||||
if (result.getUserInfo().getUsername().equals("test.user")) {
|
if (result.getUserInfo().getUsername().equals("test.user")) {
|
||||||
doStopFeedsTimer();
|
doStopFeedsTimer();
|
||||||
Window.alert("Your Session Expired, please logout and login again");
|
doShowSessionExpired();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher
|
* this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher
|
||||||
|
@ -753,6 +754,18 @@ public class NewsFeedPanel extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doShowSessionExpired() {
|
||||||
|
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
CheckSession.showLogoutDialog();
|
||||||
|
}
|
||||||
|
public void onFailure(Throwable reason) {
|
||||||
|
Window.alert("Could not load this component: " + reason.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void doShowLikes(final String feedId) {
|
private void doShowLikes(final String feedId) {
|
||||||
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
|
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package org.gcube.portlets.user.newsfeed.server;
|
package org.gcube.portlets.user.newsfeed.server;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
import org.gcube.portal.databook.server.DatabookStore;
|
import org.gcube.portal.databook.server.DatabookStore;
|
||||||
import org.gcube.portal.databook.shared.Comment;
|
import org.gcube.portal.databook.shared.Comment;
|
||||||
|
import org.gcube.portal.databook.shared.Like;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -26,15 +28,19 @@ public class CommentNotificationsThread implements Runnable {
|
||||||
private String feedOwnerId;
|
private String feedOwnerId;
|
||||||
private NotificationsManager nm;
|
private NotificationsManager nm;
|
||||||
private HashSet<String> userIdsToNotify;
|
private HashSet<String> userIdsToNotify;
|
||||||
|
//needed to avoid sending notification twice (the user who favorited gets the notification anyways)
|
||||||
|
private ArrayList<Like> favorites;
|
||||||
|
|
||||||
|
|
||||||
public CommentNotificationsThread(DatabookStore storeInstance, String commenterUserId, String commentedFeedId, String commentText, NotificationsManager nm, String feedOwnerId) {
|
public CommentNotificationsThread(DatabookStore storeInstance, String commenterUserId,
|
||||||
|
String commentedFeedId, String commentText, NotificationsManager nm, String feedOwnerId, ArrayList<Like> favorites) {
|
||||||
super();
|
super();
|
||||||
this.nm = nm;
|
this.nm = nm;
|
||||||
this.commenterUserId = commenterUserId;
|
this.commenterUserId = commenterUserId;
|
||||||
this.commentedFeedId = commentedFeedId;
|
this.commentedFeedId = commentedFeedId;
|
||||||
this.commentText = commentText;
|
this.commentText = commentText;
|
||||||
this.feedOwnerId = feedOwnerId;
|
this.feedOwnerId = feedOwnerId;
|
||||||
|
this.favorites = favorites;
|
||||||
|
|
||||||
userIdsToNotify = new HashSet<String>();
|
userIdsToNotify = new HashSet<String>();
|
||||||
List<Comment> feedComments = storeInstance.getAllCommentByFeed(commentedFeedId);
|
List<Comment> feedComments = storeInstance.getAllCommentByFeed(commentedFeedId);
|
||||||
|
@ -50,17 +56,25 @@ public class CommentNotificationsThread implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String feedOwnerFullName = "";
|
String feedOwnerFullName = "";
|
||||||
UserManager um = new LiferayUserManager();
|
UserManager um = new LiferayUserManager();
|
||||||
try {
|
try {
|
||||||
feedOwnerFullName = um.getUserByScreenName(feedOwnerId).getFullname();
|
feedOwnerFullName = um.getUserByScreenName(feedOwnerId).getFullname();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
feedOwnerFullName = feedOwnerId;
|
feedOwnerFullName = feedOwnerId;
|
||||||
}
|
}
|
||||||
|
//get the list of userid who liked the post
|
||||||
|
ArrayList<String> favoriteUserIds = new ArrayList<>();
|
||||||
|
for (Like favorite : favorites) {
|
||||||
|
favoriteUserIds.add(favorite.getUserid());
|
||||||
|
}
|
||||||
|
|
||||||
if (userIdsToNotify != null) {
|
if (userIdsToNotify != null) {
|
||||||
for (String userId : userIdsToNotify) {
|
for (String userId : userIdsToNotify) {
|
||||||
boolean result = nm.notifyCommentReply(userId, commentedFeedId, commentText, feedOwnerFullName);
|
if (userId.compareTo(feedOwnerId) != 0 && !(favoriteUserIds.contains(userId)) ) { //avoid notifying the owner and the user who liked twice
|
||||||
_log.trace("Sending Notification for also commented to: " + feedOwnerFullName + " result?"+ result);
|
boolean result = nm.notifyCommentReply(userId, commentedFeedId, commentText, feedOwnerFullName);
|
||||||
|
_log.trace("Sending Notification for also commented to: " + feedOwnerFullName + " result?"+ result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,12 @@ public class LikeNotificationsThread implements Runnable {
|
||||||
|
|
||||||
private NotificationsManager nm;
|
private NotificationsManager nm;
|
||||||
private ArrayList<Like> likes;
|
private ArrayList<Like> likes;
|
||||||
|
private String feedOwnerId;
|
||||||
|
|
||||||
public LikeNotificationsThread(String commentText, NotificationsManager nm, ArrayList<Like> likes) {
|
|
||||||
|
public LikeNotificationsThread(String commentText, NotificationsManager nm, ArrayList<Like> likes, String feedOwnerId) {
|
||||||
super();
|
super();
|
||||||
|
this.feedOwnerId = feedOwnerId;
|
||||||
this.commentText = commentText;
|
this.commentText = commentText;
|
||||||
this.nm = nm;
|
this.nm = nm;
|
||||||
this.likes = likes;
|
this.likes = likes;
|
||||||
|
@ -30,11 +32,13 @@ public class LikeNotificationsThread implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Like fav : likes) {
|
for (Like fav : likes) {
|
||||||
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getFeedid(), commentText);
|
if (fav.getUserid().compareTo(feedOwnerId) != 0) { //avoid notifying the owner twice (if the post owner commented he gets the notification regardless)
|
||||||
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
|
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getFeedid(), commentText);
|
||||||
|
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,13 +491,15 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
|
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
|
||||||
_log.trace("Comment Notification to post owner added? " + result);
|
_log.trace("Comment Notification to post owner added? " + result);
|
||||||
}
|
}
|
||||||
//notify the other users who commented this post
|
|
||||||
Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId));
|
//if there are users who liked this post they get notified, asynchronously with this thread
|
||||||
commentsNotificationthread.start();
|
ArrayList<Like> favorites = getAllLikesByFeed(feedid);
|
||||||
|
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, favorites, feedOwnerId));
|
||||||
//if there are other users who liked this post they get notified too, asynchronously with this thread
|
|
||||||
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, getAllLikesByFeed(feedid)));
|
|
||||||
likesThread.start();
|
likesThread.start();
|
||||||
|
|
||||||
|
//notify the other users who commented this post (excluding the ones above)
|
||||||
|
Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId, favorites));
|
||||||
|
commentsNotificationthread.start();
|
||||||
}
|
}
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<inherits name='com.google.gwt.user.User' />
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
<!-- To Comment out -->
|
<!-- To Comment out -->
|
||||||
<set-property name="user.agent" value="safari,gecko1_8,ie9" />
|
<set-property name="user.agent" value="safari,gecko1_8,ie9" />
|
||||||
|
|
||||||
<!-- 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" />
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
<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.portlets.widgets.userselection.UserSelection' />
|
<inherits name='org.gcube.portlets.widgets.userselection.UserSelection' />
|
||||||
|
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
|
||||||
<inherits
|
<inherits
|
||||||
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
||||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||||
|
|
|
@ -9,13 +9,10 @@ table {
|
||||||
margin: 0 0 10px;
|
margin: 0 0 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 0px 5px;
|
margin: 0px 5px;
|
||||||
|
|
||||||
background: #FFF url(images/vre_bg_gray.png) repeat-x left bottom;
|
background: #FFF url(images/vre_bg_gray.png) repeat-x left bottom;
|
||||||
|
|
||||||
border-radius: 6px !important;
|
border-radius: 6px !important;
|
||||||
-moz-border-radius: 6px !important;
|
-moz-border-radius: 6px !important;
|
||||||
-webkit-border-radius: 6px !important;
|
-webkit-border-radius: 6px !important;
|
||||||
|
|
||||||
border: 1px solid #DBDBDB;
|
border: 1px solid #DBDBDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +250,7 @@ table {
|
||||||
}
|
}
|
||||||
|
|
||||||
.openImage:hover {
|
.openImage:hover {
|
||||||
background: url(images/open-sep.png) 0px -14px no-repeat;
|
background: url(images/open-sep.png) 0px -14px no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
cursor: hand;
|
cursor: hand;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +355,14 @@ a.person-link:hover {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
color: #333;
|
color: #333;
|
||||||
word-break:break-all;
|
width: 500px;
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tweet-separator {
|
.tweet-separator {
|
||||||
|
|
Loading…
Reference in New Issue