Adding some changes to DateTimeWidget. NIHVIVO-631
This commit is contained in:
parent
75082602f6
commit
206edf5dbb
4 changed files with 406 additions and 92 deletions
|
@ -308,6 +308,8 @@ public class VitroVocabulary {
|
||||||
DATETIME_NS+"YearMonthDayHourMinutePrecision",
|
DATETIME_NS+"YearMonthDayHourMinutePrecision",
|
||||||
DATETIME_NS+"YearMonthDayTimePrecision"};
|
DATETIME_NS+"YearMonthDayTimePrecision"};
|
||||||
|
|
||||||
|
//The Precision.ordinal method is used so do
|
||||||
|
//not change the order of these enums.
|
||||||
public enum Precision {
|
public enum Precision {
|
||||||
NONE(PRECISIONS[0]),
|
NONE(PRECISIONS[0]),
|
||||||
YEAR(PRECISIONS[1]),
|
YEAR(PRECISIONS[1]),
|
||||||
|
|
|
@ -30,44 +30,76 @@ import freemarker.template.Configuration;
|
||||||
* datetime with precision and to convert he submitted parameters into
|
* datetime with precision and to convert he submitted parameters into
|
||||||
* varname -> Literal and varname -> URI maps.
|
* varname -> Literal and varname -> URI maps.
|
||||||
*
|
*
|
||||||
* This requires two variables to be defined:
|
* The variables that get passed to the template are defined in:
|
||||||
* ${fieldname}.precision - URI of datetime precision
|
* DateTimeWithPrecision.getMapForTemplate()
|
||||||
* ${fieldname}.value - DateTime literal
|
*
|
||||||
|
* Two variables will be defined for the N3 edit graphs (These are NOT variables passed to FM templates):
|
||||||
|
* $fieldname.precision - URI of datetime precision
|
||||||
|
* $fieldname.value - DateTime literal
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DateTimeWithPrecision extends BaseEditElement {
|
public class DateTimeWithPrecision extends BaseEditElement {
|
||||||
|
|
||||||
String fieldName;
|
String fieldName;
|
||||||
VitroVocabulary.Precision requiredMinimumPrecision;
|
|
||||||
|
/**
|
||||||
|
* This is the minimum datetime precision that this element
|
||||||
|
* will accept. If the parameters submitted do not meet this
|
||||||
|
* requirement, then a validation error will be created.
|
||||||
|
*/
|
||||||
|
VitroVocabulary.Precision minimumPrecision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the maximum precision that the form should
|
||||||
|
* allow the user to enter. This value is not used by
|
||||||
|
* DateTimeWithPrecision for validation, it is only passed
|
||||||
|
* to the template. This should be removed when it can be
|
||||||
|
* specified in a ftl file.
|
||||||
|
*
|
||||||
|
* This could be thought of as the maximum precision to display.
|
||||||
|
*/
|
||||||
|
VitroVocabulary.Precision displayRequiredLevel;
|
||||||
|
|
||||||
|
|
||||||
VitroVocabulary.Precision DEFAULT_MIN_PRECISION = VitroVocabulary.Precision.DAY;
|
VitroVocabulary.Precision DEFAULT_MIN_PRECISION = VitroVocabulary.Precision.DAY;
|
||||||
|
VitroVocabulary.Precision DEFAULT_DISPLAY_LEVEL = VitroVocabulary.Precision.DAY;
|
||||||
VitroVocabulary.Precision[] precisions = VitroVocabulary.Precision.values();
|
VitroVocabulary.Precision[] precisions = VitroVocabulary.Precision.values();
|
||||||
|
|
||||||
public DateTimeWithPrecision(Field field) {
|
public DateTimeWithPrecision(Field field) {
|
||||||
super(field);
|
super(field);
|
||||||
fieldName = field.getName();
|
fieldName = field.getName();
|
||||||
requiredMinimumPrecision = DEFAULT_MIN_PRECISION;
|
minimumPrecision = DEFAULT_MIN_PRECISION;
|
||||||
|
displayRequiredLevel = DEFAULT_DISPLAY_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTimeWithPrecision(Field field, VitroVocabulary.Precision requiredMinimumPrecision){
|
public DateTimeWithPrecision(Field field, VitroVocabulary.Precision minimumPrecision){
|
||||||
this(field);
|
this(field);
|
||||||
if( requiredMinimumPrecision != null )
|
if( minimumPrecision != null )
|
||||||
this.requiredMinimumPrecision = requiredMinimumPrecision;
|
this.minimumPrecision = minimumPrecision;
|
||||||
else
|
else
|
||||||
requiredMinimumPrecision = DEFAULT_MIN_PRECISION;
|
this.minimumPrecision = DEFAULT_MIN_PRECISION;
|
||||||
|
this.displayRequiredLevel = this.minimumPrecision;
|
||||||
}
|
}
|
||||||
|
|
||||||
//it would be nice to have only the version of the constructor that takes the enum
|
//it would be nice to have only the version of the constructor that takes the enum
|
||||||
//but this is to quickly get the JSP configuration working.
|
//but this is to quickly get the JSP configuration working.
|
||||||
public DateTimeWithPrecision(Field field, String precisionURI){
|
public DateTimeWithPrecision(Field field, String minimumPrecisionURI, String displayRequiredLevelUri){
|
||||||
this(field);
|
super(field);
|
||||||
for( VitroVocabulary.Precision precision : VitroVocabulary.Precision.values()){
|
|
||||||
if( precision.uri().equals(precisionURI))
|
this.minimumPrecision = toPrecision( minimumPrecisionURI);
|
||||||
this.requiredMinimumPrecision = precision;
|
if( this.minimumPrecision == null )
|
||||||
|
throw new IllegalArgumentException(minimumPrecisionURI
|
||||||
|
+" is not a valid precision for minimumPrecision, see VitroVocabulary.Precision");
|
||||||
|
|
||||||
|
this.displayRequiredLevel = toPrecision( displayRequiredLevelUri );
|
||||||
|
if( this.displayRequiredLevel == null )
|
||||||
|
throw new IllegalArgumentException(minimumPrecisionURI
|
||||||
|
+" is not a valid precision for displayRequiredLevel, see VitroVocabulary.Precision");
|
||||||
|
|
||||||
|
if( this.displayRequiredLevel.ordinal() < this.minimumPrecision.ordinal() ){
|
||||||
|
throw new IllegalArgumentException("the display precision level " + this.displayRequiredLevel
|
||||||
|
+ " is less precise than the required minimum precision of " + this.minimumPrecision);
|
||||||
}
|
}
|
||||||
if( this.requiredMinimumPrecision == null )
|
|
||||||
throw new IllegalArgumentException(precisionURI +" is not a valid precision, see VitroVocabulary.Precision");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(DateTimeWithPrecision.class);
|
private static final Log log = LogFactory.getLog(DateTimeWithPrecision.class);
|
||||||
|
@ -87,20 +119,75 @@ public class DateTimeWithPrecision extends BaseEditElement {
|
||||||
private Map getMapForTemplate(EditConfiguration editConfig, EditSubmission editSub) {
|
private Map getMapForTemplate(EditConfiguration editConfig, EditSubmission editSub) {
|
||||||
Map<String,Object>map = new HashMap<String,Object>();
|
Map<String,Object>map = new HashMap<String,Object>();
|
||||||
|
|
||||||
|
//always need the fieldName, required precision, and constants
|
||||||
map.put("fieldName", fieldName);
|
map.put("fieldName", fieldName);
|
||||||
|
addPrecisionConstants(map);
|
||||||
|
map.put("minimumPrecision", minimumPrecision.uri());
|
||||||
|
map.put("requiredLevel", displayRequiredLevel.uri());
|
||||||
|
|
||||||
|
String precisionUri = getExistingPrecision(editConfig,editSub);
|
||||||
|
VitroVocabulary.Precision existingPrec = toPrecision(precisionUri);
|
||||||
|
|
||||||
|
if( precisionUri != null && !"".equals(precisionUri) && existingPrec == null ){
|
||||||
|
log.error("field " + fieldName + ": existing precision uri was " +
|
||||||
|
"'" + precisionUri + "' but could not convert to Precision object");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( precisionUri == null || precisionUri.isEmpty() ){
|
||||||
|
map.put("existingPrecision", "");
|
||||||
|
|
||||||
|
/* no precision so there should also be no datetime */
|
||||||
|
DateTime value = getTimeValue(editConfig,editSub);
|
||||||
|
if( value != null )
|
||||||
|
log.info("Unexpected state: Precision for " + fieldName
|
||||||
|
+ " was '" + precisionUri + "' but date time was " + value);
|
||||||
|
|
||||||
|
map.put("year", "");
|
||||||
|
map.put("month", "");
|
||||||
|
map.put("day", "");
|
||||||
|
map.put("hour", "");
|
||||||
|
map.put("minute", "");
|
||||||
|
map.put("second", "") ;
|
||||||
|
} else if( VitroVocabulary.Precision.NONE.uri().equals(precisionUri) ){
|
||||||
|
//bdc34: not sure what to do with the NONE precision
|
||||||
|
map.put("existingPrecision", precisionUri);
|
||||||
|
|
||||||
|
map.put("year", "");
|
||||||
|
map.put("month", "");
|
||||||
|
map.put("day", "");
|
||||||
|
map.put("hour", "");
|
||||||
|
map.put("minute", "");
|
||||||
|
map.put("second", "") ;
|
||||||
|
}else{
|
||||||
|
map.put("existingPrecision", precisionUri);
|
||||||
|
|
||||||
DateTime value = getTimeValue(editConfig,editSub);
|
DateTime value = getTimeValue(editConfig,editSub);
|
||||||
map.put("year", Integer.toString(value.getYear()));
|
/* This is the case where there is a precision so there should be a datetime */
|
||||||
map.put("month", Integer.toString(value.getMonthOfYear()));
|
if( value == null )
|
||||||
map.put("day", Integer.toString(value.getDayOfMonth()) );
|
log.error("Field " + fieldName + " has precision " + precisionUri
|
||||||
map.put("hour", Integer.toString(value.getHourOfDay()) );
|
+ " but the date time is " + value);
|
||||||
map.put("minute", Integer.toString(value.getMinuteOfHour()) );
|
|
||||||
|
/* only put the values in the map for ones which are significant based on the precision */
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.SECOND.ordinal() ){
|
||||||
map.put("second", Integer.toString(value.getSecondOfMinute() )) ;
|
map.put("second", Integer.toString(value.getSecondOfMinute() )) ;
|
||||||
|
}
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.MINUTE.ordinal() ){
|
||||||
|
map.put("minute", Integer.toString(value.getMinuteOfHour()) );
|
||||||
|
}
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.HOUR.ordinal() ){
|
||||||
|
map.put("hour", Integer.toString(value.getHourOfDay()) );
|
||||||
|
}
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.DAY.ordinal() ){
|
||||||
|
map.put("day", Integer.toString(value.getDayOfMonth()) );
|
||||||
|
}
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.MONTH.ordinal() ){
|
||||||
|
map.put("month", Integer.toString(value.getMonthOfYear()));
|
||||||
|
}
|
||||||
|
if( existingPrec.ordinal() >= VitroVocabulary.Precision.YEAR.ordinal() ){
|
||||||
|
map.put("year", Integer.toString(value.getYear()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
map.put("precision", getPrecision(editConfig,editSub));
|
|
||||||
map.put("requiredMinimumPrecision", requiredMinimumPrecision.uri());
|
|
||||||
|
|
||||||
addPrecisionConstants(map);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,17 +197,16 @@ public class DateTimeWithPrecision extends BaseEditElement {
|
||||||
for( VitroVocabulary.Precision pc: VitroVocabulary.Precision.values()){
|
for( VitroVocabulary.Precision pc: VitroVocabulary.Precision.values()){
|
||||||
constants.put(pc.name().toLowerCase(),pc.uri());
|
constants.put(pc.name().toLowerCase(),pc.uri());
|
||||||
}
|
}
|
||||||
map.put("precisions", constants);
|
map.put("precisionConstants", constants);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the currently set precision
|
* Gets the currently set precision. May return null.
|
||||||
*/
|
*/
|
||||||
private String getPrecision(EditConfiguration editConfig, EditSubmission editSub) {
|
private String getExistingPrecision(EditConfiguration editConfig, EditSubmission editSub) {
|
||||||
String precisionURI = editConfig.getUrisInScope().get( getPrecisionVariableName() );
|
String precisionURI = editConfig.getUrisInScope().get( getPrecisionVariableName() );
|
||||||
if( precisionURI == null ){
|
if( precisionURI == null ){
|
||||||
//maybe we need a way to specify a default value?
|
return null;
|
||||||
return VitroVocabulary.Precision.DAY.uri();
|
|
||||||
}else{
|
}else{
|
||||||
return precisionURI;
|
return precisionURI;
|
||||||
}
|
}
|
||||||
|
@ -129,8 +215,7 @@ public class DateTimeWithPrecision extends BaseEditElement {
|
||||||
private DateTime getTimeValue(EditConfiguration editConfig, EditSubmission editSub) {
|
private DateTime getTimeValue(EditConfiguration editConfig, EditSubmission editSub) {
|
||||||
Literal dtValue = editConfig.getLiteralsInScope().get( getValueVariableName() );
|
Literal dtValue = editConfig.getLiteralsInScope().get( getValueVariableName() );
|
||||||
if( dtValue == null ){
|
if( dtValue == null ){
|
||||||
//maybe we need a way to specify a default value?
|
return null;
|
||||||
return new DateTime();
|
|
||||||
}else{
|
}else{
|
||||||
return new DateTime( dtValue.getLexicalForm() );
|
return new DateTime( dtValue.getLexicalForm() );
|
||||||
}
|
}
|
||||||
|
@ -462,12 +547,21 @@ public class DateTimeWithPrecision extends BaseEditElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public VitroVocabulary.Precision getRequiredMinimumPrecision() {
|
public VitroVocabulary.Precision getRequiredMinimumPrecision() {
|
||||||
return requiredMinimumPrecision;
|
return minimumPrecision;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredMinimumPrecision(
|
public void setRequiredMinimumPrecision(
|
||||||
VitroVocabulary.Precision requiredMinimumPrecision) {
|
VitroVocabulary.Precision requiredMinimumPrecision) {
|
||||||
this.requiredMinimumPrecision = requiredMinimumPrecision;
|
this.minimumPrecision = requiredMinimumPrecision;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns null if it cannot convert */
|
||||||
|
private static VitroVocabulary.Precision toPrecision(String precisionUri){
|
||||||
|
for( VitroVocabulary.Precision precision : VitroVocabulary.Precision.values()){
|
||||||
|
if( precision.uri().equals(precisionUri))
|
||||||
|
return precision;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueVariableName(){ return fieldName + ".value" ; }
|
public String getValueVariableName(){ return fieldName + ".value" ; }
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.web.widgets;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import freemarker.core.Environment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This widget is intended to assist in dealing with xsd:dateTime values from
|
||||||
|
* Literals.
|
||||||
|
*
|
||||||
|
* It is intended to be used like this:
|
||||||
|
*
|
||||||
|
* <@widget name="DateTime" dateTime="2010-11-23T11:03:23" >
|
||||||
|
* The year is ${year}
|
||||||
|
* The month is ${month}
|
||||||
|
* The day is ${day}
|
||||||
|
* The hour is ${hour}
|
||||||
|
* The second is ${second}
|
||||||
|
* precision of date entered: ${precisionUri}
|
||||||
|
* </@widget>
|
||||||
|
*
|
||||||
|
* @author bdc34
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DateTimeWidget extends Widget {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected WidgetTemplateValues process(Environment env, Map params,
|
||||||
|
HttpServletRequest request, ServletContext context)
|
||||||
|
throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,41 +6,66 @@ an example and I didn't really see any other way to get the jsp custom forms to
|
||||||
this at the moment. Needless to say, we need to be able to call the macro and pass
|
this at the moment. Needless to say, we need to be able to call the macro and pass
|
||||||
parameters from within the original custom form -->
|
parameters from within the original custom form -->
|
||||||
|
|
||||||
<@dateTime specificity="${precision}" required="${requiredMinimumPrecision}" />
|
<#--
|
||||||
|
Available variables:
|
||||||
|
|
||||||
|
fieldName -- name of field
|
||||||
|
minimumPrecision -- minimum precision accepted by validator
|
||||||
|
requiredLevel -- maximum precision to display as required
|
||||||
|
|
||||||
|
existingPrecision -- precision on an existing value, may be ""
|
||||||
|
year -- year on an existing value, may be ""
|
||||||
|
month -- month on an existing value, may be ""
|
||||||
|
day -- day on an existing value, may be ""
|
||||||
|
hour -- hour on an existing value, may be ""
|
||||||
|
minute -- minute on an existing value, may be ""
|
||||||
|
second -- second on an existing value, may be ""
|
||||||
|
|
||||||
|
precisionConstants.none -- URI for precision
|
||||||
|
precisionConstants.year -- URI for precision
|
||||||
|
precisionConstants.month -- URI for precision
|
||||||
|
precisionConstants.day -- URI for precision
|
||||||
|
precisionConstants.hour -- URI for precision
|
||||||
|
precisionConstants.minute -- URI for precision
|
||||||
|
precisionConstants.second -- URI for precision
|
||||||
|
-->
|
||||||
|
|
||||||
|
<@dateTime specificity="${minimumPrecision}" required="${requiredLevel}" />
|
||||||
|
|
||||||
<#macro dateTime specificity="full" required=specificity>
|
<#macro dateTime specificity="full" required=specificity>
|
||||||
|
|
||||||
<#assign specLevel = 10 />
|
<#assign specLevel = 10 />
|
||||||
<#assign reqLevel = 10 />
|
<#assign reqLevel = 10 />
|
||||||
<#if specificity == "${precisions.year}">
|
<#if specificity == "${precisionConstants.year}">
|
||||||
<#assign specLevel = 1 />
|
<#assign specLevel = 1 />
|
||||||
<#elseif specificity == "${precisions.month}">
|
<#elseif specificity == "${precisionConstants.month}">
|
||||||
<#assign specLevel = 2 />
|
<#assign specLevel = 2 />
|
||||||
<#-- allow to specify year, month and day using "date" -->
|
<#-- allow to specify year, month and day using "date" -->
|
||||||
<#elseif specificity == "${precisions.day}" || specificity == "date">
|
<#elseif specificity == "${precisionConstants.day}" || specificity == "date">
|
||||||
<#assign specLevel = 3 />
|
<#assign specLevel = 3 />
|
||||||
<#elseif specificity == "${precisions.hour}">
|
<#elseif specificity == "${precisionConstants.hour}">
|
||||||
<#assign specLevel = 4 />
|
<#assign specLevel = 4 />
|
||||||
<#-- allow to specify hours and minutes using "time" -->
|
<#-- allow to specify hours and minutes using "time" -->
|
||||||
<#elseif specificity == "${precisions.minute}" || specificity == "time">
|
<#elseif specificity == "${precisionConstants.minute}" || specificity == "time">
|
||||||
<#assign specLevel = 5 />
|
<#assign specLevel = 5 />
|
||||||
<#elseif specificity == "${precisions.second}">
|
<#elseif specificity == "${precisionConstants.second}">
|
||||||
<#assign specLevel = 6 />
|
<#assign specLevel = 6 />
|
||||||
</#if>
|
</#if>
|
||||||
<#if required == "${precisions.year}">
|
<#if required == "${precisionConstants.year}">
|
||||||
<#assign reqLevel = 1 />
|
<#assign reqLevel = 1 />
|
||||||
<#elseif required == "${precisions.month}">
|
<#elseif required == "${precisionConstants.month}">
|
||||||
<#assign reqLevel = 2 />
|
<#assign reqLevel = 2 />
|
||||||
<#-- allow to require year, month and day using "date" -->
|
<#-- allow to require year, month and day using "date" -->
|
||||||
<#elseif required == "${precisions.day}" || required == "date">
|
<#elseif required == "${precisionConstants.day}" || required == "date">
|
||||||
<#assign reqLevel = 3 />
|
<#assign reqLevel = 3 />
|
||||||
<#elseif required == "${precisions.hour}">
|
<#elseif required == "${precisionConstants.hour}">
|
||||||
<#assign reqLevel = 4 />
|
<#assign reqLevel = 4 />
|
||||||
<#-- allow to require hours and minutes using "time" -->
|
<#-- allow to require hours and minutes using "time" -->
|
||||||
<#elseif required == "${precisions.minute}" || required == "time">
|
<#elseif required == "${precisionConstants.minute}" || required == "time">
|
||||||
<#assign reqLevel = 5 />
|
<#assign reqLevel = 5 />
|
||||||
<#elseif required == "${precisions.second}">
|
<#elseif required == "${precisionConstants.second}">
|
||||||
<#assign reqLevel = 6 />
|
<#assign reqLevel = 6 />
|
||||||
<#elseif required == "${precisions.none}">
|
<#elseif required == "${precisionConstants.none}">
|
||||||
<#assign reqLevel = 0 />
|
<#assign reqLevel = 0 />
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
@ -55,22 +80,57 @@ parameters from within the original custom form -->
|
||||||
<#if specLevel gte 2>
|
<#if specLevel gte 2>
|
||||||
<label for="${fieldName}.month">Month<#if reqLevel gte 2> <span class="requiredHint">*</span></#if></label>
|
<label for="${fieldName}.month">Month<#if reqLevel gte 2> <span class="requiredHint">*</span></#if></label>
|
||||||
<select name="${fieldName}.month" id="${fieldName}.month" <#if reqLevel gte 2>required </#if>>
|
<select name="${fieldName}.month" id="${fieldName}.month" <#if reqLevel gte 2>required </#if>>
|
||||||
<option value=""<#if !month??> selected="selected"</#if>>month</option>
|
<option value=""<#if month??> selected="selected"</#if>>month</option>
|
||||||
<#assign numMonths = 12 />
|
<option value="01"<#if month == "01"> selected="selected"</#if>>1</option>
|
||||||
<#list 1..numMonths as currentMonth>
|
<option value="02"<#if month == "02"> selected="selected"</#if>>2</option>
|
||||||
<option value="${currentMonth?string('00')}"<#if month == "${currentMonth}"> selected="selected"</#if>>${currentMonth}</option>
|
<option value="03"<#if month == "03"> selected="selected"</#if>>3</option>
|
||||||
</#list>
|
<option value="04"<#if month == "04"> selected="selected"</#if>>4</option>
|
||||||
|
<option value="05"<#if month == "05"> selected="selected"</#if>>5</option>
|
||||||
|
<option value="06"<#if month == "06"> selected="selected"</#if>>6</option>
|
||||||
|
<option value="07"<#if month == "07"> selected="selected"</#if>>7</option>
|
||||||
|
<option value="08"<#if month == "08"> selected="selected"</#if>>8</option>
|
||||||
|
<option value="09"<#if month == "09"> selected="selected"</#if>>9</option>
|
||||||
|
<option value="10"<#if month == "10"> selected="selected"</#if>>10</option>
|
||||||
|
<option value="11"<#if month == "11"> selected="selected"</#if>>11</option>
|
||||||
|
<option value="12"<#if month == "12"> selected="selected"</#if>>12</option>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if specLevel gte 3>
|
<#if specLevel gte 3>
|
||||||
<label for="${fieldName}.day">Day<#if reqLevel gte 3> <span class="requiredHint">*</span></#if></label>
|
<label for="${fieldName}.day">Day<#if reqLevel gte 3> <span class="requiredHint">*</span></#if></label>
|
||||||
<select name="${fieldName}.day" id="${fieldName}.day" <#if reqLevel gte 3>required </#if>>
|
<select name="${fieldName}.day" id="${fieldName}.day" <#if reqLevel gte 3>required </#if>>
|
||||||
<option value=""<#if !day??> selected="selected"</#if>>day</option>
|
<option value=""<#if day??> selected="selected"</#if>>day</option>
|
||||||
<#assign numDays = 31 />
|
<option value="01"<#if day == "01"> selected="selected"</#if>>1</option>
|
||||||
<#list 1..numDays as currentDay>
|
<option value="02"<#if day == "02"> selected="selected"</#if>>2</option>
|
||||||
<option value="${currentDay?string('00')}"<#if day == "${currentDay}"> selected="selected"</#if>>${currentDay}</option>
|
<option value="03"<#if day == "03"> selected="selected"</#if>>3</option>
|
||||||
</#list>
|
<option value="04"<#if day == "04"> selected="selected"</#if>>4</option>
|
||||||
|
<option value="05"<#if day == "05"> selected="selected"</#if>>5</option>
|
||||||
|
<option value="06"<#if day == "06"> selected="selected"</#if>>6</option>
|
||||||
|
<option value="07"<#if day == "07"> selected="selected"</#if>>7</option>
|
||||||
|
<option value="08"<#if day == "08"> selected="selected"</#if>>8</option>
|
||||||
|
<option value="09"<#if day == "09"> selected="selected"</#if>>9</option>
|
||||||
|
<option value="10"<#if day == "10"> selected="selected"</#if>>10</option>
|
||||||
|
<option value="11"<#if day == "11"> selected="selected"</#if>>11</option>
|
||||||
|
<option value="12"<#if day == "12"> selected="selected"</#if>>12</option>
|
||||||
|
<option value="13"<#if day == "13"> selected="selected"</#if>>13</option>
|
||||||
|
<option value="14"<#if day == "14"> selected="selected"</#if>>14</option>
|
||||||
|
<option value="15"<#if day == "15"> selected="selected"</#if>>15</option>
|
||||||
|
<option value="16"<#if day == "16"> selected="selected"</#if>>16</option>
|
||||||
|
<option value="17"<#if day == "17"> selected="selected"</#if>>17</option>
|
||||||
|
<option value="18"<#if day == "18"> selected="selected"</#if>>18</option>
|
||||||
|
<option value="19"<#if day == "19"> selected="selected"</#if>>19</option>
|
||||||
|
<option value="20"<#if day == "20"> selected="selected"</#if>>20</option>
|
||||||
|
<option value="21"<#if day == "21"> selected="selected"</#if>>21</option>
|
||||||
|
<option value="22"<#if day == "22"> selected="selected"</#if>>22</option>
|
||||||
|
<option value="23"<#if day == "23"> selected="selected"</#if>>23</option>
|
||||||
|
<option value="24"<#if day == "24"> selected="selected"</#if>>24</option>
|
||||||
|
<option value="25"<#if day == "25"> selected="selected"</#if>>25</option>
|
||||||
|
<option value="26"<#if day == "26"> selected="selected"</#if>>26</option>
|
||||||
|
<option value="27"<#if day == "27"> selected="selected"</#if>>27</option>
|
||||||
|
<option value="28"<#if day == "28"> selected="selected"</#if>>28</option>
|
||||||
|
<option value="29"<#if day == "29"> selected="selected"</#if>>29</option>
|
||||||
|
<option value="30"<#if day == "30"> selected="selected"</#if>>30</option>
|
||||||
|
<option value="31"<#if day == "31"> selected="selected"</#if>>31</option>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
@ -78,45 +138,163 @@ parameters from within the original custom form -->
|
||||||
<#-- We'll need to make this more flexible to support 24 hour display down the road. For now assuming 12h with am/pm -->
|
<#-- We'll need to make this more flexible to support 24 hour display down the road. For now assuming 12h with am/pm -->
|
||||||
<label for="${fieldName}.hour">Hour<#if reqLevel gte 4> <span class="requiredHint">*</span></#if></label>
|
<label for="${fieldName}.hour">Hour<#if reqLevel gte 4> <span class="requiredHint">*</span></#if></label>
|
||||||
<select name="${fieldName}.hour" id="${fieldName}.hour" <#if reqLevel gte 3>required </#if>>
|
<select name="${fieldName}.hour" id="${fieldName}.hour" <#if reqLevel gte 3>required </#if>>
|
||||||
<option value=""<#if !hour??> selected="selected"</#if>>hour</option>
|
<option value=""<#if hour??> selected="selected"</#if>>hour</option>
|
||||||
<#assign numHours = 23 />
|
<option value="00"<#if hour == "00"> selected="selected"</#if>>12am</option>
|
||||||
<#list 0..numHours as currentHour>
|
<option value="01"<#if hour == "01"> selected="selected"</#if>>1am</option>
|
||||||
<#if currentHour_index == 0>
|
<option value="02"<#if hour == "02"> selected="selected"</#if>>2am</option>
|
||||||
<#assign displayHour = 12 />
|
<option value="03"<#if hour == "03"> selected="selected"</#if>>3am</option>
|
||||||
<#elseif (currentHour > 12)>
|
<option value="04"<#if hour == "04"> selected="selected"</#if>>4am</option>
|
||||||
<#assign displayHour = currentHour - 12 />
|
<option value="05"<#if hour == "05"> selected="selected"</#if>>5am</option>
|
||||||
<#else>
|
<option value="06"<#if hour == "06"> selected="selected"</#if>>6am</option>
|
||||||
<#assign displayHour = currentHour />
|
<option value="07"<#if hour == "07"> selected="selected"</#if>>7am</option>
|
||||||
</#if>
|
<option value="08"<#if hour == "08"> selected="selected"</#if>>8am</option>
|
||||||
<#if (currentHour < 12)>
|
<option value="09"<#if hour == "09"> selected="selected"</#if>>9am</option>
|
||||||
<#assign meridiem = "am" />
|
<option value="10"<#if hour == "10"> selected="selected"</#if>>10am</option>
|
||||||
<#else>
|
<option value="11"<#if hour == "11"> selected="selected"</#if>>11am</option>
|
||||||
<#assign meridiem = "pm" />
|
<option value="12"<#if hour == "12"> selected="selected"</#if>>12pm</option>
|
||||||
</#if>
|
<option value="13"<#if hour == "13"> selected="selected"</#if>>1pm</option>
|
||||||
<option value="${currentHour?string('00')}"<#if hour == "${currentHour}"> selected="selected"</#if>>${displayHour + meridiem}</option>
|
<option value="14"<#if hour == "14"> selected="selected"</#if>>2pm</option>
|
||||||
</#list>
|
<option value="15"<#if hour == "15"> selected="selected"</#if>>3pm</option>
|
||||||
|
<option value="16"<#if hour == "16"> selected="selected"</#if>>4pm</option>
|
||||||
|
<option value="17"<#if hour == "17"> selected="selected"</#if>>5pm</option>
|
||||||
|
<option value="18"<#if hour == "18"> selected="selected"</#if>>6pm</option>
|
||||||
|
<option value="19"<#if hour == "19"> selected="selected"</#if>>7pm</option>
|
||||||
|
<option value="20"<#if hour == "20"> selected="selected"</#if>>8pm</option>
|
||||||
|
<option value="21"<#if hour == "21"> selected="selected"</#if>>9pm</option>
|
||||||
|
<option value="22"<#if hour == "22"> selected="selected"</#if>>10pm</option>
|
||||||
|
<option value="23"<#if hour == "23"> selected="selected"</#if>>11pm</option>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if specLevel gte 5>
|
<#if specLevel gte 5>
|
||||||
<label for="${fieldName}.minute">Minutes<#if reqLevel gte 5> <span class="requiredHint">*</span></#if></label>
|
<label for="${fieldName}.minute">Minutes<#if reqLevel gte 5> <span class="requiredHint">*</span></#if></label>
|
||||||
<select name="${fieldName}.minute" id="${fieldName}.minute" <#if reqLevel gte 5>required </#if>>
|
<select name="${fieldName}.minute" id="${fieldName}.minute" <#if reqLevel gte 5>required </#if>>
|
||||||
<option value=""<#if !minute??> selected="selected"</#if>>minutes</option>
|
<option value=""<#if minute??> selected="selected"</#if>>minutes</option>
|
||||||
<#assign numMinutes = 59 />
|
<option value="01"<#if minute == "01"> selected="selected"</#if>>1</option>
|
||||||
<#list 1..numMinutes as currentMinute>
|
<option value="02"<#if minute == "02"> selected="selected"</#if>>2</option>
|
||||||
<option value="${currentMinute?string('00')}"<#if minute == "${currentMinute}"> selected="selected"</#if>>${currentMinute}</option>
|
<option value="03"<#if minute == "03"> selected="selected"</#if>>3</option>
|
||||||
</#list>
|
<option value="04"<#if minute == "04"> selected="selected"</#if>>4</option>
|
||||||
|
<option value="05"<#if minute == "05"> selected="selected"</#if>>5</option>
|
||||||
|
<option value="06"<#if minute == "06"> selected="selected"</#if>>6</option>
|
||||||
|
<option value="07"<#if minute == "07"> selected="selected"</#if>>7</option>
|
||||||
|
<option value="08"<#if minute == "08"> selected="selected"</#if>>8</option>
|
||||||
|
<option value="09"<#if minute == "09"> selected="selected"</#if>>9</option>
|
||||||
|
<option value="10"<#if minute == "10"> selected="selected"</#if>>10</option>
|
||||||
|
<option value="11"<#if minute == "11"> selected="selected"</#if>>11</option>
|
||||||
|
<option value="12"<#if minute == "12"> selected="selected"</#if>>12</option>
|
||||||
|
<option value="13"<#if minute == "13"> selected="selected"</#if>>13</option>
|
||||||
|
<option value="14"<#if minute == "14"> selected="selected"</#if>>14</option>
|
||||||
|
<option value="15"<#if minute == "15"> selected="selected"</#if>>15</option>
|
||||||
|
<option value="16"<#if minute == "16"> selected="selected"</#if>>16</option>
|
||||||
|
<option value="17"<#if minute == "17"> selected="selected"</#if>>17</option>
|
||||||
|
<option value="18"<#if minute == "18"> selected="selected"</#if>>18</option>
|
||||||
|
<option value="19"<#if minute == "19"> selected="selected"</#if>>19</option>
|
||||||
|
<option value="20"<#if minute == "20"> selected="selected"</#if>>20</option>
|
||||||
|
<option value="21"<#if minute == "21"> selected="selected"</#if>>21</option>
|
||||||
|
<option value="22"<#if minute == "22"> selected="selected"</#if>>22</option>
|
||||||
|
<option value="23"<#if minute == "23"> selected="selected"</#if>>23</option>
|
||||||
|
<option value="24"<#if minute == "24"> selected="selected"</#if>>24</option>
|
||||||
|
<option value="25"<#if minute == "25"> selected="selected"</#if>>25</option>
|
||||||
|
<option value="26"<#if minute == "26"> selected="selected"</#if>>26</option>
|
||||||
|
<option value="27"<#if minute == "27"> selected="selected"</#if>>27</option>
|
||||||
|
<option value="28"<#if minute == "28"> selected="selected"</#if>>28</option>
|
||||||
|
<option value="29"<#if minute == "29"> selected="selected"</#if>>29</option>
|
||||||
|
<option value="30"<#if minute == "30"> selected="selected"</#if>>30</option>
|
||||||
|
<option value="31"<#if minute == "31"> selected="selected"</#if>>31</option>
|
||||||
|
<option value="32"<#if minute == "32"> selected="selected"</#if>>32</option>
|
||||||
|
<option value="33"<#if minute == "33"> selected="selected"</#if>>33</option>
|
||||||
|
<option value="34"<#if minute == "34"> selected="selected"</#if>>34</option>
|
||||||
|
<option value="35"<#if minute == "35"> selected="selected"</#if>>35</option>
|
||||||
|
<option value="36"<#if minute == "36"> selected="selected"</#if>>36</option>
|
||||||
|
<option value="37"<#if minute == "37"> selected="selected"</#if>>37</option>
|
||||||
|
<option value="38"<#if minute == "38"> selected="selected"</#if>>38</option>
|
||||||
|
<option value="39"<#if minute == "39"> selected="selected"</#if>>39</option>
|
||||||
|
<option value="40"<#if minute == "40"> selected="selected"</#if>>40</option>
|
||||||
|
<option value="41"<#if minute == "41"> selected="selected"</#if>>41</option>
|
||||||
|
<option value="42"<#if minute == "42"> selected="selected"</#if>>42</option>
|
||||||
|
<option value="43"<#if minute == "43"> selected="selected"</#if>>43</option>
|
||||||
|
<option value="44"<#if minute == "44"> selected="selected"</#if>>44</option>
|
||||||
|
<option value="45"<#if minute == "45"> selected="selected"</#if>>45</option>
|
||||||
|
<option value="46"<#if minute == "46"> selected="selected"</#if>>46</option>
|
||||||
|
<option value="47"<#if minute == "47"> selected="selected"</#if>>47</option>
|
||||||
|
<option value="48"<#if minute == "48"> selected="selected"</#if>>48</option>
|
||||||
|
<option value="49"<#if minute == "49"> selected="selected"</#if>>49</option>
|
||||||
|
<option value="50"<#if minute == "50"> selected="selected"</#if>>50</option>
|
||||||
|
<option value="51"<#if minute == "51"> selected="selected"</#if>>51</option>
|
||||||
|
<option value="52"<#if minute == "52"> selected="selected"</#if>>52</option>
|
||||||
|
<option value="53"<#if minute == "53"> selected="selected"</#if>>53</option>
|
||||||
|
<option value="54"<#if minute == "54"> selected="selected"</#if>>54</option>
|
||||||
|
<option value="55"<#if minute == "55"> selected="selected"</#if>>55</option>
|
||||||
|
<option value="56"<#if minute == "56"> selected="selected"</#if>>56</option>
|
||||||
|
<option value="57"<#if minute == "57"> selected="selected"</#if>>57</option>
|
||||||
|
<option value="58"<#if minute == "58"> selected="selected"</#if>>58</option>
|
||||||
|
<option value="59"<#if minute == "59"> selected="selected"</#if>>59</option>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if specLevel gte 6>
|
<#if specLevel gte 6>
|
||||||
<label for="${fieldName}.second">Seconds<#if reqLevel gte 6> <span class="requiredHint">*</span></#if></label>
|
<label for="${fieldName}.second">Seconds<#if reqLevel gte 6> <span class="requiredHint">*</span></#if></label>
|
||||||
<select name="${fieldName}.second" id="${fieldName}.second" <#if reqLevel gte 6>required </#if>>
|
<select name="${fieldName}.second" id="${fieldName}.second" <#if reqLevel gte 6>required </#if>>
|
||||||
<option value=""<#if !second??> selected="selected"</#if>>seconds</option>
|
<option value=""<#if second??> selected="selected"</#if>>seconds</option>
|
||||||
<#assign numMinutes = 59 />
|
<option value="01"<#if second == "01"> selected="selected"</#if>>1</option>
|
||||||
<#list 1..numMinutes as currentSecond>
|
<option value="02"<#if second == "02"> selected="selected"</#if>>2</option>
|
||||||
<option value="${currentSecond?string('00')}"<#if second == "${currentSecond}"> selected="selected"</#if>>${currentSecond}</option>
|
<option value="03"<#if second == "03"> selected="selected"</#if>>3</option>
|
||||||
</#list>
|
<option value="04"<#if second == "04"> selected="selected"</#if>>4</option>
|
||||||
|
<option value="05"<#if second == "05"> selected="selected"</#if>>5</option>
|
||||||
|
<option value="06"<#if second == "06"> selected="selected"</#if>>6</option>
|
||||||
|
<option value="07"<#if second == "07"> selected="selected"</#if>>7</option>
|
||||||
|
<option value="08"<#if second == "08"> selected="selected"</#if>>8</option>
|
||||||
|
<option value="09"<#if second == "09"> selected="selected"</#if>>9</option>
|
||||||
|
<option value="10"<#if second == "10"> selected="selected"</#if>>10</option>
|
||||||
|
<option value="11"<#if second == "11"> selected="selected"</#if>>11</option>
|
||||||
|
<option value="12"<#if second == "12"> selected="selected"</#if>>12</option>
|
||||||
|
<option value="13"<#if second == "13"> selected="selected"</#if>>13</option>
|
||||||
|
<option value="14"<#if second == "14"> selected="selected"</#if>>14</option>
|
||||||
|
<option value="15"<#if second == "15"> selected="selected"</#if>>15</option>
|
||||||
|
<option value="16"<#if second == "16"> selected="selected"</#if>>16</option>
|
||||||
|
<option value="17"<#if second == "17"> selected="selected"</#if>>17</option>
|
||||||
|
<option value="18"<#if second == "18"> selected="selected"</#if>>18</option>
|
||||||
|
<option value="19"<#if second == "19"> selected="selected"</#if>>19</option>
|
||||||
|
<option value="20"<#if second == "20"> selected="selected"</#if>>20</option>
|
||||||
|
<option value="21"<#if second == "21"> selected="selected"</#if>>21</option>
|
||||||
|
<option value="22"<#if second == "22"> selected="selected"</#if>>22</option>
|
||||||
|
<option value="23"<#if second == "23"> selected="selected"</#if>>23</option>
|
||||||
|
<option value="24"<#if second == "24"> selected="selected"</#if>>24</option>
|
||||||
|
<option value="25"<#if second == "25"> selected="selected"</#if>>25</option>
|
||||||
|
<option value="26"<#if second == "26"> selected="selected"</#if>>26</option>
|
||||||
|
<option value="27"<#if second == "27"> selected="selected"</#if>>27</option>
|
||||||
|
<option value="28"<#if second == "28"> selected="selected"</#if>>28</option>
|
||||||
|
<option value="29"<#if second == "29"> selected="selected"</#if>>29</option>
|
||||||
|
<option value="30"<#if second == "30"> selected="selected"</#if>>30</option>
|
||||||
|
<option value="31"<#if second == "31"> selected="selected"</#if>>31</option>
|
||||||
|
<option value="32"<#if second == "32"> selected="selected"</#if>>32</option>
|
||||||
|
<option value="33"<#if second == "33"> selected="selected"</#if>>33</option>
|
||||||
|
<option value="34"<#if second == "34"> selected="selected"</#if>>34</option>
|
||||||
|
<option value="35"<#if second == "35"> selected="selected"</#if>>35</option>
|
||||||
|
<option value="36"<#if second == "36"> selected="selected"</#if>>36</option>
|
||||||
|
<option value="37"<#if second == "37"> selected="selected"</#if>>37</option>
|
||||||
|
<option value="38"<#if second == "38"> selected="selected"</#if>>38</option>
|
||||||
|
<option value="39"<#if second == "39"> selected="selected"</#if>>39</option>
|
||||||
|
<option value="40"<#if second == "40"> selected="selected"</#if>>40</option>
|
||||||
|
<option value="41"<#if second == "41"> selected="selected"</#if>>41</option>
|
||||||
|
<option value="42"<#if second == "42"> selected="selected"</#if>>42</option>
|
||||||
|
<option value="43"<#if second == "43"> selected="selected"</#if>>43</option>
|
||||||
|
<option value="44"<#if second == "44"> selected="selected"</#if>>44</option>
|
||||||
|
<option value="45"<#if second == "45"> selected="selected"</#if>>45</option>
|
||||||
|
<option value="46"<#if second == "46"> selected="selected"</#if>>46</option>
|
||||||
|
<option value="47"<#if second == "47"> selected="selected"</#if>>47</option>
|
||||||
|
<option value="48"<#if second == "48"> selected="selected"</#if>>48</option>
|
||||||
|
<option value="49"<#if second == "49"> selected="selected"</#if>>49</option>
|
||||||
|
<option value="50"<#if second == "50"> selected="selected"</#if>>50</option>
|
||||||
|
<option value="51"<#if second == "51"> selected="selected"</#if>>51</option>
|
||||||
|
<option value="52"<#if second == "52"> selected="selected"</#if>>52</option>
|
||||||
|
<option value="53"<#if second == "53"> selected="selected"</#if>>53</option>
|
||||||
|
<option value="54"<#if second == "54"> selected="selected"</#if>>54</option>
|
||||||
|
<option value="55"<#if second == "55"> selected="selected"</#if>>55</option>
|
||||||
|
<option value="56"<#if second == "56"> selected="selected"</#if>>56</option>
|
||||||
|
<option value="57"<#if second == "57"> selected="selected"</#if>>57</option>
|
||||||
|
<option value="58"<#if second == "58"> selected="selected"</#if>>58</option>
|
||||||
|
<option value="59"<#if second == "59"> selected="selected"</#if>>59</option>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
</#if>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Add table
Reference in a new issue