git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/accept-invite-portlet@160031 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6bbbdeca59
commit
d5aedc3c63
|
@ -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;
|
||||
|
||||
|
@ -78,7 +82,6 @@ public class PortletViewController {
|
|||
return store;
|
||||
}
|
||||
|
||||
// .append(PortalContext.getConfiguration().getSiteLandingPagePath(request))
|
||||
@RenderMapping
|
||||
public String handleRenderRequest(RenderRequest request,RenderResponse response, Model model) {
|
||||
|
||||
|
@ -137,10 +140,11 @@ public class PortletViewController {
|
|||
|
||||
|
||||
|
||||
|
||||
@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"))
|
||||
|
|
|
@ -11,28 +11,101 @@
|
|||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
|
||||
<portlet:resourceURL id="findState" var="findState"></portlet:resourceURL>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$( "#country" ).change(function() {
|
||||
$.ajax({
|
||||
url: "${findState}" ,
|
||||
type: 'POST',
|
||||
datatype:'json',
|
||||
data: {
|
||||
countryName: $("#country").val()
|
||||
},
|
||||
success: function(data){
|
||||
var content= JSON.parse(data);
|
||||
$('#state').html('');// to clear the previous option
|
||||
$.each(content, function(i, state) {
|
||||
$('#state').append($('<option>').text(state.name).attr('value', state.stateId));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
$( "#createAccountButton" ).click(function() {
|
||||
var firstnameBox = $.trim( $('#firstname').val() )
|
||||
if (firstnameBox == "") {
|
||||
$('#labelFirstName').css("color","red");
|
||||
$('#labelFirstName').text("First Name (This field is required)");
|
||||
} else {
|
||||
$('#labelFirstName').css("color","#555");
|
||||
$('#labelFirstName').text("First Name (Required)");
|
||||
}
|
||||
var lastnameBox = $.trim( $('#lastname').val() )
|
||||
if (lastnameBox == "") {
|
||||
$('#labelLastName').css("color","red");
|
||||
$('#labelLastName').text("Last Name (This field is required)");
|
||||
} else {
|
||||
$('#labelLastName').css("color","#555");
|
||||
$('#labelLastName').text("Last Name (Required)");
|
||||
}
|
||||
|
||||
var passwd1 = $('#password');
|
||||
var labelPwd1 = $('#labelPwd1');
|
||||
var passwd2 = $('#repassword');
|
||||
var labelPwd2 = $('#labelPwd2');
|
||||
|
||||
labelPwd1.addClass( passwd1.val().length === 0 ? 'has-error' : 'has-success' );
|
||||
labelPwd2.addClass( passwd2.val().length === 0 ? 'has-error' : 'has-success' );
|
||||
|
||||
var nomatch = $('#labelPasswordDontMatch');
|
||||
|
||||
if (passwd1.val() !== passwd2.val()) {
|
||||
nomatch.css("display","block");
|
||||
nomatch.css("color","red");
|
||||
labelPwd1.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
||||
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
||||
labelPwd2.addClass( passwd1.val() !== passwd2.val() ? 'has-error' : 'has-success' )
|
||||
.removeClass( passwd1.val() === passwd2.val() ? 'has-error' : 'has-success' );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
nomatch.css("display","none");
|
||||
}
|
||||
|
||||
var shortpwd = $('#labelPasswordTooShort');
|
||||
|
||||
if (passwd1.val().length > 0 && passwd1.val().length < 8) {
|
||||
shortpwd.css("display","block");
|
||||
shortpwd.css("color","red");
|
||||
labelPwd1.addClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' )
|
||||
.removeClass(passwd1.val().length < 8 ? 'has-error' : 'has-success' );
|
||||
labelPwd2.addClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' )
|
||||
.removeClass(passwd2.val().length < 8 ? 'has-error' : 'has-success' );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
shortpwd.css("display","none");
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$( "#country" ).change(function() {
|
||||
$.ajax({
|
||||
url: "${findState}" ,
|
||||
type: 'POST',
|
||||
datatype:'json',
|
||||
data: {
|
||||
countryName: $("#country").val()
|
||||
},
|
||||
success: function(data){
|
||||
var content= JSON.parse(data);
|
||||
$('#state').html('');// to clear the previous option
|
||||
$.each(content, function(i, state) {
|
||||
$('#state').append($('<option>').text(state.name).attr('value', state.stateId));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<b>Change the Country State Change By Ajax</b> <br><br>
|
||||
Country:
|
||||
<select id="country" name="country">
|
||||
<option value="select">Select Country</option>
|
||||
<option value="india">India</option>
|
||||
<option value="usa">USA</option>
|
||||
</select>
|
||||
|
||||
<br><br>
|
||||
State:
|
||||
<select id="state" name="state">
|
||||
</select>
|
||||
<h1>
|
||||
Hello
|
||||
<c:out escapeXml="true" value="${invitedUser.firstName}" />!<br>
|
||||
|
@ -47,8 +120,41 @@ $( "#country" ).change(function() {
|
|||
Virtual Research Environment.
|
||||
<c:choose>
|
||||
<c:when test="${empty invitedUser}">
|
||||
var1 is empty or null.landingPage
|
||||
<br />
|
||||
<span style="font-style: italic;">Please note</span>: the invite is valid for your email <a
|
||||
href="mailto:<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />">
|
||||
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
||||
</a> only. To accept the invite, please fill in the information below:
|
||||
<br />
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<fieldset>
|
||||
<label>Email (Not editable)</label> <input type="text" name="email"
|
||||
value="${inviteInstance.invitedEmail}" readonly style="color: #999;"/>
|
||||
<label id="labelFirstName">First Name (Required)</label>
|
||||
<input type="text" id="firstname" />
|
||||
<label id="labelLastName">Last Name (Required)</label>
|
||||
<input type="text" id="lastname" />
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<fieldset>
|
||||
<label id="labelPwd1">Password</label>
|
||||
<input type="password" id="password" />
|
||||
<label id="labelPwd2">Confirm Password</label>
|
||||
<input type="password" id="repassword"/>
|
||||
<label style="display: none" id="labelPasswordDontMatch">Passwords don't match</label>
|
||||
<label style="display: none" id="labelPasswordTooShort">Passwords must be at least 8 chars length</label>
|
||||
<div style="margin-top: 20px;">
|
||||
<button class="btn-primary btn-large" type="button" id="createAccountButton">Continue</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
This invite is valid for your email <a
|
||||
|
@ -56,9 +162,16 @@ $( "#country" ).change(function() {
|
|||
<c:out escapeXml="true" value="${inviteInstance.invitedEmail}" />
|
||||
</a> 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");%>
|
||||
<p class="lead">
|
||||
<button class="btn btn-large btn-primary" onclick="window.location.href='<%= exploreURL %>'" type="button">Go to <c:out escapeXml="true" value="${vreName}" /></button>
|
||||
<%
|
||||
String exploreURL = request.getAttribute("landingPage") + "/explore?" + InvitesManager.SITEID_ATTR
|
||||
+ "=" + request.getAttribute("groupId");
|
||||
%>
|
||||
<p class="lead">
|
||||
<button class="btn btn-large btn-primary"
|
||||
onclick="window.location.href='<%=exploreURL%>'" type="button">
|
||||
Accept invite on
|
||||
<c:out escapeXml="true" value="${vreName}" />
|
||||
</button>
|
||||
</p>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
@ -67,20 +180,3 @@ $( "#country" ).change(function() {
|
|||
|
||||
<br>
|
||||
<c:out escapeXml="true" value="${inviteInstance} " />
|
||||
|
||||
|
||||
<b>Change the Country State Change By Ajax</b>
|
||||
<br>
|
||||
<br>
|
||||
Country:
|
||||
<select id="country" name="country">
|
||||
<option value="select">Select Country</option>
|
||||
<option value="india">India</option>
|
||||
<option value="usa">USA</option>
|
||||
</select>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
State:
|
||||
<select id="state" name="state">
|
||||
</select>
|
|
@ -0,0 +1,6 @@
|
|||
.has-error {
|
||||
color: red !important;
|
||||
}
|
||||
.has-success {
|
||||
color: green !important;
|
||||
}
|
Loading…
Reference in New Issue