diff --git a/pom.xml b/pom.xml
index 9bf5c7c..a49b7a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,6 +83,11 @@
[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
provided
+
+ org.gcube.portlets.widgets
+ user-selection-dialog
+ [0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)
+
org.gcube.portlets.user
workspace-light-tree
@@ -104,6 +109,11 @@
custom-portal-handler
provided
+
+ org.gcube.core
+ common-scope-maps
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+
org.gcube.dvos
usermanagement-core
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
index 5063712..a62ab7c 100644
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
+++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Date;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
+import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.ClientFeed;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.Feed;
@@ -32,13 +33,17 @@ import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent;
import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEventHandler;
import org.gcube.portlets.user.newsfeed.client.event.ShowNewUpdatesEvent;
import org.gcube.portlets.user.newsfeed.client.event.ShowNewUpdatesEventHandler;
-import org.gcube.portlets.user.newsfeed.client.panels.dialog.LikesDialog;
import org.gcube.portlets.user.newsfeed.client.templates.FilterPanel;
import org.gcube.portlets.user.newsfeed.client.templates.NewFeedsAvailable;
import org.gcube.portlets.user.newsfeed.client.templates.SingleComment;
import org.gcube.portlets.user.newsfeed.client.templates.TweetTemplate;
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
import org.gcube.portlets.user.newsfeed.shared.UserSettings;
+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.SelectedUserEventHandler;
+import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent;
+import org.gcube.portlets.widgets.userselection.shared.SelectionUser;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
@@ -46,6 +51,7 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Timer;
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.Composite;
import com.google.gwt.user.client.ui.HTML;
@@ -139,6 +145,16 @@ public class NewsFeedPanel extends Composite {
});
+ eventBus.addHandler(SelectedUserEvent.TYPE, new SelectedUserEventHandler() {
+ @Override
+ public void onSelectedUser(SelectedUserEvent event) {
+ GWT.log("event...");
+ Location.assign(GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
+ Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
+ Encoder.encode(event.getSelectedUser().getId()));
+ }
+ });
+
eventBus.addHandler(SeeLikesEvent.TYPE, new SeeLikesEventHandler() {
@Override
public void onSeeLikes(SeeLikesEvent event) {
@@ -589,12 +605,13 @@ public class NewsFeedPanel extends Composite {
}
private void doShowLikes(final String feedId) {
- GWT.runAsync(new RunAsyncCallback() {
+ GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
@Override
public void onSuccess() {
- final LikesDialog dlg = new LikesDialog();
+ final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus);
dlg.center();
- dlg.show();
+ dlg.show();
+
newsService.getAllLikesByFeed(feedId, new AsyncCallback>() {
@Override
public void onFailure(Throwable caught) {
@@ -603,7 +620,11 @@ public class NewsFeedPanel extends Composite {
@Override
public void onSuccess(ArrayList result) {
- dlg.showLikes(result);
+ ArrayList toShow = new ArrayList();
+ for (Like like : result) {
+ toShow.add(new SelectionUser(like.getUserid(), like.getFullName(), like.getThumbnailURL()));
+ }
+ eventBus.fireEvent(new UsersFetchedEvent(toShow));
}
});
}
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/dialog/LikesDialog.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/dialog/LikesDialog.java
deleted file mode 100644
index 236841f..0000000
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/dialog/LikesDialog.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.gcube.portlets.user.newsfeed.client.panels.dialog;
-
-
-import java.util.ArrayList;
-
-import org.gcube.portal.databook.shared.Like;
-import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
-import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
-import org.gcube.portlets.user.newsfeed.client.templates.LikedTemplate;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CellPanel;
-import com.google.gwt.user.client.ui.HasAlignment;
-import com.google.gwt.user.client.ui.HasVerticalAlignment;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class LikesDialog extends GCubeDialog {
-
- private static final int WIDTH = 420;
- private CellPanel mainPanel = new VerticalPanel();
- private VerticalPanel topPanel = new VerticalPanel();
- private HorizontalPanel bottomPanel = new HorizontalPanel();
- private Image loadingImage;
-
- public LikesDialog() {
- super(true);
- setText("People who set this " + NewsFeedPanel.LIKE_LABEL);
- loadingImage = new Image(NewsFeedPanel.loading);
- setSize(""+WIDTH, "100");
- topPanel.setPixelSize(WIDTH, 100);
- bottomPanel.setPixelSize(WIDTH, 25);
-
- topPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
- topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
- topPanel.add(loadingImage);
- ScrollPanel scroller = new ScrollPanel();
- scroller.setPixelSize(WIDTH+40, 300);
-
- scroller.add(topPanel);
- mainPanel.add(scroller);
- mainPanel.add(bottomPanel);
-
- bottomPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
- Button close = new Button("Close");
- bottomPanel.add(close);
- close.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- hide();
- }
- });
-
- mainPanel.setCellHeight(bottomPanel, "25px");
-
- setWidget(mainPanel);
- }
- /**
- *
- * @param likes
- */
- public void showLikes(ArrayList likes) {
- topPanel.remove(loadingImage);
- bottomPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
- for (Like like : likes) {
- topPanel.add(new LikedTemplate(like));
- }
- }
-}
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.java
deleted file mode 100644
index 7696703..0000000
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.gcube.portlets.user.newsfeed.client.templates;
-
-import org.gcube.portal.databook.client.GCubeSocialNetworking;
-import org.gcube.portal.databook.shared.Like;
-import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
-
-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.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-public class LikedTemplate extends Composite {
-
- private static LikedTemplateUiBinder uiBinder = GWT
- .create(LikedTemplateUiBinder.class);
-
- interface LikedTemplateUiBinder extends UiBinder {
- }
-
- public LikedTemplate(Like like) {
- initWidget(uiBinder.createAndBindUi(this));
- if (like.getThumbnailURL() != null)
- avatarImage.setUrl(like.getThumbnailURL());
-
- avatarImage.setPixelSize(30, 30);
- contentArea.setHTML(""+like.getFullName()+" ");
- }
- @UiField
- Image avatarImage;
- @UiField
- HTML contentArea;
-}
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.ui.xml b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.ui.xml
deleted file mode 100644
index 5eb8a0f..0000000
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/LikedTemplate.ui.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
index 0adefd9..9394192 100644
--- a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
@@ -98,8 +98,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
if (user == null) {
_log.warn("USER IS NULL setting testing user and Running OUTSIDE PORTAL");
user = "test.user";
- // user = "massimiliano.assante";
- // SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
+ user = "massimiliano.assante";
+ SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube");
}
else {
withinPortal = true;
@@ -352,7 +352,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
for (Feed feed : toMerge) {
feed.setThumbnailURL("http://127.0.0.1:8888/images/Avatar_default.png");
}
-
+ //sort the feeds in reverse chronological order
+ Collections.sort(toMerge, Collections.reverseOrder());
return enhanceFeeds(toMerge, 2);
}
@@ -668,16 +669,17 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
* @throws PortalException
*/
private boolean isAdmin() throws PortalException, SystemException {
- User currUser = OrganizationsUtil.validateUser(getASLSession().getUsername());
- List organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
- Organization rootOrganization = null;
- for (Organization organization : organizations) {
- if (organization.getName().equals(OrganizationsUtil.getRootOrganizationName() ) ) {
- rootOrganization = organization;
- break;
- }
- }
try {
+ User currUser = OrganizationsUtil.validateUser(getASLSession().getUsername());
+ List organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
+ Organization rootOrganization = null;
+ for (Organization organization : organizations) {
+ if (organization.getName().equals(OrganizationsUtil.getRootOrganizationName() ) ) {
+ rootOrganization = organization;
+ break;
+ }
+ }
+
_log.trace("root: " + rootOrganization.getName() );
return (hasRole(ADMIN_ROLE, rootOrganization.getName(), currUser));
}
diff --git a/src/main/resources/clientlog4j.properties b/src/main/resources/clientlog4j.properties
new file mode 100644
index 0000000..a4f0d7c
--- /dev/null
+++ b/src/main/resources/clientlog4j.properties
@@ -0,0 +1,10 @@
+log4j.rootLogger=DEBUG, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+
+# Print the date in ISO 8601 format
+log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+# Print only messages of level TRACE or above in the package org.gcube
+log4j.logger.org.gcube=TRACE
+log4j.logger.org.gcube.application.framework.core.session=INFO
\ No newline at end of file
diff --git a/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml b/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
index f7f269d..1e9b5c0 100644
--- a/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
+++ b/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
@@ -14,6 +14,7 @@
+