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:
2008-02-12 12:34:04 +00:00
parent 1cc6b4ba22
commit 78edfde2aa
8 changed files with 36 additions and 25 deletions

View File

@@ -97,6 +97,7 @@ form.submission.listauthor=Article's author
form.submission.mainauthor=Main author
form.submission.secondaryauthor=Secondary authors
form.submission.file=File
form.submitArticle.noFile=You have to send the file of the article.
form.addConference.invitationsHeader=Invitations

View File

@@ -1,4 +1,5 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ 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" %>

View File

@@ -8,11 +8,9 @@
<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}">
<table>
<c:forEach items="${articleList}" var="article" varStatus="i">

View File

@@ -14,11 +14,11 @@
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
<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/>
@@ -44,6 +44,7 @@
<hr />
<fieldset>
<br />
<div class="formError"><form:errors path="file"/></div>
File <input type="file" name="file"/>

View File

@@ -44,19 +44,16 @@ public class ChoosePreferenceController extends SimpleFormController {
getServletContext().setAttribute("articleList", articleList);
User currentUser = SessionService.getInstance().getCurrentUser();
// 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>();
Preference pref;
for(Article article : articleList){
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), toto.getLogin());
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), currentUser.getLogin());
if(pref == null){
pref = new Preference();
pref.setArticle(article);
pref.setPcMember(toto);
pref.setPcMember(currentUser);
pref.setPreferenceType(Preference.PreferenceType.INDIFFERENT);
}
preferencesList.add(pref);
@@ -78,15 +75,17 @@ public class ChoosePreferenceController extends SimpleFormController {
List<Preference> listPreference=fp.getPreferences();
for(Preference preference : listPreference){
articleManager.addPreference(preference.getArticle().getId(),
articleManager.addOrUpdatePreference(preference.getArticle().getId(),
preference.getPcMember().getLogin(),
preference.getPreferenceType());
}
Map<String, String> model = new HashMap<String, String>();
model.put("message", "preference.ok");
return new ModelAndView(new RedirectView(getSuccessView()), model);
return new ModelAndView(new RedirectView(getSuccessView()), "model", model);
}
public IArticleManager getArticleManager() {
return articleManager;

View File

@@ -9,6 +9,7 @@ import org.yacos.core.article.Preference;
public class FormPreference {
private List<Preference> preferences = new ArrayList<Preference>();
private String successMessage;
public List<Preference> getPreferences()
{
@@ -19,4 +20,12 @@ public class FormPreference {
{
this.preferences = preferences;
}
public String getSuccessMessage() {
return successMessage;
}
public void setSuccessMessage(String successMessage) {
this.successMessage = successMessage;
}
}

View File

@@ -5,11 +5,9 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
@@ -59,14 +57,23 @@ public class SArticleController extends SimpleFormController {
listSecondaryAuthor, Article.State.SUMMARY, conf.getId());
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 {
MultipartFile file = ((FormSubmission) command).getFile();
if (file == null) {
if (file == null || file.isEmpty()) {
errors.rejectValue("file", "form.submitArticle.noFile");
return new ModelAndView(new RedirectView(getFormView()));
try {
return showForm(request, response, errors);
} catch (Exception e) {
e.printStackTrace();
}
}
else {

View File

@@ -10,14 +10,11 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.acegisecurity.util.UrlUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.mail.MailSendException;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.ModelAndViewDefiningException;
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.session.SessionService;
import com.sun.mail.smtp.SMTPAddressFailedException;
public class AddConferenceController extends AbstractWizardFormController {
protected final Log logger = LogFactory.getLog(getClass());