Merge branch 'maint-rel-1.6' into develop

This commit is contained in:
tworrall 2013-12-09 16:59:17 -05:00
commit c7418e32fd
2 changed files with 17 additions and 4 deletions

View file

@ -27,6 +27,7 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
private String startFieldName;
private String endFieldName;
private String templateName;
private String startValueName;
private String endValueName;
@ -43,6 +44,16 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
endPrecisionName = endFieldName + "-precision";
}
public DateTimeIntervalValidationVTwo(String startFieldName, String endFieldName, String template){
this.templateName = template;
this.startFieldName = startFieldName;
this.endFieldName = endFieldName;
startValueName = startFieldName + "-value";
endValueName = endFieldName + "-value";
startPrecisionName = startFieldName + "-precision";
endPrecisionName = endFieldName + "-precision";
}
public Map<String, String> validate(EditConfigurationVTwo editConfig,
MultiValueEditSubmission editSub) {
Map<String, List<Literal>> existingLiterals = editConfig.getLiteralsInScope();
@ -64,9 +75,11 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
// return errors;
// }
// We need to ensure that the user has entered a start year or end year -- tlw72
if ( literalListIsNull(formStartYear) && literalListIsNull(formStartYear) ) {
errors.put(startFieldName, "Date/time intervals must begin with a year. Please enter a start year or an end year.");
return errors;
if ( templateName != null && templateName.equals("dateTimeIntervalForm.ftl")) {
if ( literalListIsNull(formStartYear) && literalListIsNull(formEndYear) ) {
errors.put(startFieldName, "Date/time intervals must begin with a year. Please enter a start year, an end year or both.");
return errors;
}
}
//Assuming form start year and form end year are working in conjunction with multiple values
int index;

View file

@ -92,7 +92,7 @@ public class DateTimeIntervalFormGenerator extends
conf.addField(startField);
conf.addField(endField);
//Need to add validators
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField","dateTimeIntervalForm.ftl"));
//Adding additional data, specifically edit mode
addFormSpecificData(conf, vreq);
}