added method to retrieve hashtags already present in the current VRE, adapted superposed textarea to include suggestions for hashtags, refactored to use the new geenric pickitem widget
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@100399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4d1cbb0c15
commit
98674d9af8
|
@ -4,6 +4,9 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
<dependent-module archiveName="pickitem-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/pickitem-widget/pickitem-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="share-updates"/>
|
||||
</wb-module>
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -82,15 +82,15 @@
|
|||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.gcube.core</groupId> -->
|
||||
<!-- <artifactId>common-scope-maps</artifactId> -->
|
||||
<!-- <scope>compile</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>pickuser-widget</artifactId>
|
||||
<version>[0.4.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||
<artifactId>pickitem-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.gcube.portal.databook.shared.FeedType;
|
|||
import org.gcube.portal.databook.shared.PrivacyLevel;
|
||||
import org.gcube.portlets.user.shareupdates.shared.LinkPreview;
|
||||
import org.gcube.portlets.user.shareupdates.shared.UserSettings;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
@ -26,5 +26,7 @@ public interface ShareUpdateService extends RemoteService {
|
|||
|
||||
LinkPreview checkUploadedFile(String fileName, String fileabsolutePathOnServer);
|
||||
|
||||
ArrayList<PickingUser> getPortalUsers();
|
||||
ArrayList<ItemBean> getPortalUsers();
|
||||
|
||||
ArrayList<ItemBean> getHashtags();
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.ArrayList;
|
|||
import org.gcube.portal.databook.shared.ClientFeed;
|
||||
import org.gcube.portal.databook.shared.FeedType;
|
||||
import org.gcube.portal.databook.shared.PrivacyLevel;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.user.shareupdates.shared.LinkPreview;
|
||||
import org.gcube.portlets.user.shareupdates.shared.UserSettings;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
@ -25,8 +25,10 @@ public interface ShareUpdateServiceAsync {
|
|||
|
||||
void getUserSettings(AsyncCallback<UserSettings> callback);
|
||||
|
||||
void getPortalUsers(AsyncCallback<ArrayList<PickingUser>> callback);
|
||||
void getPortalUsers(AsyncCallback<ArrayList<ItemBean>> callback);
|
||||
|
||||
void checkUploadedFile(String fileName, String fileabsolutePathOnServer,
|
||||
AsyncCallback<LinkPreview> callback);
|
||||
|
||||
void getHashtags(AsyncCallback<ArrayList<ItemBean>> callback);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class ShareUpdateForm extends Composite {
|
|||
}
|
||||
|
||||
//privacyLevel.addItem("My Connections", PrivacyLevel.CONNECTION.toString());
|
||||
if (myUserInfo.isAdmin() && userSettings.isInfrastructure())
|
||||
if (myUserInfo.isAdmin())
|
||||
privacyLevel.addItem("Share with: Everyone", PrivacyLevel.PORTAL.toString());
|
||||
//change css if deployed in VRE scope
|
||||
if (!userSettings.isInfrastructure()) {
|
||||
|
|
|
@ -5,12 +5,12 @@ package org.gcube.portlets.user.shareupdates.client.view;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.widgets.pickuser.client.dialog.PickUsersDialog;
|
||||
import org.gcube.portlets.widgets.pickuser.client.events.PickedUserEvent;
|
||||
import org.gcube.portlets.widgets.pickuser.client.events.PickedUserEventHandler;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.user.shareupdates.client.ShareUpdateService;
|
||||
import org.gcube.portlets.user.shareupdates.client.ShareUpdateServiceAsync;
|
||||
import org.gcube.portlets.widgets.pickitem.client.dialog.PickItemsDialog;
|
||||
import org.gcube.portlets.widgets.pickitem.client.events.PickedItemEvent;
|
||||
import org.gcube.portlets.widgets.pickitem.client.events.PickedItemEventHandler;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
|
@ -31,11 +31,13 @@ public class SuperPosedTextArea extends TextArea {
|
|||
.create(ShareUpdateService.class);
|
||||
private final HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
PickUsersDialog pickUserDlg;
|
||||
PickItemsDialog pickUserDlg;
|
||||
PickItemsDialog pickHashtagDlg;
|
||||
public final static int ARROW_UP = 38;
|
||||
public final static int ARROW_DOWN = 40;
|
||||
|
||||
private ArrayList<String> mentionedUsers = new ArrayList<String>();
|
||||
private ArrayList<String> hashtags = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -45,18 +47,27 @@ public class SuperPosedTextArea extends TextArea {
|
|||
sinkEvents(Event.ONKEYUP);
|
||||
sinkEvents(Event.ONCONTEXTMENU);
|
||||
sinkEvents(Event.ONKEYDOWN);
|
||||
|
||||
shareupdateService.getPortalUsers(new AsyncCallback<ArrayList<PickingUser>>() {
|
||||
|
||||
//get the users
|
||||
shareupdateService.getPortalUsers(new AsyncCallback<ArrayList<ItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<PickingUser> users) {
|
||||
pickUserDlg = new PickUsersDialog(users, eventBus, 525);
|
||||
public void onSuccess(ArrayList<ItemBean> users) {
|
||||
pickUserDlg = new PickItemsDialog('@', users, eventBus, 525, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
});
|
||||
//get the hashtags in this group
|
||||
shareupdateService.getHashtags(new AsyncCallback<ArrayList<ItemBean>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<ItemBean> hashtags) {
|
||||
pickHashtagDlg = new PickItemsDialog('#', hashtags, eventBus, 525, false);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
});
|
||||
|
||||
DOM.setElementAttribute(getElement(), "id", "postTextArea");
|
||||
bind();
|
||||
}
|
||||
|
@ -90,6 +101,7 @@ public class SuperPosedTextArea extends TextArea {
|
|||
case Event.ONKEYUP: {
|
||||
injectInDiv(getText());
|
||||
pickUserDlg.onKeyUp(event.getKeyCode(), this.getAbsoluteLeft(), this.getAbsoluteTop()+this.getOffsetHeight(), getText());
|
||||
pickHashtagDlg.onKeyUp(event.getKeyCode(), this.getAbsoluteLeft(), this.getAbsoluteTop()+this.getOffsetHeight(), getText());
|
||||
break;
|
||||
}
|
||||
case Event.ONCONTEXTMENU: {
|
||||
|
@ -105,6 +117,14 @@ public class SuperPosedTextArea extends TextArea {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (pickHashtagDlg.isShowing()) {
|
||||
//avoid the arrow up to move the cursor at the beginning of the textbox and the TAB to move around inputs and enter to go newline
|
||||
if (event.getKeyCode() == ARROW_UP || event.getKeyCode() == KeyCodes.KEY_TAB || event.getKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
DOM.eventCancelBubble(event, true);
|
||||
DOM.eventPreventDefault(event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +149,11 @@ public class SuperPosedTextArea extends TextArea {
|
|||
for (String mentionedUser : mentionedUsers) {
|
||||
text = text.replaceAll(mentionedUser,"<span class=\"highlightedUser\">"+mentionedUser+"</span>");
|
||||
}
|
||||
|
||||
// for (String hashtag : hashtags) {
|
||||
// text = text.replaceAll(hashtag,"<span>"+hashtag+"</span>");
|
||||
// }
|
||||
|
||||
// re-inject the processed text into the div
|
||||
DOM.getElementById("highlighter").setInnerHTML(text);
|
||||
}
|
||||
|
@ -137,22 +162,34 @@ public class SuperPosedTextArea extends TextArea {
|
|||
* events binder
|
||||
*/
|
||||
private void bind() {
|
||||
eventBus.addHandler(PickedUserEvent.TYPE, new PickedUserEventHandler() {
|
||||
eventBus.addHandler(PickedItemEvent.TYPE, new PickedItemEventHandler() {
|
||||
@Override
|
||||
public void onSelectedUser(PickedUserEvent event) {
|
||||
public void onSelectedItem(PickedItemEvent event) {
|
||||
String triggerChar = event.getTriggerChar();
|
||||
String toAdd = event.getSelectedItem().getAlternativeName();
|
||||
if (triggerChar.compareTo("#") == 0) { //has to be treated differently becase the # char remain present in the text unlike the @
|
||||
toAdd = "#"+toAdd;
|
||||
hashtags.add(toAdd);
|
||||
|
||||
String toAdd = event.getSelectedUser().getFullName();
|
||||
int tPos = getText().lastIndexOf(triggerChar);
|
||||
setText(getText().substring(0, tPos) + toAdd);
|
||||
|
||||
Element highDiv = DOM.getElementById("highlighter");
|
||||
tPos = highDiv.getInnerHTML().lastIndexOf(triggerChar);
|
||||
highDiv.setInnerHTML(highDiv.getInnerHTML().substring(0, tPos) + toAdd);
|
||||
}
|
||||
if (event.getTriggerChar().compareTo("@") == 0) {
|
||||
mentionedUsers.add(toAdd);
|
||||
|
||||
String[] toSplit = getText().split("@"); //get the preceeding part
|
||||
String[] toSplit = getText().split(triggerChar); //get the preceeding part
|
||||
|
||||
setText(toSplit[0]+toAdd);
|
||||
Element highDiv = DOM.getElementById("highlighter");
|
||||
|
||||
String[] htmlToSplit = highDiv.getInnerHTML().split("@"); //get the preceeding part
|
||||
String[] htmlToSplit = highDiv.getInnerHTML().split(triggerChar); //get the preceeding part
|
||||
String highLightedUser = "<span class=\"highlightedUser\">"+toAdd+"</span>";
|
||||
highDiv.setInnerHTML(htmlToSplit[0]+highLightedUser);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -163,6 +200,16 @@ public class SuperPosedTextArea extends TextArea {
|
|||
toReturn.add(mentionedUser);
|
||||
}
|
||||
GWT.log(toReturn.toString());
|
||||
return mentionedUsers;
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public ArrayList<String> getHashtags() {
|
||||
ArrayList<String> toReturn = new ArrayList<String>();
|
||||
for (String hashtag : hashtags) {
|
||||
if (getText().contains(hashtag))
|
||||
toReturn.add(hashtag);
|
||||
}
|
||||
GWT.log(toReturn.toString());
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.shareupdates.server;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -18,10 +18,10 @@ public class MentionNotificationsThread implements Runnable {
|
|||
private String postText;
|
||||
private String postId;
|
||||
private NotificationsManager nm;
|
||||
private ArrayList<PickingUser> users;
|
||||
private ArrayList<ItemBean> users;
|
||||
|
||||
|
||||
public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList<PickingUser> users) {
|
||||
public MentionNotificationsThread(String postId, String postText, NotificationsManager nm, ArrayList<ItemBean> users) {
|
||||
super();
|
||||
this.postId = postId;
|
||||
this.postText = postText;
|
||||
|
@ -31,9 +31,9 @@ public class MentionNotificationsThread implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
for (PickingUser userToNotify : users) {
|
||||
boolean result = nm.notifyUserTag(userToNotify.getUsername(), postId, postText);
|
||||
_log.trace("Sending Notification for post mention to: " + userToNotify.getUsername() + " result?"+ result);
|
||||
for (ItemBean userToNotify : users) {
|
||||
boolean result = nm.notifyUserTag(userToNotify.getName(), postId, postText);
|
||||
_log.trace("Sending Notification for post mention to: " + userToNotify.getName() + " result?"+ result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,13 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.validator.routines.UrlValidator;
|
||||
|
@ -39,9 +43,10 @@ import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException;
|
|||
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;
|
||||
import org.gcube.portlets.user.shareupdates.shared.HashTagAndOccurrence;
|
||||
import org.gcube.portlets.user.shareupdates.shared.LinkPreview;
|
||||
import org.gcube.portlets.user.shareupdates.shared.UserSettings;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
|
||||
|
@ -51,6 +56,7 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gwt.core.ext.linker.LinkerOrder.Order;
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.liferay.portal.kernel.exception.PortalException;
|
||||
import com.liferay.portal.kernel.exception.SystemException;
|
||||
|
@ -113,7 +119,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
}
|
||||
public String getDevelopmentUser() {
|
||||
String user = TEST_USER;
|
||||
// user = "massimiliano.assante";
|
||||
user = "massimiliano.assante";
|
||||
return user;
|
||||
}
|
||||
/**
|
||||
|
@ -139,7 +145,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
|
||||
String escapedFeedText = TextTransfromUtils.escapeHtmlAndTransformUrl(postText);
|
||||
|
||||
ArrayList<PickingUser> mentionedUsers = null;
|
||||
ArrayList<ItemBean> mentionedUsers = null;
|
||||
if (mentionedUserFullNames != null && ! mentionedUserFullNames.isEmpty()) {
|
||||
mentionedUsers = getSelectedUserIds(mentionedUserFullNames);
|
||||
escapedFeedText = TextTransfromUtils.convertMentionPeopleAnchorHTML(escapedFeedText, mentionedUsers);
|
||||
|
@ -452,16 +458,11 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
*/
|
||||
private HashMap<String, String> getUserVreNames(String username) {
|
||||
HashMap<String, String> toReturn = new HashMap<String, String>();
|
||||
if (isInfrastructureScope()) {
|
||||
for (GroupModel vre : getUserVREs(username)) {
|
||||
toReturn.put(vre.getGroupId(), vre.getGroupName());
|
||||
}
|
||||
} else {
|
||||
for (GroupModel vre : getUserVREs(username)) {
|
||||
if (vre.getGroupName().compareTo(getASLSession().getGroupName())==0)
|
||||
toReturn.put(vre.getGroupId(), vre.getGroupName());
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -557,15 +558,15 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
*
|
||||
* @return the screennames of the addressee (user logins e.g. pino.pini)
|
||||
*/
|
||||
public ArrayList<PickingUser> getSelectedUserIds(ArrayList<String> fullNames) {
|
||||
public ArrayList<ItemBean> getSelectedUserIds(ArrayList<String> fullNames) {
|
||||
if (fullNames == null)
|
||||
return new ArrayList<PickingUser>();
|
||||
return new ArrayList<ItemBean>();
|
||||
else {
|
||||
ArrayList<PickingUser> allUsers = getPortalUsers();
|
||||
ArrayList<PickingUser> toReturn = new ArrayList<PickingUser>();
|
||||
ArrayList<ItemBean> allUsers = getPortalUsers();
|
||||
ArrayList<ItemBean> toReturn = new ArrayList<ItemBean>();
|
||||
for (String fullName : fullNames)
|
||||
for (PickingUser puser : allUsers) {
|
||||
if (puser.getFullName().compareTo(fullName) == 0) {
|
||||
for (ItemBean puser : allUsers) {
|
||||
if (puser.getAlternativeName().compareTo(fullName) == 0) {
|
||||
toReturn.add(puser);
|
||||
break;
|
||||
}
|
||||
|
@ -575,7 +576,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<PickingUser> getPortalUsers() {
|
||||
public ArrayList<ItemBean> getPortalUsers() {
|
||||
ASLSession session = getASLSession();
|
||||
boolean withinPortal = false;
|
||||
if (isWithinPortal() && session.getUsername().compareTo(TEST_USER) != 0) {
|
||||
|
@ -584,14 +585,35 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
return getOrganizationUsers(session.getScope(), session.getUsername(), withinPortal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemBean> getHashtags() {
|
||||
ASLSession session = getASLSession();
|
||||
String scope = session.getScope();
|
||||
_log.error("getting hashtags for " + scope);
|
||||
Map<String, Integer> map = store.getVREHashtagsWithOccurrence(scope);
|
||||
ArrayList<HashTagAndOccurrence> toSort = new ArrayList<HashTagAndOccurrence>();
|
||||
_log.trace("Got " + map.keySet().size() + " hashtags");
|
||||
for (String hashtag : map.keySet()) {
|
||||
toSort.add(new HashTagAndOccurrence(hashtag, map.get(hashtag)));
|
||||
}
|
||||
Collections.sort(toSort, Collections.reverseOrder());
|
||||
ArrayList<ItemBean> toReturn = new ArrayList<>();
|
||||
for (HashTagAndOccurrence wrapper : toSort) {
|
||||
String hashtag = wrapper.getHashtag().substring(1);
|
||||
toReturn.add(new ItemBean(hashtag, hashtag, hashtag, null));
|
||||
_log.trace(hashtag);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param session the Asl Session
|
||||
* @param withinPortal true when is on Liferay portal
|
||||
* @return the users belonging to the current organization (scope)
|
||||
*/
|
||||
public static ArrayList<PickingUser> getOrganizationUsers(String scope, String currUser, boolean withinPortal) {
|
||||
ArrayList<PickingUser> portalUsers = new ArrayList<PickingUser>();
|
||||
public static ArrayList<ItemBean> getOrganizationUsers(String scope, String currUser, boolean withinPortal) {
|
||||
ArrayList<ItemBean> portalUsers = new ArrayList<ItemBean>();
|
||||
try {
|
||||
if (withinPortal) {
|
||||
UserManager um = new LiferayUserManager();
|
||||
|
@ -616,21 +638,21 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
String thumbnailURL = "";
|
||||
com.liferay.portal.model.UserModel lifeUser = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), user.getScreenName());
|
||||
thumbnailURL = "/image/user_male_portrait?img_id="+lifeUser.getPortraitId();
|
||||
portalUsers.add(new PickingUser(user.getUserId(), user.getScreenName(), user.getFullname(), thumbnailURL));
|
||||
portalUsers.add(new ItemBean(user.getUserId(), user.getScreenName(), user.getFullname(), thumbnailURL));
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //test users
|
||||
portalUsers.add(new PickingUser("12111", "massimiliano.assante", "Test User #1", ""));
|
||||
portalUsers.add(new PickingUser("14111", "massimiliano.assante", "Test Second User #2", ""));
|
||||
portalUsers.add(new PickingUser("11511", "massimiliano.assante", "Test Third User", ""));
|
||||
portalUsers.add(new PickingUser("11611", "massimiliano.assante", "Test Fourth User", ""));
|
||||
portalUsers.add(new PickingUser("11711", "massimiliano.assante", "Test Fifth User", ""));
|
||||
portalUsers.add(new PickingUser("11811", "massimiliano.assante", "Test Sixth User", ""));
|
||||
portalUsers.add(new PickingUser("15811", "massimiliano.assante", "Ninth Testing User", ""));
|
||||
portalUsers.add(new PickingUser("15811", "massimiliano.assante", "Eighth Testing User", ""));
|
||||
portalUsers.add(new PickingUser("11211", "giogio.giorgi", "Seventh Test User", ""));
|
||||
portalUsers.add(new PickingUser("2222", "pino.pinetti", "Tenth Testing User", ""));
|
||||
portalUsers.add(new ItemBean("12111", "massimiliano.assante", "Test User #1", ""));
|
||||
portalUsers.add(new ItemBean("14111", "massimiliano.assante", "Test Second User #2", ""));
|
||||
portalUsers.add(new ItemBean("11511", "massimiliano.assante", "Test Third User", ""));
|
||||
portalUsers.add(new ItemBean("11611", "massimiliano.assante", "Test Fourth User", ""));
|
||||
portalUsers.add(new ItemBean("11711", "massimiliano.assante", "Test Fifth User", ""));
|
||||
portalUsers.add(new ItemBean("11811", "massimiliano.assante", "Test Sixth User", ""));
|
||||
portalUsers.add(new ItemBean("15811", "massimiliano.assante", "Ninth Testing User", ""));
|
||||
portalUsers.add(new ItemBean("15811", "massimiliano.assante", "Eighth Testing User", ""));
|
||||
portalUsers.add(new ItemBean("11211", "giogio.giorgi", "Seventh Test User", ""));
|
||||
portalUsers.add(new ItemBean("2222", "pino.pinetti", "Tenth Testing User", ""));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_log.error("Error in server get all contacts ", e);
|
||||
|
@ -639,4 +661,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
|||
import org.gcube.portlets.user.shareupdates.server.metaseeker.MetaSeeker;
|
||||
import org.gcube.portlets.user.shareupdates.server.opengraph.OpenGraph;
|
||||
import org.gcube.portlets.user.shareupdates.shared.LinkPreview;
|
||||
import org.gcube.portlets.widgets.pickuser.shared.PickingUser;
|
||||
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
|
||||
import org.htmlcleaner.HtmlCleaner;
|
||||
import org.htmlcleaner.TagNode;
|
||||
import org.htmlparser.beans.StringBean;
|
||||
|
@ -31,6 +31,7 @@ import com.sun.net.ssl.HttpsURLConnection;
|
|||
* @author Massimiliano Assante, ISTI-CNR
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation", "restriction" })
|
||||
public class TextTransfromUtils {
|
||||
/**
|
||||
*
|
||||
|
@ -55,13 +56,13 @@ public class TextTransfromUtils {
|
|||
* @param taggedPeople
|
||||
* @return
|
||||
*/
|
||||
protected static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<PickingUser> taggedPeople) {
|
||||
for (PickingUser tagged : taggedPeople) {
|
||||
protected static String convertMentionPeopleAnchorHTML(String escapedFeedText, ArrayList<ItemBean> taggedPeople) {
|
||||
for (ItemBean tagged : taggedPeople) {
|
||||
String taggedHTML = "<a class=\"link\" style=\"font-size:14px;\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK
|
||||
+"?"+
|
||||
new String(Base64.encodeBase64(GCubeSocialNetworking.USER_PROFILE_OID.getBytes()))+"="+
|
||||
new String(Base64.encodeBase64(tagged.getUsername().getBytes()))+"\">"+tagged.getFullName()+"</a> ";
|
||||
escapedFeedText = escapedFeedText.replace(tagged.getFullName(), taggedHTML);
|
||||
new String(Base64.encodeBase64(tagged.getName().getBytes()))+"\">"+tagged.getAlternativeName()+"</a> ";
|
||||
escapedFeedText = escapedFeedText.replace(tagged.getAlternativeName(), taggedHTML);
|
||||
}
|
||||
return escapedFeedText;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.portlets.user.shareupdates.shared;
|
||||
|
||||
public class HashTagAndOccurrence implements Comparable<HashTagAndOccurrence>{
|
||||
private String hashtag;
|
||||
private Integer occurrence;
|
||||
public HashTagAndOccurrence(String hashtag, Integer occurrence) {
|
||||
super();
|
||||
this.hashtag = hashtag;
|
||||
this.occurrence = occurrence;
|
||||
}
|
||||
public String getHashtag() {
|
||||
return hashtag;
|
||||
}
|
||||
public void setHashtag(String hashtag) {
|
||||
this.hashtag = hashtag;
|
||||
}
|
||||
public Integer getOccurrence() {
|
||||
return occurrence;
|
||||
}
|
||||
public void setOccurrence(Integer occurrence) {
|
||||
this.occurrence = occurrence;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HashTagAndOccurrence [hashtag=" + hashtag + ", occurrence="
|
||||
+ occurrence + "]";
|
||||
}
|
||||
@Override
|
||||
public int compareTo(HashTagAndOccurrence o) {
|
||||
if (this.occurrence == o.getOccurrence()) return 0;
|
||||
return (this.occurrence > o.getOccurrence()) ? 1 : -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -13,12 +13,12 @@
|
|||
name="net.eliasbalasis.tibcopagebus4gwt.testsubscriber.TestSubscriber" />
|
||||
|
||||
<!-- 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 -->
|
||||
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<inherits name='org.gcube.portlets.widgets.pickuser.PickUser' />
|
||||
<inherits name='org.gcube.portlets.widgets.pickitem.PickItem' />
|
||||
<inherits name='org.gcube.portlets.widgets.fileupload.FileUpload' />
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.user.shareupdates.client.ShareUpdates' />
|
||||
|
|
|
@ -65,6 +65,11 @@
|
|||
background-color: #D8DFEA !important;
|
||||
}
|
||||
|
||||
.highlightedHashtag {
|
||||
background-color: #0084B5 !important;
|
||||
}
|
||||
|
||||
|
||||
/* DIV trick ends here */
|
||||
|
||||
.gwt-Button {
|
||||
|
|
Loading…
Reference in New Issue