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"?>
|
||||
<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>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -33,5 +33,5 @@
|
|||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</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>
|
||||
|
|
13
pom.xml
13
pom.xml
|
@ -23,8 +23,6 @@
|
|||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
|
||||
|
@ -81,6 +79,15 @@
|
|||
<artifactId>invites-common-library</artifactId>
|
||||
<version>[0.1.0-SNAPSHOT,)</version>
|
||||
</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>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
|
@ -159,7 +166,7 @@
|
|||
<goals>
|
||||
<goal>compile</goal>
|
||||
<!-- <goal>test</goal> -->
|
||||
<!-- <goal>generateAsync</goal> -->
|
||||
<!-- <goal>generateAsync</goal> -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.RemoteServiceRelativePath;
|
||||
|
||||
|
@ -8,5 +10,5 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
*/
|
||||
@RemoteServiceRelativePath("greet")
|
||||
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;
|
||||
|
||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
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;
|
||||
|
||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
||||
import org.gcube.portlets.user.invitefriends.client.InviteServiceAsync;
|
||||
import org.gcube.portlets.user.invitefriends.client.validation.FormView;
|
||||
|
@ -115,12 +116,24 @@ public class FormViewImpl extends Composite implements FormView, Editor<FormView
|
|||
} else {
|
||||
nameGroup.setType(ControlGroupType.NONE);
|
||||
nameErrors.setText("");
|
||||
service.sendInviteEmail(name.getText(), "", email.getText(), new AsyncCallback<Boolean>() {
|
||||
service.sendInvite(name.getText(), "", email.getText(), new AsyncCallback<InviteOperationResult>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
feedback.setText("Thanks for inviting, we sent the email correctly.");
|
||||
feedbackGroup.setType(ControlGroupType.SUCCESS);
|
||||
public void onSuccess(InviteOperationResult result) {
|
||||
switch (result) {
|
||||
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);
|
||||
cancelInvite.setText("Close");
|
||||
email.setText("");
|
||||
|
@ -130,7 +143,7 @@ public class FormViewImpl extends Composite implements FormView, Editor<FormView
|
|||
public void onFailure(Throwable caught) {
|
||||
feedback.setText("Sorry, an error occurred and we could not send the invite, please try again later.");
|
||||
feedbackGroup.setType(ControlGroupType.ERROR);
|
||||
sendInvite.removeFromParent();
|
||||
sendInvite.setEnabled(false);
|
||||
email.setText("");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.gcube.application.framework.core.session.SessionManager;
|
|||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||
import org.gcube.portal.invites.InvitesManager;
|
||||
import org.gcube.portlets.user.invitefriends.client.InviteService;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -42,7 +43,7 @@ public class InviteServiceImpl extends RemoteServiceServlet implements InviteSer
|
|||
*
|
||||
*/
|
||||
@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();
|
||||
String fromFullName = aslSession.getUserFullName();
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class InviteServiceImpl extends RemoteServiceServlet implements InviteSer
|
|||
return null;
|
||||
}
|
||||
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'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<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" />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.user.invitefriends.client.InviteFriends' />
|
||||
|
|
Loading…
Reference in New Issue