diff --git a/.classpath b/.classpath index cf53d90..4802a75 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index cfc5846..092711b 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -7,9 +7,6 @@ uses - - uses - diff --git a/pom.xml b/pom.xml index 9ff575f..5e9be88 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.user share-updates war - 1.8.1-SNAPSHOT + 1.8.2-SNAPSHOT gCube Share Updates Portlet @@ -74,6 +74,10 @@ social-networking-library provided + + org.gcube.portal + notifications-common-library + org.gcube.applicationsupportlayer aslcore diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java index d8f12ad..ce3310b 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.java @@ -20,6 +20,7 @@ import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressPanel; import org.jsonmaker.gwt.client.Jsonizer; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.Unit; @@ -144,14 +145,12 @@ public class ShareUpdateForm extends Composite { shareupdateService.getUserSettings(new AsyncCallback() { public void onFailure(Throwable caught) { - avatarImage.setSize("60px", "60px"); avatarImage.setUrl(avatar_default); } public void onSuccess(UserSettings userSettings) { myUserInfo = userSettings.getUserInfo(); avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAccountURL()); - avatarImage.setSize("60px", "60px"); avatarImage.setUrl(myUserInfo.getAvatarId()); String singleVREName = ""; @@ -198,6 +197,9 @@ public class ShareUpdateForm extends Composite { @UiHandler("shareTextArea") void onShareUpdateClick(ClickEvent e) { shareTextArea.removeSampleText(); + Document.get().getElementById("highlighterContainer").getStyle().setHeight(52, Unit.PX); + Document.get().getElementById("highlighter").getStyle().setHeight(52, Unit.PX); + Document.get().getElementById("postTextArea").getStyle().setHeight(52, Unit.PX); } @UiHandler("attachButton") diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.ui.xml b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.ui.xml index 3c9e0d5..d4abfcd 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.ui.xml +++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/view/ShareUpdateForm.ui.xml @@ -3,16 +3,13 @@ xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:org.gcube.portlets.user.shareupdates.client.view" xmlns:j="urn:import:org.gcube.portlets.widgets.fileupload.client.view"> - - - - - - -
- - - - +
+ + + + +
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java deleted file mode 100644 index 3892df5..0000000 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/MentionNotificationsThread.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.gcube.portlets.user.shareupdates.server; - -import java.util.ArrayList; - -import org.gcube.applicationsupportlayer.social.NotificationsManager; -import org.gcube.portlets.widgets.pickitem.shared.ItemBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Massimiliano Assante ISTI-CNR - * - */ -public class MentionNotificationsThread implements Runnable { - private static Logger _log = LoggerFactory.getLogger(MentionNotificationsThread.class); - - private String postText; - private String postId; - private NotificationsManager nm; - private ArrayList users; - - - public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList users) { - super(); - this.postId = postId; - this.postText = postText; - this.nm = nm; - this.users = users; - } - - @Override - public void run() { - for (ItemBean userToNotify : users) { - boolean result = nm.notifyUserTag(userToNotify.getName(), postId, postText); - _log.trace("Sending Notification for post mention to: " + userToNotify.getName() + " result?"+ result); - } - } -} diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/PostNotificationsThread.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/PostNotificationsThread.java deleted file mode 100644 index 7d9ee5c..0000000 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/PostNotificationsThread.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.gcube.portlets.user.shareupdates.server; - -import java.util.List; - -import org.gcube.applicationsupportlayer.social.NotificationsManager; -import org.gcube.vomanagement.usermanagement.UserManager; -import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.UserModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Massimiliano Assante ISTI-CNR - * - */ -public class PostNotificationsThread implements Runnable { - private static Logger _log = LoggerFactory.getLogger(PostNotificationsThread.class); - - private String postText; - private String postId; - private String groupId; - private List hashtags; - private NotificationsManager nm; - - public PostNotificationsThread(String postId, String postText, String groupId, NotificationsManager nm, List hashtags) { - super(); - this.postId = postId; - this.postText = postText; - this.groupId = groupId; - this.hashtags = hashtags; - this.nm = nm; - } - - @Override - public void run() { - UserManager um = new LiferayUserManager(); - String[] hashtagsToPass = hashtags.toArray(new String[hashtags.size()]); - try { - for (UserModel user : um.listUsersByGroup(groupId)) { - boolean result = nm.notifyPost(user.getScreenName(), postId, postText, hashtagsToPass); - _log.trace("Sending Notification for post alert to: " + user.getScreenName() + " result?"+ result); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java index 33a3331..885c4fe 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java @@ -39,6 +39,9 @@ import org.gcube.portal.databook.shared.FeedType; import org.gcube.portal.databook.shared.PrivacyLevel; import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException; +import org.gcube.portal.notifications.bean.GenericItemBean; +import org.gcube.portal.notifications.thread.MentionNotificationsThread; +import org.gcube.portal.notifications.thread.PostNotificationsThread; import org.gcube.portlets.user.shareupdates.client.ShareUpdateService; import org.gcube.portlets.user.shareupdates.client.view.ShareUpdateForm; import org.gcube.portlets.user.shareupdates.server.opengraph.OpenGraph; @@ -249,7 +252,11 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar //send the notification to the mentioned users if (mentionedUsers != null && mentionedUsers.size() > 0) { NotificationsManager nm = new ApplicationNotificationsManager(session); - Thread thread = new Thread(new MentionNotificationsThread(toShare.getKey(), textToPost, nm, mentionedUsers)); + ArrayList toPass = new ArrayList(); + for (ItemBean u : mentionedUsers) { + toPass.add(new GenericItemBean(u.getId(), u.getName(), u.getAlternativeName(), u.getThumbnailURL())); + } + Thread thread = new Thread(new MentionNotificationsThread(toShare.getKey(), textToPost, nm, toPass)); thread.start(); } diff --git a/src/main/resources/org/gcube/portlets/user/shareupdates/ShareUpdates.gwt.xml b/src/main/resources/org/gcube/portlets/user/shareupdates/ShareUpdates.gwt.xml index f6fb00f..04a0afa 100644 --- a/src/main/resources/org/gcube/portlets/user/shareupdates/ShareUpdates.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/shareupdates/ShareUpdates.gwt.xml @@ -26,5 +26,5 @@ - + diff --git a/src/main/webapp/ShareUpdates.css b/src/main/webapp/ShareUpdates.css index e7b7c17..f767fdc 100644 --- a/src/main/webapp/ShareUpdates.css +++ b/src/main/webapp/ShareUpdates.css @@ -1,3 +1,34 @@ +.share-updates-table { + display: table; + border-collapse: collapse; + width: 100%; +} + +.share-updates-table>div { + display: table-row; +} + +.share-updates-table .share-updates-cell { + display: table-cell; + padding-left: 3px; +} + +.share-updates-table .share-updates-photo-cell { + display: table-cell; + width: 60px; + text-align: center; +} + +.share-updates-photo-cell>img { + +} + +.share-updates-member-photo { + margin-left: 6px; + width: 39px; + height: 39px; + border-radius: 4px; +} /* Superpose TextArea and Highlight DIV trick starts here */ #supercontainer { @@ -10,7 +41,7 @@ top: 0; cursor: text; width: 525px; - height: 54px; + height: 32px; } #inputContainer { @@ -27,38 +58,32 @@ font-size: 13px; letter-spacing: normal; line-height: normal; - border: 1px solid transparent; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - width: 525px; - height: 54px; - - word-wrap: break-word; /* this is very important when usere paste long links*/ + height: 32px; + word-wrap: break-word; + /* this is very important when usere paste long links*/ } - .postTextArea { padding: 4px 2px; color: #999; background-color: transparent; - margin: 0px; font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, sans-serif; font-size: 13px; letter-spacing: normal; line-height: normal; - border: 1px solid #999; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - width: 525px; - height: 54px; + height: 32px; } .highlightedUser { @@ -69,7 +94,6 @@ background-color: #0084B5 !important; } - /* DIV trick ends here */ .gwt-Button { @@ -101,7 +125,7 @@ padding: 5px 15px; } -.shareButton:hover, .shareButton:focus { +.shareButton:hover,.shareButton:focus { background-color: #019AD3; background-image: linear-gradient(#33BCEF, #019AD3); border-color: #057ED0; @@ -111,7 +135,6 @@ background: #e3e8f3; } - .framed { margin: 0 0 10px; padding: 10px; @@ -128,13 +151,6 @@ padding-top: 2px; } -.member-photo { - display: block; - padding: 2px; - border: 1px solid #E6E6E6; - margin: 0 2px 2px 0; -} - .link-previewer { width: 600px; padding-top: 10px; @@ -163,7 +179,7 @@ font-weight: bold; line-height: 15px; width: 465px; - word-break:break-all; + word-break: break-all; } .link-url { @@ -240,12 +256,9 @@ a.link:hover { } .toolsContainer { - padding-top: 3px; - width: 600px; + padding: 3px 0 0 2px; + width: 595px; background-image: none; - border-top-color: #DADADA; - border-top-style: solid; - border-top-width: 1px; } .wizardListbox { @@ -259,10 +272,11 @@ a.link:hover { border-style: solid; cursor: pointer; cursor: hand; - margin-left: 6px; + margin-left: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; + margin-top: 2px; } /* smart textarea */