Diverse modif ds ajout conf

Policy failures:   
Code warning
- failed on resource ConferenceValidator.java. Reason: Class is a raw type. References to generic type Class<T> should be parameterized, line 1
Override reason:   
uhu
This commit is contained in:
Frederic Debuire
2008-02-05 15:21:13 +00:00
parent 55c848c4ae
commit 6db0c1f686
8 changed files with 176 additions and 75 deletions

View File

@@ -113,6 +113,12 @@ conference.linkMenu.title=Adding Conference
conference.linkMenu.choose=Choosing current conference conference.linkMenu.choose=Choosing current conference
conference.linkMenu.change=Change current conference conference.linkMenu.change=Change current conference
conference.errors.dateStartNonValid=This date is not valid
conference.errors.dateStartSuperiorEnd=The start date must be earlier than the end date
conference.errors.dateStartSuperiorArticle=The article's deadline date must be earlier than the start date
conference.errors.dateStartSuperiorEvaluation=The evaluation's deadline date must be earlier than the start date
conference.errors.dateArticleSuperiorEvaluation=The article's deadline date must be earlier than the evaluation's deadline date
conference2.title=Calendar conference2.title=Calendar
conference2.date=Conference's date conference2.date=Conference's date
conference2.start=Start : conference2.start=Start :
@@ -130,6 +136,8 @@ evaluation.note=The note for the criterion
evaluation.thisArticle=evaluate this article evaluation.thisArticle=evaluate this article
evaluation.choose=Choose an title to evaluation from the list evaluation.choose=Choose an title to evaluation from the list
invitation.send=Send an invitation
#Validation messages for errors #Validation messages for errors
submissionArticle.title=The title should not be null submissionArticle.title=The title should not be null
submissionArticle.theme=The theme should not be null submissionArticle.theme=The theme should not be null

View File

@@ -13,13 +13,13 @@
<fieldset><legend>Information</legend> <fieldset><legend>Information</legend>
Page's numbers <form:input path="pageNumber" /> Page's numbers <form:input path="pageNumber" />
File's type : <form:select path="fileType"> <br /> <br />
<form:option value="" /> PDF <form:checkbox path="typePDF"/>
<form:option value="PDF" /> Tex/Latec <form:checkbox path="typeLatec"/>
<form:option value="Tex/Latec" /> Word <form:checkbox path="typeWord"/>
<form:option value="Word" /> OpenOffice <form:checkbox path="typeODT"/>
</form:select></fieldset> </fieldset>
<br /> <br />
@@ -27,7 +27,7 @@
<br /> <br />
Informations compl<70>mentaires : <form:textarea path="sendInfo" /> Complementary Information : <form:textarea path="sendInfo" />
<br /> <br />
<br /> <br />

View File

