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
This commit is contained in:
Massimiliano Assante 2013-01-28 23:17:26 +00:00
parent e71cb9916a
commit 3d94e982ea
10 changed files with 46 additions and 15 deletions

View File

@ -20,16 +20,16 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/notifications-0.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="java" version="1.6"/>
</faceted-project>

View File

@ -53,7 +53,7 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0,1.5.0]</version>
<version>[1.4.0,1.6.0]</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -163,8 +163,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- SA Plugin -->

View File

@ -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;
/**

View File

@ -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("&amp;", "&");
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(
"<a class=\"link\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"\">"+
toShow.getSenderFullName()+"</a> " + notificationToShow);
toShow.getSenderFullName()+"</a> " + 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();
}

View File

@ -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();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B