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.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.date=Conference's date
conference2.start=Start :
@@ -130,6 +136,8 @@ evaluation.note=The note for the criterion
evaluation.thisArticle=evaluate this article
evaluation.choose=Choose an title to evaluation from the list
invitation.send=Send an invitation
#Validation messages for errors
submissionArticle.title=The title should not be null
submissionArticle.theme=The theme should not be null

View File

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

View File

@@ -82,7 +82,7 @@ function clearPerson() {
<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>
<table class="plain">

View File

@@ -12,9 +12,10 @@
function init() {
dwr.engine.setAsync(false); // a v<>rifier
AddCriteriaJS.initPerson();
//AddCriteriaJS.initPerson();
dwr.engine.setAsync(true);
setTimeout("fillTable()", 500);
setTimeout("fillTable2()", 500);
}
var peopleCache = { };
@@ -29,13 +30,17 @@ function fillTable() {
}});
// Create a new set cloned from the pattern row
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++) {
person = people[i];
id = person.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 = "";
peopleCache[id] = person;
}
@@ -50,15 +55,19 @@ function fillTable2() {
}});
// Create a new set cloned from the pattern row
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++) {
person = people[i];
id = person.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 = "";
//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) {
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();
AddCriteriaJS.deletePerson(person);
filterUser(null, dwr.util.getValue("myfilter"));
@@ -111,8 +120,15 @@ function filterUser(el, value) {
<form:form commandName="formConference" name="monForm">
Filter <input id="myfilter" type="text" />
<table border="1">
Filter <form:input id="myfilter" path="myfilter" />
<br /> <br />
<table border="1" id="tableName" style="display: none;">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="personbody">
<tr id="pattern" style="display: none;">
<td><span id="tablePerson">Person</span></td>
@@ -123,12 +139,19 @@ function filterUser(el, value) {
</tbody>
</table>
<fmt:message key="pcmember.invitation.promptMessage"/> <br/>
Mail: <input id="emailAddress" type="text"/> <input type="button" name="invitationEmail" onclick="addInvitation()"/>
<br />
<fmt:message key="invitation.send"/> <br/>
Mail: <input id="emailAddress" type="text"/> <a id="invitationEmail" href="#" onclick="addInvitation()" >Invite</a>
<br />
<table border="1">
<br />
<table border="1" id="tableNameAdded" style="display: none;">
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="personbodyadded">
<tr id="patternadded" style="display: none;">
<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.users.IUserManager;
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.validation.ConferenceValidator;
import org.yacos.web.system.session.SessionService;
//TODO : Clean this class
public class AddConferenceController extends AbstractWizardFormController {
protected final Log logger = LogFactory.getLog(getClass());
@@ -52,27 +51,15 @@ public class AddConferenceController extends AbstractWizardFormController {
private List<PersonBean> listPersonFiltered;
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) {
if (text.equals(""))
listPersonFiltered = new ArrayList<PersonBean>();
listPersonFiltered = listPersonBean;
else {
listPersonFiltered = new ArrayList<PersonBean>();
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);
}
}
@@ -146,7 +133,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private static int nextId = 1;
private Set<CriterionBean> criteria = new HashSet<CriterionBean>();;
private Set<CriterionBean> criteria;
public Set<CriterionBean> getAllCriteria() {
return criteria;
@@ -180,6 +167,23 @@ public class AddConferenceController extends AbstractWizardFormController {
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
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;
}
@@ -238,6 +242,8 @@ public class AddConferenceController extends AbstractWizardFormController {
personBean.getLogin());
}
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
return new ModelAndView("main"/*, model*/);
}

View File

@@ -3,7 +3,8 @@ package org.yacos.web.chairman.controller;
public class PersonBean {
private int id;
private String name;
private String firstName;
private String lastName;
private String login;
public String getLogin() {
@@ -16,14 +17,6 @@ public class PersonBean {
public PersonBean() {}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
@@ -32,4 +25,20 @@ public class PersonBean {
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 int pageNumber;
private String fileType;
private boolean typePDF;
private boolean typeLatec;
private boolean typeWord;
private boolean typeODT;
private String sendInfo;
private Integer conferenceId;
private String myfilter;
public FormConference () {}
public Integer getId() {
@@ -66,14 +71,6 @@ public class FormConference {
this.pageNumber = pageNumber;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getSendInfo() {
return sendInfo;
}
@@ -177,4 +174,44 @@ public class FormConference {
public Integer getConferenceId() {
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

@@ -34,30 +34,48 @@ public class ConferenceValidator implements Validator {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "dateEvaluation", "DATE_REQUIRED", "A date is required");
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date dateStart = null, dateEnd = null, dateArticle = null, dateEvaluation = null;
try {
Date dateStart = format.parse(conference.getDateStart());
dateStart = format.parse(conference.getDateStart());
conference.setDateStartParsed(dateStart);
// FIXME : bug ici, ca s'affiche même si ca devrait pas
} catch (ParseException e) {
errors.reject("dateStart");
errors.rejectValue("dateStart", "conference.errors.dateStartNonValid");
}
try {
Date dateEnd = format.parse(conference.getDateEnd());
dateEnd = format.parse(conference.getDateEnd());
conference.setDateEndParsed(dateEnd);
} catch (ParseException e) {
errors.reject("dateEnd");
errors.reject("dateEnd", "conference.errors.dateStartNonValid");
}
try {
Date dateArticle = format.parse(conference.getDateArticle());
dateArticle = format.parse(conference.getDateArticle());
conference.setDateArticleParsed(dateArticle);
} catch (ParseException e) {
errors.reject("dateArticle");
errors.reject("dateArticle", "conference.errors.dateStartNonValid");
}
try {
Date dateEvaluation = format.parse(conference.getDateEvaluation());
dateEvaluation = format.parse(conference.getDateEvaluation());
conference.setDateEvaluationParsed(dateEvaluation);
} catch (ParseException e) {
errors.reject("dateEvaluation");
errors.reject("dateEvaluation", "conference.errors.dateStartNonValid");
}
if (dateStart != null && dateEnd != null)
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) {