Corrections :
Choose conference (re)marche ... merci de ne plus faire de modifs du genre de la suppression de AddOrUpdatePreference sans en discuter avec les personnes concernées Correction de submitArticle quand aucun fichier n'est envoyé Autres modifications mineures
This commit is contained in:
@@ -97,6 +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.submitArticle.noFile=You have to send the file of the article.
|
||||||
form.addConference.invitationsHeader=Invitations
|
form.addConference.invitationsHeader=Invitations
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
|
||||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||||
<%@ taglib prefix="authz" uri="http://acegisecurity.org/authz" %>
|
<%@ taglib prefix="authz" uri="http://acegisecurity.org/authz" %>
|
||||||
|
|||||||
@@ -8,11 +8,9 @@
|
|||||||
|
|
||||||
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
<h4 class="title"><fmt:message key="preference.title" /></h4>
|
||||||
|
|
||||||
<c:if test="${message}">
|
|
||||||
<fmt:message key="message"/>
|
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<form:form method="post" commandName="choosePreference">
|
<form:form method="post" commandName="choosePreference">
|
||||||
|
<spring:message var="message"/>
|
||||||
<c:if test="${not empty articleList}">
|
<c:if test="${not empty articleList}">
|
||||||
<table>
|
<table>
|
||||||
<c:forEach items="${articleList}" var="article" varStatus="i">
|
<c:forEach items="${articleList}" var="article" varStatus="i">
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
||||||
<form:label path="title"><fmt:message key="form.submission.article.title" /></form:label> <form:input path="title"/> <font color="red"><form:errors path="title"/></font> <br/><br />
|
<form:label path="title"><fmt:message key="form.submission.article.title" /></form:label> <form:input path="title"/> <span class="formError"><form:errors path="title"/></span> <br/><br />
|
||||||
|
|
||||||
<form:label path="theme"><fmt:message key="form.submission.article.theme" /></form:label> <form:input path="theme"/> <font color="red"><form:errors path="theme"/></font><br/><br />
|
<form:label path="theme"><fmt:message key="form.submission.article.theme" /></form:label> <form:input path="theme"/> <span class="formError"><form:errors path="theme"/></span><br/><br />
|
||||||
|
|
||||||
<form:label path="abstractText"><fmt:message key="form.submission.article.abstractText" /></form:label> <form:textarea path="abstractText" /><font color="red"><form:errors path="abstractText"/></font><br/><br/>
|
<form:label path="abstractText"><fmt:message key="form.submission.article.abstractText" /></form:label> <form:textarea path="abstractText" /><span class="formError"><form:errors path="abstractText"/></span><br/><br/>
|
||||||
|
|
||||||
<hr/> <br/>
|
<hr/> <br/>
|
||||||
|
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<br />
|
<br />
|
||||||
|
<div class="formError"><form:errors path="file"/></div>
|
||||||
File <input type="file" name="file"/>
|
File <input type="file" name="file"/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,19 +44,16 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
|
|
||||||
getServletContext().setAttribute("articleList", articleList);
|
getServletContext().setAttribute("articleList", articleList);
|
||||||
|
|
||||||
|
User currentUser = SessionService.getInstance().getCurrentUser();
|
||||||
// TODO : mock object, replace with real user management
|
// TODO : mock object, replace with real user management
|
||||||
User toto = userManager.getUser("toto");
|
|
||||||
if(toto == null){
|
|
||||||
toto = userManager.addUser("toto",User.hashPassword("toto"), "Toto", "Toto", "Toto corp.", "toto@totocorp.com");
|
|
||||||
}
|
|
||||||
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
||||||
Preference pref;
|
Preference pref;
|
||||||
for(Article article : articleList){
|
for(Article article : articleList){
|
||||||
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), toto.getLogin());
|
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), currentUser.getLogin());
|
||||||
if(pref == null){
|
if(pref == null){
|
||||||
pref = new Preference();
|
pref = new Preference();
|
||||||
pref.setArticle(article);
|
pref.setArticle(article);
|
||||||
pref.setPcMember(toto);
|
pref.setPcMember(currentUser);
|
||||||
pref.setPreferenceType(Preference.PreferenceType.INDIFFERENT);
|
pref.setPreferenceType(Preference.PreferenceType.INDIFFERENT);
|
||||||
}
|
}
|
||||||
preferencesList.add(pref);
|
preferencesList.add(pref);
|
||||||
@@ -78,15 +75,17 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
List<Preference> listPreference=fp.getPreferences();
|
List<Preference> listPreference=fp.getPreferences();
|
||||||
|
|
||||||
for(Preference preference : listPreference){
|
for(Preference preference : listPreference){
|
||||||
articleManager.addPreference(preference.getArticle().getId(),
|
articleManager.addOrUpdatePreference(preference.getArticle().getId(),
|
||||||
preference.getPcMember().getLogin(),
|
preference.getPcMember().getLogin(),
|
||||||
preference.getPreferenceType());
|
preference.getPreferenceType());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> model = new HashMap<String, String>();
|
Map<String, String> model = new HashMap<String, String>();
|
||||||
model.put("message", "preference.ok");
|
model.put("message", "preference.ok");
|
||||||
return new ModelAndView(new RedirectView(getSuccessView()), model);
|
return new ModelAndView(new RedirectView(getSuccessView()), "model", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IArticleManager getArticleManager() {
|
public IArticleManager getArticleManager() {
|
||||||
return articleManager;
|
return articleManager;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.yacos.core.article.Preference;
|
|||||||
|
|
||||||
public class FormPreference {
|
public class FormPreference {
|
||||||
private List<Preference> preferences = new ArrayList<Preference>();
|
private List<Preference> preferences = new ArrayList<Preference>();
|
||||||
|
private String successMessage;
|
||||||
|
|
||||||
public List<Preference> getPreferences()
|
public List<Preference> getPreferences()
|
||||||
{
|
{
|
||||||
@@ -19,4 +20,12 @@ public class FormPreference {
|
|||||||
{
|
{
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSuccessMessage() {
|
||||||
|
return successMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessMessage(String successMessage) {
|
||||||
|
this.successMessage = successMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
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.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
@@ -59,14 +57,23 @@ public class SArticleController extends SimpleFormController {
|
|||||||
listSecondaryAuthor, Article.State.SUMMARY, conf.getId());
|
listSecondaryAuthor, Article.State.SUMMARY, conf.getId());
|
||||||
|
|
||||||
if(newArticle==null){
|
if(newArticle==null){
|
||||||
return new ModelAndView(new RedirectView(getFormView()));
|
errors.reject("article.errors.didNotSave");
|
||||||
|
try {
|
||||||
|
return showForm(request, response, errors);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MultipartFile file = ((FormSubmission) command).getFile();
|
MultipartFile file = ((FormSubmission) command).getFile();
|
||||||
if (file == null) {
|
if (file == null || file.isEmpty()) {
|
||||||
errors.rejectValue("file", "form.submitArticle.noFile");
|
errors.rejectValue("file", "form.submitArticle.noFile");
|
||||||
return new ModelAndView(new RedirectView(getFormView()));
|
try {
|
||||||
|
return showForm(request, response, errors);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,11 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
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.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;
|
||||||
@@ -34,8 +31,6 @@ import org.yacos.web.chairman.validation.ConferenceValidator;
|
|||||||
import org.yacos.web.system.controller.MailSenderService;
|
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());
|
||||||
|
|||||||
Reference in New Issue
Block a user