highlight the not read notifications

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@68543 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-01-29 23:55:20 +00:00
parent 65c4867208
commit f39e7a121f
3 changed files with 15 additions and 10 deletions

View File

@ -29,8 +29,6 @@ public class SingleNotificationView extends Composite {
NotificationImages images = GWT.create(NotificationImages.class); NotificationImages images = GWT.create(NotificationImages.class);
private Notification myNotification;
@UiField @UiField
Image notificationImage; Image notificationImage;
@UiField HTMLPanel mainPanel; @UiField HTMLPanel mainPanel;
@ -40,7 +38,10 @@ public class SingleNotificationView extends Composite {
public SingleNotificationView(Notification toShow) { public SingleNotificationView(Notification toShow) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
myNotification = toShow;
if (!toShow.isRead()) {
mainPanel.addStyleName("unread-notification");
}
String notificationToShow = toShow.getDescription(); String notificationToShow = toShow.getDescription();
String removeMarkup = notificationToShow.replaceAll("&", "&"); String removeMarkup = notificationToShow.replaceAll("&", "&");
@ -49,7 +50,6 @@ public class SingleNotificationView extends Composite {
//in case of links behave differently, i know is terrible //TODO: write better code here i think //in case of links behave differently, i know is terrible //TODO: write better code here i think
if (new HTML(actualHTML).getText().equalsIgnoreCase(LINK_TEXT)) { if (new HTML(actualHTML).getText().equalsIgnoreCase(LINK_TEXT)) {
GWT.log("E' UN LINK!");
actualHTML = actualHTML.replace("your post:", ""); actualHTML = actualHTML.replace("your post:", "");
actualHTML = actualHTML.replace("shared", ""); actualHTML = actualHTML.replace("shared", "");
actualHTML = actualHTML.replace("link.", "link"); actualHTML = actualHTML.replace("link.", "link");
@ -68,6 +68,8 @@ public class SingleNotificationView extends Composite {
switch (toShow.getType()) { switch (toShow.getType()) {
case DOCUMENT_WORKFLOW_STEP_REQUEST_TASK: case DOCUMENT_WORKFLOW_STEP_REQUEST_TASK:
goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> See this Document Workflow.</a>"); goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> See this Document Workflow.</a>");
//remove the Sender of the notification because it is sent by the user that performs the last forward
notificationText.setHTML(actualHTML);
break; break;
case DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT: case DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT:
goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> See this New Document Workflow.</a>"); goApp.setHTML("<a class=\"link\" href=\""+toShow.getUri()+"\"> See this New Document Workflow.</a>");

View File

@ -59,8 +59,8 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE); String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (user == null) { if (user == null) {
//user = "test.user"; //user = "test.user";
user = "leonardo.candela"; //user = "leonardo.candela";
user = "massimiliano.assante";
_log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL"); _log.warn("USER IS NULL setting "+user+" and Running OUTSIDE PORTAL");
withinPortal = false; withinPortal = false;
} }
@ -148,13 +148,11 @@ public class NotificationsServiceImpl extends RemoteServiceServlet implements No
return cal.getTime(); return cal.getTime();
} }
/** /**
* this set all the notifications for this user read * this sets all the notifications for this user read
*/ */
public boolean setAllUserNotificationsRead() { public boolean setAllUserNotificationsRead() {
try { try {
for (Notification notification :store.getUnreadNotificationsByUser(getASLSession().getUsername()) ) { store.setAllNotificationReadByUser(getASLSession().getUsername());
store.setNotificationRead(notification.getKey());
}
} catch (Exception e) { } catch (Exception e) {
_log.error("While trying to set User notifications Read"); _log.error("While trying to set User notifications Read");
e.printStackTrace(); e.printStackTrace();

View File

@ -43,6 +43,11 @@ a.link:hover {
border-top: 1px solid #EFEFEF; border-top: 1px solid #EFEFEF;
} }
.unread-notification {
background-color: #e8effa;
}
.no-notification-message { .no-notification-message {
line-height: 40px; line-height: 40px;
font-family: 'Architects Daughter', arial, sans-serif; font-family: 'Architects Daughter', arial, sans-serif;