diff --git a/src/main/java/org/gcube/portlets/user/acceptinvite/PortletViewController.java b/src/main/java/org/gcube/portlets/user/acceptinvite/PortletViewController.java index 3f12323..3976317 100644 --- a/src/main/java/org/gcube/portlets/user/acceptinvite/PortletViewController.java +++ b/src/main/java/org/gcube/portlets/user/acceptinvite/PortletViewController.java @@ -15,6 +15,8 @@ package org.gcube.portlets.user.acceptinvite; import java.io.IOException; +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.ResourceRequest; @@ -36,7 +38,9 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.portlet.bind.annotation.ActionMapping; import org.springframework.web.portlet.bind.annotation.RenderMapping; import org.springframework.web.portlet.bind.annotation.ResourceMapping; @@ -62,11 +66,11 @@ public class PortletViewController { private static String PAGE_VRE_NOTFOUND = "vre-notfound"; private static String PAGE_INVITE_EXPIRED = "invite-expired"; private static String PAGE_INVITE_PROCESS = "view"; - + public static String INVITE_INSTANCE = "inviteInstance"; - + private static DatabookStore store; - + /** * * @return the unique instance of the store @@ -77,13 +81,12 @@ public class PortletViewController { } return store; } - - // .append(PortalContext.getConfiguration().getSiteLandingPagePath(request)) + @RenderMapping public String handleRenderRequest(RenderRequest request,RenderResponse response, Model model) { HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request)); - + final String INVITE_ID_ENCODED = new String(Base64.encodeBase64(InvitesManager.INVITEID_ATTR.getBytes())); final String SITE_ID_ENCODED = new String(Base64.encodeBase64(InvitesManager.SITEID_ATTR.getBytes())); if (httpReq.getParameter(INVITE_ID_ENCODED) == null || SITE_ID_ENCODED == null) @@ -92,10 +95,10 @@ public class PortletViewController { String siteIdEncoded = (String) httpReq.getParameter(SITE_ID_ENCODED); String inviteId= new String(Base64.decodeBase64(inviteIdEncoded)); String groupId = new String(Base64.decodeBase64(siteIdEncoded)); - + _log.info("GOT inviteId=" + inviteId); _log.info("siteId=" + groupId); - + Group site = null; try { site = GroupLocalServiceUtil.getGroup(Long.parseLong(groupId)); @@ -103,20 +106,20 @@ public class PortletViewController { e1.printStackTrace(); return PAGE_VRE_NOTFOUND; } - + Invite invite = null; - + try { invite = getStore().readInvite(inviteId); } catch (InviteIDNotFoundException | InviteStatusNotFoundException e) { e.printStackTrace(); return PAGE_INVITE_NOTFOUND; } - + if (invite.getStatus() == InviteStatus.ACCEPTED) return PAGE_INVITE_EXPIRED; - - + + GCubeUser invitedUser = null; try { invitedUser = new LiferayUserManager().getUserByEmail(invite.getInvitedEmail()); @@ -124,23 +127,24 @@ public class PortletViewController { } catch (UserManagementSystemException | UserRetrievalFault e) { _log.info("No user account exist with this email: " + invite.getInvitedEmail()); } - + //we set the invite instance retrieved in the model model.addAttribute(INVITE_INSTANCE, invite); model.addAttribute("vreName", site.getName()); model.addAttribute("vreFriendlyURL", site.getFriendlyURL()); model.addAttribute("groupId", site.getGroupId()); model.addAttribute("landingPage", PortalContext.getConfiguration().getSiteLandingPagePath(httpReq)); - + return PAGE_INVITE_PROCESS; } - + + @ResourceMapping(value="findState") public void findStateForCountry(ResourceRequest request, ResourceResponse response) throws IOException { String countryName = ParamUtil.getString(request, "countryName"); - + _log.info("countryName=" + countryName); JSONArray stateArray = JSONFactoryUtil.createJSONArray(); JSONObject stateObject,stateObject2; if(countryName.equalsIgnoreCase("india")) diff --git a/src/main/webapp/WEB-INF/jsp/view.jsp b/src/main/webapp/WEB-INF/jsp/view.jsp index 4247d43..12a8f5e 100644 --- a/src/main/webapp/WEB-INF/jsp/view.jsp +++ b/src/main/webapp/WEB-INF/jsp/view.jsp @@ -11,28 +11,101 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + +Change the Country State Change By Ajax

+Country: + + +

+State: +

Hello !
@@ -47,8 +120,41 @@ $( "#country" ).change(function() { Virtual Research Environment. - var1 is empty or null.landingPage +
+ Please note: the invite is valid for your email "> + + only. To accept the invite, please fill in the information below:
+ +
+
+
+
+ + + + + +
+
+
+
+ + + + + + +
+ +
+
+
+
+
+
This invite is valid for your email only, you will be asked to enter your password associated to it on this portal. - <% String exploreURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR+"="+request.getAttribute("groupId");%> -

- + <% + String exploreURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR + + "=" + request.getAttribute("groupId"); + %> +

+

@@ -66,21 +179,4 @@ $( "#country" ).change(function() {


- - - -Change the Country State Change By Ajax -
-
-Country: - - -
-
-State: - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index e69de29..9c0407f 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -0,0 +1,6 @@ +.has-error { + color: red !important; +} +.has-success { + color: green !important; +} \ No newline at end of file