added show VRE source when all updates is in mode infrastructure
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@92880 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3f32513834
commit
8ccca59096
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/news-feed-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/news-feed-1.5.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -31,5 +31,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/news-feed-1.5.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/news-feed-1.5.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.5.0-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.5.1-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>news-feed</artifactId>
|
<artifactId>news-feed</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.5.0-SNAPSHOT</version>
|
<version>1.5.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>gCube News Feed Portlet</name>
|
<name>gCube News Feed Portlet</name>
|
||||||
<description>
|
<description>
|
||||||
|
@ -72,6 +72,10 @@
|
||||||
<artifactId>aslcore</artifactId>
|
<artifactId>aslcore</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>accesslogger</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>aslsocial</artifactId>
|
<artifactId>aslsocial</artifactId>
|
||||||
|
|
|
@ -12,12 +12,9 @@ import org.jsonmaker.gwt.client.Jsonizer;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -92,8 +92,10 @@ public class NewsFeedPanel extends Composite {
|
||||||
public static final String LIKED_LABEL = "Favorited";
|
public static final String LIKED_LABEL = "Favorited";
|
||||||
public static final String COMMENT_LABEL = "Reply";
|
public static final String COMMENT_LABEL = "Reply";
|
||||||
public static final String MESSAGE_LABEL = "Message";
|
public static final String MESSAGE_LABEL = "Message";
|
||||||
|
|
||||||
private String vreLabel;
|
private String vreLabel;
|
||||||
|
private boolean showFeedTimelineSource = false;
|
||||||
|
private boolean isInfrastructure = false;
|
||||||
|
|
||||||
private int delayMillis = 300000; //5 minutes by default (is read from a configuration file in the first async callback)
|
private int delayMillis = 300000; //5 minutes by default (is read from a configuration file in the first async callback)
|
||||||
|
|
||||||
|
@ -152,11 +154,11 @@ public class NewsFeedPanel extends Composite {
|
||||||
public void onSelectedUser(SelectedUserEvent event) {
|
public void onSelectedUser(SelectedUserEvent event) {
|
||||||
GWT.log("event...");
|
GWT.log("event...");
|
||||||
Location.assign(GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
|
Location.assign(GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
|
||||||
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
||||||
Encoder.encode(event.getSelectedUser().getId()));
|
Encoder.encode(event.getSelectedUser().getId()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(SeeLikesEvent.TYPE, new SeeLikesEventHandler() {
|
eventBus.addHandler(SeeLikesEvent.TYPE, new SeeLikesEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onSeeLikes(SeeLikesEvent event) {
|
public void onSeeLikes(SeeLikesEvent event) {
|
||||||
|
@ -184,7 +186,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
doDeleteFeed(event.getToDelete());
|
doDeleteFeed(event.getToDelete());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(OpenFeedEvent.TYPE, new OpenFeedEventHandler() {
|
eventBus.addHandler(OpenFeedEvent.TYPE, new OpenFeedEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onOpenFeed(OpenFeedEvent event) {
|
public void onOpenFeed(OpenFeedEvent event) {
|
||||||
|
@ -225,7 +227,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
public void onSuccess(UserSettings result) {
|
public void onSuccess(UserSettings result) {
|
||||||
myUserInfo = result.getUserInfo();
|
myUserInfo = result.getUserInfo();
|
||||||
delayMillis = result.getRefreshingTimeInMillis();
|
delayMillis = result.getRefreshingTimeInMillis();
|
||||||
vreLabel = result.getChannelName();
|
vreLabel = result.getVreLabel();
|
||||||
if (result.getUserInfo().getUsername().equals("test.user")) {
|
if (result.getUserInfo().getUsername().equals("test.user")) {
|
||||||
Window.alert("Your session has expired, please log out and login again");
|
Window.alert("Your session has expired, please log out and login again");
|
||||||
}
|
}
|
||||||
|
@ -240,10 +242,13 @@ public class NewsFeedPanel extends Composite {
|
||||||
currentFilter = FilterType.ALL_UPDATES;
|
currentFilter = FilterType.ALL_UPDATES;
|
||||||
}
|
}
|
||||||
//adjustments in the UI Depending on the scope
|
//adjustments in the UI Depending on the scope
|
||||||
if (result.isInfrastructure())
|
if (result.isInfrastructure()) {
|
||||||
filterPanelWrapper.setVisible(true);
|
filterPanelWrapper.setVisible(true);
|
||||||
else
|
showFeedTimelineSource = result.isShowTimelineSourceLabel();
|
||||||
mainPanel.addStyleName("framed");
|
isInfrastructure = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mainPanel.addStyleName("framed");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -294,7 +299,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.setHeight("");
|
newsPanel.setHeight("");
|
||||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||||
newsPanel.add(new TweetTemplate(true, myUserInfo, result, eventBus));
|
newsPanel.add(new TweetTemplate(true, true, myUserInfo, result, eventBus));
|
||||||
}
|
}
|
||||||
newsPanel.add(new Image(spacer));
|
newsPanel.add(new Image(spacer));
|
||||||
}
|
}
|
||||||
|
@ -426,10 +431,16 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.clear();
|
newsPanel.clear();
|
||||||
if (feeds != null) {
|
if (feeds != null) {
|
||||||
if (feeds.size() == 0) {
|
if (feeds.size() == 0) {
|
||||||
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
if (!isInfrastructure) {
|
||||||
"Looks like we've got nothing for you at the moment. <br> " +
|
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
||||||
"You may begin by <a class=\"vrelink\" href=\"/group/data-e-infrastructure-gateway/join-new/\"><span class=\"important\">joining</span></a> some of the available " +
|
"Sorry, looks like nobody shared anything yet. <br> " +
|
||||||
"<br>"+vreLabel+"s.</div>"));
|
"You may begin by sharing a news!</div>"));
|
||||||
|
} else {
|
||||||
|
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
||||||
|
"Sorry, looks like we've got nothing for you at the moment. <br> " +
|
||||||
|
"You may begin by <a class=\"vrelink\" href=\"/group/data-e-infrastructure-gateway/join-new/\"><span class=\"important\">joining</span></a> some of the available " +
|
||||||
|
"<br>"+vreLabel+"s.</div>"));
|
||||||
|
}
|
||||||
isFirstTweet = true;
|
isFirstTweet = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -437,7 +448,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||||
for (EnhancedFeed feed : feeds) {
|
for (EnhancedFeed feed : feeds) {
|
||||||
newsPanel.add(new TweetTemplate(false, myUserInfo, feed, eventBus));
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus));
|
||||||
allUpdates.add(feed);
|
allUpdates.add(feed);
|
||||||
}
|
}
|
||||||
if (feeds.size() < 5) {
|
if (feeds.size() < 5) {
|
||||||
|
@ -483,7 +494,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||||
for (EnhancedFeed feed : feeds)
|
for (EnhancedFeed feed : feeds)
|
||||||
newsPanel.add(new TweetTemplate(false, myUserInfo, feed, eventBus));
|
newsPanel.add(new TweetTemplate(false, false, myUserInfo, feed, eventBus));
|
||||||
if (feeds.size() < 5) {
|
if (feeds.size() < 5) {
|
||||||
newsPanel.add(new Image(spacer));
|
newsPanel.add(new Image(spacer));
|
||||||
}
|
}
|
||||||
|
@ -522,7 +533,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||||
for (EnhancedFeed feed : feeds)
|
for (EnhancedFeed feed : feeds)
|
||||||
newsPanel.add(new TweetTemplate(false, myUserInfo, feed, eventBus));
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus));
|
||||||
if (feeds.size() < 5) {
|
if (feeds.size() < 5) {
|
||||||
newsPanel.add(new Image(spacer));
|
newsPanel.add(new Image(spacer));
|
||||||
}
|
}
|
||||||
|
@ -561,7 +572,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||||
for (EnhancedFeed feed : feeds)
|
for (EnhancedFeed feed : feeds)
|
||||||
newsPanel.add(new TweetTemplate(false, myUserInfo, feed, eventBus));
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus));
|
||||||
if (feeds.size() < 5) {
|
if (feeds.size() < 5) {
|
||||||
newsPanel.add(new Image(spacer));
|
newsPanel.add(new Image(spacer));
|
||||||
}
|
}
|
||||||
|
@ -614,7 +625,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus);
|
final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus);
|
||||||
dlg.center();
|
dlg.center();
|
||||||
dlg.show();
|
dlg.show();
|
||||||
|
|
||||||
newsService.getAllLikesByFeed(feedId, new AsyncCallback<ArrayList<Like>>() {
|
newsService.getAllLikesByFeed(feedId, new AsyncCallback<ArrayList<Like>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -742,7 +753,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doShowFeed(final TweetTemplate toShow) {
|
private void doShowFeed(final TweetTemplate toShow) {
|
||||||
String feedKey = toShow.getFeedKey();
|
String feedKey = toShow.getFeedKey();
|
||||||
Window.Location.assign(Window.Location.getHref() + ((Window.Location.getHref().contains("?")) ? "&oid="+feedKey : "?oid="+feedKey));
|
Window.Location.assign(Window.Location.getHref() + ((Window.Location.getHref().contains("?")) ? "&oid="+feedKey : "?oid="+feedKey));
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class FilterPanel extends Composite {
|
||||||
this.service = newsService;
|
this.service = newsService;
|
||||||
//connectionsLink.setHTML("<a>Connections</a>");
|
//connectionsLink.setHTML("<a>Connections</a>");
|
||||||
allUpdatesLink.setHTML("<a>All Updates</a>");
|
allUpdatesLink.setHTML("<a>All Updates</a>");
|
||||||
favoritesLink.setHTML("<a>My Favorites</a>");
|
favoritesLink.setHTML("<a>Favorites</a>");
|
||||||
onlyme.setHTML("<a>Only Me</a>");
|
onlyme.setHTML("<a>Your Posts</a>");
|
||||||
//connectionsLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
//connectionsLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
||||||
allUpdatesLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
allUpdatesLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
||||||
favoritesLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
favoritesLink.getElement().getStyle().setCursor(Cursor.POINTER);
|
||||||
|
|
|
@ -102,6 +102,8 @@ public class TweetTemplate extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HTML openImage;
|
HTML openImage;
|
||||||
@UiField
|
@UiField
|
||||||
|
HTML vreSource;
|
||||||
|
@UiField
|
||||||
VerticalPanel previewPanel;
|
VerticalPanel previewPanel;
|
||||||
@UiField
|
@UiField
|
||||||
Label messageSeparator;
|
Label messageSeparator;
|
||||||
|
@ -113,10 +115,10 @@ public class TweetTemplate extends Composite {
|
||||||
* @param displaySingle tells if you're displaying a single fedd or not
|
* @param displaySingle tells if you're displaying a single fedd or not
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
public TweetTemplate(boolean displaySingle, UserInfo myUserInfo, EnhancedFeed myFeed, HandlerManager eventBus) {
|
public TweetTemplate(boolean displaySingle, boolean showTimelineSource, UserInfo myUserInfo, EnhancedFeed myFeed, HandlerManager eventBus) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.myUserInfo = myUserInfo;
|
this.myUserInfo = myUserInfo;
|
||||||
|
this.vreSource.setVisible(false);
|
||||||
this.myFeed = myFeed;
|
this.myFeed = myFeed;
|
||||||
isAppFeed = myFeed.getFeed().isApplicationFeed();
|
isAppFeed = myFeed.getFeed().isApplicationFeed();
|
||||||
Feed feed = myFeed.getFeed();
|
Feed feed = myFeed.getFeed();
|
||||||
|
@ -126,14 +128,14 @@ public class TweetTemplate extends Composite {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.isUsers = myFeed.isUsers();
|
this.isUsers = myFeed.isUsers();
|
||||||
myComments = new ArrayList<SingleComment>();
|
myComments = new ArrayList<SingleComment>();
|
||||||
|
|
||||||
if (isUsers || myUserInfo.isAdmin()) {
|
if (isUsers || myUserInfo.isAdmin()) {
|
||||||
closeImage.setStyleName("closeImage");
|
closeImage.setStyleName("closeImage");
|
||||||
closeImage.setTitle(myUserInfo.isAdmin() ? "Delete (Administrator Mode)" : "delete");
|
closeImage.setTitle(myUserInfo.isAdmin() ? "Delete (Administrator Mode)" : "delete");
|
||||||
} else {
|
} else {
|
||||||
closeImage.removeFromParent();
|
closeImage.removeFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
openImage.setStyleName("openImage");
|
openImage.setStyleName("openImage");
|
||||||
openImage.setTitle("Open this feed separately");
|
openImage.setTitle("Open this feed separately");
|
||||||
//show if the user has already liked this
|
//show if the user has already liked this
|
||||||
|
@ -159,6 +161,13 @@ public class TweetTemplate extends Composite {
|
||||||
+"?"+
|
+"?"+
|
||||||
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
||||||
Encoder.encode(feed.getEntityId())+"\">"+feed.getFullName()+"</a> " + feedText);
|
Encoder.encode(feed.getEntityId())+"\">"+feed.getFullName()+"</a> " + feedText);
|
||||||
|
|
||||||
|
//show the vreid iff the info is present
|
||||||
|
if (showTimelineSource && feed.getVreid() != null && feed.getVreid().compareTo("") != 0) {
|
||||||
|
this.vreSource.setVisible(true);
|
||||||
|
String vreName = feed.getVreid().substring(feed.getVreid().lastIndexOf("/")+1);
|
||||||
|
vreSource.setHTML("<a class=\"link\" style=\"font-size: 10px; white-space: nowrap;\" href=\"/group/"+vreName.toLowerCase()+"\">[" +vreName + "]</a>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// messageSeparator.setVisible(false);
|
// messageSeparator.setVisible(false);
|
||||||
|
@ -170,7 +179,7 @@ public class TweetTemplate extends Composite {
|
||||||
closeImage.removeFromParent();
|
closeImage.removeFromParent();
|
||||||
try{
|
try{
|
||||||
String vreName = feed.getVreid().substring(feed.getVreid().lastIndexOf("/")+1);
|
String vreName = feed.getVreid().substring(feed.getVreid().lastIndexOf("/")+1);
|
||||||
messageArea.setHTML("<a class=\"link\" href=\""+feed.getUri()+"\"> go App [" +vreName + "]</a>");
|
messageArea.setHTML("<a class=\"link\" style=\"white-space: nowrap;\" href=\""+feed.getUri()+"\"> go App [" +vreName + "]</a>");
|
||||||
}
|
}
|
||||||
catch (Exception e) {}
|
catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +231,7 @@ public class TweetTemplate extends Composite {
|
||||||
* @param hidden
|
* @param hidden
|
||||||
*/
|
*/
|
||||||
public TweetTemplate(UserInfo myUserInfo, EnhancedFeed feed, HandlerManager eventBus, boolean hidden) {
|
public TweetTemplate(UserInfo myUserInfo, EnhancedFeed feed, HandlerManager eventBus, boolean hidden) {
|
||||||
this(false, myUserInfo, feed, eventBus);
|
this(false, false, myUserInfo, feed, eventBus);
|
||||||
contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content hidden");
|
contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,22 +259,22 @@ public class TweetTemplate extends Composite {
|
||||||
GWT.log("not belong to user");
|
GWT.log("not belong to user");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("openImage")
|
@UiHandler("openImage")
|
||||||
void onOpenFeedClick(ClickEvent e) {
|
void onOpenFeedClick(ClickEvent e) {
|
||||||
eventBus.fireEvent(new OpenFeedEvent(this));
|
eventBus.fireEvent(new OpenFeedEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@UiHandler("seeMore")
|
@UiHandler("seeMore")
|
||||||
void onSeeMoreClick(ClickEvent e) {
|
void onSeeMoreClick(ClickEvent e) {
|
||||||
contentArea.setHTML("<a class=\"link\"href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
|
contentArea.setHTML("<a class=\"link\"href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"?"+
|
||||||
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
Encoder.encode(GCubeSocialNetworking.USER_PROFILE_OID)+"="+
|
||||||
Encoder.encode(myFeed.getFeed().getEntityId())+"\">"+
|
Encoder.encode(myFeed.getFeed().getEntityId())+"\">"+
|
||||||
myFeed.getFeed().getFullName()+"</a> " + myFeed.getFeed().getDescription());
|
myFeed.getFeed().getFullName()+"</a> " + myFeed.getFeed().getDescription());
|
||||||
|
|
||||||
seeMore.setHTML("");
|
seeMore.setHTML("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +334,7 @@ public class TweetTemplate extends Composite {
|
||||||
Window.alert("Could not load this component: " + reason.getMessage());
|
Window.alert("Could not load this component: " + reason.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,15 +431,15 @@ public class TweetTemplate extends Composite {
|
||||||
public UserInfo getMyUserInfo() {
|
public UserInfo getMyUserInfo() {
|
||||||
return myUserInfo;
|
return myUserInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMyFeedUserId() {
|
public String getMyFeedUserId() {
|
||||||
return myFeed.getFeed().getEntityId();
|
return myFeed.getFeed().getEntityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMyFeedText() {
|
public String getMyFeedText() {
|
||||||
return myFeed.getFeed().getDescription();
|
return myFeed.getFeed().getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAppFeed() {
|
public boolean isAppFeed() {
|
||||||
return isAppFeed;
|
return isAppFeed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,20 +16,43 @@
|
||||||
</div>
|
</div>
|
||||||
<g:VerticalPanel ui:field="previewPanel"></g:VerticalPanel>
|
<g:VerticalPanel ui:field="previewPanel"></g:VerticalPanel>
|
||||||
<div class="tweet-actions">
|
<div class="tweet-actions">
|
||||||
<g:HorizontalPanel>
|
<table cellspacing="0" cellpadding="0">
|
||||||
<g:HTML styleName="comment" ui:field="commentArea" />
|
<tbody>
|
||||||
<g:Label styleName="tweet-separator">-</g:Label>
|
<tr>
|
||||||
<g:HTML styleName="like" ui:field="likeArea" />
|
<td align="left" style="vertical-align: top;">
|
||||||
<g:Label ui:field="messageSeparator" styleName="tweet-separator">-</g:Label>
|
<g:HTML styleName="comment" ui:field="commentArea" />
|
||||||
<g:HTML styleName="message" ui:field="messageArea" />
|
</td>
|
||||||
<g:HTML styleName="time" ui:field="timeArea" />
|
<td align="left" style="vertical-align: top;">
|
||||||
<g:HTML ui:field="commentsNo"></g:HTML>
|
<g:Label styleName="tweet-separator">-</g:Label>
|
||||||
<g:HTML ui:field="likesNo"></g:HTML>
|
</td>
|
||||||
</g:HorizontalPanel>
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:HTML styleName="like" ui:field="likeArea" />
|
||||||
|
</td>
|
||||||
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:Label ui:field="messageSeparator" styleName="tweet-separator">-</g:Label>
|
||||||
|
</td>
|
||||||
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:HTML styleName="message" ui:field="messageArea" />
|
||||||
|
</td>
|
||||||
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:HTML styleName="time" ui:field="timeArea" />
|
||||||
|
</td>
|
||||||
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:HTML ui:field="commentsNo"></g:HTML>
|
||||||
|
</td>
|
||||||
|
<td align="left" style="vertical-align: top;">
|
||||||
|
<g:HTML ui:field="likesNo"></g:HTML>
|
||||||
|
</td>
|
||||||
|
<td align="right" style="width: 100%; vertical-align: top;">
|
||||||
|
<g:HTML styleName="comment" ui:field="vreSource" ></g:HTML>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<g:VerticalPanel ui:field="commentsPanel"></g:VerticalPanel>
|
<g:VerticalPanel ui:field="commentsPanel"></g:VerticalPanel>
|
||||||
</div>
|
</div>
|
||||||
<div class="div-table-col close">
|
<div class="div-table-col close">
|
||||||
<g:HTML height="15px" ui:field="closeImage"></g:HTML>
|
<g:HTML height="15px" ui:field="closeImage"></g:HTML>
|
||||||
<g:HTML height="15px" ui:field="openImage"></g:HTML>
|
<g:HTML height="15px" ui:field="openImage"></g:HTML>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.gcube.portlets.user.newsfeed.server;
|
||||||
|
/**
|
||||||
|
* custom class to read propety file once
|
||||||
|
* @author massi
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CustomConfiguration {
|
||||||
|
private int refreshTime;
|
||||||
|
private String vreLabel;
|
||||||
|
private boolean showTimelineSource;
|
||||||
|
|
||||||
|
public CustomConfiguration(int refreshTime, String vreLabel,
|
||||||
|
boolean showTimelineSource) {
|
||||||
|
super();
|
||||||
|
this.refreshTime = refreshTime;
|
||||||
|
this.vreLabel = vreLabel;
|
||||||
|
this.showTimelineSource = showTimelineSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefreshTime() {
|
||||||
|
return refreshTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefreshTime(int refreshTime) {
|
||||||
|
this.refreshTime = refreshTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVreLabel() {
|
||||||
|
return vreLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVreLabel(String vreLabel) {
|
||||||
|
this.vreLabel = vreLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShowTimelineSource() {
|
||||||
|
return showTimelineSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowTimelineSource(boolean showTimelineSource) {
|
||||||
|
this.showTimelineSource = showTimelineSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CustomConfiguration [refreshTime=" + refreshTime
|
||||||
|
+ ", vreLabel=" + vreLabel + ", showTimelineSource="
|
||||||
|
+ showTimelineSource + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -64,16 +64,15 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final String ADMIN_ROLE = "Administrator";
|
private static final String ADMIN_ROLE = "Administrator";
|
||||||
/**
|
private static final String VRE_LABEL = "VRE_LABEL";
|
||||||
*
|
private static final String SHOW_TIMELINE_SOURCE = "SHOW_TIMELINE_SOURCE";
|
||||||
*/
|
private static final String REFRESH_TIME = "REFRESH_TIME";
|
||||||
|
|
||||||
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
|
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
|
||||||
|
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
|
|
||||||
|
|
||||||
private DatabookStore store;
|
private DatabookStore store;
|
||||||
|
|
||||||
private boolean withinPortal = false;
|
private boolean withinPortal = false;
|
||||||
|
@ -98,8 +97,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
_log.warn("USER IS NULL setting testing user and Running OUTSIDE PORTAL");
|
_log.warn("USER IS NULL setting testing user and Running OUTSIDE PORTAL");
|
||||||
user = "test.user";
|
user = "test.user";
|
||||||
// user = "massimiliano.assante";
|
user = "massimiliano.assante";
|
||||||
// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube");
|
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devVRE/testvrefolder2");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
withinPortal = true;
|
withinPortal = true;
|
||||||
|
@ -129,14 +128,16 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
String accountURL = themeDisplay.getURLMyAccount().toString();
|
String accountURL = themeDisplay.getURLMyAccount().toString();
|
||||||
|
|
||||||
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, isAdmin(), null);
|
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, isAdmin(), null);
|
||||||
UserSettings toReturn = new UserSettings(userInfo, getFeedsRefreshTimeInMillis(), session.getScopeName(), getVRELabel(), isInfrastructureScope());
|
CustomConfiguration config = getUserConfiguration();
|
||||||
|
UserSettings toReturn = new UserSettings(userInfo, config.getRefreshTime(), session.getScopeName(), config.getVreLabel(), isInfrastructureScope(), config.isShowTimelineSource());
|
||||||
setUserSettingsInSession(toReturn);
|
setUserSettingsInSession(toReturn);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_log.info("Returning test USER");
|
_log.info("Returning test USER");
|
||||||
|
CustomConfiguration config = getUserConfiguration();
|
||||||
UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, null);
|
UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, null);
|
||||||
return new UserSettings(user, getFeedsRefreshTimeInMillis(), session.getScopeName(), getVRELabel(), isInfrastructureScope());
|
return new UserSettings(user, config.getRefreshTime(), session.getScopeName(), config.getVreLabel(), isInfrastructureScope(), config.isShowTimelineSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -733,73 +734,55 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* read from the property the name of the label to use for VREs/Channels
|
* read from the property file in /conf the refreshing time and other configurations needed
|
||||||
* @return the refreshingTime in milliseconds
|
* @return CustomConfiguration
|
||||||
*/
|
*/
|
||||||
private String getVRELabel() {
|
private CustomConfiguration getUserConfiguration() {
|
||||||
String toReturn = "Area";
|
CustomConfiguration toReturn = null;
|
||||||
if (withinPortal) {
|
_log.info("Trying to read custom config fr News Feed (REFRESH_TIME, VRE Label and show timeline source)");
|
||||||
_log.info("Trying to read custom VRE Label");
|
Properties props = new Properties();
|
||||||
Properties props = new Properties();
|
int minutes = 0;
|
||||||
String propertyfile = "";
|
String label = "";
|
||||||
|
boolean showTimelineSource = true;
|
||||||
|
|
||||||
|
String propertyfile = "";
|
||||||
|
try {
|
||||||
|
ServletContext servletContext = getServletContext();
|
||||||
|
String contextPath = servletContext.getRealPath(File.separator);
|
||||||
|
propertyfile = contextPath + "conf" + File.separator + "settings.properties";
|
||||||
|
File propsFile = new File(propertyfile);
|
||||||
|
FileInputStream fis = new FileInputStream(propsFile);
|
||||||
|
props.load( fis);
|
||||||
try {
|
try {
|
||||||
ServletContext servletContext = getServletContext();
|
minutes = Integer.parseInt(props.getProperty(REFRESH_TIME));
|
||||||
String contextPath = servletContext.getRealPath(File.separator);
|
minutes = minutes*60*1000;
|
||||||
propertyfile = contextPath + "conf" + File.separator + "settings.properties";
|
|
||||||
File propsFile = new File(propertyfile);
|
|
||||||
FileInputStream fis = new FileInputStream(propsFile);
|
|
||||||
props.load( fis);
|
|
||||||
|
|
||||||
toReturn = (String) props.getProperty("CHANNEL_NAME");
|
|
||||||
|
|
||||||
}
|
|
||||||
//catch exception in case properties file does not exist
|
|
||||||
catch(IOException e) {
|
|
||||||
toReturn = "Area";
|
|
||||||
_log.error("settings.properties file not found under " + propertyfile +", returning Area");
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* read from the property the refreshing time
|
|
||||||
* @return the refreshingTime in milliseconds
|
|
||||||
*/
|
|
||||||
private int getFeedsRefreshTimeInMillis() {
|
|
||||||
if (withinPortal) {
|
|
||||||
_log.info("Trying to read custom REFRESH_TIME");
|
|
||||||
Properties props = new Properties();
|
|
||||||
int toReturn = 0;
|
|
||||||
int minutes = 0;
|
|
||||||
String propertyfile = "";
|
|
||||||
try {
|
|
||||||
ServletContext servletContext = getServletContext();
|
|
||||||
String contextPath = servletContext.getRealPath(File.separator);
|
|
||||||
propertyfile = contextPath + "conf" + File.separator + "settings.properties";
|
|
||||||
File propsFile = new File(propertyfile);
|
|
||||||
FileInputStream fis = new FileInputStream(propsFile);
|
|
||||||
props.load( fis);
|
|
||||||
|
|
||||||
minutes = Integer.parseInt(props.getProperty("REFRESH_TIME"));
|
|
||||||
toReturn = minutes*60*1000;
|
|
||||||
}
|
|
||||||
//catch exception in case properties file does not exist
|
|
||||||
catch(IOException e) {
|
|
||||||
toReturn = 300000; //5 minutes
|
|
||||||
_log.error("settings.properties file not found under " + propertyfile +", returning 5 minutes");
|
|
||||||
return toReturn;
|
|
||||||
}
|
}
|
||||||
//catch exception in case the property value isNot a Number
|
//catch exception in case the property value isNot a Number
|
||||||
catch (ClassCastException ex) {
|
catch (ClassCastException ex) {
|
||||||
toReturn = 300000; //5 minutes
|
minutes = 300000; //5 minutes
|
||||||
_log.error("REFRESH_TIME must be a number (in minutes) returning 5 minutes");
|
_log.error(REFRESH_TIME + " must be a number (in minutes) returning 5 minutes");
|
||||||
return toReturn;
|
|
||||||
}
|
}
|
||||||
_log.debug("Returning REFRESH_TIME in millis: " + toReturn + ", (" + minutes + " minutes)");
|
//the vre label
|
||||||
return toReturn;
|
label = props.getProperty(VRE_LABEL);
|
||||||
|
try {
|
||||||
|
showTimelineSource = Boolean.parseBoolean(props.getProperty(SHOW_TIMELINE_SOURCE));
|
||||||
|
|
||||||
|
}
|
||||||
|
//catch exception in case the property value isNot true or false
|
||||||
|
catch (ClassCastException ex) {
|
||||||
|
showTimelineSource = true;
|
||||||
|
_log.error(showTimelineSource + " must be true or false, returning true");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
//catch exception in case properties file does not exist
|
||||||
return 60000; //60 secs for testing
|
catch(IOException e) {
|
||||||
|
minutes = 300000; //5 minutes
|
||||||
|
_log.error("settings.properties file not found under " + propertyfile +", returning 5 minutes");
|
||||||
|
}
|
||||||
|
|
||||||
|
_log.debug("Read Configuration from property file: " + toReturn);
|
||||||
|
return new CustomConfiguration(minutes, label, showTimelineSource);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,22 +9,40 @@ public class UserSettings implements Serializable {
|
||||||
private UserInfo userInfo;
|
private UserInfo userInfo;
|
||||||
private int refreshingTimeInMillis;
|
private int refreshingTimeInMillis;
|
||||||
private String currentScope;
|
private String currentScope;
|
||||||
private String channelName;
|
//indicate the
|
||||||
|
private String vreLabel;
|
||||||
|
//indicate whether the webapp is running at infrasturcture level
|
||||||
boolean isInfrastructure;
|
boolean isInfrastructure;
|
||||||
|
//indicate whether to indicate the feed timeline source or not (From whicn VRE/Channel this feed come from)
|
||||||
|
boolean showTimelineSourceLabel;
|
||||||
public UserSettings() {
|
public UserSettings() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public UserSettings(UserInfo userInfo, int refreshingTimeInMillis,
|
public UserSettings(UserInfo userInfo, int refreshingTimeInMillis,
|
||||||
String currentScope, String channelName, boolean isInfrastructure) {
|
String currentScope, String vreLabel, boolean isInfrastructure,
|
||||||
|
boolean showTimelineSourceLabel) {
|
||||||
super();
|
super();
|
||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
this.refreshingTimeInMillis = refreshingTimeInMillis;
|
this.refreshingTimeInMillis = refreshingTimeInMillis;
|
||||||
this.currentScope = currentScope;
|
this.currentScope = currentScope;
|
||||||
this.channelName = channelName;
|
this.vreLabel = vreLabel;
|
||||||
this.isInfrastructure = isInfrastructure;
|
this.isInfrastructure = isInfrastructure;
|
||||||
|
this.showTimelineSourceLabel = showTimelineSourceLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isShowTimelineSourceLabel() {
|
||||||
|
return showTimelineSourceLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setShowTimelineSourceLabel(boolean showTimelineSourceLabel) {
|
||||||
|
this.showTimelineSourceLabel = showTimelineSourceLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public UserInfo getUserInfo() {
|
public UserInfo getUserInfo() {
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
@ -50,20 +68,23 @@ public class UserSettings implements Serializable {
|
||||||
this.isInfrastructure = isInfrastructure;
|
this.isInfrastructure = isInfrastructure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChannelName() {
|
public String getVreLabel() {
|
||||||
return channelName;
|
return vreLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChannelName(String channelName) {
|
public void setVreLabel(String channelName) {
|
||||||
this.channelName = channelName;
|
this.vreLabel = channelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "UserSettings [userInfo=" + userInfo
|
return "UserSettings [userInfo=" + userInfo
|
||||||
+ ", refreshingTimeInMillis=" + refreshingTimeInMillis
|
+ ", refreshingTimeInMillis=" + refreshingTimeInMillis
|
||||||
+ ", currentScope=" + currentScope + ", isInfrastructure="
|
+ ", currentScope=" + currentScope + ", vreLabel=" + vreLabel
|
||||||
+ isInfrastructure + "]";
|
+ ", isInfrastructure=" + isInfrastructure
|
||||||
|
+ ", showTimelineSourceLabel=" + showTimelineSourceLabel + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
# Defines the News Feed refreshing time in minutes
|
# Defines the News Feed refreshing time in minutes
|
||||||
REFRESH_TIME = 3
|
REFRESH_TIME = 3
|
||||||
CHANNEL_NAME = Virtual Research Environment
|
VRE_LABEL = Virtual Research Environment
|
||||||
|
SHOW_TIMELINE_SOURCE=false
|
Loading…
Reference in New Issue