removed client scope helper dependency

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@144460 82a268e6-3cf1-43bd-a215-b396298e98cf
Feature/26194
Massimiliano Assante 7 years ago
parent 9cf2f11361
commit e99edf659a

@ -17,7 +17,6 @@ import org.gcube.portal.databook.shared.Like;
import org.gcube.portal.databook.shared.PrivacyLevel;
import org.gcube.portal.databook.shared.ShowUserStatisticAction;
import org.gcube.portal.databook.shared.UserInfo;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.user.newsfeed.client.FilterType;
import org.gcube.portlets.user.newsfeed.client.NewsFeed;
import org.gcube.portlets.user.newsfeed.client.NewsService;
@ -211,7 +210,7 @@ public class NewsFeedPanel extends Composite {
eventBus.addHandler(SelectedUserEvent.TYPE, new SelectedUserEventHandler() {
@Override
public void onSelectedUser(SelectedUserEvent event) {
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
Location.assign(profilePageURL+"?"+
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
Encoder.encode(event.getSelectedUser().getId()));
@ -443,7 +442,7 @@ public class NewsFeedPanel extends Composite {
@Override
public void onSuccess(EnhancedFeed result) {
if (result.getFeed().getType() == FeedType.DISABLED) {
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
String usrLink = "<a class=\"link\" href=\""+profilePageURL+"?"+
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
Encoder.encode(result.getFeed().getEntityId())+"\">"+result.getFeed().getFullName()+
@ -1475,4 +1474,19 @@ public class NewsFeedPanel extends Composite {
public static String getCurrentScope() {
return currentScope;
}
public static String extractOrgFriendlyURL(String portalURL) {
String groupRegEx = "/group/";
if (portalURL.contains(groupRegEx)) {
String[] splits = portalURL.split(groupRegEx);
String friendlyURL = splits[1];
if (friendlyURL.contains("/")) {
friendlyURL = friendlyURL.split("/")[0];
} else {
friendlyURL = friendlyURL.split("\\?")[0].split("\\#")[0];
}
return "/"+friendlyURL;
}
return null;
}
}

@ -6,8 +6,8 @@ import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.user.newsfeed.client.event.DeleteCommentEvent;
import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
@ -90,7 +90,7 @@ public class SingleComment extends Composite {
commentToShow = commentToShow.substring(0, TEXT_TO_SHOW_LENGHT) + "...";
seeMore.setHTML("<a class=\"seemore\"> See More </a>");
}
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
commentText.setHTML("<a class=\"link\" href=\"" + profilePageURL + "?"+
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
@ -135,7 +135,7 @@ public class SingleComment extends Composite {
commentToShow = commentToShow.replaceAll("&lt;","<").replaceAll("&gt;",">");
commentToShow = commentToShow.replaceAll("&amp;","&");
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
commentText.setHTML("<a class=\"link\" href=\"" + profilePageURL + "?"+
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+

@ -16,7 +16,6 @@ import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.EnhancedFeed;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.UserInfo;
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
import org.gcube.portlets.user.newsfeed.client.event.AddLikeEvent;
import org.gcube.portlets.user.newsfeed.client.event.DeleteFeedEvent;
import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent;
@ -312,7 +311,7 @@ public class TweetTemplate extends Composite {
feedText = feedText.replaceAll("&lt;","<").replaceAll("&gt;",">");
feedText = feedText.replaceAll("&amp;","&");
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
if (! isAppFeed) {
// sharePostArea.setHTML("<a>" + NewsFeedPanel.SHARE_FWD_LABEL + "</a>");
@ -460,7 +459,7 @@ public class TweetTemplate extends Composite {
feedText = feedText.replaceAll("&lt;","<").replaceAll("&gt;",">");
feedText = feedText.replaceAll("&amp;","&");
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + ClientScopeHelper.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
contentArea.setHTML("<a class=\"link\"href=\"" + profilePageURL + "?"+

Loading…
Cancel
Save