|
|
|
@ -6,18 +6,16 @@ import org.gcube.portal.databook.client.util.Encoder;
|
|
|
|
|
import org.gcube.portal.databook.shared.Notification;
|
|
|
|
|
import org.gcube.portal.databook.shared.NotificationType;
|
|
|
|
|
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
|
|
|
|
import org.gcube.portlets.user.notifications.client.view.templates.images.NotificationImages;
|
|
|
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Icon;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
|
|
|
|
import com.google.gwt.resources.client.ImageResource;
|
|
|
|
|
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
|
|
import com.google.gwt.uibinder.client.UiField;
|
|
|
|
|
import com.google.gwt.user.client.Window.Location;
|
|
|
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
|
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
|
|
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
|
|
|
import com.google.gwt.user.client.ui.Image;
|
|
|
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -27,6 +25,7 @@ import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
public class SingleNotificationView extends Composite {
|
|
|
|
|
|
|
|
|
|
private final static String LINK_TEXT = "likes your post: shared a link. ";
|
|
|
|
|
private static final String ICON_SIZE = " fa-lg";
|
|
|
|
|
|
|
|
|
|
private static NotificationsDayUiBinder uiBinder = GWT
|
|
|
|
|
.create(NotificationsDayUiBinder.class);
|
|
|
|
@ -35,10 +34,7 @@ public class SingleNotificationView extends Composite {
|
|
|
|
|
UiBinder<Widget, SingleNotificationView> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NotificationImages images = GWT.create(NotificationImages.class);
|
|
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
|
Image notificationImage;
|
|
|
|
|
@UiField Icon notificationIcon;
|
|
|
|
|
@UiField HTMLPanel mainPanel;
|
|
|
|
|
@UiField Span notificationText;
|
|
|
|
|
@UiField Span timeArea;
|
|
|
|
@ -50,6 +46,9 @@ public class SingleNotificationView extends Composite {
|
|
|
|
|
if (!toShow.isRead()) {
|
|
|
|
|
mainPanel.addStyleName("unread-notification");
|
|
|
|
|
}
|
|
|
|
|
notificationIcon.setStyleName(new StringBuffer(getIconType(toShow.getType())).append(ICON_SIZE).toString());
|
|
|
|
|
notificationIcon.addStyleName("icon-color");
|
|
|
|
|
|
|
|
|
|
String notificationToShow = toShow.getDescription();
|
|
|
|
|
GWT.log(notificationToShow);
|
|
|
|
|
String removeMarkup = notificationToShow.replaceAll("&", "&").replaceAll("<","<").replaceAll(">",">");
|
|
|
|
@ -77,7 +76,6 @@ public class SingleNotificationView extends Composite {
|
|
|
|
|
|
|
|
|
|
timeArea.setHTML(DateTimeFormat.getFormat("h:mm a").format(toShow.getTime()));
|
|
|
|
|
|
|
|
|
|
notificationImage.setResource(getImageType(toShow.getType()));
|
|
|
|
|
|
|
|
|
|
switch (toShow.getType()) {
|
|
|
|
|
case MENTION:
|
|
|
|
@ -115,49 +113,55 @@ public class SingleNotificationView extends Composite {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ImageResource getImageType(NotificationType type) {
|
|
|
|
|
private String getIconType(NotificationType type) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case LIKE:
|
|
|
|
|
return images.like();
|
|
|
|
|
return "fa fa-thumbs-o-up";
|
|
|
|
|
case COMMENT:
|
|
|
|
|
return images.comment();
|
|
|
|
|
return "fa-comment-o";
|
|
|
|
|
case MENTION:
|
|
|
|
|
return images.mention();
|
|
|
|
|
return "fa fa-tag";
|
|
|
|
|
case MESSAGE:
|
|
|
|
|
return images.message();
|
|
|
|
|
return "fa-envelope-o";
|
|
|
|
|
case WP_FOLDER_ADDEDUSER:
|
|
|
|
|
return "fa fa-user-plus";
|
|
|
|
|
case WP_FOLDER_REMOVEDUSER:
|
|
|
|
|
return "fa-user-times";
|
|
|
|
|
case WP_FOLDER_SHARE:
|
|
|
|
|
return "fa fa-folder-open-o";
|
|
|
|
|
case WP_ITEM_NEW:
|
|
|
|
|
return "fa-file-text-o";
|
|
|
|
|
case WP_ITEM_DELETE:
|
|
|
|
|
return "fa fa-trash-o";
|
|
|
|
|
case WP_ITEM_UPDATED:
|
|
|
|
|
return images.share();
|
|
|
|
|
return "fa fa-files-o";
|
|
|
|
|
case WP_FOLDER_UNSHARE:
|
|
|
|
|
return images.unshare();
|
|
|
|
|
return "fa fa-times-circle-o";
|
|
|
|
|
case OWN_COMMENT:
|
|
|
|
|
return images.comment();
|
|
|
|
|
return "fa-comment-o";
|
|
|
|
|
case REQUEST_CONNECTION:
|
|
|
|
|
return images.connectionRequest();
|
|
|
|
|
return "fa fa-plug";
|
|
|
|
|
case JOB_COMPLETED_NOK:
|
|
|
|
|
return images.jobNOK();
|
|
|
|
|
return "fa fa-exclamation-triangle";
|
|
|
|
|
case JOB_COMPLETED_OK:
|
|
|
|
|
return images.jobOK();
|
|
|
|
|
return "fa fa-check";
|
|
|
|
|
case CALENDAR_ADDED_EVENT:
|
|
|
|
|
return images.calendar();
|
|
|
|
|
return "fa fa-calendar";
|
|
|
|
|
case CALENDAR_UPDATED_EVENT:
|
|
|
|
|
return images.calendarEdit();
|
|
|
|
|
return "fa fa-calendar";
|
|
|
|
|
case CALENDAR_DELETED_EVENT:
|
|
|
|
|
return images.calendarDelete();
|
|
|
|
|
return "fa fa-calendar";
|
|
|
|
|
case POST_ALERT:
|
|
|
|
|
return images.postAlert();
|
|
|
|
|
return "fa fa-rss";
|
|
|
|
|
case TDM_TAB_RESOURCE_SHARE:
|
|
|
|
|
case TDM_RULE_SHARE:
|
|
|
|
|
case TDM_TEMPLATE_SHARE:
|
|
|
|
|
return images.tableShare();
|
|
|
|
|
return "fa fa-table";
|
|
|
|
|
default:
|
|
|
|
|
return images.generic();
|
|
|
|
|
return "fa fa-share-alt-square";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String extractOrgFriendlyURL(String portalURL) {
|
|
|
|
|
String groupRegEx = "/group/";
|
|
|
|
|
if (portalURL.contains(groupRegEx)) {
|
|
|
|
|