support for invites invites management alpha version is complete
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/invite-friends-vre@115671 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4ac921e9dd
commit
4cff0d4d1d
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/invite-friends-vre-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/invite-friends-vre-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/invite-friends-vre-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/invite-friends-vre-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/invite-friends-vre-1.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/invite-friends-vre-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
13
pom.xml
13
pom.xml
|
@ -23,8 +23,6 @@
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.7.0</gwtVersion>
|
<gwtVersion>2.7.0</gwtVersion>
|
||||||
|
|
||||||
<!-- GWT needs at least java 1.6 -->
|
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
|
|
||||||
|
@ -81,6 +79,15 @@
|
||||||
<artifactId>invites-common-library</artifactId>
|
<artifactId>invites-common-library</artifactId>
|
||||||
<version>[0.1.0-SNAPSHOT,)</version>
|
<version>[0.1.0-SNAPSHOT,)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google</groupId>
|
||||||
|
<artifactId>gwt-jsonmaker</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
<artifactId>gwt-bootstrap</artifactId>
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
@ -159,7 +166,7 @@
|
||||||
<goals>
|
<goals>
|
||||||
<goal>compile</goal>
|
<goal>compile</goal>
|
||||||
<!-- <goal>test</goal> -->
|
<!-- <goal>test</goal> -->
|
||||||
<!-- <goal>generateAsync</goal> -->
|
<!-- <goal>generateAsync</goal> -->
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.invitefriends.client;
|
package org.gcube.portlets.user.invitefriends.client;
|
||||||
|
|
||||||
|
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
@ -8,5 +10,5 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
*/
|
*/
|
||||||
@RemoteServiceRelativePath("greet")
|
@RemoteServiceRelativePath("greet")
|
||||||
public interface InviteService extends RemoteService {
|
public interface InviteService extends RemoteService {
|
||||||
Boolean sendInviteEmail(String name, String lastName, String email) throws IllegalArgumentException;
|
InviteOperationResult sendInvite(String name, String lastName, String email) throws IllegalArgumentException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package org.gcube.portlets.user.invitefriends.client;
|
package org.gcube.portlets.user.invitefriends.client;
|
||||||
|
|
||||||
|
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
public interface InviteServiceAsync {
|
public interface InviteServiceAsync {
|
||||||
|
|
||||||
void sendInviteEmail(String name, String lastName, String email, AsyncCallback<Boolean> callback);
|
void sendInvite(String name, String lastName, String email,
|
||||||
|
AsyncCallback<InviteOperationResult> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.invitefriends.client.ui;
|
package org.gcube.portlets.user.invitefriends.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||||
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
||||||
import org.gcube.portlets.user.invitefriends.client.InviteServiceAsync;
|
import org.gcube.portlets.user.invitefriends.client.InviteServiceAsync;
|
||||||
import org.gcube.portlets.user.invitefriends.client.validation.FormView;
|
import org.gcube.portlets.user.invitefriends.client.validation.FormView;
|
||||||
|
@ -115,12 +116,24 @@ public class FormViewImpl extends Composite implements FormView, Editor<FormView
|
||||||
} else {
|
} else {
|
||||||
nameGroup.setType(ControlGroupType.NONE);
|
nameGroup.setType(ControlGroupType.NONE);
|
||||||
nameErrors.setText("");
|
nameErrors.setText("");
|
||||||
service.sendInviteEmail(name.getText(), "", email.getText(), new AsyncCallback<Boolean>() {
|
service.sendInvite(name.getText(), "", email.getText(), new AsyncCallback<InviteOperationResult>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(InviteOperationResult result) {
|
||||||
feedback.setText("Thanks for inviting, we sent the email correctly.");
|
switch (result) {
|
||||||
feedbackGroup.setType(ControlGroupType.SUCCESS);
|
case SUCCESS:
|
||||||
|
feedback.setText("Thanks for inviting, we sent the email correctly.");
|
||||||
|
feedbackGroup.setType(ControlGroupType.SUCCESS);
|
||||||
|
break;
|
||||||
|
case ALREADY_INVITED:
|
||||||
|
feedback.setText("Thanks for inviting, however the user was already invited.");
|
||||||
|
feedbackGroup.setType(ControlGroupType.WARNING);
|
||||||
|
break;
|
||||||
|
case FAILED:
|
||||||
|
feedback.setText("Sorry, an error occurred in the server and we could not send the invite, please try again later.");
|
||||||
|
feedbackGroup.setType(ControlGroupType.ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
sendInvite.setEnabled(false);
|
sendInvite.setEnabled(false);
|
||||||
cancelInvite.setText("Close");
|
cancelInvite.setText("Close");
|
||||||
email.setText("");
|
email.setText("");
|
||||||
|
@ -130,7 +143,7 @@ public class FormViewImpl extends Composite implements FormView, Editor<FormView
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
feedback.setText("Sorry, an error occurred and we could not send the invite, please try again later.");
|
feedback.setText("Sorry, an error occurred and we could not send the invite, please try again later.");
|
||||||
feedbackGroup.setType(ControlGroupType.ERROR);
|
feedbackGroup.setType(ControlGroupType.ERROR);
|
||||||
sendInvite.removeFromParent();
|
sendInvite.setEnabled(false);
|
||||||
email.setText("");
|
email.setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||||
import org.gcube.portal.invites.InvitesManager;
|
import org.gcube.portal.invites.InvitesManager;
|
||||||
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -42,7 +43,7 @@ public class InviteServiceImpl extends RemoteServiceServlet implements InviteSer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean sendInviteEmail(String name, String lastName, String email) throws IllegalArgumentException {
|
public InviteOperationResult sendInvite(String name, String lastName, String email) throws IllegalArgumentException {
|
||||||
ASLSession aslSession = getASLSession();
|
ASLSession aslSession = getASLSession();
|
||||||
String fromFullName = aslSession.getUserFullName();
|
String fromFullName = aslSession.getUserFullName();
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ public class InviteServiceImpl extends RemoteServiceServlet implements InviteSer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String portalSenderEmail = PortalContext.getConfiguration().getSenderEmail();
|
String portalSenderEmail = PortalContext.getConfiguration().getSenderEmail();
|
||||||
return InvitesManager.getInstance().sendInviteEmail(aslSession, portalSenderEmail, portalUrl, fromFullName, lastName, email, vreDescription);
|
return InvitesManager.getInstance().sendInvite(aslSession, portalSenderEmail, portalUrl, fromFullName, lastName, email, vreDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
<module rename-to='invitefriends'>
|
<module rename-to='invitefriends'>
|
||||||
<!-- Inherit the core Web Toolkit stuff. -->
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
<inherits name='com.google.gwt.user.User' />
|
<inherits name='com.google.gwt.user.User' />
|
||||||
<inherits name='com.google.gwt.activity.Activity' />
|
<inherits name='com.google.gwt.activity.Activity' />
|
||||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
|
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
|
||||||
|
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
class='org.gcube.portlets.user.invitefriends.client.InviteFriends' />
|
class='org.gcube.portlets.user.invitefriends.client.InviteFriends' />
|
||||||
|
|
Loading…
Reference in New Issue