UC Modify conference finit normalement

This commit is contained in:
Frederic Debuire
2008-02-11 15:20:44 +00:00
parent 5fcf032b9f
commit a195dd4a7e
8 changed files with 185 additions and 73 deletions

View File

@@ -118,7 +118,8 @@ preference.ok=You have successfully chosen all your preferences about each artic
dispatch.title=Dispatch the articles to the members dispatch.title=Dispatch the articles to the members
# Conference Form # Conference Form
conference.titleMenu=Add a conference conference.titleAdd=Add a conference
conference.titleModify=Modify a conference
conference.title=Title conference.title=Title
conference.description=Description conference.description=Description
conference.otherInformations=Complementary information conference.otherInformations=Complementary information

View File

@@ -18,7 +18,7 @@
<h4><fmt:message key="menu.chairman.title" /></h4> <h4><fmt:message key="menu.chairman.title" /></h4>
<ul> <ul>
<li><a href="<c:url value="addConference.htm"/>"><fmt:message key="menu.chairman.conference.create" /></a></li> <li><a href="<c:url value="addConference.htm"/>"><fmt:message key="menu.chairman.conference.create" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.chairman.conference.modify" /></a></li> <li><a href="<c:url value="addConference.htm?action=modify"/>"><fmt:message key="menu.chairman.conference.modify" /></a></li>
<li><a href="<c:url value="dispatchArticleList.htm"/>"><fmt:message key="menu.chairman.article.dispatch" /></a></li> <li><a href="<c:url value="dispatchArticleList.htm"/>"><fmt:message key="menu.chairman.article.dispatch" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.chairman.article.validate" /></a></li> <li><a href="<c:url value="#"/>"><fmt:message key="menu.chairman.article.validate" /></a></li>
</ul> </ul>

View File

@@ -4,7 +4,17 @@
<head></head> <head></head>
<body> <body>
<h4 class="title"><fmt:message key="conference.titleMenu" /></h4> <h4 class="title">
<c:choose>
<c:when test="${param['action'] eq 'modify'}">
<fmt:message key="conference.titleModify" />
</c:when>
<c:otherwise>
<fmt:message key="conference.titleAdd" />
</c:otherwise>
</c:choose>
</h4>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">
<fmt:message key="conference.title" /> <form:input path="title"/> <form:errors path="title" /> <br/><br /> <fmt:message key="conference.title" /> <form:input path="title"/> <form:errors path="title" /> <br/><br />

View File

@@ -8,7 +8,16 @@
<body> <body>
<h4 class="title"><fmt:message key="conference.titleMenu" /></h4> <h4 class="title">
<c:choose>
<c:when test="${param['action'] eq 'modify'}">
<fmt:message key="conference.titleModify" />
</c:when>
<c:otherwise>
<fmt:message key="conference.titleAdd" />
</c:otherwise>
</c:choose>
</h4>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">

View File

@@ -5,7 +5,16 @@
<body> <body>
<h4 class="title"><fmt:message key="conference.titleMenu" /></h4> <h4 class="title">
<c:choose>
<c:when test="${param['action'] eq 'modify'}">
<fmt:message key="conference.titleModify" />
</c:when>
<c:otherwise>
<fmt:message key="conference.titleAdd" />
</c:otherwise>
</c:choose>
</h4>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">

View File

