Ajout du service d'envoi d'email
Mise en place des invitations dans creer conf Mise en place de proprietés de config pour Servlet-config.xml Ajout des listes dynamiques dans le CSS
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
download.dir.path=../server/default/data/uploadedFiles/
|
download.dir.path=../server/default/data/uploadedFiles/
|
||||||
|
mailService.fromEmailAddress=system@yacos.dreamhosters.com
|
||||||
|
mailService.replyToEmailAddress=no-reply@yacos.dreamhosters.com
|
||||||
@@ -97,7 +97,7 @@ form.submission.listauthor=Article's author
|
|||||||
form.submission.mainauthor=Main author
|
form.submission.mainauthor=Main author
|
||||||
form.submission.secondaryauthor=Secondary authors
|
form.submission.secondaryauthor=Secondary authors
|
||||||
form.submission.file=File
|
form.submission.file=File
|
||||||
|
form.addConference.invitationsHeader=Invitations
|
||||||
|
|
||||||
|
|
||||||
button.add=Add
|
button.add=Add
|
||||||
@@ -162,7 +162,7 @@ submissionArticle.file=please choose an article to submit
|
|||||||
|
|
||||||
#valider les articles
|
#valider les articles
|
||||||
validate.download=download the article
|
validate.download=download the article
|
||||||
validate.report=consulter the result of the evaluation
|
validate.report=View the result of the evaluation
|
||||||
validate.validate=validate
|
validate.validate=validate
|
||||||
validate.reject=reject
|
validate.reject=reject
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
<script type='text/javascript' src='./dwr/util.js'></script>
|
<script type='text/javascript' src='./dwr/util.js'></script>
|
||||||
<script type='text/javascript' src='./dwr/interface/AddCriteriaJS.js'></script>
|
<script type='text/javascript' src='./dwr/interface/AddCriteriaJS.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
||||||
|
<script type='text/javascript' src='./javascripts/yacos/addConference_invitation.js'></script>
|
||||||
|
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
@@ -81,15 +83,6 @@ function addPerson(eleid) {
|
|||||||
dwr.engine.endBatch();
|
dwr.engine.endBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInvitation() {
|
|
||||||
var email = $("emailAddress").value;
|
|
||||||
dwr.engine.beginBatch();
|
|
||||||
AddCriteriaJS.addInvitation(email);
|
|
||||||
fillTable();
|
|
||||||
fillTable2();
|
|
||||||
dwr.engine.endBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
function deletePerson(eleid) {
|
function deletePerson(eleid) {
|
||||||
var person = peopleCache2[eleid.substring(11)];
|
var person = peopleCache2[eleid.substring(11)];
|
||||||
if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
|
if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
|
||||||
@@ -153,11 +146,6 @@ function filterUser(el, value) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br />
|
|
||||||
<fmt:message key="invitation.send"/> <br/>
|
|
||||||
Mail: <input id="emailAddress" type="text"/> <a id="invitationEmail" href="#" onclick="addInvitation()" >Invite</a>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
<br />
|
||||||
<table border="1" id="tableNameAdded" style="display: none;">
|
<table border="1" id="tableNameAdded" style="display: none;">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -176,6 +164,17 @@ function filterUser(el, value) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<fmt:message key="invitation.send"/> <br/>
|
||||||
|
Mail: <input id="emailAddress" type="text"/> <input type="button" name="inviteButton" id="inviteButton" value="Invite"/>
|
||||||
|
|
||||||
|
<div id="invitationList" class="dynamicList">
|
||||||
|
<div class="dynamicListHeader">
|
||||||
|
<fmt:message key="form.addConference.invitationsHeader" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="button" id="removeInvitationButton" name="removeInvitation" value="<fmt:message key="button.removeSelected" />"/>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<input type="submit" align="middle" name="_target3" value="Back">
|
<input type="submit" align="middle" name="_target3" value="Back">
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
<c:if test="${message}">
|
<c:if test="${message}">
|
||||||
<fmt:message key="message"/>
|
<fmt:message key="message"/>
|
||||||
huhu
|
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<form:form method="post" commandName="choosePreference">
|
<form:form method="post" commandName="choosePreference">
|
||||||
@@ -23,11 +22,11 @@ huhu
|
|||||||
<form:hidden path="preferences[${i.index}].article.id" />
|
<form:hidden path="preferences[${i.index}].article.id" />
|
||||||
<form:hidden path="preferences[${i.index}].pcMember.login" />
|
<form:hidden path="preferences[${i.index}].pcMember.login" />
|
||||||
<td><fmt:message key="preference.like"/></td>
|
<td><fmt:message key="preference.like"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Like"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="LIKE"/></td>
|
||||||
<td><fmt:message key="preference.indifferent"/></td>
|
<td><fmt:message key="preference.indifferent"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Indifferent"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="INDIFFERENT"/></td>
|
||||||
<td><fmt:message key="preference.dislike"/></td>
|
<td><fmt:message key="preference.dislike"/></td>
|
||||||
<td><form:radiobutton path="preferences[${i.index}].preference" value="Dislike"/></td>
|
<td><form:radiobutton path="preferences[${i.index}].preferenceType" value="DISLIKE"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -5,78 +5,7 @@
|
|||||||
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
||||||
<style type="text/css">
|
<script type='text/javascript' src='./javascripts/yacos/submissionArticle.js'></script>
|
||||||
.dynamicList {
|
|
||||||
display: table;
|
|
||||||
border-collapse: collapse;
|
|
||||||
min-width: 200px;
|
|
||||||
max-height: 200px;
|
|
||||||
overflow: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dynamicList > * {
|
|
||||||
display: table-row;
|
|
||||||
border: thin solid #f57627;
|
|
||||||
padding:3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dynamicListHeader {
|
|
||||||
background-color: #f57627;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected {
|
|
||||||
background-color: #fea752;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script language="JavaScript">
|
|
||||||
|
|
||||||
var SecondaryAuthorManager = Class.create({
|
|
||||||
lastRef: 0,
|
|
||||||
initialize: function(buttonAdd,buttonRemove,inputField){
|
|
||||||
this.buttonAdd = buttonAdd;
|
|
||||||
this.buttonRemove = buttonRemove;
|
|
||||||
this.inputField = inputField;
|
|
||||||
$(buttonAdd).observe("click",this.AddSecondaryAuthor.bind(this));
|
|
||||||
$(buttonRemove).observe("click",this.RemoveSecondaryAuthor.bind(this));
|
|
||||||
$(inputField).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
|
|
||||||
},
|
|
||||||
SelectSecondaryAuthor: function(event){
|
|
||||||
var item = event.element();
|
|
||||||
if(item.hasClassName('selected')){
|
|
||||||
item.removeClassName('selected');
|
|
||||||
} else {
|
|
||||||
item.addClassName('selected');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RemoveSecondaryAuthor: function() {
|
|
||||||
var itemsToRemove = $('secondaryAuthorList').select('div.selected');
|
|
||||||
itemsToRemove.invoke('remove');
|
|
||||||
},
|
|
||||||
KeyPressHandler: function(event){
|
|
||||||
switch(event.keyCode){
|
|
||||||
case Event.KEY_RETURN:
|
|
||||||
this.AddSecondaryAuthor();
|
|
||||||
event.stop();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AddSecondaryAuthor: function() {
|
|
||||||
var ref = this.lastRef++;
|
|
||||||
var elemName = "liste["+ref+"]";
|
|
||||||
var value = $('newSecondaryAuthorInput').value;
|
|
||||||
var hidden = new Element('input',{'id':elemName,'name':elemName,'type':'hidden','value':value});
|
|
||||||
var elem = new Element('div',
|
|
||||||
{ 'class':'dynamicListItem',
|
|
||||||
'style':'display:none;height:0px;width:0px;',
|
|
||||||
'id':elemName}).update(value).insert(hidden);
|
|
||||||
elem.observe('click', this.SelectSecondaryAuthor.bindAsEventListener());
|
|
||||||
$('secondaryAuthorList').insert(elem);
|
|
||||||
$(this.inputField).clear();
|
|
||||||
Effect.Appear(elemName);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -110,10 +39,6 @@ var SecondaryAuthorManager = Class.create({
|
|||||||
</div>
|
</div>
|
||||||
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />"/>
|
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />"/>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
new SecondaryAuthorManager('addSecondaryButton','removeSecondaryButton','newSecondaryAuthorInput');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
@@ -213,6 +213,7 @@
|
|||||||
<property name="conferenceManager" ref="conferenceManager" />
|
<property name="conferenceManager" ref="conferenceManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<bean id="ListEvaluationController"
|
<bean id="ListEvaluationController"
|
||||||
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
@@ -287,6 +288,17 @@
|
|||||||
<property name="userManager" ref="userManager" />
|
<property name="userManager" ref="userManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
|
||||||
|
<property name="host" value="smtp.univ-lille1.fr"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mailSenderService"
|
||||||
|
class="org.yacos.web.system.controller.MailSenderService" factory-method="getInstance">
|
||||||
|
<property name="mailSender" ref="mailSender"/>
|
||||||
|
<property name="fromEmail" value="${mailService.fromEmailAddress}" />
|
||||||
|
<property name="replyTo" value="${mailService.replyToEmailAddress}" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- EJB Services Linking -->
|
<!-- EJB Services Linking -->
|
||||||
<jee:jndi-lookup id="articleManager"
|
<jee:jndi-lookup id="articleManager"
|
||||||
jndi-name="ArticleManagerBean/remote" cache="true" />
|
jndi-name="ArticleManagerBean/remote" cache="true" />
|
||||||
|
|||||||
BIN
YACOSWeb/WebContent/images/menu-header-background-repeat.png
Normal file
BIN
YACOSWeb/WebContent/images/menu-header-background-repeat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 B |
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
var InvitationsManager = Class.create({
|
||||||
|
initialize: function(buttonAdd,buttonRemove,inputField){
|
||||||
|
this.buttonAdd = buttonAdd;
|
||||||
|
this.buttonRemove = buttonRemove;
|
||||||
|
this.inputField = inputField;
|
||||||
|
$(buttonAdd).observe("click",this.addRemote.bind(this));
|
||||||
|
$(buttonRemove).observe("click",this.removeRemote.bind(this));
|
||||||
|
$(inputField).observe("keypress", this.keyPressHandler.bindAsEventListener(this));
|
||||||
|
},
|
||||||
|
select: function(event){
|
||||||
|
var item = event.element();
|
||||||
|
if(item.hasClassName('selected')){
|
||||||
|
item.removeClassName('selected');
|
||||||
|
} else {
|
||||||
|
item.addClassName('selected');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeRemote: function() {
|
||||||
|
var itemsToRemove = $('invitationList').select('div.selected');
|
||||||
|
var emailList = itemsToRemove.pluck('id');
|
||||||
|
AddCriteriaJS.removeInvitations(emailList,this.remove.bind(this));
|
||||||
|
},
|
||||||
|
remove: function() {
|
||||||
|
var itemsToRemove = $('invitationList').select('div.selected');
|
||||||
|
itemsToRemove.invoke('remove');
|
||||||
|
},
|
||||||
|
keyPressHandler: function(event){
|
||||||
|
switch(event.keyCode){
|
||||||
|
case Event.KEY_RETURN:
|
||||||
|
this.addRemote();
|
||||||
|
event.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addRemote: function(){
|
||||||
|
var value = $(this.inputField).value;
|
||||||
|
AddCriteriaJS.addInvitation(value,function(success){
|
||||||
|
if(success){
|
||||||
|
this.add(value);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
add: function(email) {
|
||||||
|
var elem = new Element('div',
|
||||||
|
{ 'class':'dynamicListItem',
|
||||||
|
'style':'display:none;height:0px;width:0px;',
|
||||||
|
'id':email}).update(email);
|
||||||
|
$('invitationList').insert(elem);
|
||||||
|
elem.observe('click', this.select.bindAsEventListener());
|
||||||
|
elem.appear();
|
||||||
|
},
|
||||||
|
refreshList: function(){
|
||||||
|
AddCriteriaJS.getInvitations(function(emailList){
|
||||||
|
this.removeAll();
|
||||||
|
emailList.each(this.add.bind(this));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeAll: function(){
|
||||||
|
var itemsToRemove = $('invitationList').select('div.dynamicListItem');
|
||||||
|
itemsToRemove.invoke('remove');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Event.observe(window,'load', function(){
|
||||||
|
new InvitationsManager('inviteButton','removeInvitationButton','emailAddress')});
|
||||||
54
YACOSWeb/WebContent/javascripts/yacos/submissionArticle.js
Normal file
54
YACOSWeb/WebContent/javascripts/yacos/submissionArticle.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
var SecondaryAuthorManager = Class.create({
|
||||||
|
lastRef: 0,
|
||||||
|
initialize: function(buttonAdd,buttonRemove,inputField){
|
||||||
|
this.buttonAdd = buttonAdd;
|
||||||
|
this.buttonRemove = buttonRemove;
|
||||||
|
this.inputField = inputField;
|
||||||
|
$(buttonAdd).observe("click",this.AddSecondaryAuthor.bind(this));
|
||||||
|
$(buttonRemove).observe("click",this.RemoveSecondaryAuthor.bind(this));
|
||||||
|
$(inputField).observe("keypress", this.KeyPressHandler.bindAsEventListener(this));
|
||||||
|
},
|
||||||
|
SelectSecondaryAuthor: function(event){
|
||||||
|
var item = event.element();
|
||||||
|
if(item.hasClassName('selected')){
|
||||||
|
item.removeClassName('selected');
|
||||||
|
} else {
|
||||||
|
item.addClassName('selected');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
RemoveSecondaryAuthor: function() {
|
||||||
|
var itemsToRemove = $('secondaryAuthorList').select('div.selected');
|
||||||
|
// Fade and remove
|
||||||
|
itemsToRemove.invoke('fade',{
|
||||||
|
afterFinish: function(obj){
|
||||||
|
obj.element.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
KeyPressHandler: function(event){
|
||||||
|
switch(event.keyCode){
|
||||||
|
case Event.KEY_RETURN:
|
||||||
|
this.AddSecondaryAuthor();
|
||||||
|
event.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
AddSecondaryAuthor: function() {
|
||||||
|
var ref = this.lastRef++;
|
||||||
|
var elemName = "liste["+ref+"]";
|
||||||
|
var value = $('newSecondaryAuthorInput').value;
|
||||||
|
var hidden = new Element('input',{'id':elemName,'name':elemName,'type':'hidden','value':value});
|
||||||
|
var elem = new Element('div',
|
||||||
|
{ 'class':'dynamicListItem',
|
||||||
|
'style':'display:none;height:0px;width:0px;',
|
||||||
|
'id':elemName}).update(value).insert(hidden);
|
||||||
|
elem.observe('click', this.SelectSecondaryAuthor.bindAsEventListener());
|
||||||
|
$('secondaryAuthorList').insert(elem);
|
||||||
|
$(this.inputField).clear();
|
||||||
|
elem.appear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Event.observe(window,'load', function(){
|
||||||
|
new SecondaryAuthorManager('addSecondaryButton','removeSecondaryButton','newSecondaryAuthorInput')});
|
||||||
@@ -251,3 +251,31 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
||||||
|
|
||||||
|
/* @group dynamicList */
|
||||||
|
.dynamicList {
|
||||||
|
display: table;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 3px;
|
||||||
|
min-width: 200px;
|
||||||
|
min-height: 40px;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dynamicList > * {
|
||||||
|
display: table-row;
|
||||||
|
border: thin solid #f57627;
|
||||||
|
padding:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dynamicListHeader {
|
||||||
|
background-image: url(../images/menu-header-background-repeat.png);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
height: 23px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
background-color: #fea752;
|
||||||
|
}
|
||||||
|
/* @end */
|
||||||
@@ -6,12 +6,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.acegisecurity.util.UrlUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.mail.MailSendException;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
|
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
|
||||||
@@ -19,13 +25,17 @@ import org.yacos.core.conferences.Conference;
|
|||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.evaluation.Criterion;
|
import org.yacos.core.evaluation.Criterion;
|
||||||
import org.yacos.core.evaluation.IEvaluationManager;
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
|
import org.yacos.core.exceptions.ConferenceDoesntExistException;
|
||||||
import org.yacos.core.users.IUserManager;
|
import org.yacos.core.users.IUserManager;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
import org.yacos.core.users.Role.RoleType;
|
import org.yacos.core.users.Role.RoleType;
|
||||||
import org.yacos.web.chairman.form.FormConference;
|
import org.yacos.web.chairman.form.FormConference;
|
||||||
import org.yacos.web.chairman.validation.ConferenceValidator;
|
import org.yacos.web.chairman.validation.ConferenceValidator;
|
||||||
|
import org.yacos.web.system.controller.MailSenderService;
|
||||||
import org.yacos.web.system.session.SessionService;
|
import org.yacos.web.system.session.SessionService;
|
||||||
|
|
||||||
|
import com.sun.mail.smtp.SMTPAddressFailedException;
|
||||||
|
|
||||||
public class AddConferenceController extends AbstractWizardFormController {
|
public class AddConferenceController extends AbstractWizardFormController {
|
||||||
|
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
@@ -62,6 +72,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
private List<PersonBean> listPersonBean;
|
private List<PersonBean> listPersonBean;
|
||||||
private List<PersonBean> listPersonFiltered;
|
private List<PersonBean> listPersonFiltered;
|
||||||
private List<PersonBean> listPersonAdded;
|
private List<PersonBean> listPersonAdded;
|
||||||
|
private List<String> listInvitations;
|
||||||
|
|
||||||
public void fillUser(String text) {
|
public void fillUser(String text) {
|
||||||
if (text.equals(""))
|
if (text.equals(""))
|
||||||
@@ -89,12 +100,6 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
listPersonFiltered.remove(truePerson);
|
listPersonFiltered.remove(truePerson);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInvitation(String email){
|
|
||||||
PersonBean invitationBean = new PersonBean();
|
|
||||||
invitationBean.setLogin(email);
|
|
||||||
listPersonAdded.add(invitationBean);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deletePerson(PersonBean b) {
|
public void deletePerson(PersonBean b) {
|
||||||
|
|
||||||
PersonBean truePerson = getTruePerson(b.getLogin());
|
PersonBean truePerson = getTruePerson(b.getLogin());
|
||||||
@@ -137,6 +142,30 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
return listPersonAdded;
|
return listPersonAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getInvitation(){
|
||||||
|
return listInvitations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addInvitation(String email){
|
||||||
|
email = email.toLowerCase();
|
||||||
|
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
||||||
|
Matcher emailMatcher = emailPattern.matcher(email);
|
||||||
|
|
||||||
|
if(!emailMatcher.matches()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
listInvitations.add(email);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeInvitations(List<String> emailList){
|
||||||
|
for(String email : emailList){
|
||||||
|
listInvitations.remove(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
|
|
||||||
@@ -220,9 +249,10 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
FormConference conference = new FormConference();
|
FormConference conference = new FormConference();
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals("")) {
|
if (action == null || action.equals(""))
|
||||||
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
{
|
||||||
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
||||||
|
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
||||||
|
|
||||||
criteria = new HashSet<CriterionBean>();
|
criteria = new HashSet<CriterionBean>();
|
||||||
criteriaAll = new HashSet<CriterionBean>();
|
criteriaAll = new HashSet<CriterionBean>();
|
||||||
@@ -249,6 +279,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
listPersonBean = new ArrayList<PersonBean>();
|
listPersonBean = new ArrayList<PersonBean>();
|
||||||
listPersonAdded = new ArrayList<PersonBean>();
|
listPersonAdded = new ArrayList<PersonBean>();
|
||||||
|
listInvitations = new ArrayList<String>();
|
||||||
listPersonFiltered = listPersonBean;
|
listPersonFiltered = listPersonBean;
|
||||||
List<User> listUsers = userManager.getUsers();
|
List<User> listUsers = userManager.getUsers();
|
||||||
for (User user : listUsers) {
|
for (User user : listUsers) {
|
||||||
@@ -309,6 +340,8 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
listPersonBean = new ArrayList<PersonBean>();
|
listPersonBean = new ArrayList<PersonBean>();
|
||||||
listPersonAdded = new ArrayList<PersonBean>();
|
listPersonAdded = new ArrayList<PersonBean>();
|
||||||
|
// Should get the invitation tokens and allow them to be removed
|
||||||
|
listInvitations = new ArrayList<String>();
|
||||||
listPersonFiltered = listPersonBean;
|
listPersonFiltered = listPersonBean;
|
||||||
List<User> listUsers = userManager.getUsers();
|
List<User> listUsers = userManager.getUsers();
|
||||||
for (User user : listUsers) {
|
for (User user : listUsers) {
|
||||||
@@ -393,6 +426,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals("")) {
|
if (action == null || action.equals("")) {
|
||||||
|
|
||||||
|
|
||||||
Conference conf = conferenceManager.addConference(
|
Conference conf = conferenceManager.addConference(
|
||||||
conference.getTitle(),
|
conference.getTitle(),
|
||||||
conference.getDescription(),
|
conference.getDescription(),
|
||||||
@@ -420,9 +454,32 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
personBean.getLogin());
|
personBean.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
String mailSubject = "YACOS "+conf.getTitle()+" invitation";
|
||||||
|
String mailBody = "Greetings,\n";
|
||||||
|
mailBody += "You've been invited to join the program comity of the conference :\n";
|
||||||
|
mailBody += conf.getTitle()+"/n";
|
||||||
|
mailBody += "You can register on this page : \n";
|
||||||
|
String baseUrl = request.getSession().getServletContext().getContextPath();
|
||||||
|
mailBody += baseUrl+"/registerUser.htm /n";
|
||||||
|
mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials.";
|
||||||
|
// TODO : use a template
|
||||||
|
for(String invitationEmail : listInvitations){
|
||||||
|
try {
|
||||||
|
conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId());
|
||||||
|
MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody);
|
||||||
|
} catch (ConferenceDoesntExistException e) {
|
||||||
|
// Should never happen
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (MailSendException e) {
|
||||||
|
// TODO : see what we can do about this
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
|
||||||
|
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
||||||
|
// Refresh the roles to take into account the chairman credentials
|
||||||
|
SessionService.getInstance().refreshAuthentication();
|
||||||
|
} else {
|
||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
conf.setTitle(conference.getTitle());
|
conf.setTitle(conference.getTitle());
|
||||||
conf.setDescription(conference.getDescription());
|
conf.setDescription(conference.getDescription());
|
||||||
@@ -452,7 +509,6 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conf.getId(),
|
conf.getId(),
|
||||||
personBean.getLogin());
|
personBean.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModelAndView("main");
|
return new ModelAndView("main");
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package org.yacos.web.system.controller;
|
||||||
|
|
||||||
|
import org.springframework.mail.MailSender;
|
||||||
|
import org.springframework.mail.SimpleMailMessage;
|
||||||
|
|
||||||
|
public class MailSenderService {
|
||||||
|
public static MailSenderService instance = new MailSenderService();
|
||||||
|
private MailSender mailSender;
|
||||||
|
private String fromEmail;
|
||||||
|
private String replyTo;
|
||||||
|
|
||||||
|
public MailSenderService(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MailSenderService getInstance(){
|
||||||
|
if(instance == null){
|
||||||
|
instance = new MailSenderService();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEMail(String toEmail, String subject, String body){
|
||||||
|
SimpleMailMessage message = composeEmail(toEmail, fromEmail, subject, body, replyTo, null, null);
|
||||||
|
mailSender.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleMailMessage composeEmail(String toEmail, String fromEmail, String subject, String body){
|
||||||
|
return composeEmail(toEmail, fromEmail, subject, body, fromEmail, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleMailMessage composeEmail(String toEmail, String fromEmail, String subject, String body, String replyTo, String cc, String bcc){
|
||||||
|
SimpleMailMessage mailMessage = new SimpleMailMessage();
|
||||||
|
|
||||||
|
mailMessage.setTo(toEmail);
|
||||||
|
mailMessage.setFrom(fromEmail);
|
||||||
|
mailMessage.setSubject(subject);
|
||||||
|
mailMessage.setText(body);
|
||||||
|
mailMessage.setReplyTo(replyTo);
|
||||||
|
if(cc!=null){
|
||||||
|
mailMessage.setCc(cc);
|
||||||
|
}
|
||||||
|
if(bcc != null){
|
||||||
|
mailMessage.setBcc(bcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromEmail() {
|
||||||
|
return fromEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromEmail(String fromEmail) {
|
||||||
|
this.fromEmail = fromEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReplyTo() {
|
||||||
|
return replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReplyTo(String replyTo) {
|
||||||
|
this.replyTo = replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMailSender(MailSender mailSender) {
|
||||||
|
this.mailSender = mailSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MailSender getMailSender() {
|
||||||
|
return mailSender;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -74,6 +74,15 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IConferenceManager getConferenceManager() {
|
public IConferenceManager getConferenceManager() {
|
||||||
|
if(conferenceManager == null){
|
||||||
|
Context context;
|
||||||
|
try {
|
||||||
|
context = new InitialContext();
|
||||||
|
conferenceManager = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
return conferenceManager;
|
return conferenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +91,15 @@ public class SessionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IUserManager getUserManager() {
|
public IUserManager getUserManager() {
|
||||||
|
if(userManager == null){
|
||||||
|
Context context;
|
||||||
|
try {
|
||||||
|
context = new InitialContext();
|
||||||
|
userManager = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
return userManager;
|
return userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class UserValidator implements Validator {
|
|||||||
|
|
||||||
// EMAIL VALIDATOR
|
// EMAIL VALIDATOR
|
||||||
public void validateEmail(String email, Errors errors){
|
public void validateEmail(String email, Errors errors){
|
||||||
|
email = email.toLowerCase();
|
||||||
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
||||||
Matcher emailMatcher = emailPattern.matcher(email);
|
Matcher emailMatcher = emailPattern.matcher(email);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user