@@ -82,7 +82,7 @@ function clearPerson() {
<h2 align="center"><fmt:message key="conference.titleMenu" /></h2> <h2 align="center"><fmt:message key="conference.titleMenu" /></h2>
<form:form commandName="formConference" name="monForm" onsubmit="return submitIfNotEnter(this)"> <form:form commandName="formConference" name="monForm">
<fieldset><legend>Criteria</legend> <fieldset><legend>Criteria</legend>
<table class="plain"> <table class="plain">

View File

@@ -12,9 +12,10 @@
function init() { function init() {
dwr.engine.setAsync(false); // a v<>rifier dwr.engine.setAsync(false); // a v<>rifier
AddCriteriaJS.initPerson(); //AddCriteriaJS.initPerson();
dwr.engine.setAsync(true); dwr.engine.setAsync(true);
setTimeout("fillTable()", 500); setTimeout("fillTable()", 500);
setTimeout("fillTable2()", 500);
} }
var peopleCache = { }; var peopleCache = { };
@@ -29,13 +30,17 @@ function fillTable() {
}}); }});
// Create a new set cloned from the pattern row // Create a new set cloned from the pattern row
var person, id; var person, id;
people.sort(function(p1, p2) { return p1.name.localeCompare(p2.name); }); people.sort(function(p1, p2) { return p1.firstName.localeCompare(p2.firstName); });
if (people.length == 0)
$("tableName").style.display = "none";
for (var i = 0; i < people.length; i++) { for (var i = 0; i < people.length; i++) {
person = people[i]; person = people[i];
id = person.id; id = person.id;
dwr.util.cloneNode("pattern", { idSuffix:id }); dwr.util.cloneNode("pattern", { idSuffix:id });
dwr.util.setValue("tablePerson" + id, person.name); dwr.util.setValue("tablePerson" + id, person.firstName + " " + person.lastName);
$("tableName").style.display = "";
$("pattern" + id).style.display = ""; $("pattern" + id).style.display = "";
peopleCache[id] = person; peopleCache[id] = person;
} }
@@ -50,15 +55,19 @@ function fillTable2() {
}}); }});
// Create a new set cloned from the pattern row // Create a new set cloned from the pattern row
var person, id; var person, id;
people.sort(function(p1, p2) { return p1.name.localeCompare(p2.name); }); people.sort(function(p1, p2) { return p1.firstName.localeCompare(p2.lastName); });
if (people.length == 0)
$("tableNameAdded").style.display = "none";
for (var i = 0; i < people.length; i++) { for (var i = 0; i < people.length; i++) {
person = people[i]; person = people[i];
id = person.id; id = person.id;
dwr.util.cloneNode("patternadded", { idSuffix:id }); dwr.util.cloneNode("patternadded", { idSuffix:id });
dwr.util.setValue("tablePersonadded" + id, person.name); dwr.util.setValue("tablePersonadded" + id, person.firstName + " " + person.lastName);
$("tableNameAdded").style.display = "";
$("patternadded" + id).style.display = ""; $("patternadded" + id).style.display = "";
//peopleCache2[id] = person; //peopleCache2[id] = person; // voir ici pr re-remplir apr<70>s le back :)
} }
}); });
} }
@@ -83,7 +92,7 @@ function addInvitation() {
function deletePerson(eleid) { function deletePerson(eleid) {
var person = peopleCache[eleid.substring(11)]; var person = peopleCache[eleid.substring(11)];
if (confirm("Are you sure you want to delete " + person.name + "?")) { if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
dwr.engine.beginBatch(); dwr.engine.beginBatch();
AddCriteriaJS.deletePerson(person); AddCriteriaJS.deletePerson(person);
filterUser(null, dwr.util.getValue("myfilter")); filterUser(null, dwr.util.getValue("myfilter"));
@@ -111,8 +120,15 @@ function filterUser(el, value) {
<form:form commandName="formConference" name="monForm"> <form:form commandName="formConference" name="monForm">
Filter <input id="myfilter" type="text" /> Filter <form:input id="myfilter" path="myfilter" />
<table border="1"> <br /> <br />
<table border="1" id="tableName" style="display: none;">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="personbody"> <tbody id="personbody">
<tr id="pattern" style="display: none;"> <tr id="pattern" style="display: none;">
<td><span id="tablePerson">Person</span></td> <td><span id="tablePerson">Person</span></td>
@@ -123,12 +139,19 @@ function filterUser(el, value) {
</tbody> </tbody>
</table> </table>
<fmt:message key="pcmember.invitation.promptMessage"/> <br/>
Mail: <input id="emailAddress" type="text"/> <input type="button" name="invitationEmail" onclick="addInvitation()"/>
<br /> <br />
<table border="1"> <fmt:message key="invitation.send"/> <br/>
Mail: <input id="emailAddress" type="text"/> <a id="invitationEmail" href="#" onclick="addInvitation()" >Invite</a>
<br />
<br />
<table border="1" id="tableNameAdded" style="display: none;">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="personbodyadded"> <tbody id="personbodyadded">
<tr id="patternadded" style="display: none;"> <tr id="patternadded" style="display: none;">
<td><span id="tablePersonadded">Person</span></td> <td><span id="tablePersonadded">Person</span></td>

View File

@@ -17,12 +17,11 @@ import org.yacos.core.conferences.Conference;
import org.yacos.core.conferences.IConferenceManager; import org.yacos.core.conferences.IConferenceManager;
import org.yacos.core.users.IUserManager; import org.yacos.core.users.IUserManager;
import org.yacos.core.users.User; import org.yacos.core.users.User;
import org.yacos.core.users.Role.RoleType;
import org.yacos.web.chairman.form.FormConference; import org.yacos.web.chairman.form.FormConference;
import org.yacos.web.chairman.validation.ConferenceValidator; import org.yacos.web.chairman.validation.ConferenceValidator;
import org.yacos.web.system.session.SessionService; import org.yacos.web.system.session.SessionService;
//TODO : Clean this class
public class AddConferenceController extends AbstractWizardFormController { public class AddConferenceController extends AbstractWizardFormController {
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
@@ -52,27 +51,15 @@ public class AddConferenceController extends AbstractWizardFormController {
private List<PersonBean> listPersonFiltered; private List<PersonBean> listPersonFiltered;
private List<PersonBean> listPersonAdded; private List<PersonBean> listPersonAdded;
public void initPerson() {
listPersonBean = new ArrayList<PersonBean>();
listPersonAdded = new ArrayList<PersonBean>();
listPersonFiltered = new ArrayList<PersonBean>();
List<User> listUsers = userManager.getUsers();
for (User user : listUsers) {
PersonBean pb = new PersonBean();
pb.setId(getNextPerson());
pb.setName(user.getFirstName());
pb.setLogin(user.getLogin());
listPersonBean.add(pb);
}
}
public void fillUser(String text) { public void fillUser(String text) {
if (text.equals("")) if (text.equals(""))
listPersonFiltered = new ArrayList<PersonBean>(); listPersonFiltered = listPersonBean;
else { else {
listPersonFiltered = new ArrayList<PersonBean>(); listPersonFiltered = new ArrayList<PersonBean>();
for (PersonBean b : listPersonBean) { for (PersonBean b : listPersonBean) {
if (b.getName().toLowerCase().contains(text.toLowerCase())){
// TODO : faire la vérif aussi sur le vrai nom, pas que sur le prénom
if (b.getFirstName().toLowerCase().startsWith(text.toLowerCase())){
listPersonFiltered.add(b); listPersonFiltered.add(b);
} }
} }
@@ -146,7 +133,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private static int nextId = 1; private static int nextId = 1;
private Set<CriterionBean> criteria = new HashSet<CriterionBean>();; private Set<CriterionBean> criteria;
public Set<CriterionBean> getAllCriteria() { public Set<CriterionBean> getAllCriteria() {
return criteria; return criteria;
@@ -180,6 +167,23 @@ public class AddConferenceController extends AbstractWizardFormController {
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException { protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
FormConference conference = new FormConference(); FormConference conference = new FormConference();
criteria = new HashSet<CriterionBean>();
listPersonBean = new ArrayList<PersonBean>();
listPersonAdded = new ArrayList<PersonBean>();
listPersonFiltered = listPersonBean;
List<User> listUsers = userManager.getUsers();
for (User user : listUsers) {
PersonBean pb = new PersonBean();
pb.setId(getNextPerson());
pb.setFirstName(user.getFirstName());
pb.setLastName(user.getLastName());
pb.setLogin(user.getLogin());
listPersonBean.add(pb);
}
return conference; return conference;
} }
@@ -238,6 +242,8 @@ public class AddConferenceController extends AbstractWizardFormController {
personBean.getLogin()); personBean.getLogin());
} }
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
return new ModelAndView("main"/*, model*/); return new ModelAndView("main"/*, model*/);
} }

View File

@@ -3,7 +3,8 @@ package org.yacos.web.chairman.controller;
public class PersonBean { public class PersonBean {
private int id; private int id;
private String name; private String firstName;
private String lastName;
private String login; private String login;
public String getLogin() { public String getLogin() {
@@ -16,14 +17,6 @@ public class PersonBean {
public PersonBean() {} public PersonBean() {}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() { public int getId() {
return id; return id;
} }
@@ -32,4 +25,20 @@ public class PersonBean {
this.id = id; this.id = id;
} }
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
} }

View File

@@ -19,11 +19,16 @@ public class FormConference {
private Date dateEndParsed; private Date dateEndParsed;
private int pageNumber; private int pageNumber;
private String fileType; private boolean typePDF;
private boolean typeLatec;
private boolean typeWord;
private boolean typeODT;
private String sendInfo; private String sendInfo;
private Integer conferenceId; private Integer conferenceId;
private String myfilter;
public FormConference () {} public FormConference () {}
public Integer getId() { public Integer getId() {
@@ -66,14 +71,6 @@ public class FormConference {
this.pageNumber = pageNumber; this.pageNumber = pageNumber;
} }
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getSendInfo() { public String getSendInfo() {
return sendInfo; return sendInfo;
} }
@@ -177,4 +174,44 @@ public class FormConference {
public Integer getConferenceId() { public Integer getConferenceId() {
return conferenceId; return conferenceId;
} }
public String getMyfilter() {
return myfilter;
}
public void setMyfilter(String myfilter) {
this.myfilter = myfilter;
}
public boolean isTypePDF() {
return typePDF;
}
public void setTypePDF(boolean typePDF) {
this.typePDF = typePDF;
}
public boolean isTypeLatec() {
return typeLatec;
}
public void setTypeLatec(boolean typeLatec) {
this.typeLatec = typeLatec;
}
public boolean isTypeWord() {
return typeWord;
}
public void setTypeWord(boolean typeWord) {
this.typeWord = typeWord;
}
public boolean isTypeODT() {
return typeODT;
}
public void setTypeODT(boolean typeODT) {
this.typeODT = typeODT;
}
} }

View File

@@ -15,7 +15,7 @@ public class ConferenceValidator implements Validator {
public boolean supports(Class commandClass) { public boolean supports(Class commandClass) {
return FormConference.class.isAssignableFrom(commandClass); return FormConference.class.isAssignableFrom(commandClass);
} }
public void validate(Object obj, Errors errors) { public void validate(Object obj, Errors errors) {
validateFirstPage((FormConference) obj, errors); validateFirstPage((FormConference) obj, errors);
validateSecondPage((FormConference) obj, errors); validateSecondPage((FormConference) obj, errors);
@@ -26,42 +26,60 @@ public class ConferenceValidator implements Validator {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "TITLE_REQUIRED", "A title is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "TITLE_REQUIRED", "A title is required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "DESCRIPTION_REQUIRED", "A description is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "DESCRIPTION_REQUIRED", "A description is required");
} }
public void validateSecondPage(FormConference conference, Errors errors) { public void validateSecondPage(FormConference conference, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateStart", "DATE_REQUIRED", "A date is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateStart", "DATE_REQUIRED", "A date is required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEnd", "DATE_REQUIRED", "A date is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEnd", "DATE_REQUIRED", "A date is required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateArticle", "DATE_REQUIRED", "A date is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateArticle", "DATE_REQUIRED", "A date is required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEvaluation", "DATE_REQUIRED", "A date is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEvaluation", "DATE_REQUIRED", "A date is required");
DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date dateStart = null, dateEnd = null, dateArticle = null, dateEvaluation = null;
try { try {
Date dateStart = format.parse(conference.getDateStart()); dateStart = format.parse(conference.getDateStart());
conference.setDateStartParsed(dateStart); conference.setDateStartParsed(dateStart);
// FIXME : bug ici, ca s'affiche même si ca devrait pas
} catch (ParseException e) { } catch (ParseException e) {
errors.reject("dateStart"); errors.rejectValue("dateStart", "conference.errors.dateStartNonValid");
} }
try { try {
Date dateEnd = format.parse(conference.getDateEnd()); dateEnd = format.parse(conference.getDateEnd());
conference.setDateEndParsed(dateEnd); conference.setDateEndParsed(dateEnd);
} catch (ParseException e) { } catch (ParseException e) {
errors.reject("dateEnd"); errors.reject("dateEnd", "conference.errors.dateStartNonValid");
} }
try { try {
Date dateArticle = format.parse(conference.getDateArticle()); dateArticle = format.parse(conference.getDateArticle());
conference.setDateArticleParsed(dateArticle); conference.setDateArticleParsed(dateArticle);
} catch (ParseException e) { } catch (ParseException e) {
errors.reject("dateArticle"); errors.reject("dateArticle", "conference.errors.dateStartNonValid");
} }
try { try {
Date dateEvaluation = format.parse(conference.getDateEvaluation()); dateEvaluation = format.parse(conference.getDateEvaluation());
conference.setDateEvaluationParsed(dateEvaluation); conference.setDateEvaluationParsed(dateEvaluation);
} catch (ParseException e) { } catch (ParseException e) {
errors.reject("dateEvaluation"); errors.reject("dateEvaluation", "conference.errors.dateStartNonValid");
} }
}
if (dateStart != null && dateEnd != null)
public void validateThirdPage(FormConference conference, Errors errors) { if (dateStart.after(dateEnd))
errors.rejectValue("dateStart", "conference.errors.dateStartSuperiorEnd");
if (dateStart != null && dateArticle != null)
if (!dateStart.before(dateArticle))
errors.rejectValue("dateArticle", "conference.errors.dateStartSuperiorArticle");
if (dateStart != null && dateEvaluation != null)
if (!dateStart.before(dateEvaluation))
errors.rejectValue("dateEvaluation", "conference.errors.dateStartSuperiorEvaluation");
if (dateEvaluation != null && dateArticle != null)
if (!dateArticle.before(dateEvaluation))
errors.rejectValue("dateArticle", "conference.errors.dateArticleSuperiorEvaluation");
}
public void validateThirdPage(FormConference conference, Errors errors) {
} }
} }