diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 8ae7790..8f4b759 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,15 +4,12 @@ - + uses uses - - uses - uses diff --git a/pom.xml b/pom.xml index 577af13..26d14a8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 + maven-parent org.gcube.tools @@ -93,7 +94,7 @@ social-networking-library provided - + org.gcube.common home-library provided @@ -114,11 +115,6 @@ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) compile - - org.gcube.portlets.widgets - wsmail-widget - [1.9.0-SNAPSHOT, 2.0.0-SNAPSHOT) - org.gcube.portlets.user gcube-widgets 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 8379f9b..ff0647b 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 @@ -112,7 +112,7 @@ public class NewsFeedPanel extends Composite { public static final String LIKE_LABEL = "Favorite"; public static final String LIKED_LABEL = "Favorited"; public static final String COMMENT_LABEL = "Reply"; - public static final String MESSAGE_LABEL = "Message"; + public static final String SHARE_FWD_LABEL = "Share"; private String vreLabel; diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java new file mode 100644 index 0000000..bbdf850 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java @@ -0,0 +1,53 @@ +package org.gcube.portlets.user.newsfeed.client.ui; + +import com.github.gwtbootstrap.client.ui.Button; +import com.github.gwtbootstrap.client.ui.ListBox; +import com.github.gwtbootstrap.client.ui.Modal; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +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.Window; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Widget; + +public class SharePostDialog extends Composite { + + private static SharePostDialogUiBinder uiBinder = GWT + .create(SharePostDialogUiBinder.class); + + interface SharePostDialogUiBinder extends UiBinder { + } + + public SharePostDialog(TweetTemplate toShare) { + initWidget(uiBinder.createAndBindUi(this)); + + input.addItem("devVRE", "devVRE"); + input.addItem("devVRE2", "devVRE"); + input.addItem("devVRE3", "devVRE"); + + + } + + @UiField Button sharePostButton; + @UiField Button cancel; + @UiField Modal modalWindow; + @UiField ListBox input; + + @UiHandler("sharePostButton") + void onClick(ClickEvent e) { + Window.alert("Hello!"); + } + + @UiHandler("cancel") + void onCancelClick(ClickEvent e) { + modalWindow.hide(); + } + + public void openModal() { + GWT.log("OpenModal"); + modalWindow.show(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml new file mode 100644 index 0000000..5a06a90 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml @@ -0,0 +1,23 @@ + + + + .important { + font-weight: bold; + } + + + + + + + + + Cancel + Send Invite + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java index 9b2586c..6ed2e7b 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java @@ -9,6 +9,7 @@ import java.util.List; 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; @@ -20,7 +21,6 @@ import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent; import org.gcube.portlets.user.newsfeed.client.event.UnLikeEvent; import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed; -import org.gcube.portlets.widgets.wsmail.client.forms.MailForm; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.RunAsyncCallback; @@ -70,6 +70,8 @@ public class TweetTemplate extends Composite { private int totalComments = 0; private HTML showAllComments = new HTML(); private boolean isAppFeed = false; + + private TweetTemplate myInstance; /** * tell if this tweet is belonging to the current user @@ -87,7 +89,7 @@ public class TweetTemplate extends Composite { @UiField HTML commentArea; @UiField - HTML messageArea; + HTML sharePostArea; @UiField Image avatarImage; @UiField @@ -120,6 +122,7 @@ public class TweetTemplate extends Composite { */ public TweetTemplate(boolean displaySingle, boolean showTimelineSource, UserInfo myUserInfo, EnhancedFeed myFeed, HandlerManager eventBus) { initWidget(uiBinder.createAndBindUi(this)); + myInstance = this; this.myUserInfo = myUserInfo; this.vreSource.setVisible(false); this.myFeed = myFeed; @@ -138,7 +141,13 @@ public class TweetTemplate extends Composite { } else { closeImage.removeFromParent(); } - + GWT.log("# attachments: "+myFeed.getAttachments().size()); + if (myFeed.getAttachments().size() > 0) { + for (Attachment a : myFeed.getAttachments()) { + GWT.log(a.toString()); + } + } + openImage.setStyleName("openImage"); openImage.setTitle("Open this feed separately"); //show if the user has already liked this or not @@ -163,7 +172,7 @@ public class TweetTemplate extends Composite { feedText = feedText.replaceAll("&","&"); if (! isAppFeed) { - messageArea.setHTML("" + NewsFeedPanel.MESSAGE_LABEL + ""); + sharePostArea.setHTML("" + NewsFeedPanel.SHARE_FWD_LABEL + ""); contentArea.setHTML(" go App [" +vreName + "]"); + sharePostArea.setHTML(" go App [" +vreName + "]"); } catch (Exception e) {} } @@ -374,7 +383,7 @@ public class TweetTemplate extends Composite { GWT.log("Commenting disabled"); } - @UiHandler("messageArea") + @UiHandler("sharePostArea") void onMessageClick(ClickEvent e) { if (! isAppFeed) { final List listToLogin = new ArrayList(); @@ -382,7 +391,8 @@ public class TweetTemplate extends Composite { GWT.runAsync(new RunAsyncCallback() { @Override public void onSuccess() { - new MailForm(listToLogin); + SharePostDialog dlg = new SharePostDialog(myInstance); + dlg.openModal(); } public void onFailure(Throwable reason) { Window.alert("Could not load this component: " + reason.getMessage()); diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml index 0ce6ace..bdd436a 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml @@ -33,7 +33,7 @@ - - + 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 3016383..a986928 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 @@ -26,6 +26,7 @@ import org.gcube.portal.custom.communitymanager.OrganizationsUtil; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl; import org.gcube.portal.databook.server.DatabookStore; +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.Like; @@ -703,6 +704,17 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService ArrayList likedFeeds = (ArrayList) store.getAllLikedFeedIdsByUser(getASLSession().getUsername()); boolean skip = false; for (Feed feed : toEnhance) { + + boolean isMultiFileUpload = feed.isMultiFileUpload(); + ArrayList attachments = new ArrayList(); + if (isMultiFileUpload) { + try { + attachments = (ArrayList) store.getAttachmentsByFeedId(feed.getKey()); + } catch (FeedIDNotFoundException e) { + _log.error("It looks like sth wrong with this feedid having attachments, could not find feedId = " + feed.getKey() + "\n" + e.getMessage()); + } + } + skip = false; if (! feed.isApplicationFeed()) { String thumb = getUserImagePortraitUrlLocal(feed.getEntityId()); @@ -730,6 +742,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService toAdd = new EnhancedFeed(feed, liked, checkisAdminUser()); } else toAdd = new EnhancedFeed(feed, liked, isUsers(feed, username)); + toAdd.setAttachments(attachments); toReturn.add(toAdd); } else { ArrayList comments = getAllCommentsByFeed(feed.getKey()); @@ -739,7 +752,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService int currCommentsNumber = comments.size(); //if comments are less than $commentsNumberPerFeed they are the more recent, -1 return all the comments if (currCommentsNumber < commentsNumberPerFeed || commentsNumberPerFeed == -1) { - EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, username), comments); + EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, username), comments, attachments); toReturn.add(toAdd); } else { //need to get the last two @@ -747,10 +760,10 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService for (int i = currCommentsNumber -commentsNumberPerFeed; i < currCommentsNumber; i++) { comments2Attach.add(comments.get(i)); } - EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, username), comments2Attach); + EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, username), comments2Attach, attachments); toReturn.add(toAdd); } - } + } } } diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/shared/EnhancedFeed.java b/src/main/java/org/gcube/portlets/user/newsfeed/shared/EnhancedFeed.java index 03ce831..cea762d 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/shared/EnhancedFeed.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/shared/EnhancedFeed.java @@ -3,6 +3,7 @@ package org.gcube.portlets.user.newsfeed.shared; import java.io.Serializable; import java.util.ArrayList; +import org.gcube.portal.databook.shared.Attachment; import org.gcube.portal.databook.shared.Comment; import org.gcube.portal.databook.shared.Feed; /** @@ -17,6 +18,9 @@ public class EnhancedFeed implements Serializable{ private boolean liked; private boolean isUsers; private ArrayList comments; + private ArrayList attachments; + + public EnhancedFeed() { super(); } @@ -34,6 +38,17 @@ public class EnhancedFeed implements Serializable{ this.liked = liked; this.comments = comments; } + + + public EnhancedFeed(Feed feed, boolean liked, boolean isUsers, + ArrayList comments, ArrayList attachments) { + super(); + this.feed = feed; + this.liked = liked; + this.isUsers = isUsers; + this.comments = comments; + this.attachments = attachments; + } public ArrayList getComments() { return comments; } @@ -57,5 +72,18 @@ public class EnhancedFeed implements Serializable{ } public void setUsers(boolean isUsers) { this.isUsers = isUsers; + } + public ArrayList getAttachments() { + return attachments; + } + public void setAttachments(ArrayList attachments) { + this.attachments = attachments; + } + @Override + public String toString() { + return "EnhancedFeed [feed=" + feed + ", liked=" + liked + ", isUsers=" + + isUsers + ", comments=" + comments + ", attachments=" + + attachments + "]"; } + } 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 e1017d5..050aee5 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,11 +14,9 @@ - - diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index d01e911..c5b48ee 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -25,27 +25,6 @@ /newsfeed/scopeService - - mailWisdgetServlet - org.gcube.portlets.widgets.wsmail.server.WsMailServiceImpl - - - - mailWisdgetServlet - /newsfeed/mailWisdgetServlet - - - - workspaceExplorer - org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl - - - - workspaceExplorer - /newsfeed/WorkspaceExplorerService - - - checkServlet org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl