Added support to automatically increment/decrement the number of posts written by the user
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@122500 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4145a09afd
commit
886b8fc239
|
@ -2,6 +2,7 @@
|
|||
<Changeset component="org.gcube.portlets-user.news-feed.1-13-0"
|
||||
date="2016-01-22">
|
||||
<Change>Multi-attachment supported</Change>
|
||||
<Change>Image preview available</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.newsfeed.1-12-0"
|
||||
date="2015-11-12">
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
public class NewsFeed implements EntryPoint {
|
||||
|
||||
private final String UNIQUE_DIV = "newsfeedDIV";
|
||||
final PageBusAdapter pageBusAdapter = new PageBusAdapter();
|
||||
final public static PageBusAdapter pageBusAdapter = new PageBusAdapter();
|
||||
NewsFeedPanel mainPanel;
|
||||
|
||||
|
||||
|
@ -62,6 +62,9 @@ public class NewsFeed implements EntryPoint {
|
|||
ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
mainPanel.addJustAddedFeed(feed);
|
||||
|
||||
// alert the User statistics widget to increment the number of user's posts (no need to pass info)
|
||||
pageBusAdapter.PageBusPublish("org.gcube.portal.incrementPostCount", null, null);
|
||||
|
||||
} catch (PageBusAdapterException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -71,5 +74,4 @@ public class NewsFeed implements EntryPoint {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -616,6 +616,7 @@ public class NewsFeedPanel extends Composite {
|
|||
|
||||
//insert it also in the model so that the user who created it do not get notified about this new update
|
||||
allUpdates.add(0, toAdd);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@ 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.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
|
|
|
@ -7,12 +7,15 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.client.util.Encoder;
|
||||
import org.gcube.portal.databook.shared.Attachment;
|
||||
import org.gcube.portal.databook.shared.Comment;
|
||||
import org.gcube.portal.databook.shared.Feed;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsFeed;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.AddLikeEvent;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.DeleteFeedEvent;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent;
|
||||
|
@ -163,7 +166,7 @@ public class TweetTemplate extends Composite {
|
|||
|
||||
EnhancedImage enhancedImage = new EnhancedImage(
|
||||
new com.github.gwtbootstrap.client.ui.Image(
|
||||
feed.getUriThumbnail()),
|
||||
feed.getUri()),
|
||||
feed.getLinkTitle(),
|
||||
feed.getLinkTitle(),
|
||||
feed.getUri()
|
||||
|
@ -214,7 +217,7 @@ public class TweetTemplate extends Composite {
|
|||
|
||||
EnhancedImage enhancedImage = new EnhancedImage(
|
||||
new com.github.gwtbootstrap.client.ui.Image(
|
||||
feed.getUriThumbnail()),
|
||||
feed.getUri()),
|
||||
feed.getLinkTitle(),
|
||||
feed.getLinkTitle(),
|
||||
feed.getUri()
|
||||
|
@ -237,7 +240,7 @@ public class TweetTemplate extends Composite {
|
|||
|
||||
EnhancedImage enhancedImage = new EnhancedImage(
|
||||
new com.github.gwtbootstrap.client.ui.Image(
|
||||
otherAttachment.getThumbnailURL()),
|
||||
otherAttachment.getUri()),
|
||||
otherAttachment.getName(),
|
||||
otherAttachment.getName(),
|
||||
otherAttachment.getUri()
|
||||
|
@ -402,8 +405,21 @@ public class TweetTemplate extends Composite {
|
|||
|
||||
@UiHandler("closeImage")
|
||||
void onDeleteFeedClick(ClickEvent e) {
|
||||
if (isUsers || myUserInfo.isAdmin())
|
||||
if (isUsers || myUserInfo.isAdmin()){
|
||||
eventBus.fireEvent(new DeleteFeedEvent(this));
|
||||
|
||||
if(isUsers){
|
||||
try {
|
||||
|
||||
// alert the User statistics widget to decrement the number of user's posts (no need to pass info)
|
||||
NewsFeed.pageBusAdapter.PageBusPublish("org.gcube.portal.decrementPostCount", null, null);
|
||||
|
||||
} catch (PageBusAdapterException e1) {
|
||||
GWT.log("Unable to send this notification " + e1.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
GWT.log("not belong to user");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue