From 3d94e982eae755b285a3485e986e5089585e2972 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Mon, 28 Jan 2013 23:17:26 +0000 Subject: [PATCH] fixed bug displaying html tags on notifications git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/notifications@68445 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 10 +++---- .settings/org.eclipse.jdt.core.prefs | 8 ++--- ....eclipse.wst.common.project.facet.core.xml | 2 +- pom.xml | 6 ++-- .../notifications/client/Notifications.java | 1 - .../templates/SingleNotificationView.java | 28 +++++++++++++++++- .../templates/images/NotificationImages.java | 6 ++++ .../client/view/templates/images/comment.png | Bin 3288 -> 744 bytes .../templates/images/document-workflow.png | Bin 0 -> 606 bytes .../templates/images/workflow-forward.png | Bin 0 -> 537 bytes 10 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/document-workflow.png create mode 100644 src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/workflow-forward.png diff --git a/.classpath b/.classpath index 7af9f72..e003a06 100644 --- a/.classpath +++ b/.classpath @@ -20,16 +20,16 @@ - - - - - + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index ad26666..23f2710 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,9 @@ -#Thu Sep 02 10:42:20 CEST 2010 +#Mon Jan 28 22:47:29 CET 2013 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 7ff7048..d215cd0 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,7 +1,7 @@ - + diff --git a/pom.xml b/pom.xml index 0d0b734..35cd5a2 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ org.gcube.core gcf - [1.4.0,1.5.0] + [1.4.0,1.6.0] provided @@ -163,8 +163,8 @@ maven-compiler-plugin 2.3.2 - 1.5 - 1.5 + 1.6 + 1.6 diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/Notifications.java b/src/main/java/org/gcube/portlets/user/notifications/client/Notifications.java index 249a31f..461fefe 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/Notifications.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/Notifications.java @@ -3,7 +3,6 @@ package org.gcube.portlets.user.notifications.client; import org.gcube.portlets.user.notifications.client.view.NotificationsPanel; import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.RootPanel; /** diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java index 0a973fe..c123b6c 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java @@ -11,12 +11,15 @@ 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.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; public class SingleNotificationView extends Composite { + private final static String LINK_TEXT = "likes your post: shared a link. "; + private static NotificationsDayUiBinder uiBinder = GWT .create(NotificationsDayUiBinder.class); @@ -39,9 +42,22 @@ public class SingleNotificationView extends Composite { myNotification = toShow; String notificationToShow = toShow.getDescription(); + String removeMarkup = notificationToShow.replaceAll("&", "&"); + String actualHTML = new HTML(removeMarkup).getText(); + + + //in case of links behave differently, i know is terrible //TODO: write better code here + if (new HTML(actualHTML).getText().equalsIgnoreCase(LINK_TEXT)) { + GWT.log("E' UN LINK!"); + actualHTML = actualHTML.replace("your post:", ""); + actualHTML = actualHTML.replace("shared", ""); + actualHTML = actualHTML.replace("link.", "link"); + actualHTML += " you shared."; + } + notificationText.setHTML( ""+ - toShow.getSenderFullName()+" " + notificationToShow); + toShow.getSenderFullName()+" " + actualHTML); timeArea.setHTML(DateTimeFormat.getFormat("h:mm a").format(toShow.getTime())); @@ -77,6 +93,16 @@ public class SingleNotificationView extends Composite { return images.jobNOK(); case JOB_COMPLETED_OK: return images.jobOK(); + case DOCUMENT_WORKFLOW_EDIT: + return images.documentWorkflow(); + case DOCUMENT_WORKFLOW_VIEW: + return images.documentWorkflow(); + case DOCUMENT_WORKFLOW_STEP_REQUEST_TASK: + return images.documentWorkflow(); + case DOCUMENT_WORKFLOW_STEP_FORWARD_OWNER: + return images.workflowForward(); + case DOCUMENT_WORKFLOW_STEP_FORWARD_PEER: + return images.workflowForward(); default: return images.generic(); } diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/NotificationImages.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/NotificationImages.java index f9148bb..0f19eac 100644 --- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/NotificationImages.java +++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/NotificationImages.java @@ -25,6 +25,12 @@ public interface NotificationImages extends ClientBundle { @Source("job_nok.png") ImageResource jobNOK(); + @Source("document-workflow.png") + ImageResource documentWorkflow(); + + @Source("workflow-forward.png") + ImageResource workflowForward(); + @Source("notification-generic.png") ImageResource generic(); } diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/comment.png b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/comment.png index 82f6f3aadd04bede09b9c4e2e7f73ab2a1e15d15..8c767681b1c3e9d33c1acc00115d8516bb165c45 100644 GIT binary patch delta 721 zcmV;?0xtd78R!L&BYy&~NkldG=f#ZA~p*_tqWbL z1*OnMaiPVn8&R;htKdoncd1K3R8kPZAe63r6pN@-vuH|VyD3&eypUU~x5<5;bN+u^ z+{SKnGrJKaEBM1j@4FW^04(tAA_%4ajEh;E|W#V)4+C z7iWt6XjzUPtE#wwAVH-avamKvdS?B*uRpwaYKh*)mD_;(o_mQy$KO4sRsZAbe{>q# z{UItc&L$_ilVYN17z=mJA;r`iKd&q=t$*}3Hh=IL4!?Qwy-s^;Y3oKOq$K27MldB< zz|06Hm>G5L{D0Zmq3rjbec;i@5A>p}$dM1eeWKB9{?HwimyO z@!Bb4#Y7eeMSd*gMe%BPP?CiVRYP?Qa2!E!cO)i~MgkBul1ZRfR!kYMg<)CGXCXtx zFcVab@%oCBa0d~`YeN;>5+0SHN`FwztAuP-P|Ot7fPbiAmSL*5yrKWBrid6Kf{Gxj ztJ=Bx%R8Dkk_xDd$)<*7yTyu%q5_B@yJkil4Nr)e@%*Qk4v41joz8Dp>b(y?ITK@rBjApsUrIi)7OT;X&gQQdu3ujL=Gxg6cCKBz z{mS?3e~85s%lC)o)Jdy`2b<<=(^7puE2CxktF?LYv-eR8s0I3iA(G_`%ZkBZK&#b4 z&YV7dZ@1Swnqs`uJWhkpAX0$LqNJ1=tyoBYyx1a7bBm000XT000XT0n*)m`~Uz7PiaF#P*7-ZbZ>KLZ*U+< zLqi~Na&Km7Y-Iodc-oy)XH-+^7Crag^g>IBfRsybQWXdwQbLP>6pAqfylh#{fb z6;Z(vMMVS~$e@S=j*ftg6;Uh>2n?1;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6N<$g2n$0fB*mh literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/workflow-forward.png b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/images/workflow-forward.png new file mode 100644 index 0000000000000000000000000000000000000000..fac40e551b249cf94ed1efbe538e31d8f7ada366 GIT binary patch literal 537 zcmV+!0_OdRP)mw40Pyw&k3mnHSvMjrUt_$&Q7{;xx>n$rMl}Zf> zejia3!QpW1#bU9jAPC`7sdSyqW;qO9jI98*h>r$TRfR^QG3WRD!`*Hdh^ledq=p)S!C?=@s{;qyKF| zk|c_tx!pr$84nn6itYyD8B9o`eI2_eX0c}j%oBM?@Ncj2 bOMn3Y!7|lBMMFiY00000NkvXXu0mjfS+w5? literal 0 HcmV?d00001