fixed bugs result from testing in all browsers

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@73557 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-04-17 22:53:57 +00:00
parent a1907bbe76
commit 8530439672
1 changed files with 10 additions and 12 deletions

View File

@ -16,8 +16,6 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.validator.routines.UrlValidator;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
@ -60,7 +58,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.tidy.Tidy;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
@ -114,9 +111,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
// user = "test.user";
user = "massimiliano.assante";
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
user = "test.user";
// user = "massimiliano.assante";
// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
withinPortal = false;
}
else {
@ -154,7 +151,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
* @return the text inside the html
*/
private static String html2text(String html) {
return Jsoup.parse(html).text();
return Jsoup.parse(html).text().replace(" "," ");
}
@ -175,11 +172,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
String html = "<html><head></head><body>" + escapedFeedText + "</body></html>";
return html2text(html);
} else {
_log.trace("postText curing: " + postText);
// this is needed to reconstruct the place of people tags, selfexplaining i think
int i = 0;
while (postText.contains("<input readonly=")) {
while (postText.contains("<input")) {
//the replacing does not affect html but affects the While guard
postText = postText.replaceFirst("<input readonly=", "_usr_place_holder_["+i+"]<input readonly =");
postText = postText.replaceFirst("<input", "_usr_place_holder_["+i+"]<br");
i++;
}
String html = "<html><head></head><body>" + postText + "</body></html>";
@ -284,11 +282,13 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
* @return the text with the clickable url in it
*/
public String transformUrls(String feedText) {
System.out.println("transformUrls" + feedText);
StringBuilder sb = new StringBuilder();
// separate input by spaces ( URLs have no spaces )
String [] parts = feedText.split("\\s");
// Attempt to convert each item into an URL.
for (int i = 0; i < parts.length; i++) {
System.out.println("part: " + parts[i]);
if (parts[i].startsWith("http")) {
try {
URL url = new URL(parts[i]);
@ -311,8 +311,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
public UserSettings getUserSettings() {
if (getUserSettingsFromSession() != null)
return getUserSettingsFromSession();
try {
ASLSession session = getASLSession();
String username = session.getUsername();
@ -712,7 +710,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
Workspace workspace = getWorkspace();
List<User> users = workspace.getHome().getHomeManager().getUsers();
for (User user : users) {
_log.trace("Trying to get additional info for "+user.getPortalLogin());
//_log.trace("Trying to get additional info for "+user.getPortalLogin());
if (user.getPortalLogin().compareTo("test.user") != 0) { //skip test.user
UserModel curr = null;
String thumbnailURL = "";