@@ -128,7 +128,16 @@ function clearPerson() {
<body> <body>
<h4 class="title"><fmt:message key="conference.titleMenu" /></h4> <h4 class="title">
<c:choose>
<c:when test="${param['action'] eq 'modify'}">
<fmt:message key="conference.titleModify" />
</c:when>
<c:otherwise>
<fmt:message key="conference.titleAdd" />
</c:otherwise>
</c:choose>
</h4>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">

View File

@@ -116,7 +116,16 @@ function filterUser(el, value) {
</head> </head>
<body> <body>
<h4 class="title"><fmt:message key="conference.titleMenu" /></h4> <h4 class="title">
<c:choose>
<c:when test="${param['action'] eq 'modify'}">
<fmt:message key="conference.titleModify" />
</c:when>
<c:otherwise>
<fmt:message key="conference.titleAdd" />
</c:otherwise>
</c:choose>
</h4>
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">

View File

@@ -220,14 +220,23 @@ 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
// 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 ?
// 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>();
List<Criterion> listCriterion = evaluationManager.getCriterions(); List<Criterion> listCriterion = evaluationManager.getCriterions();
int maxNext = 0;
for (Criterion crit : listCriterion) {
if (maxNext <= crit.getId())
maxNext = crit.getId();
}
nextId = maxNext + 1;
for (Criterion crit : listCriterion) { for (Criterion crit : listCriterion) {
CriterionBean cb = new CriterionBean(); CriterionBean cb = new CriterionBean();
cb.setId(crit.getId()); cb.setId(crit.getId());
@@ -260,6 +269,16 @@ public class AddConferenceController extends AbstractWizardFormController {
criteriaAll = new HashSet<CriterionBean>(); criteriaAll = new HashSet<CriterionBean>();
List<Criterion> listCriterionForConf = evaluationManager.getCriterions(conf.getId()); List<Criterion> listCriterionForConf = evaluationManager.getCriterions(conf.getId());
List<Criterion> listCriterion = evaluationManager.getCriterions();
int maxNext = 0;
for (Criterion crit : listCriterion) {
if (maxNext <= crit.getId())
maxNext = crit.getId();
}
nextId = maxNext + 1;
for (Criterion crit : listCriterionForConf) { for (Criterion crit : listCriterionForConf) {
CriterionBean cb = new CriterionBean(); CriterionBean cb = new CriterionBean();
cb.setId(crit.getId()); cb.setId(crit.getId());
@@ -270,7 +289,6 @@ public class AddConferenceController extends AbstractWizardFormController {
getNextId(); getNextId();
} }
List<Criterion> listCriterion = evaluationManager.getCriterions();
for (Criterion crit : listCriterion) { for (Criterion crit : listCriterion) {
CriterionBean cb = new CriterionBean(); CriterionBean cb = new CriterionBean();
cb.setId(crit.getId()); cb.setId(crit.getId());
@@ -281,6 +299,14 @@ public class AddConferenceController extends AbstractWizardFormController {
getNextId(); getNextId();
} }
// remove of the criteria already added
Set<CriterionBean> criteriaAllIter = new HashSet<CriterionBean>(criteriaAll);
for (CriterionBean crit : criteriaAllIter)
for (CriterionBean crit2 : criteria)
if (crit.getId() == crit2.getId())
criteriaAll.remove(crit);
listPersonBean = new ArrayList<PersonBean>(); listPersonBean = new ArrayList<PersonBean>();
listPersonAdded = new ArrayList<PersonBean>(); listPersonAdded = new ArrayList<PersonBean>();
listPersonFiltered = listPersonBean; listPersonFiltered = listPersonBean;
@@ -294,10 +320,7 @@ public class AddConferenceController extends AbstractWizardFormController {
listPersonBean.add(pb); listPersonBean.add(pb);
} }
List<User> listUsersForConf = userManager.getUsers(conf.getId(), RoleType.PCMEMBER);
// FIXME : bug here when we remove a person
// and remove the person added from the list above
List<User> listUsersForConf = userManager.getUsers(conf.getId());
for (User user : listUsersForConf) { for (User user : listUsersForConf) {
PersonBean pb = new PersonBean(); PersonBean pb = new PersonBean();
pb.setId(getNextPerson()); pb.setId(getNextPerson());
@@ -307,6 +330,13 @@ public class AddConferenceController extends AbstractWizardFormController {
listPersonAdded.add(pb); listPersonAdded.add(pb);
} }
// remove of the person already added
List<PersonBean> listPersonIter = new ArrayList<PersonBean>(listPersonBean);
for (PersonBean person : listPersonIter)
for (PersonBean person2 : listPersonAdded)
if (person.getLogin().equals(person2.getLogin()))
listPersonBean.remove(person);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
conference.setTitle(conf.getTitle()); conference.setTitle(conf.getTitle());
@@ -360,36 +390,71 @@ public class AddConferenceController extends AbstractWizardFormController {
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) { HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) {
FormConference conference = (FormConference) command; FormConference conference = (FormConference) command;
String action = request.getParameter("action");
if (action == null || action.equals("")) {
Conference conf = conferenceManager.addConference( Conference conf = conferenceManager.addConference(
conference.getTitle(), conference.getTitle(),
conference.getDescription(), conference.getDescription(),
conference.getOtherInformations(), conference.getOtherInformations(),
conference.getDateArticleParsed(), conference.getDateArticleParsed(),
conference.getDateArticleParsed(), conference.getDateArticleParsed(),
conference.getDateEvaluationParsed(), conference.getDateEvaluationParsed(),
conference.getDateStartParsed(), conference.getDateStartParsed(),
conference.getDateEndParsed()); conference.getDateEndParsed());
conference.setConferenceId(conf.getId()); conference.setConferenceId(conf.getId());
SessionService.getInstance().setCurrentConference(conf); SessionService.getInstance().setCurrentConference(conf);
for(CriterionBean criterion : criteria){ for(CriterionBean criterion : criteria){
conferenceManager.addCriterionToConference( conferenceManager.addCriterionToConference(
conf.getId(), conf.getId(),
criterion.getLabel(), criterion.getLabel(),
criterion.getMin(), criterion.getMin(),
criterion.getMax()); criterion.getMax());
}
for(PersonBean personBean : listPersonAdded){
conferenceManager.addPCMemberToConference(
conf.getId(),
personBean.getLogin());
}
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
} }
else {
Conference conf = SessionService.getInstance().getCurrentConference();
conf.setTitle(conference.getTitle());
conf.setDescription(conference.getDescription());
conf.setOtherInformations(conference.getOtherInformations());
conf.setDateArticle(conference.getDateArticleParsed());
conf.setDateAbstract(conference.getDateArticleParsed());
conf.setDateEnd(conference.getDateEndParsed());
conf.setDateStart(conference.getDateStartParsed());
conf.setDateEvaluation(conference.getDateEvaluationParsed());
conferenceManager.update(conf);
conferenceManager.removeCriterionToConference(conf.getId());
for(CriterionBean criterion : criteria){
conferenceManager.addCriterionToConference(
conf.getId(),
criterion.getLabel(),
criterion.getMin(),
criterion.getMax());
}
conferenceManager.removePCMemberForConf(conf.getId());
for(PersonBean personBean : listPersonAdded){
conferenceManager.addPCMemberToConference(
conf.getId(),
personBean.getLogin());
}
for(PersonBean personBean : listPersonAdded){
conferenceManager.addPCMemberToConference(
conf.getId(),
personBean.getLogin());
} }
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
return new ModelAndView("main"); return new ModelAndView("main");
} }