template work

This commit is contained in:
tworrall 2011-11-18 14:15:17 +00:00
parent f218cc8d24
commit 5d7bb6e77d
2 changed files with 85 additions and 63 deletions

View file

@ -92,7 +92,7 @@
<p class="inline"> <p class="inline">
<label for="orgType">Organization Type ${requiredHint}</label> <label for="orgType">Organization Type ${requiredHint}</label>
<#assign orgTypeOpts = editConfiguration.pageData.orgType /> <#assign orgTypeOpts = editConfiguration.pageData.orgType />
<select id="typeSelector" name="orgType" <#if (disabledVal!?length > 0)>disabled="${disabledVal}"</#if>> <select id="typeSelector" name="orgType" ${disabledVal}>
<option value="" selected="selected">Select one</option> <option value="" selected="selected">Select one</option>
<#list orgTypeOpts?keys as key> <#list orgTypeOpts?keys as key>
<#if orgTypeValue = key> <#if orgTypeValue = key>
@ -108,7 +108,7 @@
<p> <p>
<label for="relatedIndLabel">### Name ${requiredHint}</label> <label for="relatedIndLabel">### Name ${requiredHint}</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="orgLabel" value="${orgLabelValue}" <#if (disabledVal!?length > 0)>disabled="${disabledVal}"</#if>/> <input class="acSelector" size="50" type="text" id="relatedIndLabel" name="orgLabel" value="${orgLabelValue}" <#if (disabledVal!?length > 0)>disabled="${disabledVal}"</#if> />
</p> </p>
<#--Store values in hidden fields--> <#--Store values in hidden fields-->
@ -119,8 +119,6 @@
<@lvf.acSelection urls.base /> <@lvf.acSelection urls.base />
<input class="acLabelReceiver" type="hidden" id="existingOrgLabel" name="existingOrgLabel" value="" />
<p> <p>
<label for="dept">Department or School Name within the ###</label> <label for="dept">Department or School Name within the ###</label>
<input size="50" type="text" id="dept" name="dept" value="${deptValue}" /> <input size="50" type="text" id="dept" name="dept" value="${deptValue}" />
@ -132,8 +130,7 @@
<#assign degreeOpts = editConfiguration.pageData.degree /> <#assign degreeOpts = editConfiguration.pageData.degree />
<select name="degree" id="degreeUri" > <select name="degree" id="degreeUri" >
<option value="" <#if degreeValue = "">selected</#if>>Select one</option> <option value="" <#if degreeValue = "">selected</#if>>Select one</option>
<#list degreeOpts?keys as key>
<#list degreeOpts?keys as key>
<option value="${key}" <#if degreeValue = key>selected</#if>>${degreeOpts[key]}</option> <option value="${key}" <#if degreeValue = key>selected</#if>>${degreeOpts[key]}</option>
</#list> </#list>
</select> </select>
@ -145,11 +142,11 @@
</p> </p>
<p> <p>
<label for="info">Supplemental Information</label> <label for="info">Supplemental Information (e.g., <em>Postdoctoral training</em> or <em>Transferred</em>)</label>
<input size="50" type="text" id="info" name="info" value="${infoValue}" /> <input size="50" type="text" id="info" name="info" value="${infoValue}" />
<br />e.g., <em>Postdoctoral training</em> or <em>Transferred</em>
</p>
</p>
<p></p>
<#--Need to draw edit elements for dates here--> <#--Need to draw edit elements for dates here-->
<#if htmlForElements?keys?seq_contains("startField")> <#if htmlForElements?keys?seq_contains("startField")>
<label class="dateTime" for="startField">Start</label> <label class="dateTime" for="startField">Start</label>

View file

