Merge branch 'maint-rel-1.6' of git+ssh://github.com/vivo-project/Vitro into maint-rel-1.6
This commit is contained in:
commit
c1e28101dd
5 changed files with 26 additions and 7 deletions
|
@ -864,3 +864,5 @@ view_labels_capitalized = Ver etiquetas
|
||||||
view_labels_for = Ver Etiquetas de
|
view_labels_for = Ver Etiquetas de
|
||||||
|
|
||||||
select_an_existing_document = Seleccione un documento existente
|
select_an_existing_document = Seleccione un documento existente
|
||||||
|
|
||||||
|
datetime_year_required = Intervalos de fecha / hora deben empezar por un año. Ingrese una Fecha de inicio, un fin de año o los dos.
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
|
|
||||||
private String startFieldName;
|
private String startFieldName;
|
||||||
private String endFieldName;
|
private String endFieldName;
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
private String startValueName;
|
private String startValueName;
|
||||||
private String endValueName;
|
private String endValueName;
|
||||||
|
@ -43,6 +44,16 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
endPrecisionName = endFieldName + "-precision";
|
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,
|
public Map<String, String> validate(EditConfigurationVTwo editConfig,
|
||||||
MultiValueEditSubmission editSub) {
|
MultiValueEditSubmission editSub) {
|
||||||
Map<String, List<Literal>> existingLiterals = editConfig.getLiteralsInScope();
|
Map<String, List<Literal>> existingLiterals = editConfig.getLiteralsInScope();
|
||||||
|
@ -63,8 +74,13 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
// errors.put(startFieldName, "If there is an end date, there should be a start date");
|
// errors.put(startFieldName, "If there is an end date, there should be a start date");
|
||||||
// return errors;
|
// return errors;
|
||||||
// }
|
// }
|
||||||
|
// We need to ensure that the user has entered a start year or end year -- tlw72
|
||||||
|
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
|
//Assuming form start year and form end year are working in conjunction with multiple values
|
||||||
int index;
|
int index;
|
||||||
if (!literalListIsNull(formStartYear) && !literalListIsNull(formEndYear)) {
|
if (!literalListIsNull(formStartYear) && !literalListIsNull(formEndYear)) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class DateTimeIntervalFormGenerator extends
|
||||||
conf.addField(startField);
|
conf.addField(startField);
|
||||||
conf.addField(endField);
|
conf.addField(endField);
|
||||||
//Need to add validators
|
//Need to add validators
|
||||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
|
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField","dateTimeIntervalForm.ftl"));
|
||||||
//Adding additional data, specifically edit mode
|
//Adding additional data, specifically edit mode
|
||||||
addFormSpecificData(conf, vreq);
|
addFormSpecificData(conf, vreq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,4 +875,6 @@ selection_in_process = Your selection is being processed.
|
||||||
view_labels_capitalized = View Labels
|
view_labels_capitalized = View Labels
|
||||||
view_labels_for = View Labels for
|
view_labels_for = View Labels for
|
||||||
|
|
||||||
select_an_existing_document = Select an existing document
|
select_an_existing_document = Select an existing document
|
||||||
|
|
||||||
|
datetime_year_required = Date/time intervals must begin with a year. Enter either a Start Year, an End Year or both.
|
|
@ -58,7 +58,7 @@
|
||||||
<#if htmlForElements?keys?seq_contains("endField")>
|
<#if htmlForElements?keys?seq_contains("endField")>
|
||||||
${i18n().end_capitalized} ${htmlForElements["endField"]}
|
${i18n().end_capitalized} ${htmlForElements["endField"]}
|
||||||
</#if>
|
</#if>
|
||||||
|
<span class="requiredHint"> *${i18n().datetime_year_required}</span>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<input type="hidden" name="editKey" value="${editKey}" />
|
<input type="hidden" name="editKey" value="${editKey}" />
|
||||||
<input type="submit" id="submit" value="${submitButtonText}" role="button" />
|
<input type="submit" id="submit" value="${submitButtonText}" role="button" />
|
||||||
|
@ -69,8 +69,7 @@
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customForm.css" />',
|
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
|
||||||
'<link rel="stylesheet" href="${urls.base}/edit/forms/css/personHasEducationalTraining.css" />')}
|
|
||||||
|
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/utils.js"></script>',
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/utils.js"></script>',
|
||||||
'<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
|
'<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
|
Loading…
Add table
Reference in a new issue