Les anciens critères sont affichés.

Les dates sont validées.
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:   
haha
This commit is contained in:
Frederic Debuire
2008-02-07 16:12:34 +00:00
parent 4ad64d5271
commit 0308c822c6
5 changed files with 160 additions and 21 deletions

View File

@@ -11,14 +11,19 @@
<script type='text/javascript'>
function init() {
fillTable();
//fillTable2();
//fillTable();
setTimeout("fillTable2()", 500);
setTimeout("fillTable()", 500);
}
var peopleCache = { };
var peopleCache2 = { };
var viewed = -1;
function fillTable() {
AddCriteriaJS.getAllCriteria(function(criteria) {
AddCriteriaJS.getCriteriaAdded(function(criteria) {
// Delete all the rows except for the "pattern" row
dwr.util.removeAllRows("criteriabody", { filter:function(tr) {
return (tr.id != "pattern");
@@ -37,6 +42,31 @@ function fillTable() {
dwr.util.setValue("tableCriterionMax" + id, person.max);
$("tableCriterion").style.display = "";
$("pattern" + id).style.display = "";
peopleCache2[id] = person;
}
});
}
function fillTable2() {
AddCriteriaJS.getCriteriaAll(function(criteria) {
// Delete all the rows except for the "pattern" row
dwr.util.removeAllRows("criteriabodyAll", { filter:function(tr) {
return (tr.id != "patternAll");
}});
// Create a new set cloned from the pattern row
var person, id;
criteria.sort(function(p1, p2) { return p1.label.localeCompare(p2.label); });
if (criteria.length == 0)
$("tableCriterionAll").style.display = "none";
for (var i = 0; i < criteria.length; i++) {
person = criteria[i];
id = person.id;
dwr.util.cloneNode("patternAll", { idSuffix:id });
dwr.util.setValue("tableCriterionAll" + id, person.label);
dwr.util.setValue("tableCriterionMinAll" + id, person.min);
dwr.util.setValue("tableCriterionMaxAll" + id, person.max);
$("tableCriterionAll").style.display = "";
$("patternAll" + id).style.display = "";
peopleCache[id] = person;
}
});
@@ -44,19 +74,34 @@ function fillTable() {
function editClicked(eleid) {
// we were an id of the form "edit{id}", eg "edit42". We lookup the "42"
var person = peopleCache[eleid.substring(4)];
var person = peopleCache2[eleid.substring(4)];
dwr.util.setValues(person);
}
function deleteClicked(eleid) {
// we were an id of the form "delete{id}", eg "delete42". We lookup the "42"
var person = peopleCache[eleid.substring(6)];
var person = peopleCache2[eleid.substring(6)];
if (confirm("Are you sure you want to delete " + person.label + "?")) {
dwr.engine.beginBatch();
AddCriteriaJS.deleteCriterion(person);
fillTable();
setTimeout("fillTable2()", 500);
setTimeout("fillTable()", 500);
dwr.engine.endBatch();
}
viewed = -1;
dwr.util.setValues({ id:-1, label:null, min:null, max:null });
}
function addClicked(eleid) {
var person = peopleCache[eleid.substring(3)];
//person.id = -1;
dwr.engine.beginBatch();
AddCriteriaJS.setCriterion(person);
setTimeout("fillTable2()", 500);
setTimeout("fillTable()", 500);
dwr.engine.endBatch();
viewed = -1;
dwr.util.setValues({ id:-1, label:null, min:null, max:null });
}
function writePerson() {
@@ -64,8 +109,11 @@ function writePerson() {
dwr.util.getValues(person);
dwr.engine.beginBatch();
AddCriteriaJS.setCriterion(person);
fillTable();
AddCriteriaJS.setCriterionClick(person);
//fillTable2();
//fillTable();
setTimeout("fillTable()", 500);
dwr.engine.endBatch();
}
@@ -84,6 +132,36 @@ function clearPerson() {
<form:form commandName="formConference" name="monForm">
This step allows you to add criterion which will be used when someone will evaluate an article.<br/>
You can add a new criterion using the input form, or add an existing criterion.<br/>
<br/>
<fieldset><legend>Existing criteria</legend>
<table border="1" id="tableCriterionAll" style="display: none;">
<thead>
<tr>
<th>Criterion</th>
<th>Min</th>
<th>Max</th>
<th>Action</th>
</tr>
</thead>
<tbody id="criteriabodyAll">
<tr id="patternAll" style="display: none;">
<td><span id="tableCriterionAll">Criterion</span></td>
<td><span id="tableCriterionMinAll">Min</span></td>
<td><span id="tableCriterionMaxAll">Max</span></td>
<td>
<a id="add" href="#" onclick="addClicked(this.id)" >Add</a>
</td>
</tr>
</tbody>
</table>
</fieldset>
<br />
<fieldset><legend>Criteria</legend>
<table class="plain">
<tr>

View File

@@ -19,7 +19,7 @@ function init() {
}
var peopleCache = { };
//var peopleCache2 = { };
var peopleCache2 = { };
var viewed = -1;
function fillTable() {
@@ -67,7 +67,7 @@ function fillTable2() {
dwr.util.setValue("tablePersonadded" + id, person.firstName + " " + person.lastName);
$("tableNameAdded").style.display = "";
$("patternadded" + id).style.display = "";
//peopleCache2[id] = person; // voir ici pr re-remplir apr<70>s le back :)
peopleCache2[id] = person; // voir ici pr re-remplir apr<70>s le back :)
}
});
}
@@ -91,7 +91,7 @@ function addInvitation() {
}
function deletePerson(eleid) {
var person = peopleCache[eleid.substring(11)];
var person = peopleCache2[eleid.substring(11)];
if (confirm("Are you sure you want to delete " + person.firstName + " " + person.lastName + "?")) {
dwr.engine.beginBatch();
AddCriteriaJS.deletePerson(person);

View File

@@ -160,6 +160,7 @@
value="org.yacos.web.chairman.form.FormConference" />
<property name="conferenceManager" ref="conferenceManager" />
<property name="userManager" ref="userManager" />
<property name="evaluationManager" ref="evaluationManager" />
<property name="validator" ref="ConferenceValidator" />
</bean>

View File

@@ -15,6 +15,8 @@ import org.springframework.web.servlet.ModelAndViewDefiningException;
import org.springframework.web.servlet.mvc.AbstractWizardFormController;
import org.yacos.core.conferences.Conference;
import org.yacos.core.conferences.IConferenceManager;
import org.yacos.core.evaluation.Criterion;
import org.yacos.core.evaluation.IEvaluationManager;
import org.yacos.core.users.IUserManager;
import org.yacos.core.users.User;
import org.yacos.core.users.Role.RoleType;
@@ -30,6 +32,14 @@ public class AddConferenceController extends AbstractWizardFormController {
private IUserManager userManager;
private IEvaluationManager evaluationManager;
public IEvaluationManager getEvaluationManager() {
return evaluationManager;
}
public void setEvaluationManager(IEvaluationManager evaluationManager) {
this.evaluationManager = evaluationManager;
}
public IUserManager getUserManager() {
return userManager;
}
@@ -57,9 +67,7 @@ public class AddConferenceController extends AbstractWizardFormController {
else {
listPersonFiltered = new ArrayList<PersonBean>();
for (PersonBean b : listPersonBean) {
// TODO : faire la vérif aussi sur le vrai nom, pas que sur le prénom
if (b.getFirstName().toLowerCase().startsWith(text.toLowerCase())){
if (b.getFirstName().toLowerCase().startsWith(text.toLowerCase()) || b.getLastName().toLowerCase().startsWith(text.toLowerCase())){
listPersonFiltered.add(b);
}
}
@@ -134,12 +142,33 @@ public class AddConferenceController extends AbstractWizardFormController {
private static int nextId = 1;
private Set<CriterionBean> criteria;
private Set<CriterionBean> criteriaAll;
public Set<CriterionBean> getAllCriteria() {
public Set<CriterionBean> getCriteriaAll() {
return criteriaAll;
}
public Set<CriterionBean> getCriteriaAdded() {
return criteria;
}
public void setCriterion(CriterionBean c) {
public CriterionBean getTrueCriteria(int id) {
for (CriterionBean cb : criteriaAll) {
if (cb.getId() == id){
return cb;
}
}
for (CriterionBean cb : criteria) {
if (cb.getId() == id){
return cb;
}
}
return null;
}
public void setCriterionClick(CriterionBean c) {
if (c.getId() == -1) {
c.setId(getNextId());
}
@@ -148,8 +177,26 @@ public class AddConferenceController extends AbstractWizardFormController {
criteria.add(c);
}
public void setCriterion(CriterionBean c) {
if (c.getId() == -1) {
c.setId(getNextId());
}
CriterionBean trueCriteria = getTrueCriteria(c.getId());
criteria.remove(trueCriteria);
criteria.add(trueCriteria);
criteriaAll.remove(trueCriteria);
}
public void deleteCriterion(CriterionBean c) {
criteria.remove(c);
CriterionBean trueCriteria = getTrueCriteria(c.getId());
criteria.remove(trueCriteria);
criteriaAll.add(trueCriteria);
}
private static synchronized int getNextId()
@@ -166,10 +213,23 @@ public class AddConferenceController extends AbstractWizardFormController {
}
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
logger.info(this.getClass().toString() + " dans le formBackingObject");
FormConference conference = new FormConference();
criteria = new HashSet<CriterionBean>();
criteriaAll = new HashSet<CriterionBean>();
List<Criterion> listCriterion = evaluationManager.getCriterions();
for (Criterion crit : listCriterion) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
cb.setLabel(crit.getName());
cb.setMax(crit.getMax_rating());
cb.setMin(crit.getMin_rating());
criteriaAll.add(cb);
getNextId();
}
listPersonBean = new ArrayList<PersonBean>();
listPersonAdded = new ArrayList<PersonBean>();

View File

@@ -65,11 +65,11 @@ public class ConferenceValidator implements Validator {
errors.rejectValue("dateStart", "conference.errors.dateStartSuperiorEnd");
if (dateStart != null && dateArticle != null)
if (!dateStart.before(dateArticle))
if (!dateStart.after(dateArticle))
errors.rejectValue("dateArticle", "conference.errors.dateStartSuperiorArticle");
if (dateStart != null && dateEvaluation != null)
if (!dateStart.before(dateEvaluation))
if (!dateStart.after(dateEvaluation))
errors.rejectValue("dateEvaluation", "conference.errors.dateStartSuperiorEvaluation");
if (dateEvaluation != null && dateArticle != null)