@ -4,53 +4,79 @@
<#import "lib-vivo-form.ftl" as lvf> <#import "lib-vivo-form.ftl" as lvf>
<#if editConfiguration.objectUri?has_content> <#--Retrieve certain edit configuration information-->
<#assign editMode = "edit"> <#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#else> <#assign editMode = editConfiguration.pageData.editMode />
<#assign editMode = "add">
<#--Get existing value for specific data literals and uris-->
<#assign orgTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgType")/>
<#assign orgLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabel")/>
<#assign positionTitleValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionTitle")/>
<#assign positionTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionType")/>
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
</#if> </#if>
<#assign disabledVal = ""/>
<#if editMode == "edit"> <#if editMode == "edit">
<#assign formAction="Edit"> <#assign formAction="Edit">
<#assign submitButtonText="Edit Position"> <#assign submitButtonText="Edit Position">
<#assign disabledVal="disabled">
<#else> <#else>
<#assign formAction="Create"> <#assign formAction="Create">
<#assign submitButtonText="Create Position"> <#assign submitButtonText="Create Position">
<#assign disabledVal="">
</#if> </#if>
<#--Get existing value for specific data literals and uris-->
<#assign orgLabel = lvf.getFormFieldValue(editSubmission, editConfiguration, "orgLabel")/>
<#assign positionTitle = lvf.getFormFieldValue(editSubmission, editConfiguration, "positionTitle")/>
<#assign startField = lvf.getFormFieldValue(editSubmission, editConfiguration, "startField") />
<#assign endField = lvf.getFormFieldValue(editSubmission, editConfiguration, "endField") />
<#assign requiredHint="<span class='requiredHint'> *</span>"/> <#assign requiredHint="<span class='requiredHint'> *</span>"/>
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
<#-- <@lvf.unsupportedBrowser urls.base /> --> <@lvf.unsupportedBrowser urls.base />
<h2>${formAction} position entry for ${editConfiguration.subjectName}</h2> <h2>${formAction} position entry for ${editConfiguration.subjectName}</h2>
<#if errorOrgType??> <#--Display error messages if any-->
<#assign errorMessage = "You must supply an organization type." /> <#if submissionErrors?has_content>
</#if>
<#if errorOrgLabel??>
<#assign errorMessage = "You must supply an organization name." />
</#if>
<#if errorPositionTitle??>
<#assign errorMessage = "You must supply a position title." />
</#if>
<#if errorPositionType??>
<#assign errorMessage = "You must supply a position type." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert"> <section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" /> <img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p> <p>
<#--below shows examples of both printing out all error messages and checking the error message for a specific field-->
<#list submissionErrors?keys as errorFieldName>
<#if errorFieldName == "startField">
<#if submissionErrors[errorFieldName]?contains("before")>
The Start Year must be earlier than the End Year.
<#else>
${submissionErrors[errorFieldName]}
</#if>
<br />
<#elseif errorFieldName == "endField">
<#if submissionErrors[errorFieldName]?contains("after")>
The End Year must be later than the Start Year.
<#else>
${submissionErrors[errorFieldName]}
</#if>
</#if>
</#list>
<#--Checking if Org Type field is empty-->
<#if lvf.submissionErrorExists(editSubmission, "orgType")>
Please select a value in the Organization Type field.
</#if>
<#--Checking if Org Name field is empty-->
<#if lvf.submissionErrorExists(editSubmission, "orgLabel")>
Please enter or select a value in the Name field.
</#if>
<#--Checking if Position Title field is empty-->
<#if lvf.submissionErrorExists(editSubmission, "positionTitle")>
Please enter a value in the Position Title field.
</#if>
<#--Checking if Position Type field is empty-->
<#if lvf.submissionErrorExists(editSubmission, "positionType")>
Please select a value in the Position Type field.
</#if>
</p>
</section> </section>
</#if> </#if>
@ -58,14 +84,10 @@
<p class="inline"> <p class="inline">
<label for="orgType">Organization Type ${requiredHint}</label> <label for="orgType">Organization Type ${requiredHint}</label>
<#assign orgTypeOpts = editConfiguration.pageData.orgType /> <#assign orgTypeOpts = editConfiguration.pageData.orgType />
<select id="typeSelector" name="orgType" > <select id="typeSelector" name="orgType" ${disabledVal} >
<option value="" selected="selected">Select one</option> <option value="" selected="selected">Select one</option>
<#list orgTypeOpts?keys as key> <#list orgTypeOpts?keys as key>
<#if editConfiguration.objectUri?has_content && editConfiguration.objectUri = key> <option value="${key}" <#if orgTypeValue = key>selected</#if>>${orgTypeOpts[key]}</option>
<option value="${key}" selected >${orgTypeOpts[key]}</option>
<#else>
<option value="${key}">${orgTypeOpts[key]}</option>
</#if>
</#list> </#list>
</select> </select>
</p> </p>
@ -73,34 +95,40 @@
<div class="fullViewOnly"> <div class="fullViewOnly">
<p> <p>
<label for="relatedIndLabel">### Name ${requiredHint}</label> <label for="relatedIndLabel">### Name ${requiredHint}</label>
<input type="text" name="orgLabel" id="relatedIndLabel" size="50" class="acSelector" value="${orgLabel}" > <input type="text" name="orgLabel" id="relatedIndLabel" size="50" class="acSelector" value="${orgLabelValue}" <#if (disabledVal!?length > 0)>disabled="${disabledVal}"</#if> >
</p> </p>
<#if editMode = "edit">
<input type="hidden" id="orgLabel" name="orgLabel" value="${orgLabelValue}"/>
</#if>
<@lvf.acSelection urls.base /> <@lvf.acSelection urls.base />
<label for="positionTitle">Position Title ${requiredHint}</label> <label for="positionTitle">Position Title ${requiredHint}</label>
<input size="30" type="text" id="positionTitle" name="positionTitle" value="${positionTitle}" role="input" /> <input size="30" type="text" id="positionTitle" name="positionTitle" value="${positionTitleValue}" role="input" />
<label for="positionType">Position Type ${requiredHint}</label> <label for="positionType">Position Type ${requiredHint}</label>
<#assign posnTypeOpts = editConfiguration.pageData.positionType /> <#assign posnTypeOpts = editConfiguration.pageData.positionType />
<select id="typeSelector" name="positionType" style="margin-top:-2px" > <select name="positionType" style="margin-top:-2px" >
<option value="" selected="selected">Select one</option> <option value="" selected="selected">Select one</option>
<#list posnTypeOpts?keys as key> <#list posnTypeOpts?keys as key>
<#if editConfiguration.objectUri?has_content && editConfiguration.objectUri = key> <option value="${key}" <#if positionTypeValue = key>selected</#if>>${posnTypeOpts[key]}</option>
<option value="${key}" selected >${posnTypeOpts[key]}</option>
<#else>
<option value="${key}">${posnTypeOpts[key]}</option>
</#if>
</#list> </#list>
</select> </select>
<p></p>
<#--Need to draw edit elements for dates here-->
<#if htmlForElements?keys?seq_contains("startField")>
<label class="dateTime" for="startField">Start</label>
${htmlForElements["startField"]} ${yearHint}
</#if>
<p></p>
<#if htmlForElements?keys?seq_contains("endField")>
<label class="dateTime" for="endField">End</label>
${htmlForElements["endField"]} ${yearHint}
</#if>
<#--End draw elements-->
<label for="startField">Start Year</label>
<input class="text-field" name="startField-year" id="startField-year" type="text" value="${startField}" size="4" maxlength="4" role="input" />
<span class='hint'>(YYYY)</span>
<label for="endField">End Year</label>
<input class="text-field" name="endField-year" id="endField-year" type="text" value="${endField}" size="4" maxlength="4" role="input" />
<span class='hint'>(YYYY)</span>
<input type="hidden" name = "editKey" value="${editKey}" role="input"/> <input type="hidden" name = "editKey" value="${editKey}" role="input"/>
</div> </div>
@ -135,9 +163,6 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/cust
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>', ${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>', '<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>', '<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>', '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>',
'<script type="text/javascript" src="${urls.base}/edit/forms/js/customFormWithAutocomplete.js"></script>')} '<script type="text/javascript" src="${urls.base}/edit/forms/js/customFormWithAutocomplete.js"></script>')}