diff --git a/2.8/.classpath b/2.8/.classpath deleted file mode 100644 index 47f9d23..0000000 --- a/2.8/.classpath +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2.8/.gwt/.gwt-log b/2.8/.gwt/.gwt-log deleted file mode 100644 index e69de29..0000000 diff --git a/2.8/.project b/2.8/.project deleted file mode 100644 index 3bd6a13..0000000 --- a/2.8/.project +++ /dev/null @@ -1,71 +0,0 @@ - - - news-feed - news-feed project - - - - - org.eclipse.wst.jsdt.core.javascriptValidator - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - com.google.gdt.eclipse.core.webAppProjectValidator - - - - - com.google.gwt.eclipse.core.gwtProjectValidator - - - - - com.gwtplugins.gdt.eclipse.core.webAppProjectValidator - - - - - com.gwtplugins.gwt.eclipse.core.gwtProjectValidator - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.maven.ide.eclipse.maven2Nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.jsdt.core.jsNature - com.google.gwt.eclipse.core.gwtNature - com.liferay.ide.core.liferayNature - com.gwtplugins.gwt.eclipse.core.gwtNature - - diff --git a/2.8/.settings/.jsdtscope b/2.8/.settings/.jsdtscope deleted file mode 100644 index fda242a..0000000 --- a/2.8/.settings/.jsdtscope +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/2.8/.settings/com.google.appengine.eclipse.core.prefs b/2.8/.settings/com.google.appengine.eclipse.core.prefs deleted file mode 100644 index a60576c..0000000 --- a/2.8/.settings/com.google.appengine.eclipse.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Thu Jun 16 10:18:26 CEST 2011 -eclipse.preferences.version=1 -filesCopiedToWebInfLib= diff --git a/2.8/.settings/com.google.gdt.eclipse.core.prefs b/2.8/.settings/com.google.gdt.eclipse.core.prefs deleted file mode 100644 index d969bb0..0000000 --- a/2.8/.settings/com.google.gdt.eclipse.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -jarsExcludedFromWebInfLib= -lastWarOutDir=/home/costantino/workspace/news-feed_good_trunk/target/news-feed-2.1.0-SNAPSHOT -warSrcDir=src/main/webapp -warSrcDirIsOutput=false diff --git a/2.8/.settings/com.google.gwt.eclipse.core.prefs b/2.8/.settings/com.google.gwt.eclipse.core.prefs deleted file mode 100644 index c803c44..0000000 --- a/2.8/.settings/com.google.gwt.eclipse.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Thu Jun 16 11:14:17 CEST 2011 -eclipse.preferences.version=1 -entryPointModules= -filesCopiedToWebInfLib=gwt-servlet.jar -gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+ diff --git a/2.8/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/2.8/.settings/com.gwtplugins.gdt.eclipse.core.prefs deleted file mode 100644 index b5e46b5..0000000 --- a/2.8/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-2.8.0-SNAPSHOT -warSrcDir=src/main/webapp -warSrcDirIsOutput=false diff --git a/2.8/.settings/org.eclipse.core.resources.prefs b/2.8/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 02122d8..0000000 --- a/2.8/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Tue Apr 02 15:52:18 CEST 2013 -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/2.8/.settings/org.eclipse.jdt.core.prefs b/2.8/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8445b6b..0000000 --- a/2.8/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/2.8/.settings/org.eclipse.jst.jsp.core.prefs b/2.8/.settings/org.eclipse.jst.jsp.core.prefs deleted file mode 100644 index 3a5c98d..0000000 --- a/2.8/.settings/org.eclipse.jst.jsp.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -validateFragments=false -validation.use-project-settings=true diff --git a/2.8/.settings/org.eclipse.m2e.core.prefs b/2.8/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 68e3275..0000000 --- a/2.8/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Apr 02 15:52:17 CEST 2013 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/2.8/.settings/org.eclipse.m2e.wtp.prefs b/2.8/.settings/org.eclipse.m2e.wtp.prefs deleted file mode 100644 index 2ab9c2c..0000000 --- a/2.8/.settings/org.eclipse.m2e.wtp.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Apr 02 16:00:18 CEST 2013 -eclipse.preferences.version=1 -org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false diff --git a/2.8/.settings/org.eclipse.wst.common.component b/2.8/.settings/org.eclipse.wst.common.component deleted file mode 100644 index ecd5910..0000000 --- a/2.8/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - uses - - - uses - - - uses - - - - - diff --git a/2.8/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/2.8/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml deleted file mode 100644 index cc81385..0000000 --- a/2.8/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/2.8/.settings/org.eclipse.wst.common.project.facet.core.xml b/2.8/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index b6f63a3..0000000 --- a/2.8/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.container b/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.container deleted file mode 100644 index 49c8cd4..0000000 --- a/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.container +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.wst.jsdt.launching.JRE_CONTAINER \ No newline at end of file diff --git a/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.name b/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.name deleted file mode 100644 index 11006e2..0000000 --- a/2.8/.settings/org.eclipse.wst.jsdt.ui.superType.name +++ /dev/null @@ -1 +0,0 @@ -Global \ No newline at end of file diff --git a/2.8/.settings/org.eclipse.wst.validation.prefs b/2.8/.settings/org.eclipse.wst.validation.prefs deleted file mode 100644 index 04cad8c..0000000 --- a/2.8/.settings/org.eclipse.wst.validation.prefs +++ /dev/null @@ -1,2 +0,0 @@ -disabled=06target -eclipse.preferences.version=1 diff --git a/2.8/.settings/org.maven.ide.eclipse.prefs b/2.8/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index c74c58e..0000000 --- a/2.8/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Thu Sep 02 10:42:12 CEST 2010 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/2.8/.tern-project b/2.8/.tern-project deleted file mode 100644 index 61348cc..0000000 --- a/2.8/.tern-project +++ /dev/null @@ -1,17 +0,0 @@ -{ - "plugins": { - "aui": { - - }, - "liferay": { - - }, - "yui": { - - } - }, - "libs": [ - "ecma5", - "browser" - ] -} \ No newline at end of file diff --git a/2.8/distro/LICENSE b/2.8/distro/LICENSE deleted file mode 100644 index 7bca8c8..0000000 --- a/2.8/distro/LICENSE +++ /dev/null @@ -1,2 +0,0 @@ -${gcube.license} - diff --git a/2.8/distro/README b/2.8/distro/README deleted file mode 100644 index 5259287..0000000 --- a/2.8/distro/README +++ /dev/null @@ -1,64 +0,0 @@ -The gCube System - ${name} --------------------------------------------------- - -${description} - - -${gcube.description} - -${gcube.funding} - - -Version --------------------------------------------------- - -${version} (${buildDate}) - -Please see the file named "changelog.xml" in this directory for the release notes. - - -Authors --------------------------------------------------- - -* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). -* Costantino Perciante (costantino.perciante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). - -Maintainers ------------ - -* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). -* Costantino Perciante (costantino.perciante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). - -Download information --------------------------------------------------- - -Source code is available from SVN: - ${scm.url} - -Binaries can be downloaded from the gCube website: - ${gcube.website} - - -Installation --------------------------------------------------- - -Installation documentation is available on-line in the gCube Wiki: - ${gcube.wikiRoot} - -Documentation --------------------------------------------------- - -Documentation is available on-line in the gCube Wiki: - ${gcube.wikiRoot} - -Support --------------------------------------------------- - -Bugs and support requests can be reported in the gCube issue tracking tool: - ${gcube.issueTracking} - - -Licensing --------------------------------------------------- - -This software is licensed under the terms you may find in the file named "LICENSE" in this directory. \ No newline at end of file diff --git a/2.8/distro/changelog.xml b/2.8/distro/changelog.xml deleted file mode 100644 index 1c63ffc..0000000 --- a/2.8/distro/changelog.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - Bug #16724, Social networking: "See more" seems to reload a post with part of the old look and feel - Bug #16673, News Feed: comments with links between parenthesis not recognised - - - Feature #16205: News Feed avoid refresh page when user is commenting - Minor CSS fix for anchors links font size - Bug fix #16225 mentions and replies http links not working in some email notifications - Feature #16452, Revise posts look and feel - - - Removed previous jquery js load script and useless deprecated - pagebus - - - Ported to GWT 2.8.2 - Fix for Incident #11187 citing a people (with '@') in comments - is not working anymore - - - Feature #11189: Social-Networking - citing a people (with '@') - in comments loses the focus. - - Feature #10192 allow to sort feeds per recent comments - - Bug #7841 lack of blank space to separate the query term when - hashtag is used - Support for ticket #11139 - Enhanced efficiency when retrieving mentioned users or groups - in comments - - - fixes for Incident #10262: Cannot see who liked posts on VREs - of Parthenos - - Feature #10242: add comment taking up to 3 seconds sometime to - be delivered in the UI now shows a loader - - Ported to GWT 2.8.1 - - - fixes for changes to the underneath - common-notification-library - - Minor css fix - Refactored to the new version of elastic search client's - compliancy - - Feature #7212, do not apologies if no posts are present and - try to engage the user to post something. - - - - removed asl session - Increased general performance and bugfixes - fetching of users list to mention in comments loaded on demand - - - - Support to show feeds related to user's statistics added - - Fixed time for comments/posts: the year is present only if the - comment/post - was made before the current one - - - - Updated for Liferay 6.2.5 - - - Full-text search supported - - - Multi-attachment supported - Image preview available - - - Fix for Bug #246, editing changes comment "metadata" namely - data - - - - Integrated workspace explorer widget and replace light tree - - Fix for Bug #195, Post dates lack the year - - - - Revised the way we shorten posts' text when this is very long, - better heuristic used - - Fixed bug #320, Users tagging does not work if @ is in the - middle of already typed text, works for hashtags too - - Revised mail notification message formatting, user text is now - more clear and visible - - Revised the way we provide back links for posts, removed - assumption that News Feed is always present the default community - page, good for single VRE portals support - - - - Integrated gwt-bootstrap and revised css - Ported to GWT 2.7.0 - - - added ClientScopeHandler to help prevent the back button cache - problem in Chrome and Firefox - - - - fixed see more problem with commercial ands (amps;) not being - converted - - - - Added support for hashtags - - - Fixed bug that was allowing to like posts even if the user had - the session expired. - - - - - Fixed bug loosing session when messaging user from the news - feed - - - - Implemented the automatic scroll back in time for feeds (in - VRE scope) - - Added possibility to unlike alread liked posts - Added possibility to mention users in comments - Added default comment inputbox at the bottom of feed comments, - if any - - Added avatar replacement if user has no avatar - Fixed double notifications for post owner who commented his - post - - Fixed double notifications for post owner who liked his post - - Fixed user referral problem when post was deleted - Added session checking popup - Fixed paste problem on replies - Preserve new lines in comments implemented - - - Moved to Java7 - Added configuration file for VRE Labels - - - Moved to GWT 2.5.1 - Ported to Feather Weight Stack - Removed GCF Dependency - Logging with sl4j Enabled - - - Fix for support Ticket #708 - Fix for support Ticket #636 - - - Open single feed separately enhancement implemeented #1818 - - links redirects correctly to user profiles - - - Mavenized - Smart Refresh Support Added #1539 - Show HTTP URL in replies as HTML anchor links #1542 - Replies on App Feed exception fixed #580 prod. support - - Add Tag people in News Feed Portlet #1535 - Notify people involved in post thread #1576 - Scope Dependent News Feed #1561 - Open single feed in new Window Support #1599 - - - User who favorite a post gets notified is someone comments on - that post - - - - First Release - - diff --git a/2.8/distro/descriptor.xml b/2.8/distro/descriptor.xml deleted file mode 100644 index b3f5628..0000000 --- a/2.8/distro/descriptor.xml +++ /dev/null @@ -1,31 +0,0 @@ - - servicearchive - - tar.gz - - / - - - ${distroDirectory} - / - true - - README - LICENSE - changelog.xml - profile.xml - - 755 - true - - - - - target/${build.finalName}.${project.packaging} - /${artifactId} - - - \ No newline at end of file diff --git a/2.8/distro/profile.xml b/2.8/distro/profile.xml deleted file mode 100644 index 51c3b6b..0000000 --- a/2.8/distro/profile.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Service - - ${description} - PortletUser - ${artifactId} - ${version} - - - ${artifactId} - ${version} - - ${groupId} - ${artifactId} - ${version} - - - target/${build.finalName}.war - - - - - diff --git a/2.8/log.txt b/2.8/log.txt deleted file mode 100644 index e69de29..0000000 diff --git a/2.8/pom.xml b/2.8/pom.xml deleted file mode 100644 index 5394221..0000000 --- a/2.8/pom.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - 4.0.0 - - maven-parent - org.gcube.tools - 1.0.0 - - - - org.gcube.portlets.user - news-feed - war - 2.8.0-SNAPSHOT - - gCube News Feed Portlet - - gCube News Feed for exchanging updates with other users of VREs. - - - scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} - - - - 2.8.2 - 18.0 - distro - 1.8 - 1.8 - ${project.build.directory}/${project.build.finalName} - 6.2.5 - UTF-8 - UTF-8 - - - - - - org.gcube.distribution - maven-portal-bom - LATEST - pom - import - - - - - - com.google.gwt - gwt-user - ${gwtVersion} - provided - - - javax.servlet - javax.servlet-api - - - - - com.google.gwt - gwt-dev - ${gwtVersion} - provided - - - javax.servlet - javax.servlet-api - - - - - - com.google.gwt - gwt-servlet - ${gwtVersion} - provided - - - xerces - xercesImpl - 2.9.1 - - - xml-apis - xml-apis - 1.4.01 - - - org.gcube.portlets.user - gcube-widgets - compile - - - org.gcube.core - common-scope - provided - - - org.gcube.common.portal - portal-manager - provided - - - org.gcube.dvos - usermanagement-core - provided - - - com.github.gwtbootstrap - gwt-bootstrap - - - org.gcube.applicationsupportlayer - aslsocial - provided - - - org.gcube.resources.discovery - ic-client - provided - - - org.gcube.common - authorization-client - provided - - - com.google - gwt-jsonmaker - - - - org.gcube.common - common-authorization - provided - - - org.gcube.portal - social-networking-library - [1.16.0-SNAPSHOT, 2.0.0-SNAPSHOT) - provided - - - com.netflix.astyanax - astyanax-core - provided - - - org.slf4j - log4j-over-slf4j - - - - - com.netflix.astyanax - astyanax-thrift - provided - - - com.netflix.astyanax - astyanax-cassandra - provided - - - org.apache.cassandra - cassandra-all - provided - - - org.apache.cassandra - cassandra-thrift - provided - - - org.apache.thrift - libthrift - - - commons-logging - commons-logging - - - provided - - - org.gcube.socialnetworking - social-util-library - [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - compile - - - org.gcube.socialnetworking - social-data-search-client - [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - - - org.gcube.portlets.widgets - pickitem-widget - [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) - - - org.gcube.portlets.widgets - image-previewer-widget - [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) - - - org.gcube.portal - notifications-common-library - provided - - - org.gcube.portlets.widgets - user-selection-dialog - [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) - compile - - - org.gcube.core - common-scope-maps - compile - - - com.google.guava - guava - compile - - - - com.ning - compress-lzf - 1.0.3 - compile - - - - commons-validator - commons-validator - 1.4.0 - - - commons-codec - commons-codec - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - com.sun.mail - javax.mail - provided - - - com.liferay.portal - portal-service - provided - - - com.liferay.portal - util-java - provided - - - javax.portlet - portlet-api - provided - - - org.slf4j - slf4j-api - provided - - - junit - junit - 4.7 - provided - - - - - - ${webappDirectory}/WEB-INF/classes - - - - - - org.codehaus.mojo - gwt-maven-plugin - ${gwtVersion} - - - - compile - - - - - - - NewsFeed.html - ${webappDirectory} - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - - - compile - - exploded - - - - - ${webappDirectory} - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2 - - - ${distroDirectory}/descriptor.xml - - - - - servicearchive - install - - single - - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.5 - - - copy-profile - install - - copy-resources - - - target - - - ${distroDirectory} - true - - profile.xml - - - - - - - - - - - diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/FilterType.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/FilterType.java deleted file mode 100644 index 832d451..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/FilterType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client; - -public enum FilterType { - ALL_UPDATES, CONNECTIONS, RECENT_COMMENTS, MINE; -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java deleted file mode 100644 index 826982a..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client; - -import org.gcube.portal.databook.shared.ClientPost; -import org.gcube.portal.databook.shared.JSON; -import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; - - -import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.user.client.ui.RootPanel; - -/** - * - * @author Massimiliano Assante, CNR-ISTI - * - * This class uses Liferay's Client-side+Inter-Portlet-Communication for displaying post created in the Share Updates portlet - * @see https://web.liferay.com/community/wiki/-/wiki/Main/Client-side+Inter-Portlet-Communication+%28IPC%29%20using+Java+Script - * - */ -public class NewsFeed implements EntryPoint { - - private final String UNIQUE_DIV = "newsfeedDIV"; - - private NewsFeedPanel mainPanel; - - private static NewsFeedPanel instance; - - public static NewsFeedPanel getInstance() { - if (instance == null) { - instance = new NewsFeedPanel(); - } - return instance; - } - - public void onModuleLoad() { - injectLiferayIPCEventReceiver(); - exportReceiveEventJavascriptFunction(); - mainPanel = getInstance(); - RootPanel.get(UNIQUE_DIV).add(mainPanel); - } - /** - * this is a JSNI method that injects the Liferay Javascript function listening for events from ShareUpdates - */ - public static native void injectLiferayIPCEventReceiver() /*-{ - try { - $wnd.Liferay.on('newPostCreated',function(event) { - $wnd.handleReceiveEvent(event.payload); - }); - } catch(err) { - $wnd.console.log('error subscribing to newPostCreated events, acceptable in dev'); - } - }-*/; - /** - * this is a JSNI method mapping the Javascript function handleReceiveEvent to the Java method handleReceiveEvent - */ - public static native void exportReceiveEventJavascriptFunction()/*-{ - $wnd.handleReceiveEvent = @org.gcube.portlets.user.newsfeed.client.NewsFeed::handleReceiveEvent(*); - }-*/; - /** - * the Java method handleReceiveEvent - * @param jsonizedClientPostInstance the jsonized {@link ClientPost} sent by ShareUpdates - */ - public static void handleReceiveEvent(String jsonizedClientPostInstance) { - ClientPost cp = (ClientPost) JSON.parse(jsonizedClientPostInstance); - getInstance().addJustAddedFeed(cp); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsService.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsService.java deleted file mode 100644 index 3a8d3cd..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsService.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.gcube.portal.databook.shared.Comment; -import org.gcube.portal.databook.shared.EnhancedFeed; -import org.gcube.portal.databook.shared.Like; -import org.gcube.portal.databook.shared.ShowUserStatisticAction; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; -import org.gcube.portlets.user.newsfeed.shared.MorePostsBean; -import org.gcube.portlets.user.newsfeed.shared.OperationResult; -import org.gcube.portlets.user.newsfeed.shared.UserSettings; -import org.gcube.portlets.widgets.pickitem.shared.ItemBean; - -import com.google.gwt.user.client.rpc.RemoteService; -import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; - -/** - * The client side stub for the RPC service. - */ -@RemoteServiceRelativePath("newsServlet") -public interface NewsService extends RemoteService { - ArrayList getAllUpdateUserFeeds(int feedsNoPerCategory); - - ArrayList getOnlyConnectionsUserPosts(); - - ArrayList getOnlyMyUserPosts(); - - ArrayList getOnlyLikedPosts(); - - ArrayList getPostsByHashtag(String hashtag); - - ArrayList getPostsByQuery(String query, int from, int quantity); - - ArrayList getPostsRelatedToUserStatistics(ShowUserStatisticAction action, int from, int quantity); - - MorePostsBean getMorePosts(int from, int quantity); - - boolean like(String postid, String postText, String postOwnerId); - - boolean unlike(String postid, String postText, String postOwnerId); - - boolean deleteComment(String commentid, String feedid); - - boolean deletePost(String postid); - - OperationResult comment(String feedid, String text, - HashSet mentionedUsers, String feedOwnerId, - boolean isAppFeed); - - OperationResult editComment(Comment toEdit); - - ArrayList getAllLikesByPost(String postid); - - ArrayList getAllCommentsByPost(String feedid); - - UserSettings getUserSettings(); - - EnhancedFeed getSinglePost(String postKey); - - ArrayList getOrganizationUsers(); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsServiceAsync.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsServiceAsync.java deleted file mode 100644 index 6acd5a8..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsServiceAsync.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.gcube.portal.databook.shared.Comment; -import org.gcube.portal.databook.shared.EnhancedFeed; -import org.gcube.portal.databook.shared.Like; -import org.gcube.portal.databook.shared.ShowUserStatisticAction; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; -import org.gcube.portlets.user.newsfeed.shared.MorePostsBean; -import org.gcube.portlets.user.newsfeed.shared.OperationResult; -import org.gcube.portlets.user.newsfeed.shared.UserSettings; -import org.gcube.portlets.widgets.pickitem.shared.ItemBean; - -import com.google.gwt.user.client.rpc.AsyncCallback; - -/** - * The async counterpart of NewsService. - */ -public interface NewsServiceAsync { - - void getAllUpdateUserFeeds(int feedsNoPerCategory, - AsyncCallback> callback); - - void getOnlyConnectionsUserPosts( - AsyncCallback> callback); - - void like(String postid, String postText, String postOwnerId, - AsyncCallback callback); - - void getAllLikesByPost(String postid, - AsyncCallback> callback); - - void getOnlyMyUserPosts(AsyncCallback> callback); - - void getUserSettings(AsyncCallback callback); - - void comment(String feedid, String text, HashSet mentionedUsers, - String feedOwnerId, boolean isAppFeed, - AsyncCallback callback); - - void getAllCommentsByPost(String postid, - AsyncCallback> callback); - - void deleteComment(String commentid, String feedid, - AsyncCallback callback); - - void deletePost(String feedid, AsyncCallback callback); - - void editComment(Comment toEdit, AsyncCallback callback); - - void getOnlyLikedPosts(AsyncCallback> callback); - - void getSinglePost(String postKey, AsyncCallback callback); - - void getMorePosts(int from, int quantity, - AsyncCallback callback); - - void unlike(String postid, String postText, String postOwnerId, - AsyncCallback callback); - - void getOrganizationUsers(AsyncCallback> callback); - - void getPostsByHashtag(String hashtag, - AsyncCallback> callback); - - void getPostsByQuery(String query, int from, int quantity, - AsyncCallback> callback); - - void getPostsRelatedToUserStatistics(ShowUserStatisticAction action, int from, int quantity, - AsyncCallback> callback); - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEvent.java deleted file mode 100644 index 24b6650..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import java.util.HashSet; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class AddCommentEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate owner; - private String text; - private HashSet mentionedUsers; - - public AddCommentEvent(TweetTemplate owner, String text,HashSet mentionedUsers) { - this.owner = owner; - this.text = text; - this.mentionedUsers = mentionedUsers; - } - - public TweetTemplate getOwner() { - return owner; - } - - public String getText() { - return text; - } - - public HashSet getMentionedUsers() { - return mentionedUsers; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(AddCommentEventHandler handler) { - handler.onAddComment(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEventHandler.java deleted file mode 100644 index 0ab2960..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddCommentEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface AddCommentEventHandler extends EventHandler { - void onAddComment(AddCommentEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEvent.java deleted file mode 100644 index 098d5e0..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class AddLikeEvent extends GwtEvent { - public static Type TYPE = new Type(); - private TweetTemplate owner; - private final String feedid; - - - - public AddLikeEvent(TweetTemplate owner, String feedid) { - this.feedid = feedid; - this.owner = owner; - } - - public String getFeedId() { - return feedid; - } - public TweetTemplate getOwner() { - return owner; - } - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(AddLikeEventHandler handler) { - handler.onAddLike(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEventHandler.java deleted file mode 100755 index 3a3a5ec..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/AddLikeEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface AddLikeEventHandler extends EventHandler { - void onAddLike(AddLikeEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEvent.java deleted file mode 100644 index 829ef91..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class DeleteCommentEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate owner; - private String commentid; - - public TweetTemplate getOwner() { - return owner; - } - public String getCommentId() { - return commentid; - } - public DeleteCommentEvent(TweetTemplate owner, String commentid) { - this.owner = owner; - this.commentid = commentid; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(DeleteCommentEventHandler handler) { - handler.onDeleteComment(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEventHandler.java deleted file mode 100644 index 7476e01..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeleteCommentEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface DeleteCommentEventHandler extends EventHandler { - void onDeleteComment(DeleteCommentEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEvent.java deleted file mode 100644 index 2d9171d..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class DeletePostEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate toDelete; - - - public TweetTemplate getToDelete() { - return toDelete; - } - - public DeletePostEvent(TweetTemplate toDelete) { - this.toDelete = toDelete; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(DeletePostEventHandler handler) { - handler.onDeletePost(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEventHandler.java deleted file mode 100644 index 12db8f4..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/DeletePostEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface DeletePostEventHandler extends EventHandler { - void onDeletePost(DeletePostEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEvent.java deleted file mode 100644 index 98b394d..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portal.databook.shared.Comment; -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.user.client.ui.HTMLPanel; - - - -public class EditCommentEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate owner; - private Comment edited; - private HTMLPanel commentPanel; - - public TweetTemplate getOwner() { - return owner; - } - public Comment getCommentInstance() { - return edited; - } - - public HTMLPanel getCommentPanel() { - return commentPanel; - } - public EditCommentEvent(TweetTemplate owner, Comment editedComment, HTMLPanel commentPanel) { - this.owner = owner; - this.edited = editedComment; - this.commentPanel = commentPanel; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(EditCommentEventHandler handler) { - handler.onEditComment(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEventHandler.java deleted file mode 100644 index 78c270a..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/EditCommentEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface EditCommentEventHandler extends EventHandler { - void onEditComment(EditCommentEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEvent.java deleted file mode 100644 index 3db0466..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class OpenPostEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate toShow; - - - public TweetTemplate getToShow() { - return toShow; - } - - public OpenPostEvent(TweetTemplate toShow) { - this.toShow = toShow; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(OpenPostEventHandler handler) { - handler.onOpenPost(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEventHandler.java deleted file mode 100644 index 5e1c2c7..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/OpenPostEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface OpenPostEventHandler extends EventHandler { - void onOpenPost(OpenPostEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/PageBusEvents.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/PageBusEvents.java deleted file mode 100644 index 7a7f658..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/PageBusEvents.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -/** - * This class contains the events (in a package like format) to which this portlet listens at. - * NOTE: these events are the same in the User-Statistics portlet and the share-updates one. - * @author Costantino Perciante at ISTI-CNR - * (costantino.perciante@isti.cnr.it) - */ -public class PageBusEvents { - - // events in this portlet and user-statistics - public static final String postIncrement = "org.gcube.portal.incrementPostCount"; - public static final String postDecrement = "org.gcube.portal.decrementPostCount"; - public static final String likesIncrement = "org.gcube.portal.incrementLikesGot"; - public static final String likesDecrement = "org.gcube.portal.decrementLikesGot"; - public static final String commentsIncrement = "org.gcube.portal.incrementCommentsGot"; - public static final String commentsDecrement = "org.gcube.portal.decrementCommentsGot"; - - // events in this portlet and the share-updates one - public static final String newPostCreated = "org.gcube.portal.databook.shared"; -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEvent.java deleted file mode 100644 index 2539aaf..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class SeeCommentsEvent extends GwtEvent { - public static Type TYPE = new Type(); - - private TweetTemplate owner; - - private boolean commentForm2Add; - - public TweetTemplate getOwner() { - return owner; - } - - public boolean isCommentForm2Add() { - return commentForm2Add; - } - public SeeCommentsEvent(TweetTemplate owner, boolean commentForm2Add) { - this.owner = owner; - this.commentForm2Add = commentForm2Add; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(SeeCommentsEventHandler handler) { - handler.onSeeComments(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEventHandler.java deleted file mode 100644 index 33b5e64..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeCommentsEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface SeeCommentsEventHandler extends EventHandler { - void onSeeComments(SeeCommentsEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEvent.java deleted file mode 100644 index f1e1a17..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class SeeLikesEvent extends GwtEvent { - public static Type TYPE = new Type(); - private final String feedid; - - public SeeLikesEvent(String feedid) { - this.feedid = feedid; - } - - public String getFeedId() { - return feedid; - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(SeeLikesEventHandler handler) { - handler.onSeeLikes(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEventHandler.java deleted file mode 100644 index 06f71c7..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/SeeLikesEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface SeeLikesEventHandler extends EventHandler { - void onSeeLikes(SeeLikesEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEvent.java deleted file mode 100644 index 694c7c6..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class ShowMoreUpdatesEvent extends GwtEvent { - public static Type TYPE = new Type(); - - public ShowMoreUpdatesEvent() { } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(ShowMoreUpdatesEventHandler handler) { - handler.onShowMoreUpdatesClick(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEventHandler.java deleted file mode 100644 index e6c9ef6..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowMoreUpdatesEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface ShowMoreUpdatesEventHandler extends EventHandler { - void onShowMoreUpdatesClick(ShowMoreUpdatesEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEvent.java deleted file mode 100644 index acfd66a..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class ShowNewUpdatesEvent extends GwtEvent { - public static Type TYPE = new Type(); - - public ShowNewUpdatesEvent() { } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(ShowNewUpdatesEventHandler handler) { - handler.onShowNewUpdatesClick(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEventHandler.java deleted file mode 100644 index 404215d..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/ShowNewUpdatesEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface ShowNewUpdatesEventHandler extends EventHandler { - void onShowNewUpdatesClick(ShowNewUpdatesEvent event); -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEvent.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEvent.java deleted file mode 100644 index 671be6f..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; - -import com.google.gwt.event.shared.GwtEvent; - - - -public class UnLikeEvent extends GwtEvent { - public static Type TYPE = new Type(); - private TweetTemplate owner; - private final String feedid; - - - - public UnLikeEvent(TweetTemplate owner, String feedid) { - this.feedid = feedid; - this.owner = owner; - } - - public String getFeedId() { - return feedid; - } - public TweetTemplate getOwner() { - return owner; - } - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(UnLikeEventHandler handler) { - handler.onUnLike(this); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEventHandler.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEventHandler.java deleted file mode 100644 index 58cd263..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/event/UnLikeEventHandler.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.event; - -import com.google.gwt.event.shared.EventHandler; - -public interface UnLikeEventHandler extends EventHandler { - void onUnLike(UnLikeEvent event); - } diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java deleted file mode 100644 index 977f2a4..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java +++ /dev/null @@ -1,1513 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.panels; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; - -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.Attachment; -import org.gcube.portal.databook.shared.ClientAttachment; -import org.gcube.portal.databook.shared.ClientPost; -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.FeedType; -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.newsfeed.client.FilterType; -import org.gcube.portlets.user.newsfeed.client.NewsService; -import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync; -import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent; -import org.gcube.portlets.user.newsfeed.client.event.AddCommentEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.AddLikeEvent; -import org.gcube.portlets.user.newsfeed.client.event.AddLikeEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.DeleteCommentEvent; -import org.gcube.portlets.user.newsfeed.client.event.DeleteCommentEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.DeletePostEvent; -import org.gcube.portlets.user.newsfeed.client.event.DeletePostEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.EditCommentEvent; -import org.gcube.portlets.user.newsfeed.client.event.EditCommentEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.OpenPostEvent; -import org.gcube.portlets.user.newsfeed.client.event.OpenPostEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEvent; -import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent; -import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.ShowMoreUpdatesEvent; -import org.gcube.portlets.user.newsfeed.client.event.ShowMoreUpdatesEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.ShowNewUpdatesEvent; -import org.gcube.portlets.user.newsfeed.client.event.ShowNewUpdatesEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.UnLikeEvent; -import org.gcube.portlets.user.newsfeed.client.event.UnLikeEventHandler; -import org.gcube.portlets.user.newsfeed.client.ui.FilterPanel; -import org.gcube.portlets.user.newsfeed.client.ui.LoadingText; -import org.gcube.portlets.user.newsfeed.client.ui.NewFeedsAvailable; -import org.gcube.portlets.user.newsfeed.client.ui.ResultsFor; -import org.gcube.portlets.user.newsfeed.client.ui.ShowMoreFeeds; -import org.gcube.portlets.user.newsfeed.client.ui.SingleComment; -import org.gcube.portlets.user.newsfeed.client.ui.TweetTemplate; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; -import org.gcube.portlets.user.newsfeed.shared.MorePostsBean; -import org.gcube.portlets.user.newsfeed.shared.NewsConstants; -import org.gcube.portlets.user.newsfeed.shared.OperationResult; -import org.gcube.portlets.user.newsfeed.shared.UserSettings; -import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog; -import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent; -import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler; -import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent; -import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean; - -import com.github.gwtbootstrap.client.ui.Row; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Document; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.Window.Location; -import com.google.gwt.user.client.Window.ScrollEvent; -import com.google.gwt.user.client.Window.ScrollHandler; -import com.google.gwt.user.client.rpc.AsyncCallback; -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.HasAlignment; -import com.google.gwt.user.client.ui.HasVerticalAlignment; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -/** - * - * @author Massimiliano Assante, ISTI-CNR - * - */ -public class NewsFeedPanel extends Composite { - /** - * the current scope on the client can be static - */ - private static String currentScope; - /** - * Create a remote service proxy to talk to the server-side News service. - */ - private final NewsServiceAsync newsService = GWT.create(NewsService.class); - private final HandlerManager eventBus = new HandlerManager(null); - - private VerticalPanel mainPanel = new VerticalPanel(); - private HorizontalPanel filterPanelWrapper = new HorizontalPanel(); - private FilterPanel filterPanel; - private SimplePanel newUpdatesPanel = new SimplePanel(); - private Row showMoreUpdatesPanel = new Row(); - private VerticalPanel newsPanel = new VerticalPanel(); - - private NewFeedsAvailable newsFeedAlert; - - private static final String warning = GWT.getModuleBaseURL() + "../images/warning_blue.png"; - private static final String spacer = GWT.getModuleBaseURL() + "../images/feeds-spacer.gif"; - public static final String loading = GWT.getModuleBaseURL() + "../images/feeds-loader.gif"; - - public static final String GET_OID_PARAMETER = "oid"; - - public static final String LIKE_LABEL = "Like"; - public static final String LIKED_LABEL = "Liked"; - public static final String COMMENT_LABEL = "Reply"; - public static final String SHARE_FWD_LABEL = "Share"; - private static final int SEARCHED_FEEDS_TO_SHOW = 10; - private static final int FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW = 10; - private static final String LIMIT_REACHED_FOR_SORTING_COMMENTS_TEXT = "You reached the limit, sort by newest comments works up to 100 posts."; - - 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 currNewUpdatesNo = 0; - - private boolean isFirstTweet = false; - - // is user searching for something? - private boolean isSearch = false; - - // the current query (if isSearch is true) - protected String currentQuery; - - // is the user seeing her statistics? - private boolean isFeedsRelatedToStatistics = false; - - // the feeds related to user statistics to show - protected ShowUserStatisticAction relatedFeedsToUserStatisticsToShow; - - private LoadingText loadingIcon = new LoadingText(); - private Image loadingImage; - private UserInfo myUserInfo; - private FilterType currentFilter; - private Timer feedsTimer; - private ShowMoreFeeds showMoreWidget; - //needed to know the next range start - private Integer fromStartingPoint; - - private ArrayList allUpdates = new ArrayList(); - - private ArrayList tempCacheNewUpdates = new ArrayList(); - - /** - * events binder - */ - private void bind() { - eventBus.addHandler(ShowMoreUpdatesEvent.TYPE, new ShowMoreUpdatesEventHandler() { - @Override - public void onShowMoreUpdatesClick(ShowMoreUpdatesEvent event) { - doShowMoreUpdates(); - } - }); - - eventBus.addHandler(ShowNewUpdatesEvent.TYPE, new ShowNewUpdatesEventHandler() { - @Override - public void onShowNewUpdatesClick(ShowNewUpdatesEvent event) { - doShowCachedNewUpdates(); - } - }); - - - eventBus.addHandler(AddLikeEvent.TYPE, new AddLikeEventHandler() { - @Override - public void onAddLike(AddLikeEvent event) { - doAddLike( event.getOwner(), event.getFeedId()); - } - }); - - eventBus.addHandler(UnLikeEvent.TYPE, new UnLikeEventHandler() { - @Override - public void onUnLike(UnLikeEvent event) { - doUnLike(event.getOwner(), event.getFeedId()); - } - }); - - eventBus.addHandler(AddCommentEvent.TYPE, new AddCommentEventHandler() { - @Override - public void onAddComment(AddCommentEvent event) { - doAddComment(event.getOwner(), event.getText(), event.getMentionedUsers()); - } - }); - - eventBus.addHandler(EditCommentEvent.TYPE, new EditCommentEventHandler() { - @Override - public void onEditComment(EditCommentEvent event) { - doEditComment(event.getOwner(), event.getCommentInstance(), event.getCommentPanel()); - } - }); - - - eventBus.addHandler(SelectedUserEvent.TYPE, new SelectedUserEventHandler() { - @Override - public void onSelectedUser(SelectedUserEvent event) { - 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())); - } - }); - - eventBus.addHandler(SeeLikesEvent.TYPE, new SeeLikesEventHandler() { - @Override - public void onSeeLikes(SeeLikesEvent event) { - doShowLikes(event.getFeedId()); - } - }); - - eventBus.addHandler(SeeCommentsEvent.TYPE, new SeeCommentsEventHandler() { - @Override - public void onSeeComments(SeeCommentsEvent event) { - doShowComments(event.getOwner(), event.isCommentForm2Add()); - } - }); - - eventBus.addHandler(DeleteCommentEvent.TYPE, new DeleteCommentEventHandler() { - @Override - public void onDeleteComment(DeleteCommentEvent event) { - doDeleteComment(event.getOwner(), event.getCommentId()); - } - }); - - eventBus.addHandler(DeletePostEvent.TYPE, new DeletePostEventHandler() { - @Override - public void onDeletePost(DeletePostEvent event) { - doDeletePost(event.getToDelete()); - } - }); - - eventBus.addHandler(OpenPostEvent.TYPE, new OpenPostEventHandler() { - @Override - public void onOpenPost(OpenPostEvent event) { - doShowFeed(event.getToShow()); - } - }); - } - - /** - * - */ - public NewsFeedPanel() { - bind(); - mainPanel.setWidth("100%"); - mainPanel.add(filterPanelWrapper); - filterPanelWrapper.setVisible(false); - mainPanel.add(newUpdatesPanel); - mainPanel.add(newsPanel); - filterPanel = new FilterPanel(this, newsService); - filterPanelWrapper.add(filterPanel); - initWidget(mainPanel); - newsPanel.clear(); - newsPanel.setWidth("100%"); - showMoreUpdatesPanel.setWidth("60%"); - newsPanel.setHeight("300px"); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - loadingImage = new Image(loading); - newsPanel.add(loadingIcon); - //CheckSession.getInstance().startPolling(); - isSearch = false; - isFeedsRelatedToStatistics = false; - - newsService.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - } - - @Override - public void onSuccess(UserSettings result) { - myUserInfo = result.getUserInfo(); - delayMillis = result.getRefreshingTimeInMillis(); - vreLabel = result.getVreLabel(); - currentScope = result.getCurrentScope(); - if (result.getUserInfo().getUsername().equals(NewsConstants.TEST_USER)) { - doStopFeedsTimer(); - doShowSessionExpired(); - } - else { - GWT.log("checking params "); - if (getFeedToShowId() != null) { - String feedKey = getFeedToShowId(); - showSinglePost(feedKey); - filterPanel.removeFilterSelected(); - } - else if (getHashtagParam() != null) { - String hashtag = ""; - try { - hashtag = Encoder.decode(getHashtagParam()); - } catch (Exception e) { - newsPanel.clear(); - newsPanel.add(new HTML("
" + - "We're sorry, it seems you used an invalid character, please check the hashtag
")); - return; - } - showFeedsByHashtag(hashtag); - filterPanel.removeFilterSelected(); - } - else if (getSearchParam() != null) { - String query = ""; - try { - query = Encoder.decode(getSearchParam()); - currentQuery = query; - } catch (Exception e) { - newsPanel.clear(); - newsPanel.add(new HTML("
" + - "We're sorry, it seems you used an invalid character, please check the query
")); - return; - } - // show - isSearch = true; - showFeedsSearch(query, 0, SEARCHED_FEEDS_TO_SHOW); - filterPanel.removeFilterSelected(); - }else if(getShowUserStatisticParam() != null){ - String action = ""; - try { - action = Encoder.decode(getShowUserStatisticParam()); - relatedFeedsToUserStatisticsToShow = ShowUserStatisticAction.valueOf(action); - } catch (Exception e) { - newsPanel.clear(); - newsPanel.add(new HTML("
" + - "We're sorry, it seems you used an invalid character
")); - return; - } - isFeedsRelatedToStatistics = true; - showUserStatisticsRelatedFeeds(relatedFeedsToUserStatisticsToShow, 0, FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW); - filterPanel.removeFilterSelected(); - } - else { - if (!result.isInfrastructure()) - filterPanelWrapper.setVisible(getFeedToShowId() == null); - showAllUpdatesFeeds(); - } - currentFilter = FilterType.ALL_UPDATES; - } - //adjustments in the UI Depending on the scope - if (result.isInfrastructure()) { - //filterPanelWrapper.setVisible(getFeedToShowId() == null); - showFeedTimelineSource = result.isShowTimelineSourceLabel(); - isInfrastructure = true; - filterPanelWrapper.setVisible(getFeedToShowId() == null); - } - } - }); - - feedsTimer = new Timer() { - @Override - public void run() { - checkForNewUpdates(); - } - }; - feedsTimer.scheduleRepeating(delayMillis); - - //this is for the automatic scroll of feeds - Window.addWindowScrollHandler(new ScrollHandler() { - @Override - public void onWindowScroll(ScrollEvent event) { - if (showMoreWidget != null) { - boolean isInView = isScrolledIntoView(showMoreWidget); - if (isInView) { - eventBus.fireEvent(new ShowMoreUpdatesEvent()); - } - } - } - }); - } - - /** - * stop the feeds timer (when session expires) - */ - private void doStopFeedsTimer() { - feedsTimer.cancel(); - } - /** - * - */ - private void checkForNewUpdates() { - switch (currentFilter) { - case ALL_UPDATES: - checkAllUpdatesFeeds(); - break; - case CONNECTIONS: - showOnlyConnectionsFeeds(); - break; - case MINE: - showOnlyMyPosts(); - break; - case RECENT_COMMENTS: - checkAllUpdatesFeeds(); - break; - default: - break; - } - } - /** - * check if it has to show just one feed - * @return - */ - private String getFeedToShowId() { - return Window.Location.getParameter(GET_OID_PARAMETER); - } - /** - * check if it has to show the feeds given an hashtag - * @return - */ - private String getHashtagParam() { - return Window.Location.getParameter(Encoder.encode(GCubeSocialNetworking.HASHTAG_OID)); - } - - /** - * Check if some user statistic related feeds must be shown - * @return - */ - private String getShowUserStatisticParam(){ - return Window.Location.getParameter(Encoder.encode(GCubeSocialNetworking.SHOW_STATISTICS_ACTION_OID)); - } - - /** - * check if it has to show the feeds given a query - * @return - */ - private String getSearchParam() { - return Window.Location.getParameter(Encoder.encode(GCubeSocialNetworking.SEARCH_OID)); - } - - /** - * used from notification referrals (see this Post) - * @param postKey - */ - private void showSinglePost(String postKey) { - newsPanel.clear(); - newsService.getSinglePost(postKey, new AsyncCallback() { - @Override - public void onSuccess(EnhancedFeed result) { - if (result.getFeed().getType() == FeedType.DISABLED) { - final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; - String usrLink = ""+result.getFeed().getFullName()+ - " "; - newsPanel.add(new HTML("
" + - "We're sorry, "+ usrLink +" removed the post in the meantime!
")); - } else { - mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - newsPanel.add(new ResultsFor("selected post", "")); - newsPanel.setHeight(""); - newsPanel.add(new TweetTemplate(true, true, myUserInfo, result, eventBus)); - } - newsPanel.add(new Image(spacer)); - } - @Override - public void onFailure(Throwable caught) { - showProblems(); - } - - }); - } - /** - * check for updates - */ - private void checkAllUpdatesFeeds() { - newsService.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - doStopFeedsTimer(); - } - @Override - public void onSuccess(UserSettings result) { - if (result.getUserInfo().getUsername().equals(NewsConstants.TEST_USER)) { - doStopFeedsTimer(); - doShowSessionExpired(); - } - /** - * this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher - * is open at infra level the first tab stops checking for updates - */ - if (result.getCurrentScope().compareTo(currentScope) == 0) { - newsService.getAllUpdateUserFeeds(NewsConstants.FEEDS_NO_PER_CATEGORY, new AsyncCallback>() { - @Override - public void onSuccess(ArrayList feeds) { - if (feeds != null && allUpdates.size() > 0) { - - Date myLastUpdateTime = allUpdates.get(0).getFeed().getTime(); //this is the last update in the View - GWT.log("Last Mine: "+allUpdates.get(0).getFeed().getDescription()); - - GWT.log("Last Retr.: "+feeds.get(0).getFeed().getDescription()); - - - tempCacheNewUpdates = new ArrayList(); //need to clear it everytime i check (in case someone deleted the updated in the meanwhile) - - //check if there are new updates (enter the while) and put them in a temporary cache for displaying on user click - - int i = 0; - while (i < feeds.size() && feeds.get(i).getFeed().getTime().after(myLastUpdateTime)) { - tempCacheNewUpdates.add(feeds.get(i)); - i++; - } - - /* currNewUpdatesNo keeps the number of updates to be added on user clicks, - * i keeps the total number as it arrives, - * if they differ you got to refresh the updates to show the new number - */ - if (currNewUpdatesNo < i) { - //add the current "show new updates" alert panel if not present - if (newsFeedAlert == null) { - newsFeedAlert = new NewFeedsAvailable(i, eventBus); - newUpdatesPanel.add(newsFeedAlert); - } - else //update it otherwise - newsFeedAlert.updateNewUpdatesNo(i); - - currNewUpdatesNo = i; - } - } - } - @Override - public void onFailure(Throwable caught) {} - }); - } - } - }); - } - /** - * get the hashtagged feeds - * @param hashtag to look for - */ - private void showFeedsByHashtag(final String hashtag) { - showLoader(); - newsService.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - doStopFeedsTimer(); - } - @Override - public void onSuccess(UserSettings result) { - if (result.getUserInfo().getUsername().equals(NewsConstants.TEST_USER)) { - doStopFeedsTimer(); - doShowSessionExpired(); - } else { - /** - * this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher - * is open at infra level the first tab stops checking for updates - */ - if (result.getCurrentScope().compareTo(currentScope) == 0) { - newsService.getPostsByHashtag(hashtag, new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts) { - filterPanelWrapper.setVisible(false); - newsPanel.clear(); - if (posts != null) { - if (posts.size() == 0) { - newsPanel.add(new ResultsFor("results for", hashtag)); - newsPanel.add(new HTML("
" + - "Sorry, looks like we found no updates with topic: " + hashtag +"
")); - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - newsPanel.add(new ResultsFor("results for", hashtag)); - for (EnhancedFeed feed : posts) { - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - } - if (posts.size() < 5) { - newsPanel.add(new Image(spacer)); - } - isFirstTweet = false; - } - } else { - showProblems(); - } - } - @Override - public void onFailure(Throwable caught) { - showProblems(); - } - }); - } - } - } - }); - } - - /** - * Called when a user wants to show some feeds related to her statistics - */ - private void showUserStatisticsRelatedFeeds(final ShowUserStatisticAction relatedFeedsToUserStatisticsToShow, final int from, final int to) { - - // show loader while waiting - showLoader(); - - // stop asking for feeds - doStopFeedsTimer(); - - final String actionToPrint = relatedFeedsToUserStatisticsToShow.getHumanFriendlyAction(); - - newsService.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - } - @Override - public void onSuccess(UserSettings result) { - if (result.getUserInfo().getUsername().equals(NewsConstants.TEST_USER)) { - doShowSessionExpired(); - } else { - /** - * this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher - * is open at infra level the first tab stops checking for updates - */ - if (result.getCurrentScope().compareTo(currentScope) == 0) { - newsService.getPostsRelatedToUserStatistics(relatedFeedsToUserStatisticsToShow, from, to, new AsyncCallback>() { - - @Override - public void onSuccess(ArrayList posts) { - - filterPanelWrapper.setVisible(false); - newsPanel.clear(); - if (posts != null) { - - GWT.log("Retrieved " + posts.size() + " hits for search."); - if (posts.size() == 0) { - newsPanel.add(new ResultsFor("", actionToPrint)); - newsPanel.add(new HTML("
" + - "Sorry, looks like we found no match for action : " + actionToPrint +"
")); - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - newsPanel.add(new ResultsFor("", actionToPrint)); - for (EnhancedFeed feed : posts) { - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - // save them (they will be used when asking more feeds) - allUpdates.add(feed); - } - if (posts.size() < 5) { - newsPanel.add(new Image(spacer)); - } - - // add widget to lookup more feeds: if the size of the returned data is less - // than the required disable this feature. - if(posts.size() == FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW){ - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - } - } - } else { - showProblems(); - } - } - @Override - public void onFailure(Throwable caught) { - showProblems(); - } - }); - } - } - } - }); - } - - /** - * Called when a user search something - */ - private void showFeedsSearch(final String query, final int from, final int to) { - - // show loader while waiting - showLoader(); - - // stop asking for feeds - doStopFeedsTimer(); - - newsService.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - } - @Override - public void onSuccess(UserSettings result) { - if (result.getUserInfo().getUsername().equals(NewsConstants.TEST_USER)) { - doShowSessionExpired(); - } else { - /** - * this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher - * is open at infra level the first tab stops checking for updates - */ - if (result.getCurrentScope().compareTo(currentScope) == 0) { - newsService.getPostsByQuery(query, from, to, new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts) { - filterPanelWrapper.setVisible(false); - newsPanel.clear(); - if (posts != null) { - - GWT.log("Retrieved " + posts.size() + " hits for search."); - if (posts.size() == 0) { - newsPanel.add(new ResultsFor("Results for query: ", query)); - newsPanel.add(new HTML("
" + - "Sorry, looks like we found no match for: " + query +"
")); - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - newsPanel.add(new ResultsFor("Results for query: ", query)); - for (EnhancedFeed feed : posts) { - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - // save them (they will be used when asking more feeds) - allUpdates.add(feed); - } - if (posts.size() < 5) { - newsPanel.add(new Image(spacer)); - } - - // add widget to lookup more feeds: if the size of the returned data is less - // than the required disable this feature. - if(posts.size() == SEARCHED_FEEDS_TO_SHOW){ - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - } - } - } else { - showProblems(); - } - } - @Override - public void onFailure(Throwable caught) { - showProblems(); - } - }); - } - } - } - }); - } - - /** - * called when a user click on the are new updates - */ - protected void doShowCachedNewUpdates() { - newUpdatesPanel.clear(); //remove the alert panel - newsFeedAlert = null; //reset the alert panel and other needed vars - currNewUpdatesNo = 0; - - //need to put them in reverse order; - for (int i = tempCacheNewUpdates.size(); i > 0; i--) { - EnhancedFeed feed = tempCacheNewUpdates.get(i-1); - final TweetTemplate tt = new TweetTemplate(myUserInfo, feed, eventBus, true); - newsPanel.insert(tt, 0); //insert in the view - allUpdates.add(0, feed); //insert in the model - - //timer for the transition - Timer t = new Timer() { - @Override - public void run() { - tt.setcontentAreaStyle("visible"); - } - }; - t.schedule(100); - } - //after that I remove the ($updatesNo) from Window Title - String currTitle = Document.get().getTitle(); - Document.get().setTitle(currTitle.startsWith("(") ? currTitle.substring(4) : currTitle); - } - - /** - * used when adding directly a feed from the UI (IPC) - * @param userid - * @param fullName - * @param thumbURL - * @param description - */ - public void addJustAddedFeed(ClientPost cFeed) { - - // build up the feed - Feed feed = new Feed( - cFeed.key, - FeedType.SHARE, - cFeed.userid, - cFeed.time, - "", - cFeed.uri, - cFeed.linkUrlThumbnail, - cFeed.description, - PrivacyLevel.CONNECTION, - cFeed.fullName, - cFeed.email, - cFeed.thumbnailURL, - cFeed.linkTitle, - cFeed.linkDescription, - cFeed.linkHost); - - // set multi-attachments property - boolean multiAttachments = (cFeed.attachments != null) ? cFeed.attachments.length > 0 : false; - feed.setMultiFileUpload(multiAttachments); - - //false because he could not have liked this yet and true because is the current user's - EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); - - ArrayList attachments = null; - if (multiAttachments) { - attachments = new ArrayList<>(cFeed.attachments.length); - for (int i = 0; i >() { - @Override - public void onSuccess(ArrayList feeds) { - newsPanel.clear(); - if (feeds != null) { - if (feeds.size() == 0) { - if (!isInfrastructure) { - newsPanel.add(new HTML("
" + - "Looks like nobody posted anything yet. Are you willing to be the first?
" + - "You may begin by posting a message!
")); - } else { - newsPanel.add(new HTML("
" + - "Looks like we've got nothing for you at the moment.
" + - "You may begin by joining some of the available " + - "
"+vreLabel+"s.
")); - } - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - - for (EnhancedFeed feed : feeds) { - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - allUpdates.add(feed); //in the model - } - if (feeds.size() < 5) { - newsPanel.add(new Image(spacer)); - } - //if you are showing more than feedsMaxPerCategory-1 feeds there is probably more - if (feeds.size() >= NewsConstants.FEEDS_MAX_PER_CATEGORY-1 && (!isInfrastructure)) { - GWT.log("Show MORE " + NewsConstants.FEEDS_NO_PER_CATEGORY); - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - } - isFirstTweet = false; - } - } else { - showProblems(); - } - - } - - @Override - public void onFailure(Throwable caught) { - newsPanel.clear(); - newsPanel.add(new HTML("
" + - "Ops! There were problems while retrieving your feeds!.
" + - "Please try again in a short while.
")); - } - }); - } - /** - * called when a user scroll down the page to the bottom - */ - protected void doShowMoreUpdates() { - - showMoreUpdatesPanel.remove(0); - loadingImage.getElement().getStyle().setMargin(10, Unit.PX); - showMoreUpdatesPanel.add(loadingIcon); - - if(isSearch){ - - GWT.log("Going to request more feeds for this search"); - - // start position - int start = allUpdates.size(); - - GWT.log("StartingPoint = " + start); - newsService.getPostsByQuery(currentQuery, start, SEARCHED_FEEDS_TO_SHOW , new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts){ - newsPanel.remove(showMoreUpdatesPanel); - if (posts != null) { - GWT.log("There are " + posts.size() + " more feeds"); - - for (EnhancedFeed feed : posts) { - // avoid to insert same data - if(!isFeedPresent(feed)){ - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - allUpdates.add(feed); - } - } - - // clear panel - showMoreUpdatesPanel.clear(); - - // check if we can ask for other data - if(posts.size() == SEARCHED_FEEDS_TO_SHOW){ - GWT.log("It seems there are no more feeds for this query. Stop asking further"); - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - }else{ - showMoreWidget = null; - } - } - } - @Override - public void onFailure(Throwable caught) { - showMoreUpdatesPanel.clear(); - newsPanel.add(new HTML("
" + - "Ops! There were problems while retrieving your feeds!.
" + - "Please try again in a short while.
")); - } - }); - }else if(isFeedsRelatedToStatistics){ - GWT.log("Going to request more feeds for this user's statisics"); - - // start position - int start = allUpdates.size(); - - GWT.log("StartingPoint = " + start); - newsService.getPostsRelatedToUserStatistics(relatedFeedsToUserStatisticsToShow, start, FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW , new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts){ - newsPanel.remove(showMoreUpdatesPanel); - if (posts != null) { - GWT.log("There are " + posts.size() + " more feeds"); - - for (EnhancedFeed feed : posts) { - // avoid to insert same data - if(!isFeedPresent(feed)){ - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view - allUpdates.add(feed); - } - } - - // clear panel - showMoreUpdatesPanel.clear(); - - // check if we can ask for other data - if(posts.size() == FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW){ - GWT.log("It seems there are no more feeds for this query. Stop asking further"); - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - }else{ - showMoreWidget = null; - } - } - } - @Override - public void onFailure(Throwable caught) { - showMoreUpdatesPanel.clear(); - newsPanel.add(new HTML("
" + - "Ops! There were problems while retrieving your feeds!.
" + - "Please try again in a short while.
")); - } - }); - } - else{ - final int quantity = 10; - loadMorePosts(quantity, false); - } - } - /** - * - * @param quantity - */ - public void loadMorePosts(final int quantity, boolean isSortingByLastCommentedposts) { - int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint; - if (isSortingByLastCommentedposts) { - showLoader(); - if ((from == 0)) - from = 1; - } - - GWT.log("StartingPoint = " + from); - newsService.getMorePosts(from, quantity, new AsyncCallback() { - @Override - public void onSuccess(MorePostsBean rangeFeeds) { - newsPanel.remove(showMoreUpdatesPanel); - if (rangeFeeds.getPosts() != null) { - fromStartingPoint = rangeFeeds.getLastReturnedFeedTimelineIndex(); - int c = 1; - for (EnhancedFeed post : rangeFeeds.getPosts()) { - if (!isFeedPresent(post)) { //avoid possible duplicates - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, post, eventBus)); //in the view - allUpdates.add(post); //in the model - } - c++; - } - if (c >= quantity) { //there could be more feeds - GWT.log("there could be more feeds"); - showMoreUpdatesPanel.clear(); - showMoreWidget = new ShowMoreFeeds(eventBus); - showMoreUpdatesPanel.add(showMoreWidget); - newsPanel.add(showMoreUpdatesPanel); - } - if (isSortingByLastCommentedposts) { - sortCurrentPostsByLatestComment(); - showMoreUpdatesPanel.clear(); - showMoreWidget = null; - if (getAllUpdatesSize() > 99) - newsPanel.add(new HTML(LIMIT_REACHED_FOR_SORTING_COMMENTS_TEXT)); - } - } - } - @Override - public void onFailure(Throwable caught) { - showMoreUpdatesPanel.clear(); - newsPanel.add(new HTML("
" + - "Ops! There were problems while retrieving your feeds!.
" + - "Please try again in a short while.
")); - } - }); - } - /** - * @param widget the widget to check - * @returnn true if the widget is in the visible part of the page - */ - private boolean isScrolledIntoView(Widget widget) { - if (widget != null) { - int docViewTop = Window.getScrollTop(); - int docViewBottom = docViewTop + Window.getClientHeight(); - int elemTop = widget.getAbsoluteTop(); - int elemBottom = elemTop + widget.getOffsetHeight(); - return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); - } - return false; - } - - private boolean isFeedPresent(EnhancedFeed toCheck) { - for (EnhancedFeed feed : allUpdates) { - if (feed.getFeed().getKey().compareTo(toCheck.getFeed().getKey()) == 0) - return true; - } - return false; - } - /** - * Only User Connections - */ - public void showOnlyConnectionsFeeds() { - showLoader(); - newsService.getOnlyConnectionsUserPosts(new AsyncCallback>() { - @Override - public void onSuccess(ArrayList feeds) { - if (feeds != null) { - newsPanel.clear(); - if (feeds.size() == 0) { - //TODO: provide actual link for Making some friends - newsPanel.add(new HTML("
" + - "Looks like we've got nothing for you at the moment.
" + - "You may begin by adding some friend!
")); - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - for (EnhancedFeed feed : feeds) - newsPanel.add(new TweetTemplate(false, false, myUserInfo, feed, eventBus)); - if (feeds.size() < 5) { - newsPanel.add(new Image(spacer)); - } - isFirstTweet = false; - } - } else - showProblems(); - - } - - @Override - public void onFailure(Throwable caught) { - loadingImage.setUrl(warning); - newsPanel.add(new HTML("Ops! There were problems while retrieving your feeds! Please try again in a short while")); - } - }); - } - /** - * Only User Feeds - */ - public void showOnlyMyPosts() { - showLoader(); - newsService.getOnlyMyUserPosts(new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts) { - if (posts != null) { - newsPanel.clear(); - if (posts.size() == 0) { - newsPanel.add(new HTML("
" + - "Looks like we've got nothing for you at the moment.
" + - "You may begin by sharing an update!
")); - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - for (EnhancedFeed feed : posts) - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); - if (posts.size() < 5) { - newsPanel.add(new Image(spacer)); - } - isFirstTweet = false; - } - } else - showProblems(); - - } - - @Override - public void onFailure(Throwable caught) { - loadingImage.setUrl(warning); - newsPanel.add(new HTML("Ops! There were problems while retrieving your feeds! Please try again in a short while")); - } - }); - } - /** - * Only User Liked Posts - */ - public void showOnlyLikedPosts() { - showLoader(); - newsService.getOnlyLikedPosts(new AsyncCallback>() { - @Override - public void onSuccess(ArrayList posts) { - if (posts != null) { - newsPanel.clear(); - if (posts.size() == 0) { - newsPanel.add(new HTML("
" + - "Looks like we've got nothing for you at the moment.
" + - "Set an update as your favorite to see it here
")); - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - for (EnhancedFeed feed : posts) - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); - if (posts.size() < 5) { - newsPanel.add(new Image(spacer)); - } - isFirstTweet = false; - } - } else - showProblems(); - - } - - @Override - public void onFailure(Throwable caught) { - loadingImage.setUrl(warning); - newsPanel.add(new HTML("Ops! There were problems while retrieving your feeds! Please try again in a short while")); - } - }); - } - /**: - * Sort the posts per recent comment - */ - private void sortCurrentPostsByLatestComment() { - showLoader(); - GWT.log(" number of posts " + allUpdates.size()); - ArrayList latestComments = new ArrayList<>(); - //thePostsMap is need so that later it is faster to get the post by id - HashMap theCommentedPostsMap = new HashMap<>(); - for (EnhancedFeed post : allUpdates) { - ArrayList postComments = post.getComments(); - if (postComments != null && !postComments.isEmpty()) { - theCommentedPostsMap.put(post.getFeed().getKey(), post); - Comment latest = postComments.get(postComments.size()-1); - latestComments.add(latest); //get the latest - } - } - //sort the comments - Collections.sort(latestComments, Collections.reverseOrder()); - ArrayList sortedPostsByLatestComment = new ArrayList<>(); - // evaluate unique posts' ids - HashSet postIds = new HashSet(); - for (Comment comment : latestComments) { - String postId = comment.getFeedid(); - if(!postIds.contains(postId)){ - postIds.add(postId); - sortedPostsByLatestComment.add(theCommentedPostsMap.get(postId)); - } - } - //at this point the sortedPostsByLatestComment list contains only the commented posts in the right order - //we need to add the remaining posts of the page in the latest post order - for (EnhancedFeed post : allUpdates) { - if (!theCommentedPostsMap.containsKey(post.getFeed().getKey())) - sortedPostsByLatestComment.add(post); - } - newsPanel.clear(); - if (sortedPostsByLatestComment.size() == 0) { - newsPanel.add(new HTML("
" + - "Looks like we've got nothing for you at the moment.
" + - "Set an update as your favorite to see it here
")); - isFirstTweet = true; - } - else { - newsPanel.setHeight(""); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); - for (EnhancedFeed feed : sortedPostsByLatestComment) - newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); - if (sortedPostsByLatestComment.size() < 5) { - newsPanel.add(new Image(spacer)); - } - isFirstTweet = false; - } - - - } - - - - - private void showLoader() { - newsPanel.clear(); - newsPanel.setWidth("100%"); - newsPanel.setHeight("300px"); - newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER); - newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); - newsPanel.add(new Image(loading)); - } - - private void showProblems() { - newsPanel.clear(); - newsPanel.add(new HTML("
" + - "Ops! There were problems while retrieving your feeds!.
" + - "Looks like we are not able to communicate with the infrastructure,
(or your session expired)
please try again in a short while or refresh the page.
")); - } - - private void doAddLike(final TweetTemplate owner, final String feedId) { - newsService.like(feedId, owner.getMyFeedText(), owner.getMyFeedUserId(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) {} - @Override - public void onSuccess(Boolean result) { - if (!result) { - doShowSessionExpired(); - } - } - }); - } - - protected void doUnLike(final TweetTemplate owner, String feedId) { - newsService.unlike(feedId, owner.getMyFeedText(), owner.getMyFeedUserId(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) {} - @Override - public void onSuccess(Boolean result) { - if (!result) { - doShowSessionExpired(); - } - } - }); - - } - - private void doShowSessionExpired() { - - } - - private void doShowLikes(final String postId) { - final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus); - dlg.center(); - dlg.show(); - - newsService.getAllLikesByPost(postId, new AsyncCallback>() { - @Override - public void onFailure(Throwable caught) { - Window.alert("People who liked this could not be retrieved: " + caught.getMessage()); - } - - @Override - public void onSuccess(ArrayList result) { - ArrayList toShow = new ArrayList(); - for (Like like : result) { - toShow.add(new ItemSelectableBean(like.getUserid(), like.getFullName(), like.getThumbnailURL())); - } - eventBus.fireEvent(new UsersFetchedEvent(toShow)); - } - }); - } - - private void doAddComment(final TweetTemplate owner, String text, HashSet mentionedUsers) { - owner.showCommentingPreloader(true); - newsService.comment(owner.getFeedKey(), text, mentionedUsers, owner.getMyFeedUserId(), owner.isAppFeed(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - owner.showCommentingPreloader(true); - Window.alert("Could not deliver this comment: " + caught.getMessage()); - } - @Override - public void onSuccess(OperationResult result) { - owner.showCommentingPreloader(false); - if (result != null) { - if (!result.isSuccess()) { - Window.alert("Could not deliver this comment. Please try again in a short while."); - } - else { - Comment comment = (Comment) result.getComment(); - owner.addComment(new SingleComment(comment, owner, (comment.getUserid().equals(myUserInfo.getUsername())))); - owner.setCommentingDisabled(false); - owner.updateCommentsNumberCount(); - owner.showAddCommentForm(false); - - // if(owner.isUser()){ - // // alert the User statistics portlet to increment the number of comments got - // try { - // NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER); - // } catch (PageBusAdapterException e) { - // GWT.log(e.toString()); - // } - // } - } - } - else { - Window.alert("Could not deliver this comment. Please try again in a short while."); - } - } - }); - } - - private void doEditComment(final TweetTemplate owner, Comment edited, final HTMLPanel commentPanel) { - newsService.editComment(edited, new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - Window.alert("Could not edit this comment: " + caught.getMessage()); - } - - @Override - public void onSuccess(OperationResult result) { - if (result != null) { - if (!result.isSuccess()) { - //CheckSession.showLogoutDialog(); - } - else { - Comment comment = (Comment) result.getComment(); - owner.updateSingleComment(comment, commentPanel); - owner.setCommentingDisabled(false); - } - } - else { - Window.alert("Could not deliver this comment. Please try again in a short while."); - } - } - }); - - - } - - private void doShowComments(final TweetTemplate owner, final boolean commentForm2Add) { - owner.showLoadingComments(); - newsService.getAllCommentsByPost(owner.getFeedKey(), new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - Window.alert("Comments could not be retrieved: " + caught.getMessage()); - } - - @Override - public void onSuccess(ArrayList comments) { - owner.clearComments(); - for (Comment comment :comments) - owner.addComment(new SingleComment(comment, owner,(comment.getUserid().equals(myUserInfo.getUsername())))); - owner.setCommentsFetched(true); - if (commentForm2Add) - owner.showAddCommentForm(false); - owner.updateCommentsNumberCount(); - owner.showAddCommentForm(false); - } - }); - - } - - - protected void doDeleteComment(final TweetTemplate owner, String commentId) { - newsService.deleteComment(commentId, owner.getFeedKey(), new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - Window.alert("Comment could not be deleted: " + caught.getMessage()); - - } - @Override - public void onSuccess(Boolean result) { - if (result) { - doShowComments(owner, false); - owner.updateCommentsNumberCount(); - - } else - Window.alert("Comment could not be deleted, please try again in a short while."); - } - }); - - } - - private void doDeletePost(final TweetTemplate toDelete) { - if (Window.confirm("Are you sure you want to delete this post?")) { - newsService.deletePost(toDelete.getFeedKey(), new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - Window.alert("Feed could not be deleted: " + caught.getMessage()); - } - - @Override - public void onSuccess(Boolean result) { - if (result) { - toDelete.removeFromParent(); - } else - Window.alert("Feed could not be deleted, please try again in a short while."); - } - }); - } - } - - private void doShowFeed(final TweetTemplate toShow) { - String feedKey = toShow.getFeedKey(); - Window.Location.assign(Window.Location.getHref() + ((Window.Location.getHref().contains("?")) ? "&oid="+feedKey : "?oid="+feedKey)); - } - - public int getAllUpdatesSize() { - return allUpdates.size(); - } - - /** - * set the filter type status for automatic reloading of tweets - * @param currentFilter - */ - public void setCurrentFilter(FilterType currentFilter) { - this.currentFilter = currentFilter; - } - /** - * - * @return the current scope on the client - */ - 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; - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.java deleted file mode 100644 index a1bc3e4..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.java +++ /dev/null @@ -1,260 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - - -import org.gcube.portal.databook.shared.Comment; -import org.gcube.portal.databook.shared.UserInfo; -import org.gcube.portlets.user.gcubewidgets.client.elements.Div; -import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent; -import org.gcube.portlets.user.newsfeed.client.event.EditCommentEvent; - -import com.github.gwtbootstrap.client.ui.Button; -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiFactory; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.Window.ClosingHandler; -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 AddCommentTemplate extends Composite { - - interface CommentTemplateUiBinder extends UiBinder { - } - - private static CommentTemplateUiBinder uiBinder = GWT.create(CommentTemplateUiBinder.class); - - - public final static String COMMENT_TEXT = "Write a comment, use @ to mention someone"; - public final static String ERROR_UPDATE_TEXT = "Looks like empty to me!"; - public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png"; - - private TweetTemplate owner; - private HandlerManager eventBus; - private boolean isEditing = false; - private HTMLPanel commentPanel; - private Comment toEdit; - private ClosingHandler closingHandler; - private HandlerRegistration handlerRegistration; - - @UiField HTMLPanel mainPanel; - @UiField Image avatarImage; - @UiField SuperPosedTextArea commentTextArea; - @UiField Div highlighterDIV; - @UiField Button submitButton; - @UiField Button cancelButton; //obsolete - - - /** - * called on add comment - * @param caller - * @param myUserInfo - * @param eventBus - */ - public AddCommentTemplate(TweetTemplate caller, UserInfo myUserInfo, HandlerManager eventBus) { - initWidget(uiBinder.createAndBindUi(this)); - this.eventBus = eventBus; - owner = caller; - avatarImage.setPixelSize(30, 30); - avatarImage.setUrl(myUserInfo.getAvatarId()); - submitButton.setVisible(false); - cancelButton.setVisible(false); - commentTextArea.setHeight("30px"); - commentTextArea.setContext(owner.getVREContext()); - } - /** - * called on edit comment - * @param caller - * @param editText - */ - public AddCommentTemplate(TweetTemplate caller, Comment toEdit, HTMLPanel commentPanel) { - initWidget(uiBinder.createAndBindUi(this)); - this.eventBus = caller.getEventBus(); - this.commentPanel = commentPanel; - isEditing = true; - this.toEdit = toEdit; - - String commentText = new HTML(toEdit.getText()).getText(); - //replace the < & and > - commentText = commentText.replaceAll("<","<").replaceAll(">",">"); - commentText = commentText.replaceAll("&","&"); - - owner = caller; - commentTextArea.setContext(owner.getVREContext()); - avatarImage.setPixelSize(30, 30); - avatarImage.setUrl(caller.getMyUserInfo().getAvatarId()); - commentTextArea.setText(commentText); - mainPanel.removeStyleName("comment-hidden"); - mainPanel.setStyleName("single-comment"); - commentTextArea.addStyleName("comment-dark-color"); - submitButton.setText("Edit"); - closingHandler = new Window.ClosingHandler() { - public void onWindowClosing(Window.ClosingEvent closingEvent) { - String currentText = commentTextArea.getText(); - if(!currentText.isEmpty()){ - closingEvent.setMessage("Do you really want to leave the page?"); - } - } - }; - handlerRegistration = Window.addWindowClosingHandler(closingHandler); - - } - - - - /** Used by AddCommentTemplate to instantiate SuperPosedTextArea */ - @UiFactory SuperPosedTextArea build() { - return new SuperPosedTextArea(highlighterDIV); - } - - public void setFocus() { - commentTextArea.setFocus(true); - submitButton.setVisible(true); - cancelButton.setVisible(true); - //it needs a timer otherwise it won't work - Timer t = new Timer() { - @Override - public void run() { - setCaretPositionToBegin(commentTextArea.getAreaId()); - closingHandler = new Window.ClosingHandler() { - public void onWindowClosing(Window.ClosingEvent closingEvent) { - String currentText = commentTextArea.getText(); - if(!currentText.isEmpty()){ - closingEvent.setMessage("Do you really want to leave the page?"); - } - } - }; - handlerRegistration = Window.addWindowClosingHandler(closingHandler); - } - }; - t.schedule(200); - - } - - - @UiHandler("submitButton") - void onSubmitClick(ClickEvent e) { - String userComment = commentTextArea.getText().trim(); - if (userComment.equals(COMMENT_TEXT) || userComment.equals(ERROR_UPDATE_TEXT) || userComment.equals("")) { - commentTextArea.addStyleName("nwfeed-error"); - commentTextArea.setText(ERROR_UPDATE_TEXT); - return; - } - if (isEditing) { - toEdit.setText(escapeHtml(commentTextArea.getText())); - eventBus.fireEvent(new EditCommentEvent(owner, toEdit, commentPanel)); - } - else { //it is ok to add this comment - eventBus.fireEvent(new AddCommentEvent(owner, escapeHtml(commentTextArea.getText()), commentTextArea.getMentionedUsers())); - } - this.getWidget().setVisible(false); - owner.setCommentingDisabled(false); - handlerRegistration.removeHandler(); - GWT.log(" handlerRegistration.removeHandler();"); - } - - /** - * called when pasting. it tries to avoid pasting long non spaced strings - * @param linkToCheck - */ - private boolean checkTextLength(String textToCheck) { - - String [] parts = textToCheck.split("\\s"); - // check the length of tokens - for( String item : parts ) { - if (!item.startsWith("http") && !item.startsWith("ftp")) { //url are accepted as they can be trunked - if (item.length() > 50) { - return false; - } - } - } - return true; - } - - @UiHandler("cancelButton") - void onCancelClick(ClickEvent e) { - this.getWidget().setVisible(false); - owner.setCommentingDisabled(false); - if (isEditing) { - commentPanel.clear(); - SingleComment sc = new SingleComment(toEdit, owner, true); - commentPanel.add(sc); - } - handlerRegistration.removeHandler(); - } - - - @UiHandler("commentTextArea") - void onCommentClick(ClickEvent e) { - if (commentTextArea.getText().equals(COMMENT_TEXT) || commentTextArea.getText().equals(ERROR_UPDATE_TEXT) ) { - commentTextArea.setText(""); - commentTextArea.addStyleName("comment-dark-color"); - commentTextArea.removeStyleName("nwfeed-error"); - } - submitButton.setVisible(true); - cancelButton.setVisible(true); - closingHandler = new Window.ClosingHandler() { - public void onWindowClosing(Window.ClosingEvent closingEvent) { - String currentText = commentTextArea.getText(); - if(!currentText.isEmpty()){ - closingEvent.setMessage("Do you really want to leave the page?"); - } - } - }; - handlerRegistration = Window.addWindowClosingHandler(closingHandler); - } - - @UiHandler("commentTextArea") - void onCommentKeyPress(KeyPressEvent e) { - if (commentTextArea.getText().equals(COMMENT_TEXT) || commentTextArea.getText().equals(ERROR_UPDATE_TEXT) ) { - commentTextArea.setText(""); - commentTextArea.addStyleName("comment-dark-color"); - commentTextArea.removeStyleName("nwfeed-error"); - } - } - /** - * Escape an html string. Escaping data received from the client helps to - * prevent cross-site script vulnerabilities. - * - * @param html the html string to escape - * @return the escaped string - */ - private String escapeHtml(String html) { - if (html == null) { - return null; - } - return html.replaceAll("&", "&").replaceAll("<", "<") - .replaceAll(">", ">"); - } - /** - * this position the caret at the begin in a TextArea - * @param myAreaId the unique identifier of the textarea - */ - public static native void setCaretPositionToBegin(String myAreaId) /*-{ - var elem = $doc.getElementById(myAreaId); - if(elem != null) { - if(elem.createTextRange) { - var range = elem.createTextRange(); - range.move('character', 0); - range.select(); - } - else { - if(elem.selectionStart) { - elem.focus(); - elem.setSelectionRange(0, 0); - } - else - elem.focus(); - } - } - }-*/; -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.ui.xml deleted file mode 100644 index 695e24f..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AddCommentTemplate.ui.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - -
- - - -
-
- -
-
- -
-
-
- - -
-
-
\ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.java deleted file mode 100644 index 419ddb7..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import org.gcube.portal.databook.shared.Attachment; -import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage; -import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel; - -import com.github.gwtbootstrap.client.ui.Image; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Cursor; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; - -/** - * Class to show an attached file. - * @author Costantino Perciante at ISTI-CNR - * - */ -public class AttachmentPreviewer extends Composite { - - private static AttachmentPreviewerUiBinder uiBinder = GWT - .create(AttachmentPreviewerUiBinder.class); - - interface AttachmentPreviewerUiBinder extends - UiBinder { - } - - public AttachmentPreviewer() { - initWidget(uiBinder.createAndBindUi(this)); - } - - @UiField - HTMLPanel attachmentContainer; - - @UiField - Image imagePreview; - - @UiField - Label fileNameLabel; - - @UiField - Anchor downloadLabel; - - @UiField - Anchor showPreviewLabel; - - @UiField - Label labelSeparator; - - // save attachment - private Attachment attachment; - - // carousel reference - private Carousel carousel; - - // enhanced image associated with this carousel - private EnhancedImage img; - - public AttachmentPreviewer(Attachment a) { - - // init - initWidget(uiBinder.createAndBindUi(this)); - - // save the attachment - attachment = a; - - // set image preview - imagePreview.setUrl(a.getThumbnailURL()); - imagePreview.setStyleName("image-preview-attachment"); - - // set file name (be careful on file name length) - String shownName = a.getName().length() > 21 ? a.getName().substring(0, 18) + "..." : a.getName(); - fileNameLabel.setText(shownName); - fileNameLabel.setTitle(a.getName()); - - // download label - downloadLabel.setText("Download"); - downloadLabel.setHref(attachment.getUri()); - downloadLabel.setTarget("_blank"); - - - // preview in case of an image - if(a.getMimeType().contains("image/")){ - - showPreviewLabel.setText("Show"); - showPreviewLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - if(img != null) - carousel.show(img); - - } - }); - - }else{ - - // hide the show button and the separator label - showPreviewLabel.setVisible(false); - labelSeparator.setVisible(false); - } - - // style links - downloadLabel.addStyleName("link"); - showPreviewLabel.addStyleName("link"); - - } - - /** - * Change the width of this container. - * @param newWidth - * @param unit - */ - public void changeAttachmentWidth(int newWidth, Unit unit){ - - attachmentContainer.getElement().getStyle().setWidth(newWidth, unit); - - } - - /** - * Open the carousel when the user clicks on the preview's image. - * @param carousel - */ - public void onImageClickOpenCarousel(final Carousel carousel) { - - // save it - this.carousel = carousel; - - // change cursor type on hover - imagePreview.getElement().getStyle().setCursor(Cursor.POINTER); - - // change tooltipe - imagePreview.setTitle("Click for a preview"); - - // add handler - imagePreview.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - carousel.show(); - - } - }); - } - - /** - * Open the carousel and show this enhancedImage when the user clicks on the preview's image. - * @param carousel - * @param enhancedImage the image to show - */ - public void onImageClickOpenCarousel(final Carousel carousel, final EnhancedImage enhancedImage) { - - // save the carousel ref. - this.carousel = carousel; - - // save img ref - this.img = enhancedImage; - - // change cursor type on hover - imagePreview.getElement().getStyle().setCursor(Cursor.POINTER); - - // change tooltipe - imagePreview.setTitle("Click for a preview"); - - // add handler - imagePreview.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - if(img != null) - carousel.show(img); - - } - }); - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.ui.xml deleted file mode 100644 index 688d434..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AttachmentPreviewer.ui.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - .container-style { - padding: 5px; - font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; - background-clip: border-box; - background-color: #FBFBFB; - background-image: none; - border: 1px solid #DDD; - border-radius: 4px; - margin: 5px; - display: inline-block; - width: 95%; - height: 60px; - overflow: hidden; - } - - .label-filename-style { - overflow-x: hidden; - margin-left: 5px; - } - - .label-show { - font-weight: bold; - margin-left: 5px; - } - - .label-download { - font-weight: bold; - margin-left: 5px; - margin-right: 5px; - } - - .display-inline-style { - display: inline-block; - margin-right: 5px; - } - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.java deleted file mode 100644 index c58c9d5..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import java.util.HashMap; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Random; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.Widget; - -public class AvatarReplacement extends Composite { - - private static NoAvatarUiBinder uiBinder = GWT.create(NoAvatarUiBinder.class); - - /** - * to maintain the color assigned to an avatar replacement, for each page load - * this hashmap maintain the assigned users color, chosen reandomly at the beginning - */ - public static final HashMap avatarReplacementAssignedColors = new HashMap(); - - interface NoAvatarUiBinder extends UiBinder { - } - - @UiField HTML avatarBox; - /** - * the random colors - */ - private String[] randomColors = { - "#8e8e93", - "#ff2d55", - "#ff3b30", - "#ff9500", - "#ffcc00", - "#4cd964", - "#5ac8fa", - "#34aadc", - "#007aff", - "#5856d6" - }; - - - public AvatarReplacement() { - initWidget(uiBinder.createAndBindUi(this)); - } - - public void setInitials(String username, String firstName, String lastName) { - pickRandomColor(username); - String first = "A"; - if (firstName != null && firstName.trim().length() > 0) - first = firstName.trim().substring(0, 1); - String second = "Z"; - if (lastName != null && lastName.trim().length() > 0) - second = lastName.trim().substring(0, 1); - avatarBox.setText(first+second); - } - /** - * randomize of does not find it, else color is maintained through all the session - * @param username - */ - private void pickRandomColor(String username) { - if (! avatarReplacementAssignedColors.containsKey(username)) { - String randomColor = randomColors[Random.nextInt(randomColors.length)]; - avatarBox.getElement().getStyle().setBackgroundColor(randomColor); - avatarReplacementAssignedColors.put(username, randomColor); - } else - avatarBox.getElement().getStyle().setBackgroundColor(avatarReplacementAssignedColors.get(username)); - } - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.ui.xml deleted file mode 100644 index 8bb8fcd..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement.ui.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - .avatar-frame { - border-radius: 2em; - border: 1px solid #E6E6E6; - padding: 2px; - } - - .avatar-replacement { - border-radius: 2em; - display: table-cell; - text-align: center; - vertical-align: middle; - font-family: "HelveticaNeue-Light", "Helvetica Neue Light", - "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; - font-weight: 300; - font-size: 22px; - padding: 0; - color: #FFF; - } - - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.java deleted file mode 100644 index b377a0c..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Random; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.Widget; - -public class AvatarReplacement4Comments extends Composite { - - private static NoAvatarUiBinder uiBinder = GWT.create(NoAvatarUiBinder.class); - - interface NoAvatarUiBinder extends UiBinder { - } - - @UiField HTML avatarBox; - /** - * the random colors - */ - private String[] randomColors = { - "#8e8e93", - "#ff2d55", - "#ff3b30", - "#ff9500", - "#ffcc00", - "#4cd964", - "#5ac8fa", - "#34aadc", - "#007aff", - "#5856d6" - }; - - - public AvatarReplacement4Comments() { - initWidget(uiBinder.createAndBindUi(this)); - } - - public void setInitials(String username, String firstName, String lastName) { - pickRandomColor(username); - String first = "A"; - if (firstName != null && firstName.trim().length() > 0) - first = firstName.trim().substring(0, 1); - String second = "Z"; - if (lastName != null && lastName.trim().length() > 0) - second = lastName.trim().substring(0, 1); - avatarBox.setText(first+second); - } - /** - * randomize of does not find it, else color is maintained through all the session - * @param username - */ - private void pickRandomColor(String username) { - if (! AvatarReplacement.avatarReplacementAssignedColors.containsKey(username)) { - String randomColor = randomColors[Random.nextInt(randomColors.length)]; - avatarBox.getElement().getStyle().setBackgroundColor(randomColor); - AvatarReplacement.avatarReplacementAssignedColors.put(username, randomColor); - } else - avatarBox.getElement().getStyle().setBackgroundColor(AvatarReplacement.avatarReplacementAssignedColors.get(username)); - } - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.ui.xml deleted file mode 100644 index c492de3..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/AvatarReplacement4Comments.ui.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - .avatar-frame { - border-radius: 2em; - border: 1px solid #E6E6E6; - padding: 2px; - } - .avatar-replacement { - display: table-cell; - border-radius: 2em; - text-align: center; - vertical-align: middle; - font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; - font-weight: 300; - font-size: 12px; - padding: 0; - color: #FFF; - } - - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.java deleted file mode 100644 index 912ea95..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import org.gcube.portlets.user.newsfeed.client.FilterType; -import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync; -import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; -import org.gcube.portlets.user.newsfeed.shared.UserSettings; - -import com.github.gwtbootstrap.client.ui.Dropdown; -import com.github.gwtbootstrap.client.ui.NavLink; -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - -public class FilterPanel extends Composite { - - private static FilterPanelUiBinder uiBinder = GWT - .create(FilterPanelUiBinder.class); - - interface FilterPanelUiBinder extends UiBinder { - } - - protected static final String ERROR_MESSAGE = "Ops! we encountered some problems, server is not responding, please try again in a short while."; - protected static final String SESSION_EXPIRED = "Your session has expired, please log out and login again"; - - NewsFeedPanel caller; - NewsServiceAsync service; - @UiField NavLink allUpdatesLink; - @UiField NavLink recentCommentsLink; - @UiField Dropdown sortByDD; - - public FilterPanel(NewsFeedPanel caller, NewsServiceAsync newsService) { - initWidget(uiBinder.createAndBindUi(this)); - this.caller = caller; - this.service = newsService; - } - - - public void removeFilterSelected() { - allUpdatesLink.setActive(false); - recentCommentsLink.setActive(false); - } - - @UiHandler("recentCommentsLink") - void onRecentCommentsLinkClick(ClickEvent e) { - allUpdatesLink.setDisabled(false); - recentCommentsLink.setDisabled(true); - sortByDD.setText("newest Comment"); - caller.setCurrentFilter(FilterType.RECENT_COMMENTS); - int loadedPostsInView = caller.getAllUpdatesSize() + 1; - int quantity = loadedPostsInView < 100 ? 100 - loadedPostsInView : loadedPostsInView; - caller.loadMorePosts(quantity, true); - } - - @UiHandler("allUpdatesLink") - void onAllUpdatesClick(ClickEvent e) { - allUpdatesLink.setDisabled(true); - recentCommentsLink.setDisabled(false); - sortByDD.setText("newest Post"); - caller.setCurrentFilter(FilterType.ALL_UPDATES); - service.getUserSettings(new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - Window.alert(ERROR_MESSAGE); - } - - @Override - public void onSuccess(UserSettings result) { - if (result.getUserInfo().getUsername().equals("test.user")) { - Window.alert(SESSION_EXPIRED); - } - else - caller.showAllUpdatesFeeds(); - } - }); - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.ui.xml deleted file mode 100644 index 6d2bf2f..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/FilterPanel.ui.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - .margin { - margin-bottom: 0 !important; - margin-top: -15px !important; - } - - - - Show sorted by: - - newest Post - newest Comment - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.java deleted file mode 100644 index 03672ff..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Cursor; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -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.Image; -import com.google.gwt.user.client.ui.Widget; - -/** - * Link Previewer class to show a link a preview. - * @author Costantino Perciante at ISTI-CNR - * @author Massimiliano Assante at ISTI-CNR - */ -public class LinkPreviewer extends Composite { - - // is the preview image still there ? - private boolean imageRemoved = false; - - @UiField - HTML titleArea; - @UiField - HTML urlText; - @UiField - HTML descText; - @UiField - Image image; - - // saved file name - private final String fileName; - - private static LinkPreviewUiBinder uiBinder = GWT - .create(LinkPreviewUiBinder.class); - - interface LinkPreviewUiBinder extends UiBinder { - } - - public LinkPreviewer(String title, String titleDesc, String host, String linkThumbUrl, String url) { - initWidget(uiBinder.createAndBindUi(this)); - if (linkThumbUrl == null || linkThumbUrl.equals("null")){ - - image.removeFromParent(); - imageRemoved = true; - - } - else { - - image.setUrl(linkThumbUrl); - image.setWidth("80px"); - - } - - // save the filename info - fileName = title; - titleArea.setHTML(""+title+" - " + host+ ""); - urlText.setHTML((url.length() > 70) ? url.substring(0, 70)+"..." : url); - String desc = titleDesc; - descText.setHTML((desc.length() > 256) ? desc.substring(0, 256)+"..." : desc); - - } - - /** - * Open the carousel when the user clicks on the preview's image. - * @param carousel - */ - public void onImageClickOpenCarousel(final Carousel carousel) { - - if(imageRemoved) - return; - - // change cursor type on hover - image.getElement().getStyle().setCursor(Cursor.POINTER); - - // add handler - image.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - carousel.show(); - - } - }); - } - - /** - * Open the carousel when the user clicks on the previews' file name. - * @param carousel - */ - public void onFileNameClickOpenCarousel(final Carousel carousel) { - - String nameToShow = fileName.length() > 40 ? fileName.substring(0, 40) + "..." : fileName; - titleArea.setHTML(""+ nameToShow +""); - titleArea.setTitle(fileName); - - titleArea.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - carousel.show(); - - } - }); - - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.ui.xml deleted file mode 100644 index 17df84c..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LinkPreviewer.ui.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - -
-
- -
-
-
- -
-
- -
-
- -
-
-
-
\ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.java deleted file mode 100644 index c00cbe4..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - -public class LoadingText extends Composite { - - private static LoadingTextUiBinder uiBinder = GWT - .create(LoadingTextUiBinder.class); - - interface LoadingTextUiBinder extends UiBinder { - } - - public LoadingText() { - initWidget(uiBinder.createAndBindUi(this)); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.ui.xml deleted file mode 100644 index 4235f32..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/LoadingText.ui.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Please wait - - Contacting infrastructure services ... - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.java deleted file mode 100644 index 64d5452..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import org.gcube.portlets.user.newsfeed.client.event.ShowNewUpdatesEvent; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Document; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Timer; -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.Widget; - -public class NewFeedsAvailable extends Composite { - - private static NewFeedsAvailableUiBinder uiBinder = GWT - .create(NewFeedsAvailableUiBinder.class); - - interface NewFeedsAvailableUiBinder extends - - UiBinder { - } - - private HandlerManager eventBus; - - @UiField HTML caption; - @UiField HTMLPanel panel; - - - public NewFeedsAvailable(int newUpdatesNo, HandlerManager eventBus) { - initWidget(uiBinder.createAndBindUi(this)); - this.eventBus = eventBus; - if (newUpdatesNo > 0) { - updateNewUpdatesNo(newUpdatesNo); - //create the fade transition effect - Timer t = new Timer() { - @Override - public void run() { - caption.addStyleName("new-feeds-show"); - } - }; - t.schedule(100); - } - else throw new IllegalArgumentException("newUpdatesNo must be greater than 0"); - } - - public void updateNewUpdatesNo(int newUpdatesNo) { - String messageToShow = newUpdatesNo > 1 ? "See " + newUpdatesNo + " new Updates" : "See 1 new Update"; - caption.setHTML(messageToShow); - setBrowserWindowTitle(newUpdatesNo); - } - - public static void setBrowserWindowTitle (int newUpdatesNo) { - if (Document.get() != null) { - String currTitle = Document.get().getTitle(); - if (currTitle.startsWith("(")) { - String newTitle = "(" + newUpdatesNo + currTitle.substring(2); - Document.get().setTitle(newTitle); - } - else - Document.get().setTitle ("("+newUpdatesNo+") " + currTitle); - } - } - - @UiHandler("caption") - void onClick(ClickEvent e) { - eventBus.fireEvent(new ShowNewUpdatesEvent()); - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.ui.xml deleted file mode 100644 index 743c429..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/NewFeedsAvailable.ui.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/Placeholder.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/Placeholder.java deleted file mode 100644 index 8391e99..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/Placeholder.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; -import com.google.gwt.core.shared.GWT; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.client.ui.WidgetCollection; -/** - * This panel will contain the attachments/previews - * @author Massimiliano Assante at ISTI CNR - * @author Costantino Perciante at ISTI CNR - * - */ -public class Placeholder extends FlowPanel { - - private static final String SHOW_OTHER_ATTACHMENTS_LABEL = "Show All"; - - // check if we need to show more attachments - private boolean appendShowMoreLabel; - - /** - * Modified version of the add method. - */ - public void add(AttachmentPreviewer atPrev){ - - // retrieve the list of children - WidgetCollection listOfChildren = this.getChildren(); - - // check the size - int size = listOfChildren.size(); - - // look at NewsFeed.css ... - if(Window.getClientWidth() <= 1128){ - - add((Widget)atPrev); - atPrev.changeAttachmentWidth(92, Unit.PCT); - } - else if(size % 2 == 0){ - // in this case the next attachment we are going to add remains with the same width - add((Widget)atPrev); - GWT.log("added without changing size"); - } - else{ - // we need to change the length of the last element added and of this new one - ((AttachmentPreviewer) listOfChildren.get(size -1)).changeAttachmentWidth(45, Unit.PCT); - atPrev.changeAttachmentWidth(45, Unit.PCT); - - // add it finally - add((Widget)atPrev); - } - - if(size >= 4){ - // ok, we are going to add the 5th attachment and so forth but we hide them.. - atPrev.setVisible(false); - - // remember to add the button to let the user show them later - appendShowMoreLabel = true; - } - } - - /** - * Append "Show All" label to the post template. - */ - public void appendShowMoreLabel(){ - - if(appendShowMoreLabel){ - - final WidgetCollection listOfChildren = this.getChildren(); - - final SimplePanel sp = new SimplePanel(); - sp.setStyleName("centered"); - - final Anchor showMoreAttachments = new Anchor(SHOW_OTHER_ATTACHMENTS_LABEL); - showMoreAttachments.setTitle("Show all the attached files"); - showMoreAttachments.setStyleName("link"); - sp.add(showMoreAttachments); - - showMoreAttachments.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - // retrieve the list of attachmentPreviewers and show them - for(Widget w: listOfChildren){ - w.setVisible(true); - } - - sp.setVisible(false); - - } - }); - - // show the panel - this.add(sp); - } - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.java deleted file mode 100644 index e953050..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Cursor; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Window.Location; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.Widget; - -public class ResultsFor extends Composite { - - private static ResultsForUiBinder uiBinder = GWT - .create(ResultsForUiBinder.class); - - interface ResultsForUiBinder extends UiBinder { - } - - @UiField HTML allUpdatesLink; - @UiField HTML resultForDiv; - public ResultsFor(String prefix, String hashtag) { - initWidget(uiBinder.createAndBindUi(this)); - allUpdatesLink.setHTML("All Posts"); - allUpdatesLink.getElement().getStyle().setCursor(Cursor.POINTER); - resultForDiv.setHTML(prefix + " " + hashtag + ""); - resultForDiv.setStyleName("filter-selected"); - } - - @UiHandler("allUpdatesLink") - void onAllUpdatesClick(ClickEvent e) { - String href = Location.getHref(); - if (href.contains("?")) - href = href.substring(0, href.indexOf("?")); - Location.assign(href); - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.ui.xml deleted file mode 100644 index 36a403e..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ResultsFor.ui.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - -
-
    -
  • - -
  • -
  • - -
  • -
-
-
-
\ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java deleted file mode 100644 index bbdf850..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import com.github.gwtbootstrap.client.ui.Button; -import com.github.gwtbootstrap.client.ui.ListBox; -import com.github.gwtbootstrap.client.ui.Modal; -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - -public class SharePostDialog extends Composite { - - private static SharePostDialogUiBinder uiBinder = GWT - .create(SharePostDialogUiBinder.class); - - interface SharePostDialogUiBinder extends UiBinder { - } - - public SharePostDialog(TweetTemplate toShare) { - initWidget(uiBinder.createAndBindUi(this)); - - input.addItem("devVRE", "devVRE"); - input.addItem("devVRE2", "devVRE"); - input.addItem("devVRE3", "devVRE"); - - - } - - @UiField Button sharePostButton; - @UiField Button cancel; - @UiField Modal modalWindow; - @UiField ListBox input; - - @UiHandler("sharePostButton") - void onClick(ClickEvent e) { - Window.alert("Hello!"); - } - - @UiHandler("cancel") - void onCancelClick(ClickEvent e) { - modalWindow.hide(); - } - - public void openModal() { - GWT.log("OpenModal"); - modalWindow.show(); - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml deleted file mode 100644 index 5a06a90..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SharePostDialog.ui.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - .important { - font-weight: bold; - } - - - - - - - - - Cancel - Send Invite - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.java deleted file mode 100644 index 43cfa0f..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.shared.HandlerManager; -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.Widget; - -public class ShowMoreFeeds extends Composite { - - private static NewFeedsAvailableUiBinder uiBinder = GWT - .create(NewFeedsAvailableUiBinder.class); - - interface NewFeedsAvailableUiBinder extends - - UiBinder { - } - - @UiField HTML caption; - @UiField HTMLPanel panel; - - public ShowMoreFeeds(HandlerManager eventBus) { - initWidget(uiBinder.createAndBindUi(this)); - panel.getElement().getStyle().setMarginTop(10, Unit.PX); - caption.addStyleName("new-feeds-show"); - caption.getElement().getStyle().setBackgroundColor("transparent"); - caption.getElement().getStyle().setFontSize(14, Unit.PX); - caption.setHTML("Show more feeds"); - //done after - //panel.getElement().getStyle().setVisibility(Visibility.HIDDEN); - } - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.ui.xml deleted file mode 100644 index 743c429..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/ShowMoreFeeds.ui.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.java deleted file mode 100644 index cf0ad16..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.java +++ /dev/null @@ -1,186 +0,0 @@ -package org.gcube.portlets.user.newsfeed.client.ui; - -import java.util.Date; - -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.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; -import com.google.gwt.event.dom.client.MouseOutEvent; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.Window.Location; -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 SingleComment extends Composite { - - private static SingleCommentUiBinder uiBinder = GWT - .create(SingleCommentUiBinder.class); - - interface SingleCommentUiBinder extends UiBinder { - } - private static final int MAX_SHOWTEXT_LENGTH = 450; - - private boolean isUsers = false; - private TweetTemplate owner; - private String myCommentid; - private Comment myComment; - - @UiField HTMLPanel mainPanel; - @UiField Image avatarImage; - @UiField AvatarReplacement4Comments avatarReplacement; - @UiField HTML commentText; - @UiField HTML timeArea; - @UiField HTML closeImage; - @UiField HTML editImage; - @UiField HTML seeMore; - - public SingleComment(Comment toShow, TweetTemplate owner, boolean isUsers) { - initWidget(uiBinder.createAndBindUi(this)); - sinkEvents(Event.ONPASTE); - this.owner = owner; - this.isUsers = isUsers; - this.myComment = toShow; - myCommentid = toShow.getKey(); - avatarImage.setPixelSize(30, 30); - avatarImage.setUrl(toShow.getThumbnailURL()); - - //check if the user has his own avatar - if (toShow.getThumbnailURL().endsWith("img_id=0") || !toShow.getThumbnailURL().contains("?")) { //it means no avatar is set - avatarImage.setVisible(false); - String f = "A"; - String s = "Z"; - if (toShow.getFullName() != null) { - String[] parts = toShow.getFullName().split("\\s"); - if (parts.length > 0) { - f = parts[0].toUpperCase(); - s = parts[parts.length-1].toUpperCase(); - } else { - f = toShow.getFullName().substring(0,1); - s = toShow.getFullName().substring(1,2); - } - } - avatarReplacement.setInitials(toShow.getUserid(), f, s); - avatarReplacement.setVisible(true); - } - - String commentToShow = toShow.getText(); - - //replace the < & and > - commentToShow = commentToShow.replaceAll("<","<").replaceAll(">",">"); - commentToShow = commentToShow.replaceAll("&","&"); - - - - if (commentToShow.length() > MAX_SHOWTEXT_LENGTH) { - final int TEXT_TO_SHOW_LENGHT = (commentToShow.length() < 700) ? (commentToShow.length() - (commentToShow.length() / 3)) : 700; - commentToShow = commentToShow.substring(0, TEXT_TO_SHOW_LENGHT) + "..."; - seeMore.setHTML(" See More "); - } - final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; - - commentText.setHTML(""+toShow.getFullName()+ - " " + commentToShow); - - // Comment's data - Date now = new Date(); - String formattedTime; - String formattedTimeEdit = null; - - if(now.getYear() != toShow.getTime().getYear()) - formattedTime = DateTimeFormat.getFormat("MMMM dd yyyy, h:mm a").format(toShow.getTime()); - else - formattedTime = DateTimeFormat.getFormat("MMMM dd, h:mm a").format(toShow.getTime()); - - if(toShow.isEdit()){ - if(now.getYear() != toShow.getLastEditTime().getYear()) - formattedTimeEdit = DateTimeFormat.getFormat("MMMM dd yyyy, h:mm a").format(toShow.getLastEditTime()); - else - formattedTimeEdit = DateTimeFormat.getFormat("MMMM dd, h:mm a").format(toShow.getLastEditTime()); - } - - if(toShow.isEdit()) - timeArea.setHTML(formattedTime + - " (Last edit on " + formattedTimeEdit + ")"); - else - timeArea.setHTML(formattedTime); - - if (isUsers) { - closeImage.setStyleName("closeImage"); - closeImage.setTitle("Delete"); - editImage.setStyleName("editImage"); - editImage.setTitle("Edit"); - } - } - - @UiHandler("seeMore") - void onSeeMoreClick(ClickEvent e) { - String commentToShow = myComment.getText(); - //replace the < & and > - commentToShow = commentToShow.replaceAll("<","<").replaceAll(">",">"); - commentToShow = commentToShow.replaceAll("&","&"); - - final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; - - commentText.setHTML(""+ - myComment.getFullName()+" " + commentToShow); - seeMore.setHTML(""); - } - - - - @UiHandler("closeImage") - void onDeleteCommentClick(ClickEvent e) { - if (isUsers) - owner.getEventBus().fireEvent(new DeleteCommentEvent(owner, myCommentid)); - } - - @UiHandler("editImage") - void onEditCommentClick(ClickEvent e) { - if (isUsers) { - AddCommentTemplate addComm = new AddCommentTemplate(owner, myComment, mainPanel); - mainPanel.getElement().setInnerHTML(""); - mainPanel.add(addComm); - } - } - - - @UiHandler("commentText") - public void onHover(MouseOverEvent event) { - if (isUsers) { - closeImage.addStyleName("uiCloseButton"); - editImage.addStyleName("uiEditButton"); - } - } - - @UiHandler("commentText") - public void onHover(MouseOutEvent event) { - if (isUsers) { - closeImage.removeStyleName("uiCloseButton"); - editImage.removeStyleName("uiEditButton"); - } - } - - public String getCommentKey() { - return myCommentid; - } - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.ui.xml deleted file mode 100644 index 82d0fe8..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SingleComment.ui.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - .important { - font-weight: bold; - } - - - - - - - - - -
- - - -
- - - -
-
- - - -
-
-
\ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SuperPosedTextArea.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SuperPosedTextArea.java deleted file mode 100644 index c6ac00c..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/SuperPosedTextArea.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.newsfeed.client.ui; - -import java.util.HashSet; - -import org.gcube.portlets.user.gcubewidgets.client.elements.Div; -import org.gcube.portlets.user.newsfeed.client.NewsService; -import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; -import org.gcube.portlets.widgets.pickitem.client.dialog.PickItemsDialog; -import org.gcube.portlets.widgets.pickitem.client.events.PickedItemEvent; -import org.gcube.portlets.widgets.pickitem.client.events.PickedItemEventHandler; -import org.gcube.portlets.widgets.pickitem.shared.ItemBean; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NodeList; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.FocusHandler; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.Random; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.ui.TextArea; - -/** - * @author massi - * - */ -public class SuperPosedTextArea extends TextArea { - - private final NewsServiceAsync newsService = GWT.create(NewsService.class); - - private final HandlerManager eventBus = new HandlerManager(null); - - private PickItemsDialog pickUserDlg = null; - private Div highlighterDIV; - public final static int ARROW_UP = 38; - public final static int ARROW_DOWN = 40; - private String context; - private HashSet mentionedUsers = new HashSet(); - - private String areaId; - - /** - * - */ - public SuperPosedTextArea(Div highlighterDIV) { - sinkEvents(Event.ONPASTE); - sinkEvents(Event.ONCONTEXTMENU); - sinkEvents(Event.ONKEYDOWN); - sinkEvents(Event.ONKEYUP); - setText(AddCommentTemplate.COMMENT_TEXT); - this.highlighterDIV = highlighterDIV; - //needed to give unique identifiers to the Area (for the jQuery plugin) - areaId = "postTextArea"+Random.nextInt(); - getElement().setAttribute("id", areaId); - bind(); - Timer t = new Timer() { - @Override - public void run() { - myAutoSize(areaId); - } - }; - t.schedule(200); - - this.addKeyPressHandler(new KeyPressHandler() { - @Override - public void onKeyPress(KeyPressEvent event) { - if (pickUserDlg != null) { - int top = getAbsoluteTop(); - int offset = getOffsetHeight(); - int y = getAbsoluteTop()+getOffsetHeight(); - GWT.log("top=" + top + " - offset = " +offset); - pickUserDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), y, getText()); - } - } - }); - this.addFocusHandler(new FocusHandler() { - @Override - public void onFocus(FocusEvent event) { - pickUserDlg = new PickItemsDialog('@', eventBus, 430, context); - pickUserDlg.withPhoto(); - } - }); - - } - /** - * This is the way to wrap jQuery plugins into GWT, wrap it in a function and call it. - */ - public static native void myAutoSize(String myAreaId) /*-{ - function autoSizeArea() { - $wnd.jQuery('#'+myAreaId).autosize(); - } - autoSizeArea(); - }-*/; - /** - * @param element - */ - public SuperPosedTextArea(Element element) { - super(element); - } - /** - * - * @param context e.g. /gcube/devNext/NextNext - */ - public void setContext(String context) { - this.context = context; - } - - /** - * paste event overridden - */ - public void onBrowserEvent(Event event) { - super.onBrowserEvent(event); - switch (event.getTypeInt()) { - case Event.ONPASTE: { - if (getText().equals(AddCommentTemplate.COMMENT_TEXT) || getText().equals(AddCommentTemplate.ERROR_UPDATE_TEXT) ) { - setText(""); - addStyleName("dark-color"); - removeStyleName("nwfeed-error"); - } - break; - } - case Event.ONKEYUP: { - injectInDiv(getText()); - pickUserDlg.onKeyUp(event.getKeyCode()); - break; - } - case Event.ONCONTEXTMENU: { - removeSampleText(); - break; - } - case Event.ONKEYDOWN: { - if (pickUserDlg.isShowing()) { - //avoid the arrow up to move the cursor at the beginning of the textbox and the TAB to move around inputs and enter to go newline - if (event.getKeyCode() == ARROW_UP || event.getKeyCode() == KeyCodes.KEY_TAB || event.getKeyCode() == KeyCodes.KEY_ENTER) { - DOM.eventCancelBubble(event, true); - event.preventDefault(); - return; - } - } - break; - } - } - } - protected void removeSampleText() { - if (getText().equals(AddCommentTemplate.COMMENT_TEXT) || getText().equals(AddCommentTemplate.ERROR_UPDATE_TEXT) ) { - setText(""); - addStyleName("darker-color"); - removeStyleName("nwfeed-error"); - } - } - protected void cleanHighlighterDiv() { - //DOM.getElementById("comment-highlighter").setInnerHTML(""); - highlighterDIV.getElement().setInnerHTML(""); - } - /** - * copy what is being written in the text area in the underneath DIV - * @param textAreaText - */ - private void injectInDiv(String textAreaText) { - String text; - // parse the text: - // replace all the line braks by
, and all the double spaces by the html version   - text = textAreaText.replaceAll("(\r\n|\n)","
"); - text = text.replaceAll("\\s\\s","  "); - - for (MentionedDTO mentionedUser : mentionedUsers) { - text = text.replaceAll(mentionedUser.value, - ""+mentionedUser.value+""); - } - // re-inject the processed text into the div - highlighterDIV.getElement().setInnerHTML(text); - } - - /** - * events binder - */ - private void bind() { - eventBus.addHandler(PickedItemEvent.TYPE, new PickedItemEventHandler() { - @Override - public void onSelectedItem(PickedItemEvent event) { - - String toAdd = event.getSelectedItem().getAlternativeName(); - - ItemBean ib = event.getSelectedItem(); - String type = ib.isItemGroup() ? "team" : "user"; - MentionedDTO mToAdd = new MentionedDTO(ib.getId(), ib.getAlternativeName(), type); - mentionedUsers.add(mToAdd); - - String preceedingPart = getText().substring(0, event.getItemCursorIndexStart()); - String afterPart = getText().substring(event.getItemCursorIndexEnd()+1); - - setText(preceedingPart + toAdd + " " + afterPart); - injectInDiv(getText()); - } - }); - } - - public HashSet getMentionedUsers() { - NodeList elems = highlighterDIV.getElement().getElementsByTagName("span"); - HashSet toReturn = new HashSet(); - if (elems != null && elems.getLength() > 0) { - int elemsNo = elems.getLength(); - for (int i = 0; i < elemsNo; i++) { - Element el = elems.getItem(i); - String id = el.getId(); - String type = el.getTitle(); - String value = el.getInnerText(); - MentionedDTO toAdd = new MentionedDTO(id, value, type); - toReturn.add(toAdd); - GWT.log(toAdd.toString()); - } - } - return toReturn; - } - /** - * return the unique identifier of this textarea, useful for getElementById JS method - * @return - */ - public String getAreaId() { - return areaId; - } - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java deleted file mode 100644 index 045d75e..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java +++ /dev/null @@ -1,727 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.newsfeed.client.ui; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; - -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.Attachment; -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.newsfeed.client.event.AddLikeEvent; -import org.gcube.portlets.user.newsfeed.client.event.DeletePostEvent; -import org.gcube.portlets.user.newsfeed.client.event.OpenPostEvent; -import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEvent; -import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent; -import org.gcube.portlets.user.newsfeed.client.event.UnLikeEvent; -import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; -import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage; -import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel; - -import com.github.gwtbootstrap.client.ui.Button; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; -import com.google.gwt.event.dom.client.MouseOverEvent; -import com.google.gwt.event.shared.HandlerManager; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window.Location; -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.InlineLabel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -/** - * @author Massimiliano Assante at ISTI-CNR - * @author Costantino Perciante at ISTI-CNR - * - */ -public class TweetTemplate extends Composite { - - private static TweetTemplateUiBinder uiBinder = GWT - .create(TweetTemplateUiBinder.class); - - interface TweetTemplateUiBinder extends UiBinder { - } - - - public static final String loading = GWT.getModuleBaseURL() + "../images/loading-comments.gif"; - - private static final int MAX_SHOWTEXT_LENGTH = 612; - - private EnhancedFeed myPost; - private UserInfo myUserInfo; - - private HandlerManager eventBus; - private ArrayList myComments; - private boolean commentingDisabled = false; - private boolean commentsFetched = false; - private int totalComments = 0; - private HTML showAllComments = new HTML(); - private boolean isAppPost = false; - private HTML submitCommentPreloader = new HTML("
"); - private TweetTemplate myInstance; - - // Carousel from the image-previewer widget - private Carousel carousel; - - /** - * tell if this tweet is belonging to the current user - */ - private boolean isUsers = false; - - @UiField - HTML contentArea; - @UiField - HTML postOwnerArea; - @UiField - HTML seeMore; - @UiField - InlineLabel timeArea; - @UiField - InlineLabel separator; - @UiField - InlineLabel vreSourceInMetadata; - @UiField - HTML likeArea; - @UiField - HTML commentArea; - @UiField - Image avatarImage; - @UiField - AvatarReplacement avatarReplacement; - @UiField - HTMLPanel mainHTML; - @UiField - Button likesNo; - @UiField - Button commentsNo; - @UiField - VerticalPanel commentsPanel; - @UiField - HTML closeImage; - @UiField - HTML openImage; - @UiField - VerticalPanel previewPanel; - @UiField - Placeholder attachmentPreviewPanel; - @UiField - Label messageSeparator; - /** - * used when fetching tweets from server - * @param myUserInfo - * @param myPost - * @param isUsers - * @param displaySingle tells if you're displaying a single fedd or not - * @param eventBus - */ - public TweetTemplate(boolean displaySingle, boolean showTimelineSource, UserInfo myUserInfo, EnhancedFeed myPost, HandlerManager eventBus) { - initWidget(uiBinder.createAndBindUi(this)); - commentsNo.getElement().getStyle().setPaddingTop(0, Unit.PX); - likesNo.getElement().getStyle().setPaddingTop(0, Unit.PX); - likesNo.getElement().getStyle().setPaddingRight(2, Unit.PX); - commentsNo.getElement().getStyle().setPaddingRight(2, Unit.PX); - likesNo.getElement().getStyle().setPaddingLeft(2, Unit.PX); - commentsNo.getElement().getStyle().setPaddingLeft(2, Unit.PX); - - myInstance = this; - this.myUserInfo = myUserInfo; - this.vreSourceInMetadata.setVisible(false); - this.separator.setVisible(false); - this.myPost = myPost; - isAppPost = myPost.getFeed().isApplicationFeed(); - Feed post = myPost.getFeed(); - this.eventBus = eventBus; - this.isUsers = myPost.isUsers(); - this.carousel = new Carousel(); - myComments = new ArrayList(); - - if (isUsers || myUserInfo.isAdmin()) { - closeImage.setStyleName("closeImage"); - closeImage.setTitle(myUserInfo.isAdmin() ? "Delete (Administrator Mode)" : "delete"); - } else { - closeImage.removeFromParent(); - } - - // if there is one attachment or a link preview, maintain backward compatibility - if (post.getUri() != null && post.getUri().compareTo("") != 0 && post.getLinkTitle() != null && post.getLinkTitle().compareTo("") != 0 && !post.isMultiFileUpload()) { - - // hide the attachments panel - attachmentPreviewPanel.setVisible(false); - - LinkPreviewer linkPreviewer = new LinkPreviewer(post.getLinkTitle(), post.getLinkDescription(), post.getLinkHost(), post.getUriThumbnail(), post.getUri()); - - // enable the image previewer if it is an image (mime) - if(post.getLinkHost().contains("image/")){ - - ArrayList listOfEnhancedImages; - - EnhancedImage enhancedImage = new EnhancedImage( - post.getUri(), - post.getLinkTitle() + - " (" + post.getLinkDescription() + ", type:" + post.getLinkHost() +")", - post.getLinkTitle(), - post.getUri() - ); - - listOfEnhancedImages = new ArrayList(); - listOfEnhancedImages.add(enhancedImage); - carousel.updateImages(listOfEnhancedImages); - - // set handler on the linkpreviewer image to show this carousel and on the image title too - linkPreviewer.onImageClickOpenCarousel(carousel); - linkPreviewer.onFileNameClickOpenCarousel(carousel); - - // remove next and prev buttons of the carousel since we have only an image - carousel.hideArrows(); - - } - - // add link preview to the preview panel - previewPanel.add(linkPreviewer); - } - - // in case there are attachments, we have to fill attachmentPreviewPanel instead of the previewPanel - if(post.isMultiFileUpload()){ - - // set style to the attachment container - attachmentPreviewPanel.setStyleName("attachment-preview-container"); - - // hide link preview panel - previewPanel.setVisible(false); - - // prepare the carousel - ArrayList listOfEnhancedImages = new ArrayList(); - - // remember that one attachment is stored in the fields: uri, uriThumbnail, linkTitle, linkDescription, linkHost - Attachment firstAttachment = new Attachment( - post.getKey(), // it is meaningless but it's needed - post.getUri(), - post.getLinkTitle(), - post.getLinkDescription(), - post.getUriThumbnail(), - post.getLinkHost()); - - // create first attachment previewer and pass it the carousel - AttachmentPreviewer firstAttachmentPreviewer = new AttachmentPreviewer(firstAttachment); - - // determine if the left/right arrows must be removed - int imagesAvailableInCarousel = 0; - - // check if it is an image - if(firstAttachment.getMimeType().contains("image/")){ - - EnhancedImage enhancedImage = new EnhancedImage( - post.getUri(), - post.getLinkTitle() + - " (" + post.getLinkDescription() + ", type:" + post.getLinkHost() +")", - post.getLinkTitle(), - post.getUri() - ); - - listOfEnhancedImages.add(enhancedImage); - firstAttachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage); - - // increment the images - imagesAvailableInCarousel ++; - - } - - // add the first attachment to the panel - attachmentPreviewPanel.add(firstAttachmentPreviewer); - - // check the others - for (Attachment otherAttachment : myPost.getAttachments()) { - - AttachmentPreviewer attachmentPreviewer = new AttachmentPreviewer(otherAttachment); - - if(otherAttachment.getMimeType().contains("image/")){ - - EnhancedImage enhancedImage = new EnhancedImage( - otherAttachment.getUri(), - otherAttachment.getName() + - " (" + otherAttachment.getDescription() + ", type:" + post.getLinkHost() +")", - otherAttachment.getName(), - otherAttachment.getUri() - ); - - listOfEnhancedImages.add(enhancedImage); - - // pass the carousel - attachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage); - - // increment the images - imagesAvailableInCarousel ++; - - } - - // try to build the attachment viewer - attachmentPreviewPanel.add(attachmentPreviewer); - - // hide arrows if there is no more than 1 image - if(imagesAvailableInCarousel <= 1) - carousel.hideArrows(); - - } - - // update the carousel's images - carousel.updateImages(listOfEnhancedImages); - - // invoke append label - attachmentPreviewPanel.appendShowMoreLabel(); - } - - openImage.setStyleName("openImage"); - openImage.setTitle("Open this feed separately"); - //show if the user has already liked this or not - setFavoritedUI(myPost.isLiked()); - - commentArea.setHTML("" + NewsFeedPanel.COMMENT_LABEL + ""); - - String postText = post.getDescription(); - String descWithoutHTML = new HTML(postText).getText(); - - if ( (! postText.startsWith(" MAX_SHOWTEXT_LENGTH && !displaySingle) { - final int TEXT_TO_SHOW_LENGHT = (descWithoutHTML.length() < 600) ? (postText.length() - (postText.length() / 3)) : 600; - postText = postText.substring(0, TEXT_TO_SHOW_LENGHT) + "..."; - seeMore.setHTML(" See More "); - } - - avatarImage.setUrl(post.getThumbnailURL()); - avatarImage.setPixelSize(40, 40); - - //replace the < & and > - postText = postText.replaceAll("<","<").replaceAll(">",">"); - postText = postText.replaceAll("&","&"); - - final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + NewsFeedPanel.extractOrgFriendlyURL(Location.getHref()) +GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; - - - - if (showTimelineSource && post.getVreid() != null && post.getVreid().compareTo("") != 0) { - this.vreSourceInMetadata.setVisible(true); - this.separator.setVisible(true); - String vreName = post.getVreid().substring(post.getVreid().lastIndexOf("/")+1); - vreSourceInMetadata.setText(vreName); - vreSourceInMetadata.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - Location.assign("/group/"+vreName.toLowerCase()); - } - }); - } - - if (! isAppPost) { - // sharePostArea.setHTML("" + NewsFeedPanel.SHARE_FWD_LABEL + ""); - postOwnerArea.setHTML(""+post.getFullName()+""); - contentArea.setHTML(postText); - - //check if the user has his own avatar - if (post.getThumbnailURL().contains("img_id=0") || !post.getThumbnailURL().contains("?")) { //it means no avatar is set - avatarImage.setVisible(false); - String f = "A"; - String s = "Z"; - if (post.getFullName() != null) { - String[] parts = post.getFullName().split("\\s"); - if (parts.length > 0) { - f = parts[0].toUpperCase(); - s = parts[parts.length-1].toUpperCase(); - } else { - f = post.getFullName().substring(0,1); - s = post.getFullName().substring(1,2); - } - } - avatarReplacement.setInitials(post.getEntityId(), f, s); - avatarReplacement.setVisible(true); - } - } - else { - // messageSeparator.setVisible(false); - postOwnerArea.setHTML(""+post.getFullName()+""); - contentArea.setHTML(postText); - - if (isAppPost) { - if (myUserInfo.isAdmin()) - closeImage.setTitle("Delete this Application feed (Administrator Only)"); - else - closeImage.removeFromParent(); - } - } - - - try { - Date now = new Date(); - String formattedTime; - // TODO java.util.Calendar is not yet available in GWT - if(now.getYear() != post.getTime().getYear()) - formattedTime = DateTimeFormat.getFormat("MMMM dd yyyy, h:mm a").format(post.getTime()); - else - formattedTime = DateTimeFormat.getFormat("MMMM dd, h:mm a").format(post.getTime()); - - timeArea.setText(formattedTime); - String formattedTimeWithYear = DateTimeFormat.getFormat("dd MMMM yyyy h:mm a ").format(post.getTime()); - timeArea.setTitle(formattedTimeWithYear); - if (! post.getCommentsNo().equals("0")) { - commentsNo.setVisible(true); - commentsNo.setText(post.getCommentsNo()); - commentsNo.setTitle(post.getCommentsNo() + " people commented this."); - } - if (! post.getLikesNo().equals("0")) { - likesNo.setVisible(true); - likesNo.setText(post.getLikesNo()); - likesNo.setTitle("Show People who have " + NewsFeedPanel.LIKED_LABEL + " this."); - } - totalComments = Integer.parseInt(post.getCommentsNo()); - } - catch (NumberFormatException e) { - totalComments = 0; - } - catch (Exception e) { - timeArea.setText("just now"); - } - commentsPanel.setStyleName("commentsPanel"); - if (myPost.getComments() != null && myPost.getComments().size() > 0) { - if (totalComments > 2 && !displaySingle) { - showAllComments = getShowAllCommentsLink(totalComments); - commentsPanel.add(showAllComments); - commentsNo.setVisible(true); - } - for (Comment comment : myPost.getComments()) { - addComment(new SingleComment(comment, this, (comment.getUserid().equals(myUserInfo.getUsername())))); - } - showAddCommentForm(false); - } - } - - /** - * used when getting tweets from the client - * @param myUserInfo - * @param feed - * @param eventBus - * @param hidden - */ - public TweetTemplate(UserInfo myUserInfo, EnhancedFeed feed, HandlerManager eventBus, boolean hidden) { - this(false, false, myUserInfo, feed, eventBus); - contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content hidden"); - } - - @UiHandler("contentArea") - public void onHover(MouseOutEvent event) { - if (isUsers) - closeImage.removeStyleName("uiCloseButton"); - openImage.removeStyleName("uiOpenButton"); - } - - @UiHandler("contentArea") - public void onHover(MouseOverEvent event) { - if (isUsers) { - closeImage.addStyleName("uiCloseButton"); - GWT.log("this belong to user"); - } - openImage.addStyleName("uiOpenButton"); - } - - @UiHandler("closeImage") - void onDeleteFeedClick(ClickEvent e) { - if (isUsers || myUserInfo.isAdmin()){ - eventBus.fireEvent(new DeletePostEvent(this)); - } - else { - GWT.log("not belong to user"); - } - } - - @UiHandler("openImage") - void onOpenFeedClick(ClickEvent e) { - eventBus.fireEvent(new OpenPostEvent(this)); - } - - - - - @UiHandler("seeMore") - void onSeeMoreClick(ClickEvent e) { - String postText = myPost.getFeed().getDescription(); - //replace the < & and > - postText = postText.replaceAll("<","<").replaceAll(">",">"); - postText = postText.replaceAll("&","&"); - - contentArea.setHTML(postText); - seeMore.setHTML(""); - } - - private void setFavoritedUI(boolean favorited) { - if (favorited) { - likeArea.setHTML("" + NewsFeedPanel.LIKED_LABEL + ""); - likeArea.setTitle("Unlike this"); - } - else { - likeArea.setHTML("" + NewsFeedPanel.LIKE_LABEL + ""); - } - } - - - - @UiHandler("likeArea") - void onLikeClick(ClickEvent e) { - //if is not liked - if (!likeArea.getText().equals(NewsFeedPanel.LIKED_LABEL)) { - try { - int cur = Integer.parseInt(myPost.getFeed().getLikesNo()); - cur++; - if (cur == 1) { - myPost.getFeed().setLikesNo("1"); - likesNo.setText("1"); - likesNo.setTitle("People who have " + NewsFeedPanel.LIKED_LABEL + " this"); - likesNo.setVisible(true); - } else { - myPost.getFeed().setLikesNo(""+cur); - likesNo.setText(""+cur); - likesNo.setVisible(true); - } - eventBus.fireEvent(new AddLikeEvent(this, myPost.getFeed().getKey())); - setFavoritedUI(true); - } - catch (NumberFormatException ex) { - likeArea.setHTML("Error on the server"); - } - } else { - //it is liked - int cur = Integer.parseInt(myPost.getFeed().getLikesNo()); - cur--; - if (cur == 0) { - myPost.getFeed().setLikesNo("0"); - likesNo.setText(""); - likesNo.setVisible(false); - likesNo.setTitle(""); - } else { - myPost.getFeed().setLikesNo(""+cur); - likesNo.setText(""+cur); - likesNo.setVisible(true); - } - eventBus.fireEvent(new UnLikeEvent(this, myPost.getFeed().getKey())); - setFavoritedUI(false); - } - } - - @UiHandler("commentArea") - void onAddCommentClick(ClickEvent e) { - if (! commentingDisabled) { - if (! commentsFetched && totalComments > 2) { //if so, need to load all comments before adding a comment - fireSeeComments(true); - } - else { - showAddCommentForm(true); - } - } - else - GWT.log("Commenting disabled"); - } - - public void showAddCommentForm(boolean focus) { - final AddCommentTemplate toAdd = new AddCommentTemplate(this, myUserInfo, eventBus); - commentsPanel.add(toAdd); - commentingDisabled = true; - final Timer t = new Timer() { - @Override - public void run() { - toAdd.setStyleName("comment-show"); - } - }; - if (focus) - toAdd.setFocus(); - t.schedule(10); - } - - private HTML getShowAllCommentsLink(int commentsNo) { - final HTML toReturn = new HTML(""); - toReturn.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - fireSeeComments(false); - } - }); - return toReturn; - } - - private void fireSeeComments(boolean commentForm2Add) { - eventBus.fireEvent(new SeeCommentsEvent(this, commentForm2Add)); - } - - @UiHandler("likesNo") - void onSeeLikes(ClickEvent e) { - eventBus.fireEvent(new SeeLikesEvent(myPost.getFeed().getKey())); - } - - @UiHandler("commentsNo") - void onSeeComments(ClickEvent e) { - fireSeeComments(false); - } - - public void setcontentAreaStyle(String cssclass) { - contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content visible"); - } - - public boolean isCommenting() { - return commentingDisabled; - } - - public void setCommentingDisabled(boolean commenting) { - this.commentingDisabled = commenting; - } - public String getFeedKey() { - return myPost.getFeed().getKey(); - } - - public void remove(Widget w) { - mainHTML.remove(w); - } - - public void addComment(SingleComment comment) { - commentsPanel.add(comment); - myComments.add(comment); - - } - /** - * - * @param show true to show a preloader, false to hide it. - * display a preloader userful when the user is wating for the comment operation to be confirmed by the server - */ - public void showCommentingPreloader(boolean show) { - if (show) - commentsPanel.add(submitCommentPreloader); - else - commentsPanel.remove(submitCommentPreloader); - - } - - public void updateSingleComment(Comment edited, HTMLPanel commentPanel){ - - commentPanel.clear(); - SingleComment sc = new SingleComment(edited, this, true); - commentPanel.add(sc); - - // replace the new SingleComment in the list - int index = 0; - Iterator iterator = this.myComments.iterator(); - - for (;iterator.hasNext();) { - SingleComment singleComment = (SingleComment) iterator.next(); - - if(singleComment.getCommentKey().equals(edited.getKey())){ - - iterator.remove(); - this.myComments.add(index, sc); - break; - - } - index ++; - } - - } - - public void clearComments() { - myComments.clear(); - commentsPanel.clear(); - } - - public void showLoadingComments() { - showAllComments.setHTML("
"); - } - - public boolean isCommentsFetched() { - return commentsFetched; - } - - public void setCommentsFetched(boolean commentsFetched) { - this.commentsFetched = commentsFetched; - } - public HandlerManager getEventBus() { - return eventBus; - } - public void updateCommentsNumberCount() { - if (myComments.size() == 1) { - //commentsNo.setStyleName("show-comments-number"); - commentsNo.setTitle("Persons who have commented this."); - } - //commentsNo.setHTML(commentIcon.getElement().toString()+" "+myComments.size()); - commentsNo.setText(""+myComments.size()); - } - public UserInfo getMyUserInfo() { - return myUserInfo; - } - - public String getMyFeedUserId() { - return myPost.getFeed().getEntityId(); - } - - public String getMyFeedText() { - return myPost.getFeed().getDescription(); - } - - public boolean isAppFeed() { - return isAppPost; - } - - public boolean isUser() { - return isUsers; - } - - /** - * Returns the number of comments this post has - * @return - */ - public int numberOfComments(){ - return myComments.size(); - } - /** - * Returns the context of the Post - * @return the context (scope) of the Post - */ - public String getVREContext() { - return this.myPost.getFeed().getVreid(); - } - - /** - * Returns the number of likes this post has - * @return - */ - public int numberOfLikes(){ - - // not so easy - int ret = 0; - - try{ - - ret = Integer.parseInt(likesNo.getText()); - - }catch(NumberFormatException e){ - - GWT.log(e.toString()); - } - - return ret; - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml deleted file mode 100644 index e572d2c..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.ui.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - -
-
- - - - - - - -
- - - -
- - - · - -
-
-
- - -
-
-
-
-
- - -
- - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
-
-
-
-
- -
-
-
-
\ No newline at end of file diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/CustomConfiguration.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/CustomConfiguration.java deleted file mode 100644 index f124c7e..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/CustomConfiguration.java +++ /dev/null @@ -1,51 +0,0 @@ -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 + "]"; - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java deleted file mode 100644 index f334882..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java +++ /dev/null @@ -1,1231 +0,0 @@ -package org.gcube.portlets.user.newsfeed.server; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.Set; -import java.util.UUID; - -import javax.servlet.ServletContext; - -import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; -import org.gcube.applicationsupportlayer.social.NotificationsManager; -import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite; -import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; -import org.gcube.common.portal.GCubePortalConstants; -import org.gcube.common.portal.PortalContext; -import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl; -import org.gcube.portal.databook.server.DatabookStore; -import org.gcube.portal.databook.shared.Attachment; -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.Like; -import org.gcube.portal.databook.shared.RangeFeeds; -import org.gcube.portal.databook.shared.ShowUserStatisticAction; -import org.gcube.portal.databook.shared.UserInfo; -import org.gcube.portal.databook.shared.ex.ColumnNameNotFoundException; -import org.gcube.portal.databook.shared.ex.CommentIDNotFoundException; -import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException; -import org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException; -import org.gcube.portal.databook.shared.ex.LikeIDNotFoundException; -import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException; -import org.gcube.portal.notifications.bean.GenericItemBean; -import org.gcube.portal.notifications.thread.CommentNotificationsThread; -import org.gcube.portal.notifications.thread.LikeNotificationsThread; -import org.gcube.portal.notifications.thread.MentionNotificationsThread; -import org.gcube.portlets.user.newsfeed.client.NewsService; -import org.gcube.portlets.user.newsfeed.shared.MentionedDTO; -import org.gcube.portlets.user.newsfeed.shared.MorePostsBean; -import org.gcube.portlets.user.newsfeed.shared.NewsConstants; -import org.gcube.portlets.user.newsfeed.shared.OperationResult; -import org.gcube.portlets.user.newsfeed.shared.UserSettings; -import org.gcube.portlets.widgets.pickitem.shared.ItemBean; -import org.gcube.social_networking.socialutillibrary.Utils; -import org.gcube.socialnetworking.social_data_search_client.ElasticSearchClient; -import org.gcube.socialnetworking.social_data_search_client.ElasticSearchClientImpl; -import org.gcube.socialnetworking.socialtoken.SocialMessageParser; -import org.gcube.vomanagement.usermanagement.GroupManager; -import org.gcube.vomanagement.usermanagement.RoleManager; -import org.gcube.vomanagement.usermanagement.UserManager; -import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; -import org.gcube.vomanagement.usermanagement.exception.TeamRetrievalFault; -import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException; -import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault; -import org.gcube.vomanagement.usermanagement.exception.VirtualGroupNotExistingException; -import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.gcube.vomanagement.usermanagement.model.GCubeGroup; -import org.gcube.vomanagement.usermanagement.model.GCubeTeam; -import org.gcube.vomanagement.usermanagement.model.GCubeUser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gwt.user.server.rpc.RemoteServiceServlet; -import com.liferay.portal.kernel.exception.PortalException; -import com.liferay.portal.kernel.exception.SystemException; -import com.liferay.portal.service.UserLocalServiceUtil; - -/** - * The server side implementation of the RPC service. - */ -@SuppressWarnings("serial") -public class NewsServiceImpl extends RemoteServiceServlet implements NewsService { - - private static final Logger _log = LoggerFactory.getLogger(NewsServiceImpl.class); - - 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"; - public static final String NF_ORGANIZATIONUSERS_CACHE = "NF_ORGANIZATIONUSERS_CACHE"; - public static final String LAST_RETRIEVED_TIME = "NF_LAST_RETRIEVED_TIME"; - - private String APP_ID; - - /** - * Cassandra client - */ - private DatabookStore store; - - /** - * Elasticsearch client - */ - private ElasticSearchClient escl; - - private final static int MAX_POSTS_NO = 30; - - public void init() { - store = new DBCassandraAstyanaxImpl(); - try { - escl = new ElasticSearchClientImpl(null); - _log.info("Elasticsearch connection created"); - } catch (Exception e) { - escl = null; - _log.error("Unable to create elasticsearch client connection!!!", e); - } - - APP_ID = this.getClass().getName(); - } - - public void destroy() { - store.closeConnection(); - } - /** - * - * @return true if you're running into the portal, false if in development - */ - private boolean isWithinPortal() { - try { - UserLocalServiceUtil.getService(); - return true; - } - catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) { - _log.trace("Development Mode ON"); - return false; - } - } - /** - * this is the first method called by the web app - */ - @Override - public UserSettings getUserSettings() { - try { - PortalContext context = PortalContext.getConfiguration(); - GCubeUser currUser = context.getCurrentUser(getThreadLocalRequest()); - String username = currUser.getUsername(); - String email = currUser.getEmail(); - String fullName = currUser.getFullname(); - String thumbnailURL = currUser.getUserAvatarURL(); - - String groupName = context.getCurrentGroupName(getThreadLocalRequest()); - - - final String profilePageURL = - GCubePortalConstants.PREFIX_GROUP_URL + - PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest())+ - GCubePortalConstants.USER_PROFILE_FRIENDLY_URL; - String accountURL = profilePageURL; - - UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, email, accountURL, true, isAdmin(), null); - CustomConfiguration config = getUserConfiguration(); - UserSettings toReturn = new UserSettings(userInfo, config.getRefreshTime(), groupName, config.getVreLabel(), isInfrastructureScope(), config.isShowTimelineSource()); - return toReturn; - - - } catch (Exception e) { - e.printStackTrace(); - } - return new UserSettings(); - } - - /** - * Indicates whether the scope is the whole infrastructure. - * @return true if it is, false otherwise. - * @throws GroupRetrievalFault - * @throws UserManagementSystemException - */ - private boolean isInfrastructureScope() throws UserManagementSystemException, GroupRetrievalFault { - PortalContext context = PortalContext.getConfiguration(); - String scope = context.getCurrentScope(getThreadLocalRequest()); - - long groupId = context.getCurrentGroupId(getThreadLocalRequest()); - boolean isInfrastructureScope = new LiferayGroupManager().isRootVO(groupId); - _log.debug("isInfrastructureScope? " + scope + " groupId=" + groupId + " ? i say " + isInfrastructureScope); - return isInfrastructureScope; - } - - @Override - public ArrayList getAllUpdateUserFeeds(int postsNoPerCategory) { - - ArrayList toMerge = new ArrayList(); - HashMap feedsMap = new HashMap(); - try { - GCubeUser currUser = PortalContext.getConfiguration().getCurrentUser(getThreadLocalRequest()); - _log.info("****** retrieving posts for user: " + currUser.getUsername()); - /** - * this handles the case where the portlet is deployed outside of VREs (regular) - */ - if (isInfrastructureScope()) { - _log.debug("****** risInfrastructureScope() = true"); - //VRE Feeds - GroupManager gm = new LiferayGroupManager(); - for (GCubeGroup group : gm.listGroupsByUserAndSite(currUser.getUserId(), getThreadLocalRequest().getServerName())) { - if (gm.isVRE(group.getGroupId())) { - String vreid = gm.getInfrastructureScope(group.getGroupId()); //get the scope - _log.debug("Reading posts for VRE: " + vreid); - ArrayList OrganizationFeeds = (ArrayList) store.getRecentFeedsByVRE(vreid, postsNoPerCategory); - for (Feed post : OrganizationFeeds) { - feedsMap.put(post.getKey(), post); - } - } - } - - //Portal Feeds - ArrayList portalFeeds = (ArrayList) store.getAllPortalPrivacyLevelFeeds(); - for (Feed post : portalFeeds) { - feedsMap.put(post.getKey(), post); - } - } - //else must be in a VRE scope - else { - PortalContext context = PortalContext.getConfiguration(); - String vreid = context.getCurrentScope(getThreadLocalRequest()); - _log.trace("News Feed in VRE, Reading posts for VRE: " + vreid); - ArrayList OrganizationFeeds = (ArrayList) store.getRecentFeedsByVRE(vreid, (NewsConstants.FEEDS_MAX_PER_CATEGORY)); - for (Feed post : OrganizationFeeds) { - feedsMap.put(post.getKey(), post); - } - } - - for (String key: feedsMap.keySet()) { - toMerge.add(feedsMap.get(key)); - } - - //sort the posts in reverse chronological order - Collections.sort(toMerge, Collections.reverseOrder()); - - ArrayList toReturn = new ArrayList(); - //return only posts - if (toMerge.size() > MAX_POSTS_NO) - for (int i = 0; i < MAX_POSTS_NO; i++) - toReturn.add(toMerge.get(i)); - else { - return enhanceFeeds(toMerge, 2); - } - return enhanceFeeds(toReturn, 2); - } catch (PrivacyLevelTypeNotFoundException e) { - _log.error("Privacy Level not Found " + e.getMessage()); - e.printStackTrace(); - } catch (FeedTypeNotFoundException e) { - _log.error("Feed Type not Found " + e.getMessage()); - e.printStackTrace(); - } catch (ColumnNameNotFoundException e) { - _log.error("Column name not Found " + e.getMessage()); - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * return the posts having the hashtag passed as param the user has access on - * @param hashtag the hashtag to look for including '#' - */ - @Override - public ArrayList getPostsByHashtag(String hashtag) { - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - String currentScope = pContext.getCurrentScope(getThreadLocalRequest()); - - //in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info) - //this check just return nothing if that happens - if (userName.compareTo(NewsConstants.TEST_USER) == 0) { - _log.debug("Found " + userName + " returning nothing"); - return null; - } - - try { - - ArrayList toMerge = new ArrayList(); - HashMap feedsMap = new HashMap(); - String lowerCaseHashtag = hashtag.toLowerCase(); - - // the contexts of the user - List contexts = new ArrayList(); - - //this handles the case where the portlet is deployed outside of VREs (regular) - if (isInfrastructureScope()) { - - GroupManager gm = new LiferayGroupManager(); - UserManager um = new LiferayUserManager(); - GCubeUser user = um.getUserByUsername(userName); - Set vresInPortal = gm.listGroupsByUserAndSite(user.getUserId(), getThreadLocalRequest().getServerName()); - _log.debug("Contexts in this site are per user " + vresInPortal); - - // get the scopes associated with such groups - for (GCubeGroup gCubeGroup : vresInPortal) { - contexts.add(gm.getInfrastructureScope(gCubeGroup.getGroupId())); - } - } - else { - - contexts.add(currentScope); - - } - - _log.debug("Contexts for hashtags is " + contexts); - - for (String context : contexts) { - ArrayList posts = (ArrayList) store.getVREFeedsByHashtag(context, lowerCaseHashtag); - for (Feed post : posts) { - feedsMap.put(post.getKey(), post); - } - } - - for (String key: feedsMap.keySet()) { - toMerge.add(feedsMap.get(key)); - } - - //sort the posts in reverse chronological order - Collections.sort(toMerge, Collections.reverseOrder()); - - ArrayList toReturn = new ArrayList(); - //return only posts - if (toMerge.size() > MAX_POSTS_NO) - for (int i = 0; i < MAX_POSTS_NO; i++) - toReturn.add(toMerge.get(i)); - else { - return enhanceFeeds(toMerge, 2); - } - return enhanceFeeds(toReturn, 2); - } catch (PrivacyLevelTypeNotFoundException e) { - _log.error("Privacy Level not Found ", e); - } catch (FeedTypeNotFoundException e) { - _log.error("Feed Type not Found ", e); - } catch (ColumnNameNotFoundException e) { - _log.error("Column name not Found ", e); - } catch (Exception e) { - _log.error("Error while retrieving posts for hashtag ", e); - } - return null; - } - - @Override - public ArrayList getPostsByQuery(String query, int from, int quantity) { - - // TODO : check this error better - if(escl == null){ - _log.warn("There is no connection to elasticsearch, sorry."); - return null; - } - - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - String currentScope = pContext.getCurrentScope(getThreadLocalRequest()); - - try { - - //in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info) - //this check just return nothing if that happens - if (userName.compareTo(NewsConstants.TEST_USER) == 0) { - _log.debug("Found " + userName + " returning nothing"); - return null; - } - - // Retrieve user's vres in which we must search - Set vres = new HashSet(); - - if (isInfrastructureScope()) { - UserManager um = new LiferayUserManager(); - GCubeUser currUser = um.getUserByUsername(userName); - //VRE Feeds - GroupManager gm = new LiferayGroupManager(); - for (GCubeGroup group : gm.listGroupsByUser(currUser.getUserId())) { - if (gm.isVRE(group.getGroupId())) { - String vreid = gm.getInfrastructureScope(group.getGroupId()); //get the scope - vres.add(vreid); - } - } - } - //else must be in a VRE scope - else { - vres.add(currentScope); - } - - // query elastic search - List enhancedFeeds = escl.search(query, vres, from, quantity); - - // retrieve the ids of liked posts by the user - List likedPosts = store.getAllLikedFeedIdsByUser(userName); - - // update fields "liked" and "isuser" - for (EnhancedFeed enhancedFeed : enhancedFeeds) { - - if(isUsers(enhancedFeed.getFeed(), userName)) - enhancedFeed.setUsers(true); - - if(likedPosts.contains(enhancedFeed.getFeed().getKey())) - enhancedFeed.setLiked(true); - - } - - return (ArrayList) enhancedFeeds; - - }catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - /** - * return only the user connection posts - */ - @Override - public ArrayList getOnlyConnectionsUserPosts() { - ArrayList toMerge = new ArrayList(); - HashMap feedsMap = new HashMap(); - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - - try { - //UserFriends Feeds - ArrayList userFriendsIds = (ArrayList)store.getFriends(userName); - for (String userid : userFriendsIds) { - for (Feed post : store.getRecentFeedsByUser(userid, NewsConstants.FEEDS_NO_PER_CATEGORY)) { - feedsMap.put(post.getKey(), post); - } - } - for (String key: feedsMap.keySet()) { - toMerge.add(feedsMap.get(key)); - } - Collections.sort(toMerge, Collections.reverseOrder()); - ArrayList toReturn = new ArrayList(); - //return only posts - if (toMerge.size() > MAX_POSTS_NO) - for (int i = 0; i < MAX_POSTS_NO; i++) - toReturn.add(toMerge.get(i)); - else - return enhanceFeeds(toMerge, 2); - - } catch (PrivacyLevelTypeNotFoundException e) { - _log.error("Privacy Level not Found " + e.getMessage()); - e.printStackTrace(); - } catch (FeedTypeNotFoundException e) { - _log.error("Feed Type not Found " + e.getMessage()); - e.printStackTrace(); - } catch (ColumnNameNotFoundException e) { - _log.error("Column name not Found " + e.getMessage()); - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * return only one post with all the comments - */ - @Override - public EnhancedFeed getSinglePost(String postKey) { - Feed post = null; - try { - if (postKey != null) { - post = store.readFeed(postKey); - if (post != null) { - ArrayList toEnhance = new ArrayList(); - toEnhance.add(post); - return enhanceFeeds(toEnhance, -1).get(0); //-1 all the comments - } - } - } catch (Exception e) { - _log.debug("Error while trying to fetch post with key " + postKey + " returning nothing"); - return new EnhancedFeed(); - } - return new EnhancedFeed(); - } - /** - * MorePostsBean contains the timeline index of the last returned valid post (because if you delete a feed is stays on in the timeline and is marked deleted) - * and contains the Feeds - * @param strat the range start (most recent posts for this vre) has to be greater than 0 - * @param quantity the number of most recent posts for this vre starting from "start" param - */ - @Override - public MorePostsBean getMorePosts(int start, int quantity) { - ArrayList toMerge = new ArrayList(); - HashMap feedsMap = new HashMap(); - PortalContext pContext = PortalContext.getConfiguration(); - String vreid = pContext.getCurrentScope(getThreadLocalRequest()); - _log.debug("\n\nAsking more post for Timeline " + vreid + " from " + start + " get other " + quantity); - ArrayList organizationFeeds; - RangeFeeds rangeFeeds = null; - try { - rangeFeeds = store.getRecentFeedsByVREAndRange(vreid, start, quantity); - organizationFeeds = rangeFeeds.getFeeds(); - if (organizationFeeds != null) { - for (Feed post : organizationFeeds) { - feedsMap.put(post.getKey(), post); - } - } - } - catch (Exception e) { - e.printStackTrace(); - return null; - } - - for (String key: feedsMap.keySet()) { - toMerge.add(feedsMap.get(key)); - } - //sort the posts in reverse chronological order - Collections.sort(toMerge, Collections.reverseOrder()); - ArrayList toReturn = enhanceFeeds(toMerge, 2); - return new MorePostsBean(rangeFeeds.getLastReturnedFeedTimelineIndex(), toReturn); - } - - @Override - public ArrayList getOnlyMyUserPosts() { - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - _log.trace("getOnly UserFeeds for " + userName); - ArrayList userFeeds = null; - try { - userFeeds = (ArrayList) store.getRecentFeedsByUser(userName, 15); - } catch (Exception e) { - e.printStackTrace(); - } - Collections.sort(userFeeds, Collections.reverseOrder()); - return enhanceFeeds(userFeeds, 2); - } - - @Override - public ArrayList getOnlyLikedPosts() { - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - _log.trace("getLiked Feeds for " + userName); - ArrayList userFeeds = null; - try { - userFeeds = (ArrayList) store.getAllLikedFeedsByUser(userName, 25); - } catch (Exception e) { - e.printStackTrace(); - } - Collections.sort(userFeeds, Collections.reverseOrder()); - return enhanceFeeds(userFeeds, 2); - } - - @Override - public boolean like(String postid, String postText, String postOwnerId) { - boolean likeCommitResult = false; - UserInfo user = getUserSettings().getUserInfo(); - String username = user.getUsername(); - if (username.compareTo(NewsConstants.TEST_USER) == 0) { - return false; - } - - Like toLike = new Like(UUID.randomUUID().toString(), user.getUsername(), - new Date(), postid, user.getFullName(), user.getAvatarId()); - try { - likeCommitResult = store.like(toLike); - } catch (FeedIDNotFoundException e) { - _log.error("Feed not Found for this like " + e.getMessage()); - e.printStackTrace(); - return false; - } - //if the like was correctly delivered notify users involved - if (likeCommitResult) { - PortalContext pContext = PortalContext.getConfiguration(); - String currScope = pContext.getCurrentScope(getThreadLocalRequest()); - //if the user who liked this post is not the user who posted it notify the poster user (Feed owner) - if (! user.getUsername().equals(postOwnerId)) { - NotificationsManager nm = new ApplicationNotificationsManager( - new SocialNetworkingSite(getThreadLocalRequest()), - currScope, - new SocialNetworkingUser(username, user.getEmailaddress(), user.getFullName(), user.getAvatarId()), - APP_ID); - - ArrayList mentionedUsers = new ArrayList<>(); - SocialMessageParser messageParser = new SocialMessageParser(postText); - String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest()); - String escapedPostText = messageParser.getParsedMessage(mentionedUsers, siteLandingPagePath); - boolean nResult = nm.notifyLikedPost(postOwnerId, postid, escapedPostText); - _log.trace("Like Notification added? " + nResult); - } - } - return likeCommitResult; - } - - @Override - public boolean unlike(String postid, String postText, String postOwnerId) { - UserInfo user = getUserSettings().getUserInfo(); - try { - for (Like like : store.getAllLikesByFeed(postid)) { - if (like.getUserid().compareTo(user.getUsername()) == 0) { - _log.trace("Trying unlike of " + postText + " for " + user.getFullName()); - store.unlike(user.getUsername(), like.getKey(), postid); - return true; - } - } - } catch (FeedIDNotFoundException | PrivacyLevelTypeNotFoundException | FeedTypeNotFoundException | ColumnNameNotFoundException | LikeIDNotFoundException e) { - _log.error("Either Feed or Like not Found " + e.getMessage()); - e.printStackTrace(); - return false; - } - return false; - } - /** - * @param feedid the id of the commented post - * @param commentText the comment text - * @param feedOwnerId the username of the user who created the post that was commented - */ - @Override - public OperationResult comment(String feedid, String commentText, HashSet mentionedItemsSet, String feedOwnerId, boolean isAppFeed) { - boolean commentCommitResult = false; - _log.trace("Trying to add this comment " + commentText); - UserInfo user = getUserSettings().getUserInfo(); - - if (user.getUsername().compareTo(NewsConstants.TEST_USER) == 0) { - return new OperationResult(false, "Session Expired", null); - } - - ArrayList mentionedUsers = new ArrayList<>(); - if (mentionedItemsSet != null && mentionedItemsSet.size() > 0) { - //copy the set into a list - ArrayList mentionedItems = new ArrayList(); - mentionedItems.addAll(mentionedItemsSet); - if (mentionedItemsSet != null && ! mentionedItemsSet.isEmpty()) { - mentionedUsers = getMentionsBean(mentionedItems); - } - } - - SocialMessageParser messageParser = new SocialMessageParser(commentText); - String siteLandingPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest()); - String escapedCommentText = messageParser.getParsedMessage(mentionedUsers, siteLandingPagePath); - List hashtags = messageParser.getHashtags(); - - Comment comment = new Comment(UUID.randomUUID().toString(), user.getUsername(), - new Date(), feedid, escapedCommentText, user.getFullName(), user.getAvatarId()); - try { - if (store.addComment(comment)) - commentCommitResult = true; - } catch (FeedIDNotFoundException e) { - _log.error("Related post not found for this comment " + e.getMessage()); - e.printStackTrace(); - return new OperationResult(false, "Related post not found for this comment", comment); - } - - try { - if (hashtags != null && !hashtags.isEmpty()) - store.saveHashTagsComment(comment.getKey(), store.readFeed(comment.getFeedid()).getVreid(), hashtags); - } catch (CommentIDNotFoundException - | PrivacyLevelTypeNotFoundException - | FeedTypeNotFoundException | FeedIDNotFoundException - | ColumnNameNotFoundException e1) { - _log.error("Unable to save hashtags for this comment " + e1.getMessage()); - } - - //if the comment was correctly delivered && is not an app feed notify users involved - if (commentCommitResult && isWithinPortal()) { - PortalContext pContext = PortalContext.getConfiguration(); - String currScope = pContext.getCurrentScope(getThreadLocalRequest()); - //if the user who commented this post is not the user who posted it notify the poster user (Feed owner) - NotificationsManager nm = new ApplicationNotificationsManager( - new SocialNetworkingSite(getThreadLocalRequest()), - currScope, - new SocialNetworkingUser(user.getUsername(), user.getEmailaddress(), user.getFullName(), user.getAvatarId()), - APP_ID); - if (! user.getUsername().equals(feedOwnerId) && (!isAppFeed)) { - boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapedCommentText, comment.getKey()); - _log.trace("Comment Notification to post owner added? " + result); - } - - //if there are users who liked this post they get notified, asynchronously with this thread - ArrayList favorites = getAllLikesByPost(feedid); - Thread likesThread = new Thread(new LikeNotificationsThread(escapedCommentText, nm, favorites, feedOwnerId, comment.getKey())); - likesThread.start(); - - //notify the other users who commented this post (excluding the ones above) - Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, new LiferayUserManager(), user.getUsername(), comment.getFeedid(), escapedCommentText, nm, feedOwnerId, comment.getKey(), favorites)); - commentsNotificationthread.start(); - - //send the notification to the mentioned users, if any - if (mentionedUsers != null && mentionedUsers.size() > 0) { - ArrayList toPass = new ArrayList(); - - - // among the mentionedUsers there could be groups of people - Map uniqueUsersToNotify = new HashMap<>(); - UserManager um = new LiferayUserManager(); - - for (ItemBean bean : mentionedUsers) { - - if(bean.isItemGroup()){ - - // retrieve the users of this group - try { - List teamUsers = um.listUsersByTeam(Long.parseLong(bean.getId())); - - for (GCubeUser userTeam : teamUsers) { - if(!uniqueUsersToNotify.containsKey(userTeam.getUsername())) - uniqueUsersToNotify.put(userTeam.getUsername(), new ItemBean(userTeam.getUserId()+"", - userTeam.getUsername(), userTeam.getFullname(), userTeam.getUserAvatarURL())); - } - - } catch (NumberFormatException - | UserManagementSystemException - | TeamRetrievalFault | UserRetrievalFault e) { - _log.error("Unable to retrieve team information", e); - } - - }else{ - // it is a user, just add to the hashmap - if(!uniqueUsersToNotify.containsKey(bean.getName())) - uniqueUsersToNotify.put(bean.getName(), bean); - - } - } - - // iterate over the hashmap - Iterator> userMapIterator = uniqueUsersToNotify.entrySet().iterator(); - while (userMapIterator.hasNext()) { - Map.Entry userEntry = (Map.Entry) userMapIterator - .next(); - ItemBean userBean = userEntry.getValue(); - toPass.add(new GenericItemBean(userBean.getId(), userBean.getName(), userBean.getAlternativeName(), userBean.getThumbnailURL())); - } - - Thread thread = new Thread(new MentionNotificationsThread(comment.getFeedid(), escapedCommentText, nm, null, toPass)); - thread.start(); - } - } - return new OperationResult(true, "OK", comment); - } - - @Override - public OperationResult editComment(Comment toEdit) { - Comment edited = null; - try { - UserInfo user = getUserSettings().getUserInfo(); - if (user.getUsername().compareTo(NewsConstants.TEST_USER) == 0) { - return new OperationResult(false, "Session Expired", null); - } - - String vreIdFeed = store.readFeed(toEdit.getFeedid()).getVreid(); - - // get old hashtags and delete them - String oldText = store.readCommentById(toEdit.getKey()).getText(); - _log.debug("Old text for this comment is " + oldText); - List oldHashtags = Utils.getHashTags(Utils.removeHTMLFromText(oldText)); - if (oldHashtags != null && !oldHashtags.isEmpty()) { - _log.debug("The comment has hashtags, attempting to delete them ... " + oldHashtags.toString()); - boolean deletedHashtag = store.deleteHashTagsComment(toEdit.getKey(), vreIdFeed, oldHashtags); - _log.debug("deletedHashtag? " + deletedHashtag); - } - - // get new hashtags - String escapedCommentText = Utils.escapeHtmlAndTransformUrl(toEdit.getText()); - List newHashtags = Utils.getHashTags(escapedCommentText); - if (newHashtags != null && !newHashtags.isEmpty()) - escapedCommentText = Utils.convertHashtagsAnchorHTML(escapedCommentText, newHashtags); - - edited = new Comment(toEdit.getKey(), toEdit.getUserid(), - toEdit.getTime(), toEdit.getFeedid(), escapedCommentText, user.getFullName(), user.getAvatarId(), true, new Date()); - - store.editComment(edited); - - if (newHashtags != null && !newHashtags.isEmpty()) - store.saveHashTagsComment(edited.getKey(), vreIdFeed, newHashtags); - } catch (Exception e) { - e.printStackTrace(); - return new OperationResult(false, "Exception on the server: " + e.getMessage(), null); - } - return new OperationResult(true, "OK", edited); - } - - /** - * this method sorts the Feeds in Chronological Reversed order and adds additional informations such as comments and attachments - * @param toEnhance - * @param } catch (Exception e) { the max number of comments you want to get back, -1 to get all - * - * @return - */ - private ArrayList enhanceFeeds(ArrayList toEnhance, int commentsNumberPerFeed) { - ArrayList toReturn = new ArrayList(); - PortalContext pContext = PortalContext.getConfiguration(); - String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - - - //patch needed for maintaining mention link backward compatibility (they point to /group/data-e-infrastructure-gateway/profile) - final String LINK_TO_REPLACE = "data-e-infrastructure-gateway"; - String siteLandinPagePath = PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest()); - String tokenTosubstitute = siteLandinPagePath.replace("/group/", ""); - - ArrayList likedFeeds = (ArrayList) store.getAllLikedFeedIdsByUser(userName); - boolean skip = false; - for (Feed feed : toEnhance) { - //patch needed for maintaining mention link backward compatibility (they point to /group/data-e-infrastructure-gateway/profile) - String currPostText = feed.getDescription().replace(LINK_TO_REPLACE,tokenTosubstitute); - feed.setDescription(currPostText); - boolean isMultiFileUpload = feed.isMultiFileUpload(); - ArrayList attachments = new ArrayList(); - if (isMultiFileUpload) { - try { - attachments = (ArrayList) store.getAttachmentsByFeedId(feed.getKey()); - } catch (FeedIDNotFoundException e) { - _log.error("It looks like sth wrong with this feedid having attachments, could not find feedId = " + feed.getKey() + "\n" + e.getMessage()); - } - } - - skip = false; - if (! feed.isApplicationFeed()) { - String thumb = getUserImagePortraitUrlLocal(feed.getEntityId()); - if (thumb == null) { - _log.warn(feed.getEntityId() + " is not avaialble on this portal, skipping this feed: " + feed.getKey()); - skip = true; - } else - feed.setThumbnailURL(thumb); - } - //if likedFeeds contains this feed key it means the user already Liked it - boolean liked = likedFeeds.contains(feed.getKey()); - int commentsNo = 0; - try { - commentsNo = Integer.parseInt(feed.getCommentsNo()); - } - catch (NumberFormatException e) { - commentsNo = 0; - _log.error("NumberFormatException while reading comments number " + e.getMessage()); - } - if (!skip) { - if (commentsNo == 0) { - EnhancedFeed toAdd = null; - //create the enhanced feed - if (feed.isApplicationFeed()) { - toAdd = new EnhancedFeed(feed, liked, checkisAdminUser()); - } else - toAdd = new EnhancedFeed(feed, liked, isUsers(feed, userName)); - toAdd.setAttachments(attachments); - toReturn.add(toAdd); - } else { - ArrayList comments = getAllCommentsByPost(feed.getKey()); - //sort in chronological order - Collections.sort(comments); - - int currCommentsNumber = comments.size(); - //if comments are less than $commentsNumberPerFeed they are the more recent, -1 return all the comments - if (currCommentsNumber < commentsNumberPerFeed || commentsNumberPerFeed == -1) { - EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, userName), comments, attachments); - toReturn.add(toAdd); - } else { - //need to get the last two - ArrayList comments2Attach = new ArrayList(); - for (int i = currCommentsNumber -commentsNumberPerFeed; i < currCommentsNumber; i++) { - comments2Attach.add(comments.get(i)); - } - EnhancedFeed toAdd = new EnhancedFeed(feed, liked, isUsers(feed, userName), comments2Attach, attachments); - toReturn.add(toAdd); - } - } - } - - } - _log.trace("ENHANCED FEEDS TOTAL= " + toReturn.size() + " for user: " + userName); - return toReturn; - } - - /** - * this method is needed because user images portrait change id depending on the portal instance - * e.g. a post made from iMarine portal would not show the avatarIMage in D4Science.org - * @param screenname - * @return the url of the image portrait for this portal instance - */ - private String getUserImagePortraitUrlLocal(String screenName) { - if (! isWithinPortal()) { - return ""; - } - String thumbnailURL = ""; - try { - thumbnailURL = new LiferayUserManager().getUserByUsername(screenName).getUserAvatarURL(); - } catch (UserManagementSystemException | UserRetrievalFault e) { - e.printStackTrace(); - } - return thumbnailURL; - } - - @Override - public ArrayList getAllLikesByPost(String postid) { - ArrayList toReturn = (ArrayList) store.getAllLikesByFeed(postid); - _log.trace("Asking likes for " + postid); - for (Like like : toReturn) { - String thumb = getUserImagePortraitUrlLocal(like.getUserid()); - - like.setThumbnailURL(thumb == null ? "" : thumb); - } - return toReturn; - } - - @Override - public ArrayList getAllCommentsByPost(String postid) { - _log.trace("Asking comments for " + postid); - ArrayList toReturn = (ArrayList) store.getAllCommentByFeed(postid); - for (Comment comment : toReturn) { - String thumb = getUserImagePortraitUrlLocal(comment.getUserid()); - comment.setThumbnailURL(thumb == null ? "" : thumb); - } - Collections.sort(toReturn); - return toReturn; - } - @Override - public boolean deleteComment(String commentid, String feedid) { - _log.trace("Attempting to delete comment " + commentid); - try { - // get hashtags, if any, and delete them - Comment toDelete = store.readCommentById(commentid); - String vreIdFeed = store.readFeed(toDelete.getFeedid()).getVreid(); - List hashtags = Utils.getHashTags(Utils.removeHTMLFromText(toDelete.getText())); - if (hashtags != null && !hashtags.isEmpty()) { - _log.debug("The comment has hashtags, attempting to delete them ... " + hashtags.toString()); - boolean deletedHashtag = store.deleteHashTagsComment(toDelete.getKey(), vreIdFeed, hashtags); - _log.debug("deletedHashtag? " + deletedHashtag); - } - _log.debug("Attempting to delete comment " + commentid); - return store.deleteComment(commentid, feedid); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - @Override - public boolean deletePost(String postid) { - _log.debug("Called delete feed " + postid); - try { - Feed toDelete = store.readFeed(postid); - - // delete comments and hastags as well - boolean hasComments = Integer.parseInt(toDelete.getCommentsNo()) > 0; - - if(hasComments){ - _log.debug("Deleting feed's comments and their hashtags"); - List comments = store.getAllCommentByFeed(postid); - for (Comment comment : comments) { - deleteComment(comment.getKey(), postid); - } - } - - List hashtags = Utils.getHashTags(Utils.removeHTMLFromText(toDelete.getDescription())); - if (hashtags != null && !hashtags.isEmpty()) { - _log.debug("The feed has hashtags, attempting to delete them ... " + hashtags.toString()); - boolean deletedHashtag = store.deleteHashTags(postid, toDelete.getVreid(), hashtags); - _log.debug("deletedHashtag? " + deletedHashtag); - } - _log.debug("Attempting to delete feed " + postid); - return store.deleteFeed(postid); - - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - @Override - public ArrayList getOrganizationUsers() { - ArrayList portalBeans = new ArrayList(); - PortalContext pContext = PortalContext.getConfiguration(); - GCubeUser currentUser = pContext.getCurrentUser(getThreadLocalRequest()); - String userName = currentUser.getUsername(); - UserManager um = new LiferayUserManager(); - GroupManager gm = new LiferayGroupManager(); - long currentGroupId = pContext.getCurrentGroupId(getThreadLocalRequest()); - Set users = new HashSet<>(); - List teams = new ArrayList<>(); //TODO: teams should be added also in root Mode - try { - if (gm.isRootVO(currentGroupId)) { - Set userGroups = gm.listGroupsByUserAndSite(currentUser.getUserId(), getThreadLocalRequest().getServerName()); - for (GCubeGroup userGroup : userGroups) { - if (gm.isVRE(userGroup.getGroupId())) { - users.addAll(um.listUsersByGroup(userGroup.getGroupId())); - _log.debug("getOrganizationUsers added users of group " + userGroup.getGroupId()); - } - } - } else { //is a VRE - if (isWithinPortal()) { - users.addAll(um.listUsersByGroup(currentGroupId)); - teams = new LiferayRoleManager().listTeamsByGroup(currentGroupId); - } else { - List forDev = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - forDev.add(new GCubeUser(1L, "username"+i, "email", "firstName"+i, "middleNam", "lastName"+i, "fullname test"+i, 0L, "url", true, "jobTitle", null)); - } - users.addAll(forDev); - } - } - } catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault | VirtualGroupNotExistingException e) { - e.printStackTrace(); - } - for (GCubeUser user : users) { - if (user.getUsername().compareTo("test.user") != 0 && user.getUsername().compareTo(userName) != 0) { //skip test.user & current user - portalBeans.add(new ItemBean(user.getUserId()+"", user.getUsername(), user.getFullname(), user.getUserAvatarURL())); - } - } - for (GCubeTeam gCubeTeam : teams) { - portalBeans.add(new ItemBean(gCubeTeam.getTeamId()+"", gCubeTeam.getTeamName())); - } - _log.trace("Returning " + portalBeans.size() + " users for scope groupid = " + currentGroupId); - return portalBeans; - } - - /** - * tell if a feed is belonging to the current user or not - * @param tocheck - * @param username - * @return true if this feed is of the current user - */ - private boolean isUsers(Feed tocheck, String username) { - return (tocheck.getEntityId().equals(username)); - } - - /** - * - * @return true if the user is a portal administrator or not - */ - private boolean checkisAdminUser() { - if (getThreadLocalRequest().getSession().getAttribute(SESSION_ADMIN_ATTR) == null) { - boolean isAdmin = false; - try { - isAdmin = isAdmin(); - } catch (Exception e) { - e.printStackTrace(); - } - getThreadLocalRequest().getSession().setAttribute(SESSION_ADMIN_ATTR, isAdmin); - return isAdmin; - } - return (Boolean) getThreadLocalRequest().getSession().getAttribute(SESSION_ADMIN_ATTR); - } - /** - * - * @param mentions - * @return - */ - private ArrayList getMentionsBean(ArrayList mentions) { - ArrayList toReturn = new ArrayList(); - if (mentions == null) - return toReturn; - UserManager um = new LiferayUserManager(); - RoleManager rm = new LiferayRoleManager(); - try { - for (MentionedDTO mentioned : mentions) { - if (mentioned.getType().equalsIgnoreCase("user")) { - long userId = Long.parseLong(mentioned.id); - GCubeUser user = um.getUserById(userId); - toReturn.add(new ItemBean(user.getUserId()+"", user.getUsername(), user.getFullname(), user.getUserAvatarURL())); - } - else { //is a team - long teamId = Long.parseLong(mentioned.id); - GCubeTeam gCubeTeam = rm.getTeam(teamId); - toReturn.add(new ItemBean(gCubeTeam.getTeamId()+"", gCubeTeam.getTeamName())); - } - } - } catch (Exception e) { - _log.error("getMentionsBean Error: ", e); - } - return toReturn; - } - /** - * tell if the user is a portal administrator or not - * @param username - * @return true if is admin - * @throws SystemException - * @throws PortalException - */ - private boolean isAdmin() throws PortalException, SystemException { - if (! isWithinPortal()) - return false; - try { - PortalContext pContext = PortalContext.getConfiguration(); - GCubeUser curUser = pContext.getCurrentUser(getThreadLocalRequest()); - return new LiferayRoleManager().isAdmin(curUser.getUserId()); - } - catch (Exception e) { - _log.error("Could not check if the user is an Administrator, returning false"); - return false; - } - } - - /** - * read from the property file in /conf the refreshing time and other configurations needed - * @return CustomConfiguration - */ - private CustomConfiguration getUserConfiguration() { - CustomConfiguration toReturn = null; - _log.info("Trying to read custom config fr News Feed (REFRESH_TIME, VRE Label and show timeline source)"); - Properties props = new Properties(); - int minutes = 0; - 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 { - minutes = Integer.parseInt(props.getProperty(REFRESH_TIME)); - minutes = minutes*60*1000; - } - //catch exception in case the property value isNot a Number - catch (ClassCastException ex) { - minutes = 300000; //5 minutes - _log.error(REFRESH_TIME + " must be a number (in minutes) returning 5 minutes"); - } - //the vre label - 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"); - } - - } - //catch exception in case properties file does not exist - catch(IOException e) { - minutes = 300000; //5 minutes - _log.error("settings.properties file not found under " + propertyfile +", returning 5 minutes"); - } - toReturn = new CustomConfiguration(minutes, label, showTimelineSource); - _log.debug("Read Configuration from property file: " + toReturn); - return toReturn; - - } - - @Override - public ArrayList getPostsRelatedToUserStatistics( - ShowUserStatisticAction action, int from, int quantity) { - - PortalContext pContext = PortalContext.getConfiguration(); - String userid = pContext.getCurrentUser(getThreadLocalRequest()).getUsername(); - String scope = pContext.getCurrentScope(getThreadLocalRequest()); - - if(userid == NewsConstants.TEST_USER) - return null; - - try{ - - // get reference time - Calendar oneYearAgo = Calendar.getInstance(); - oneYearAgo.set(Calendar.YEAR, oneYearAgo.get(Calendar.YEAR) - 1); - - ArrayList feeds = null; - - switch(action){ - case POSTS_MADE_BY_USER: - feeds = (ArrayList) store.getRecentFeedsByUserAndDate(userid, oneYearAgo.getTimeInMillis()); - break; - case LIKES_MADE_BY_USER: - feeds = (ArrayList) store.getRecentLikedFeedsByUserAndDate(userid, oneYearAgo.getTimeInMillis()); - break; - case COMMENTS_MADE_BY_USER: - feeds = (ArrayList) store.getRecentCommentedFeedsByUserAndDate(userid, oneYearAgo.getTimeInMillis()); - break; - case LIKES_GOT_BY_USER: - feeds = (ArrayList) store.getRecentFeedsByUserAndDate(userid, oneYearAgo.getTimeInMillis()); - Iterator feedsIteratorLikes = feeds.iterator(); - while (feedsIteratorLikes.hasNext()) { - Feed feed = (Feed) feedsIteratorLikes.next(); - if(Integer.parseInt(feed.getLikesNo()) == 0) - feedsIteratorLikes.remove(); - } - break; - case COMMENTS_GOT_BY_USER: - feeds = (ArrayList) store.getRecentFeedsByUserAndDate(userid, oneYearAgo.getTimeInMillis()); - Iterator feedsIteratorComments = feeds.iterator(); - while (feedsIteratorComments.hasNext()) { - Feed feed = (Feed) feedsIteratorComments.next(); - if(Integer.parseInt(feed.getCommentsNo()) == 0) - feedsIteratorComments.remove(); - } - break; - default : return new ArrayList(); - } - - - List contexts = new ArrayList(); - if(isInfrastructureScope()){ - - LiferayGroupManager groupManager = new LiferayGroupManager(); - long userIdLong = new LiferayUserManager().getUserId(userid); - - // filter for site - Set vresInPortal = groupManager.listGroupsByUserAndSite(userIdLong, getThreadLocalRequest().getServerName()); - _log.debug("Contexts in this site are " + vresInPortal); - - // get the scopes associated with such groups - for (GCubeGroup gCubeGroup : vresInPortal) { - contexts.add(groupManager.getInfrastructureScope(gCubeGroup.getGroupId())); - } - - }else{ - - // just the current scope - contexts.add(scope); - - } - - // filter - Iterator iteratorScope = feeds.iterator(); - while (iteratorScope.hasNext()) { - Feed feed = (Feed) iteratorScope.next(); - if(!contexts.contains(feed.getVreid())) - iteratorScope.remove(); - } - - // sort the list, retrieve elements in the range and enhance the feeds - Collections.sort(feeds, Collections.reverseOrder()); - int upperIndex = (from + quantity) >= feeds.size() ? feeds.size() : from + quantity; - feeds = new ArrayList(feeds.subList(from, upperIndex)); - return enhanceFeeds(feeds, -1); - - }catch(Exception e){ - _log.error("Error while retrieving feeds for user " + userid + " and action " + action.toString(), e); - } - - return null; - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/portlet/NewsFeedPortlet.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/portlet/NewsFeedPortlet.java deleted file mode 100644 index a874163..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/server/portlet/NewsFeedPortlet.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.gcube.portlets.user.newsfeed.server.portlet; - -import java.io.IOException; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.GenericPortlet; -import javax.portlet.PortletException; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; - -public class NewsFeedPortlet extends GenericPortlet { - public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { - response.setContentType("text/html"); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/NewsFeed_view.jsp"); - dispatcher.include(request, response); - } - - public void processAction(ActionRequest request, ActionResponse response) - throws PortletException, IOException { - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MentionedDTO.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MentionedDTO.java deleted file mode 100644 index cfb2bf6..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MentionedDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.gcube.portlets.user.newsfeed.shared; - -import com.google.gwt.user.client.rpc.IsSerializable; - -public class MentionedDTO implements IsSerializable{ - public String id, value, type; - - public MentionedDTO() { - super(); - } - - public MentionedDTO(String id, String value, String type) { - super(); - this.id = id; - this.value = value; - this.type = type; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public String toString() { - return "MentionedDTO [id=" + id + ", value=" + value + ", type=" + type + "]"; - } - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MorePostsBean.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MorePostsBean.java deleted file mode 100644 index 80deaa5..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/MorePostsBean.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.gcube.portlets.user.newsfeed.shared; - -import java.io.Serializable; -import java.util.ArrayList; - -import org.gcube.portal.databook.shared.EnhancedFeed; - -@SuppressWarnings("serial") -public class MorePostsBean implements Serializable { - private int lastReturnedPostTimelineIndex; - private ArrayList posts; - - public MorePostsBean() { - super(); - } - - public MorePostsBean(int lastReturnedFeedTimelineIndex, - ArrayList feeds) { - super(); - this.lastReturnedPostTimelineIndex = lastReturnedFeedTimelineIndex; - this.posts = feeds; - } - - public int getLastReturnedFeedTimelineIndex() { - return lastReturnedPostTimelineIndex; - } - public void setLastReturnedFeedTimelineIndex(int lastReturnedFeedTimelineIndex) { - this.lastReturnedPostTimelineIndex = lastReturnedFeedTimelineIndex; - } - public ArrayList getPosts() { - return posts; - } - public void setPosts(ArrayList posts) { - this.posts = posts; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("MorePostsBean [lastReturnedPostTimelineIndex="); - builder.append(lastReturnedPostTimelineIndex); - builder.append(", posts="); - builder.append(posts); - builder.append("]"); - return builder.toString(); - } - - - - -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/NewsConstants.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/NewsConstants.java deleted file mode 100644 index 497e2e2..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/NewsConstants.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.gcube.portlets.user.newsfeed.shared; - -public class NewsConstants { - /** - * Feeds Number to who per VRE/Category - */ - public static final int FEEDS_NO_PER_CATEGORY = 9; - - public static final int FEEDS_MAX_PER_CATEGORY = 30; - - public static final String TEST_USER = "test.user"; -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java deleted file mode 100644 index 6a3b954..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/OperationResult.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.gcube.portlets.user.newsfeed.shared; - -import org.gcube.portal.databook.shared.Comment; - -import com.google.gwt.user.client.rpc.IsSerializable; - -public class OperationResult implements IsSerializable { - - private Boolean success; - private String message; - private Comment comment; - - public OperationResult() { - super(); - } - - public OperationResult(Boolean success, String message, Comment comment) { - super(); - this.success = success; - this.message = message; - this.comment = comment; - } - - public Boolean isSuccess() { - return success; - } - - public void setSuccess(Boolean success) { - this.success = success; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Comment getComment() { - return comment; - } - - public void setComment(Comment comment) { - this.comment = comment; - } -} diff --git a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java b/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java deleted file mode 100644 index 894b014..0000000 --- a/2.8/src/main/java/org/gcube/portlets/user/newsfeed/shared/UserSettings.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.gcube.portlets.user.newsfeed.shared; - -import org.gcube.portal.databook.shared.UserInfo; - -import com.google.gwt.user.client.rpc.IsSerializable; - -@SuppressWarnings("serial") -public class UserSettings implements IsSerializable { - private UserInfo userInfo; - private int refreshingTimeInMillis; - private String currentScope; - //indicate the - private String vreLabel; - //indicate whether the webapp is running at infrasturcture level - boolean isInfrastructure; - //indicate whether to indicate the feed timeline source or not (From whicn VRE/Channel this feed come from) - boolean showTimelineSourceLabel; - public UserSettings() { - super(); - } - - - public UserSettings(UserInfo userInfo, int refreshingTimeInMillis, - String currentScope, String vreLabel, boolean isInfrastructure, - boolean showTimelineSourceLabel) { - super(); - this.userInfo = userInfo; - this.refreshingTimeInMillis = refreshingTimeInMillis; - this.currentScope = currentScope; - this.vreLabel = vreLabel; - this.isInfrastructure = isInfrastructure; - this.showTimelineSourceLabel = showTimelineSourceLabel; - } - - - public boolean isShowTimelineSourceLabel() { - return showTimelineSourceLabel; - } - - - public void setShowTimelineSourceLabel(boolean showTimelineSourceLabel) { - this.showTimelineSourceLabel = showTimelineSourceLabel; - } - - - public UserInfo getUserInfo() { - return userInfo; - } - public void setUserInfo(UserInfo userInfo) { - this.userInfo = userInfo; - } - public int getRefreshingTimeInMillis() { - return refreshingTimeInMillis; - } - public void setRefreshingTimeInMillis(int refreshingTimeInMillis) { - this.refreshingTimeInMillis = refreshingTimeInMillis; - } - public String getCurrentScope() { - return currentScope; - } - public void setCurrentScope(String currentScope) { - this.currentScope = currentScope; - } - public boolean isInfrastructure() { - return isInfrastructure; - } - public void setInfrastructure(boolean isInfrastructure) { - this.isInfrastructure = isInfrastructure; - } - - public String getVreLabel() { - return vreLabel; - } - - public void setVreLabel(String channelName) { - this.vreLabel = channelName; - } - - @Override - public String toString() { - return "UserSettings [userInfo=" + userInfo - + ", refreshingTimeInMillis=" + refreshingTimeInMillis - + ", currentScope=" + currentScope + ", vreLabel=" + vreLabel - + ", isInfrastructure=" + isInfrastructure - + ", showTimelineSourceLabel=" + showTimelineSourceLabel + "]"; - } - - - -} diff --git a/2.8/src/main/resources/clientlog4j.properties b/2.8/src/main/resources/clientlog4j.properties deleted file mode 100644 index a56e901..0000000 --- a/2.8/src/main/resources/clientlog4j.properties +++ /dev/null @@ -1,42 +0,0 @@ -# gCube Portal custom log4j Logger -#Author: Massimiliano Assante, ISTI-CNR - -log4j.rootLogger=INFO, CA - -log4j.appender.CA=org.apache.log4j.ConsoleAppender - -log4j.appender.CA.layout=org.apache.log4j.PatternLayout -log4j.appender.CA.layout.ConversionPattern=[PORTAL] %-4r [%t] %-5p %c %x - %m%n - -# Display any warnings generated by our code -#log4j.category.org.globus=WARN - -# Comment out the line below if you want to log every authorization -# decision the notification consumer makes. -#log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=ERROR - -log4j.logger.org.gcube=TRACE, GCUBE -log4j.appender.GCUBE.threshold=DEBUG -log4j.appender.GCUBE=org.apache.log4j.ConsoleAppender -log4j.appender.GCUBE.layout=org.apache.log4j.PatternLayout -log4j.appender.GCUBE.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] % -m%n - -log4j.logger.org.apache.jasper.compiler.TldLocationsCache.level=ERROR, CA -#AVOID LOGGING EHCACHE Hearbeat problem -log4j.logger.net.sf.ehcache.distribution.PayloadUtil=OFF, CA - -log4j.logger.org.eclipse.jetty=ERROR, CA -log4j.logger.org.gcube.portal.notifications=INFO, CA -log4j.logger.org.gcube.common.scope.impl=INFO, CA -log4j.logger.org.gcube.common.core.utils.events=INFO, CA -log4j.logger.org.gcube.portlets.user.homelibrary=INFO CA -log4j.logger.org.gcube.common.resources.kxml=ERROR, CA -log4j.logger.org.gcube.application.aquamaps.enhabling.Impl.ISCrawler=ERROR, CA -log4j.logger.com.netflix.astyanax.connectionpool.impl=ERROR, CA -log4j.logger.org.gcube.common.scope.impl=INFO, CA -log4j.logger.com.couchbase.client=ERROR, CA -log4j.logger.org.gcube.smartgears.handlers=INFO, CA -log4j.logger.org.gcube.informationsystem.publisher=INFO, CA -log4j.logger.org.gcube.application.framework.core.session=INFO, CA - diff --git a/2.8/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml b/2.8/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml deleted file mode 100644 index 4d6f7bb..0000000 --- a/2.8/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/2.8/src/main/webapp/NewsFeed.css b/2.8/src/main/webapp/NewsFeed.css deleted file mode 100644 index 0860421..0000000 --- a/2.8/src/main/webapp/NewsFeed.css +++ /dev/null @@ -1,667 +0,0 @@ -/* Media queries for phones at the bottom pf this page */ -table { - border-collapse: separate !important; - border-spacing: 0; -} - -a.linkProfile { - font-size: 14px; - font-weight: 600; - height: auto; - line-height: 19px; - cursor: pointer; -} - -.timeStampContent { - color: rgb(97, 103, 112); - font-size: 12px; - font-weight: normal; - height: auto; - line-height: 16px; -} -.vreSourceInMetadata { - color: rgb(97, 103, 112); - font-size: 12px; - font-weight: normal; - height: auto; - line-height: 16px; - cursor: pointer; -} - -.vreSourceInMetadata:hover { - text-decoration: underline; - cursor: pointer; -} - -img.member-photo { - border-radius: 2em; - display: block; - padding: 2px; - border: 1px solid #E6E6E6; -} - -.result-hashtag { - color: #555; - font-size: 20px; -} - -#newsfeedDIV .nav .dropdown-toggle .caret { - margin-top: 5px !important; - border-top: 7px solid #000; - border-right: 7px solid transparent; - border-left: 7px solid transparent; - border-top-color: #08c; - order-bottom-color: #08c; -} - -#newsfeedDIV .nav-pills>li.disabled>a { - padding-right: 0; -} - -.image-preview-attachment { - align: left !important; - margin: 5px !important; - display: inline !important; - height: 40px !important; - width: 40px !important; - overflow: hidden !important; - float: left !important; - border: 1px solid #DDD !important; - border-radius: 4px !important; -} - -/* Superpose TextArea and Highlight DIV trick starts here */ -#comment-supercontainer { - position: relative; - background-color: #EFF3F5; -} - -#comment-highlighterContainer { - position: absolute; - left: 0; - top: 0; - cursor: text; - width: 100%; - height: 50px; -} - -#comment-inputContainer { - position: relative; -} - -.comment-highlighter { - padding: 4px 2px; - color: #ffffff; - background-color: #FFF; - margin-top: 0; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 11px; - letter-spacing: normal; - line-height: normal; - border: 1px solid transparent; - margin-left: 5px; - width: 98%; - min-height: 30px; - word-wrap: break-word; - /* this is very important when usere paste long links*/ -} - -div#comment-inputContainer textarea.post-comment { - padding: 4px 2px; - color: #999; - background-color: transparent; - margin-top: 0px; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 11px; - letter-spacing: normal; - line-height: normal; - border: 1px solid #C3CDE7; - margin-left: 5px; - width: 98%; - min-height: 30px; - border-radius: 2px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; -} - -div#comment-inputContainer textarea.post-comment.comment-dark-color { - color: #333; - background-color: transparent; - transition: background .25s ease-in-out; - -moz-transition: background .25s ease-in-out; - -webkit-transition: background .25s ease-in-out; -} - -.highlightedUser { - background-color: #D8DFEA !important; -} - -/* DIV trick ends here */ -.new-feeds-container { - position: relative; -} - -.new-feeds-available { - color: #444; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - text-align: center; - font-size: 13px; - width: 576px; - margin: 0px 25px 0px 8px; - padding: 3px; - border: 1px solid #75AAD0; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - height: 0px; - opacity: 0; - transition-property: opacity, height; - transition-duration: .40s; - transition-timing-function: ease-out; - -moz-transition-property: opacity, height; - -moz-transition-duration: .40s; - -moz-transition-timing-function: ease-out; - -webkit-transition-property: opacity, height; - -webkit-transition-duration: .40s; - -webkit-transition-timing-function: ease-out; - -ms-transition-property: opacity, height; - -ms-transition-duration: .40s; - -ms-transition-timing-function: ease-out; -} - -.new-feeds-show { - opacity: 1; - background: #D6E2FC; - height: 20px; - width: 95%; -} - -.new-feeds-available:hover { - background: #EDEFF4; - cursor: pointer; - cursor: hand; - text-decoration: underline; -} - -.nofeed-message { - line-height: 40px; - font-family: 'Architects Daughter', arial, sans-serif; - font-size: 15px; -} - -.feed-filters { - margin-top: -5px; - width: 500px -} - -.feed-filters ul { - list-style: none; - margin: 0; - padding-left: 0; -} - -.feed-filters li a { - color: #3B5998; - text-decoration: none; -} - -.feed-filters li a:hover { - text-decoration: underline; - transition: color .25s ease-in-out; - -moz-transition: color .25s ease-in-out; - -webkit-transition: color .25s ease-in-out; -} - -.feed-filters li { - color: #444; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 15px; - float: left; - height: 2em; - line-height: 2em; - display: block; - text-decoration: none; - text-align: center; - padding-left: 10px; - padding-right: 25px; - background-attachment: scroll; - background-color: transparent; - background-image: url("images/grid_small_dot.png"); - background-position: 100% 50%; - background-repeat: no-repeat; - background-size: auto auto; -} - -.feed-filters li.final { - background-image: none; -} - -.feed-filters li.feed-breadcrumb { - background-image: url("images/arrow-right.png"); -} - -.filter-selected a { - color: #444 !important; - font-weight: bold; -} - -/* Other */ -.attachment-preview-container { - padding: 5px; - font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; - background-clip: border-box; - background-color: #FBFBFB; - background-image: none; - border: 1px solid #DDD; - border-radius: 4px; - width: 97%; - margin-top: 5px; - margin-left: 5px; -} - -.centered { - width: 100%; - text-align: center; -} - -.linkpreview-image { - margin: 3px; - width: 80px; -} - -.link-preview { - padding: 5px; - font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; - background-clip: border-box; - background-color: #FBFBFB; - background-image: none; - border: 1px solid #DDD; - border-radius: 4px; - width: 97%; - margin-top: 5px; - margin-left: 5px; -} - -.linkpreview-bgcolor { - background-color: #FBFBFB; -} - -.linkpreview-title { - margin-top: 3px; - font-size: 12px; - font-weight: bold; - line-height: 15px; -} - -.linkpreview-url { - margin-top: 10px; - color: #666; - font-size: 10px; -} - -.linkpreview-desc { - padding-top: 5px; - color: #333; - font-size: 10px; - line-height: 14px; -} - -.comment-hidden { - opacity: 0; -} - -.comment-show { - background-color: #EFF3F5; - opacity: 1; - transition: opacity .45s ease-in-out; - -moz-transition: opacity .45s ease-in-out; - -webkit-transition: opacity .45s ease-in-out; - -ms-transition: opacity .45s ease-in-out; - width: 100%; -} - -.commentsPanel { - width: 99%; - margin: 4px 0 0 4px; -} - -.more-comment, .more-comment:hover { - background-color: #EFF3F5; - width: 100%; - text-align: center; - padding-top: 3px; - border-bottom-color: #FFF; - border-bottom-style: solid; - border-bottom-width: 1px; - cursor: pointer; -} - -div>table.single-comment, .single-comment { - background-color: #EFF3F5; - border-bottom-color: #FFF; - border-bottom-style: solid; - border-bottom-width: 1px; - border-left: 2px solid #DDD; - padding-left: 3px; - width: 100%; -} - -.comment-bgcolor { - background-color: #EFF3F5; -} - -.uiCloseButton { - background: url(images/close.png) 0px 0px no-repeat; - height: 15px; - width: 15px; -} - -.uiOpenButton { - background: url(images/open-sep.png) 0px 2px no-repeat; - height: 15px; - width: 15px; -} - -.closeImage { - float: right; - height: 15px; - width: 15px; -} - -.closeImage:hover { - background: url(images/close.png) 0px -16px no-repeat; - cursor: pointer; - cursor: hand; -} - -.closeImage:active { - background: url(images/close.png) 0px -32px no-repeat; -} - -.openImage { - float: right; - height: 15px; - width: 15px; -} - -.openImage:hover { - background: url(images/open-sep.png) 0px -14px no-repeat; - cursor: pointer; - cursor: hand; -} - -.openImage:active { - background: url(images/open-sep.png) 0px -30px no-repeat; -} - -.uiEditButton { - background: url(images/edit.png) 0px 0px no-repeat; - height: 15px; - width: 15px; -} - -.editImage { - height: 15px; - width: 15px; -} - -.editImage:hover { - background: url(images/edit.png) 0px -16px no-repeat; - cursor: pointer; - cursor: hand; -} - -.editImage:active { - background: url(images/edit.png) 0px -32px no-repeat; -} - -.user-comment { - width: 99%; - color: #333; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 11px; - border-color: #999; - border-width: 1px; - letter-spacing: normal; -} - -.user-comment-time { - width: 99%; - color: #999; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 11px; - white-space: nowrap; -} - -a.seemore, .seemore:hover { - font-size: 9px; - cursor: pointer; - cursor: hand; -} - -.like:hover { - cursor: pointer; - cursor: hand; -} - -.comment:hover { - cursor: pointer; - cursor: hand; -} - -a.person-link { - font-size: 16x; -} - -.tweet-content { - font-family: 'Helvetica Neue', Arial, sans-serif; - font-size: 14px; - line-height: 18px; - color: #333; - width: 100%; - word-wrap: break-word; - -ms-word-break: break-all; - /* Non standard for webkit */ - word-break: break-word; - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} - -.tweet-separator { - padding-left: 5px; - padding-right: 5px; -} - -.tweet-actions { - width: 99%; - padding-top: 5px; - font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial, - sans-serif; - font-size: 11px; - text-align: left; - overflow: hidden; - clear: both; -} - -.tweet-actions .time { - padding-left: 15px; - padding-right: 15px; - white-space: nowrap; -} - -.tweet-actions div { - color: #666; -} - -/* TABLES */ -.div-table-400 { - display: table; - width: 400px; - background-clip: border-box; - background-image: none; - background-origin: padding-box; - border-bottom-color: #DADADA; - border-bottom-style: solid; - border-bottom-width: 1px; - padding: 12px 7px 3px 7px; -} - -.div-table { - display: table; - width: 98%; - background-clip: border-box; - background-image: none; - background-origin: padding-box; - border-bottom-color: #DADADA; - border-bottom-style: solid; - border-bottom-width: 1px; - padding: 10px 7px 3px 7px; -} - -.div-table-row { - display: table-row; - text-align: left; -} - -.div-table-col { - display: table-cell; - text-align: left; -} - -.div-table-col.content { - padding-top: 7px; - vertical-align: top; -} - -.div-table-col.edit { - padding-left: 5px; - vertical-align: top; - width: 15px; -} - -.div-table-col.nf-post-remove { - padding-left: 5px; - vertical-align: top; - width: 30px; -} - -.div-table-col.photo { - width: 60px; -} - -.div-table-col.labels { - width: 60px; -} - -.div-table-col.smallphoto { - width: 40px; -} - -.visible { - background-color: #FFF; - transition: background .75s ease-in-out; - -moz-transition: background .75s ease-in-out; - -webkit-transition: background .75s ease-in-out; -} - -.hidden { - background-color: #fdffcc; -} - -.nwfeed-error { - color: #FFF; - background-color: pink; - transition: background .45s ease-in-out; - -moz-transition: background .45s ease-in-out; - -webkit-transition: background .45s ease-in-out; -} - -div.tweet-content a.link { - font-size: 14px; -} - -/* For phones*/ -@media screen and (max-width: 520px) { - .commentsPanel { - width: 260px; - } - #comment-highlighterContainer { - width: 260px; - } - .comment-highlighter { - width: 230px; - } - div#comment-inputContainer textarea.post-comment { - width: 230px; - } - .link-preview { - width: 260px; - } - /* div.attachment-preview-container { */ - /* width: 300px; */ - /* } */ - .linkpreview-desc, .linkpreview-url, .linkpreview-image { - display: none; - } - .image-preview-attachment { - display: none !important; - } - .new-feeds-show { - width: 260px; - } - .div-table { - padding-left: 0; - padding-right: 0; - margin-left: -15px; - } - .tweet-actions { - width: 330px; - } - .feed-filters { - width: 320px; - } -} - -@media screen and (max-width: 1128px) { - .commentsPanel { - width: 300px; - } - .link-preview { - width: 260px; - } - /* div.attachment-preview-container { */ - /* width: 300px; */ - /* } */ - .new-feeds-show { - width: 260px; - } - .linkpreview-desc, .linkpreview-url, .linkpreview-image { - display: none; - } - .image-preview-attachment { - display: none !important; - } - .div-table-col { - display: block; - padding-left: 10px; - padding-bottom: 5px; - } - .div-table { - padding-left: 0; - padding-right: 0; - margin-left: -10px; - } - .tweet-actions { - width: 330px; - } - .feed-filters { - width: 320px; - } -} \ No newline at end of file diff --git a/2.8/src/main/webapp/NewsFeed.html b/2.8/src/main/webapp/NewsFeed.html deleted file mode 100644 index 8fc4496..0000000 --- a/2.8/src/main/webapp/NewsFeed.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - -News Feed - - - - - - - - - - - - - - - - -
- - diff --git a/2.8/src/main/webapp/WEB-INF/jsp/NewsFeed_view.jsp b/2.8/src/main/webapp/WEB-INF/jsp/NewsFeed_view.jsp deleted file mode 100644 index a22175b..0000000 --- a/2.8/src/main/webapp/WEB-INF/jsp/NewsFeed_view.jsp +++ /dev/null @@ -1,18 +0,0 @@ -<%@page contentType="text/html"%> -<%@page pageEncoding="UTF-8"%> - -<%-- Uncomment below lines to add portlet taglibs to jsp -<%@ page import="javax.portlet.*"%> -<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> - - ---%> - - - - - - - -
diff --git a/2.8/src/main/webapp/WEB-INF/liferay-display.xml b/2.8/src/main/webapp/WEB-INF/liferay-display.xml deleted file mode 100644 index ff6aaa3..0000000 --- a/2.8/src/main/webapp/WEB-INF/liferay-display.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/2.8/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/2.8/src/main/webapp/WEB-INF/liferay-plugin-package.properties deleted file mode 100644 index 26c3e64..0000000 --- a/2.8/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=NewsFeed -module-group-id=liferay -module-incremental-version=1 -tags= -short-description= -change-log= -page-url=http://www.d4science.org -author=D4Science.org -licenses=EUPL \ No newline at end of file diff --git a/2.8/src/main/webapp/WEB-INF/liferay-portlet.xml b/2.8/src/main/webapp/WEB-INF/liferay-portlet.xml deleted file mode 100644 index b831c8c..0000000 --- a/2.8/src/main/webapp/WEB-INF/liferay-portlet.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - NewsFeed - false - false - false - /NewsFeed.css - - - administrator - Administrator - - - guest - Guest - - - power-user - Power User - - - user - User - - diff --git a/2.8/src/main/webapp/WEB-INF/portlet.xml b/2.8/src/main/webapp/WEB-INF/portlet.xml deleted file mode 100644 index 19e41f7..0000000 --- a/2.8/src/main/webapp/WEB-INF/portlet.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - NewsFeed - NewsFeed - org.gcube.portlets.user.newsfeed.server.portlet.NewsFeedPortlet - - view-jsp - /view.jsp - - 0 - - text/html - - - News feed - News feed - News feed - - - administrator - - - \ No newline at end of file diff --git a/2.8/src/main/webapp/WEB-INF/web.xml b/2.8/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index da47c9f..0000000 --- a/2.8/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - newsServlet - org.gcube.portlets.user.newsfeed.server.NewsServiceImpl - - - - newsServlet - /newsfeed/newsServlet - - - - imageservices - org.gcube.portlets.widgets.imagepreviewerwidget.server.ImageOrientationServicesImpl - - - - imageservices - /newsfeed/imageservices - - - - pickItemServlet - org.gcube.portlets.widgets.pickitem.server.PickItemServiceImpl - - - - pickItemServlet - /newsfeed/pickItemServlet - - - - - NewsFeed.html - - - diff --git a/2.8/src/main/webapp/conf/settings.properties b/2.8/src/main/webapp/conf/settings.properties deleted file mode 100644 index d5e7c81..0000000 --- a/2.8/src/main/webapp/conf/settings.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Defines the News Feed refreshing time in minutes -REFRESH_TIME = 3 -VRE_LABEL = Virtual Research Environment -SHOW_TIMELINE_SOURCE=true \ No newline at end of file diff --git a/2.8/src/main/webapp/images/Avatar_default.png b/2.8/src/main/webapp/images/Avatar_default.png deleted file mode 100644 index 2a6c844..0000000 Binary files a/2.8/src/main/webapp/images/Avatar_default.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/arrow-right.png b/2.8/src/main/webapp/images/arrow-right.png deleted file mode 100644 index b278de8..0000000 Binary files a/2.8/src/main/webapp/images/arrow-right.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/close.png b/2.8/src/main/webapp/images/close.png deleted file mode 100644 index 978ee49..0000000 Binary files a/2.8/src/main/webapp/images/close.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/close_darker.gif b/2.8/src/main/webapp/images/close_darker.gif deleted file mode 100644 index 0ae170c..0000000 Binary files a/2.8/src/main/webapp/images/close_darker.gif and /dev/null differ diff --git a/2.8/src/main/webapp/images/comment_edit.png b/2.8/src/main/webapp/images/comment_edit.png deleted file mode 100644 index d31e68a..0000000 Binary files a/2.8/src/main/webapp/images/comment_edit.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/edit.png b/2.8/src/main/webapp/images/edit.png deleted file mode 100644 index 03d88a1..0000000 Binary files a/2.8/src/main/webapp/images/edit.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/feeds-loader.gif b/2.8/src/main/webapp/images/feeds-loader.gif deleted file mode 100644 index 89ae681..0000000 Binary files a/2.8/src/main/webapp/images/feeds-loader.gif and /dev/null differ diff --git a/2.8/src/main/webapp/images/feeds-spacer.gif b/2.8/src/main/webapp/images/feeds-spacer.gif deleted file mode 100644 index dabcc3c..0000000 Binary files a/2.8/src/main/webapp/images/feeds-spacer.gif and /dev/null differ diff --git a/2.8/src/main/webapp/images/grid_small_dot.png b/2.8/src/main/webapp/images/grid_small_dot.png deleted file mode 100644 index b6f9099..0000000 Binary files a/2.8/src/main/webapp/images/grid_small_dot.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/loading-comments.gif b/2.8/src/main/webapp/images/loading-comments.gif deleted file mode 100644 index 507b556..0000000 Binary files a/2.8/src/main/webapp/images/loading-comments.gif and /dev/null differ diff --git a/2.8/src/main/webapp/images/open-sep.png b/2.8/src/main/webapp/images/open-sep.png deleted file mode 100644 index 00c31bc..0000000 Binary files a/2.8/src/main/webapp/images/open-sep.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/spacer-dot.png b/2.8/src/main/webapp/images/spacer-dot.png deleted file mode 100644 index 4ae3d33..0000000 Binary files a/2.8/src/main/webapp/images/spacer-dot.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/star_blue.png b/2.8/src/main/webapp/images/star_blue.png deleted file mode 100644 index e475c89..0000000 Binary files a/2.8/src/main/webapp/images/star_blue.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/transparent.png b/2.8/src/main/webapp/images/transparent.png deleted file mode 100644 index 4f57b7f..0000000 Binary files a/2.8/src/main/webapp/images/transparent.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/user_endorse.png b/2.8/src/main/webapp/images/user_endorse.png deleted file mode 100644 index df0576e..0000000 Binary files a/2.8/src/main/webapp/images/user_endorse.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/vre_bg_gray.png b/2.8/src/main/webapp/images/vre_bg_gray.png deleted file mode 100644 index 31cb923..0000000 Binary files a/2.8/src/main/webapp/images/vre_bg_gray.png and /dev/null differ diff --git a/2.8/src/main/webapp/images/warning_blue.png b/2.8/src/main/webapp/images/warning_blue.png deleted file mode 100644 index a4e57c6..0000000 Binary files a/2.8/src/main/webapp/images/warning_blue.png and /dev/null differ diff --git a/2.8/src/main/webapp/js/jquery.autosize.js b/2.8/src/main/webapp/js/jquery.autosize.js deleted file mode 100644 index 370279e..0000000 --- a/2.8/src/main/webapp/js/jquery.autosize.js +++ /dev/null @@ -1,187 +0,0 @@ -/*! - jQuery Autosize v1.16.12 - (c) 2013 Jack Moore - jacklmoore.com - updated: 2013-05-31 - license: http://www.opensource.org/licenses/mit-license.php -*/ - -(function ($) { - var - defaults = { - className: 'autosizejs', - append: '', - callback: false - }, - hidden = 'hidden', - borderBox = 'border-box', - lineHeight = 'lineHeight', - - // border:0 is unnecessary, but avoids a bug in FireFox on OSX - copy = '