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
# Conference Form
conference.titleMenu=Add a conference
conference.titleAdd=Add a conference
conference.titleModify=Modify a conference
conference.title=Title
conference.description=Description
conference.otherInformations=Complementary information

View File

@@ -18,7 +18,7 @@
<h4><fmt:message key="menu.chairman.title" /></h4>
<ul>
<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="#"/>"><fmt:message key="menu.chairman.article.validate" /></a></li>
</ul>

View File

@@ -4,7 +4,17 @@
<head></head>
<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">
<fmt:message key="conference.title" /> <form:input path="title"/> <form:errors path="title" /> <br/><br />

View File

@@ -8,7 +8,16 @@
<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">

View File

@@ -5,7 +5,16 @@
<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">

View File

@@ -128,7 +128,16 @@ function clearPerson() {
<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">

View File

@@ -116,7 +116,16 @@ function filterUser(el, value) {
</head>
<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">

View File

@@ -220,14 +220,23 @@ public class AddConferenceController extends AbstractWizardFormController {
FormConference conference = new FormConference();
String action = request.getParameter("action");
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 ?
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 ?
criteria = new HashSet<CriterionBean>();
criteriaAll = new HashSet<CriterionBean>();
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) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
@@ -260,6 +269,16 @@ public class AddConferenceController extends AbstractWizardFormController {
criteriaAll = new HashSet<CriterionBean>();
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) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
@@ -270,7 +289,6 @@ public class AddConferenceController extends AbstractWizardFormController {
getNextId();
}
List<Criterion> listCriterion = evaluationManager.getCriterions();
for (Criterion crit : listCriterion) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
@@ -281,6 +299,14 @@ public class AddConferenceController extends AbstractWizardFormController {
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>();
listPersonAdded = new ArrayList<PersonBean>();
listPersonFiltered = listPersonBean;
@@ -294,10 +320,7 @@ public class AddConferenceController extends AbstractWizardFormController {
listPersonBean.add(pb);
}
// FIXME : bug here when we remove a person
// and remove the person added from the list above
List<User> listUsersForConf = userManager.getUsers(conf.getId());
List<User> listUsersForConf = userManager.getUsers(conf.getId(), RoleType.PCMEMBER);
for (User user : listUsersForConf) {
PersonBean pb = new PersonBean();
pb.setId(getNextPerson());
@@ -307,6 +330,13 @@ public class AddConferenceController extends AbstractWizardFormController {
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");
conference.setTitle(conf.getTitle());
@@ -360,6 +390,8 @@ public class AddConferenceController extends AbstractWizardFormController {
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) {
FormConference conference = (FormConference) command;
String action = request.getParameter("action");
if (action == null || action.equals("")) {
Conference conf = conferenceManager.addConference(
conference.getTitle(),
@@ -389,6 +421,39 @@ public class AddConferenceController extends AbstractWizardFormController {
}
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());
}
}
return new ModelAndView("main");
}