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