Quelques corrections supplementaires

MailSenderService : plus de lancement d'exception, simple log
This commit is contained in:
2008-02-25 20:07:26 +00:00
parent 6d4b6b3e79
commit c3258fe818
7 changed files with 46 additions and 6 deletions

View File

@@ -71,7 +71,7 @@
<td width="7%">Show</td>
<td width="93%"><input id="register" type="checkbox" name="register" value="Register" onchange="ShowRegistered()" checked="checked"> Conference you are registered in<br />
<input id="notregister" type="checkbox" name="notregister" value="NotRegister" onchange="ShowNotRegistered()" checked="checked"> Conference you are not registered in<br />
<input id="ongoing" type="checkbox" name="ongoing" value="Ongoing" onchange="ShowOngoing()"> Only ongoing conferences<br />
<input id="ongoing" type="checkbox" name="ongoing" value="Upcoming" onchange="ShowOngoing()" checked="checked"> Only upcoming conferences<br />
</td>
</tr>
</table>
@@ -87,7 +87,7 @@
<c:when test="${varName == 'true'}">
<c:choose>
<c:when test="${conference.currentPhase == 'PAST'}">
<div class="conferenceBloc cbb isRegistered confPast">
<div class="conferenceBloc cbb isRegistered confPast" style="display:none;height:0px;width:0px;">
<h2>
${conference.title} - In this conference you are:
<c:forEach items="${listRole}" var="role">

View File

@@ -19,7 +19,9 @@ import org.yacos.core.users.IUserManager;
import org.yacos.core.users.Speciality;
import org.yacos.core.users.User;
import org.yacos.core.users.Role.RoleType;
import org.yacos.web.system.controller.MailSenderService;
import org.yacos.web.system.session.SessionService;
import org.yacos.web.system.session.YACOSUtils;
public class DelegateArticleController implements Controller{
@@ -163,6 +165,14 @@ public class DelegateArticleController implements Controller{
articleManager.delegateArticleToReferee(articleId, refereeId,memberId);
if(!userManager.hasRoleForConference(refereeId, RoleType.REFEREE, conf.getId())){
conferenceManager.addRole(RoleType.REFEREE, refereeId, conf.getId());
// Send an email to the referee
String mailSubject = "YACOS : you asked to review an article for a conference";
String mailBody = "A member of the new conference "+SessionService.getInstance().getCurrentConference().getTitle();
mailBody += " has added you to the Program Committee\n";
mailBody += "You will be able to view, evaluate or delegate the evaluation of the articles that will be submitted\n";
mailBody += YACOSUtils.fullURL("userBoard.htm");
User user = userManager.getUser(refereeId);
MailSenderService.getInstance().sendEMail(user.getEmail(), mailSubject, mailBody);
}
}
logger.info("add referee to article");

View File

@@ -91,6 +91,13 @@ public class EvaluationController extends SimpleFormController {
}
}
listarticles = articleManager.getArticlesOfReferee(memberId);
for (Article article : listarticles) {
if(article.getId() == Integer.parseInt(articleId)){
haveArticle = true;
}
}
if(!haveArticle){
throw new ModelAndViewDefiningException(new ModelAndView("denied"));
}

View File

@@ -461,6 +461,14 @@ public class AddConferenceController extends AbstractWizardFormController {
conferenceManager.addPCMemberToConference(
conf.getId(),
personBean.getLogin());
// Send an email to the pc member
String mailSubject = "YACOS : you have been added to the program committee of a new conference";
String mailBody = "The chairman of the new conference "+conference.getTitle();
mailBody += " has added you to the Program Committee\n";
mailBody += "You will be able to view, evaluate or delegate the evaluation of the articles that will be submitted\n";
mailBody += YACOSUtils.fullURL("userBoard.htm");
User user = userManager.getUser(personBean.getLogin());
MailSenderService.getInstance().sendEMail(user.getEmail(), mailSubject, mailBody);
}
String mailSubject = "YACOS "+conf.getTitle()+" invitation";

View File

@@ -1,9 +1,13 @@
package org.yacos.web.system.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
public class MailSenderService {
protected final Log logger = LogFactory.getLog(getClass());
public static MailSenderService instance = new MailSenderService();
private MailSender mailSender;
private String fromEmail;
@@ -22,7 +26,11 @@ public class MailSenderService {
public void sendEMail(String toEmail, String subject, String body){
SimpleMailMessage message = composeEmail(toEmail, fromEmail, subject, body, replyTo, null, null);
mailSender.send(message);
try {
mailSender.send(message);
} catch (Exception e) {
logger.warn("Could not send email to "+toEmail,e);
}
}
public SimpleMailMessage composeEmail(String toEmail, String fromEmail, String subject, String body){

View File

@@ -54,6 +54,12 @@ public class SUserRegistrationController extends SimpleFormController {
userCommand.getLastName(),
userCommand.getOrganization(),
userCommand.getEmail());
String mailSubject = "YACOS : Registration successful";
String mailBody = "Your account "+userCommand.getLogin();
mailBody += " has been successfully created.\n";
mailBody += "You can now log in the YACOS System";
MailSenderService.getInstance().sendEMail(userCommand.getEmail(),
mailSubject, mailBody);
SessionService.getInstance().authenticate(
userCommand.getLogin(),
userCommand.getPassword());

View File

@@ -26,10 +26,11 @@ public class YACOSUtils {
public static String fullURL(String path) {
HttpServletRequest request = SessionService.request;
String resource = path;
if(! resource.substring(0, 1).equals("/")){
resource = "/"+resource;
String resource = request.getContextPath();
if(! path.substring(0, 1).equals("/")){
path = "/"+path;
}
resource += path;
try {
URL url = new URL(request.getScheme(),