NIHVIVO-2288: new templates versions of custom forms

This commit is contained in:
tworrall 2011-10-31 15:20:38 +00:00
parent ed9c404197
commit 4484f6ff40
5 changed files with 539 additions and 0 deletions

View file

@ -0,0 +1,113 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for adding a grant role, such as principal investigator, to a foaf:Persons -->
<#import "lib-vivo-form.ftl" as lvf>
<#if editConfig.object?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#if editMode == "edit">
<#assign titleVerb="Edit">
<#assign submitButtonText="Edit Grant">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="Create">
<#assign submitButtonText="Create Grant">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
<#if editMode = “ERROR”>
<div>This form is unable to handle the editing of this position because it is associated with
multiple Position individuals.</div>
<#else>
<h2>${titleVerb}&nbsp;${roleDescriptor} entry for ${subjectName}</h2>
<#if errorNameFieldIsEmpty??>
<#assign errorMessage = "Enter a name for the grant." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<section id="addGrantRoleToPerson" role="region">
<@lvf.unsupportedBrowser>
<form id="addGrantRoleToPerson" class="customForm noIE67" action="${submitUrl}" role="add/edit grant role">
<p>
<label for="relatedIndLabel">Grant Name ${requiredHint}</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="grantLabel" disabled="${disabledVal}" value="${grantLabel}" />
</p>
<#-- DO WE NEED THIS??
Store this value in a hidden field, because the displayed field is disabled and doesn't submit. This ensures that when
returning from a validation error, we retain the value.
<#if editMode == "edit">
<input type="hidden" id="grantLabel" />
</#if>
-->
<div class="acSelection">
<p class="inline">
<label>Selected Grant:</label>
<span class="acSelectionInfo"></span>
<a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a>
</p>
<input class="acUriReceiver" type="hidden" id="${roleActivityUri}" name="grant" value="" />
<input class="acLabelReceiver" type="hidden" id="existingGrantLabel" name="existingGrantLabel" value="${grantLabel}" />
</div>
<h4>Years of Participation in Grant</h4>
<label for="startField">Start Year ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="startField-year" id="startField-year" type="text" value="${startYear}" size="4" maxlength="4" />
</fieldset>
<label for="endField">End Year ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="endField-year" id="endField-year" type="text" value="${endYear}" size="4" maxlength="4" />
</fieldset>
<p class="submit">
<input type="hidden" name = "editKey" value="${???}"/>
<input type="submit" id="submit" value="editConfiguration.submitLabel"/><span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<#assign acUrl value="/autocomplete?tokenize=true" />
<#assign sparqlQueryUrl ="/ajax/sparqlQuery" />
<#assign sparqlForAcFilter = "PREFIX core: <${vivoCore}> SELECT ?grantUri WHERE {<${subjectUri}> <${predicateUri}> ?grantRole . ?grantRole core:roleIn ?grantUri .}>"
<script type="text/javascript">
var customFormData = {
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',
acUrl: '${acUrl}',
acType: 'http://vivoweb.org/ontology/core#Grant',
editMode: 'add',
submitButtonTextType: 'compound',
typeName: 'Grant'
};
</script>
</section>
</#if>

View file

@ -0,0 +1,107 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for adding a publication to a foaf:Persons -->
<#import "lib-vivo-form.ftl" as lvf>
<#if editConfig.object?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#if editMode == "edit">
<#assign titleVerb="Edit">
<#assign submitButtonText="Edit Publication">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="Create">
<#assign submitButtonText="Create Publication">
<#assign disabledVal=""/>
</#if>
<h2>${titleVerb}&nbsp;${roleDescriptor} entry for ${subjectName}</h2>
<#if errorTitleFieldIsEmpty??>
<#assign errorMessage = "Enter a title for the publication." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
<#if editMode = “ERROR”>
<div>This form is unable to handle the editing of this position because it is associated with
multiple Position individuals.</div>
<#else>
<section id="addPublicationToPerson" role="region">
<@lvf.unsupportedBrowser>
<form id="addpublicationToPerson" class="customForm noIE67" action="${submitUrl}" role="add/edit publication">
<p class="inline"><label for="typeSelector">Publication Type ${requiredHint}</label>
<select id="typeSelector" name="roleActivityType" disabled="${disabledVal}" >
<option value="" selected="selected">Select one</option>
<#list rangeOptionKeys as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_contant && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
</p>
<p>
<label for="relatedIndLabel">Title ${requiredHint}</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="publicationLabel" disabled="${disabledVal}" value="${???}" />
</p>
<div class="acSelection">
<p class="inline">
<label>Selected Publication:</label>
<span class="acSelectionInfo"></span>
<a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a>
</p>
<input class="acUriReceiver" type="hidden" id="${roleActivityUri}" name="publication" value="" />
<input class="acLabelReceiver" type="hidden" id="existingPublicationLabel" name="existingPublicationLabel" value="${grantLabel}" />
</div>
<label for="startField">Publication Date ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="dateField-year" id="dateField-year" type="text" value="${dateTime}" size="4" maxlength="4" />
</fieldset>
<p class="submit">
<input type="hidden" name = "editKey" value="${???}"/>
<input type="submit" id="submit" value="editConfiguration.submitLabel"/><span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<#assign acUrl = "/autocomplete?tokenize=true" >
<#assign sparqlQueryUrl = "/ajax/sparqlQuery" >
<#assign sparqlForAcFilter = "PREFIX core: <${vivoCore}> SELECT ?pubUri WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri . ?authorshipUri core:linkedInformationResource ?pubUri .}"
<script type="text/javascript">
var customFormData = {
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',
acUrl: '${acUrl}',
submitButtonTextType: 'simple',
editMode: '${editMode}',
defaultTypeName: 'publication' // used in repair mode to generate button text
};
</script>
</section>
<#/if>

View file

@ -0,0 +1,62 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for adding a new individual from the Site Admin page: VIVO version -->
<h2>Create a new ${subclassName}</h2>
<#if errorFirstNameIsEmpty??>
<#assign errorMessage = "Enter a first name." />
</#if>
<#if errorLastNameIsEmpty??>
<#assign errorMessage = "Enter a last name." />
</#if>
<#if errorNameFieldIsEmpty??>
<#assign errorMessage = "Enter a name." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<section id="newIndividual" role="region">
<form id="newIndividual" class="customForm noIE67" action="${submitUrl}" role="add new individual">
<#if isPersonType >
<p>
<label for="firstName">First Name ${requiredHint}</label>
<input size="30" type="text" id="firstName" name="firstName" value="" />
</p>
<p>
<label for="lastName">Last Name ${requiredHint}</label>
<input size="30" type="text" id="lastName" name="lastName" value="" />
</p>
<#else>
<p>
<label for="name">Name ${requiredHint}</label>
<input size="30" type="text" id="name" name="name" value="" />
</p>
</#if>
<p class="submit">
<input type="hidden" name = "editKey" value="${???}"/>
<input type="submit" id="submit" value="editConfiguration.submitLabel"/>
<span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
</section>

View file

@ -0,0 +1,114 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this template is for adding a person's position to an organization -->
<#import "lib-vivo-form.ftl" as lvf>
<#if editConfig.object?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#if editMode == "edit">
<#assign titleVerb="Edit">
<#assign submitButtonText="Edit Position">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="Create">
<#assign submitButtonText="Create Position">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
<#if editMode = “ERROR”>
<div>This form is unable to handle the editing of this position because it is associated with
multiple Position individuals.</div>
<#else>
<h2>${titleVerb}&nbsp;educational training entry for ${subjectName}</h2>
<#if errorTitleFieldIsEmpty??>
<#assign errorMessage = "Enter a position title." />
</#if>
<#if errorTypeFieldIsEmpty??>
<#assign errorMessage = "Select a position type." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<section id="organizationHasPositionHistory" role="region">
<@lvf.unsupportedBrowser>
<form id="organizationHasPositionHistory" class="customForm noIE67" action="${submitUrl}" role="add/edit position history">
<p>
<label for="positionTitle">Position Title ${requiredHint}</label>
<input size="30" type="text" id="positionTitle" name="positionTitle" value="${positionTitle}" />
</p>
<label for="positionType">Position Type ${requiredHint}</label>
<select id="positionType" name="positionType">
<option value="" selected="selected">Select one</option>
<#list rangeOptionKeys as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_content && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
<p>
<label for="relatedIndLabel">Person</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="orgLabel" value="${orgLabel}" />
</p>
<div class="acSelection">
<p class="inline">
<label>Selected Person:</label>
<span class="acSelectionInfo"></span>
<a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a>
</p>
<input class="acUriReceiver" type="hidden" id="${roleActivityUri}" name="org" value="" />
<input class="acLabelReceiver" type="hidden" id="existingPersonLabel" name="existingPersonLabel" value="${personLabel}" />
</div>
<label for="startField">Start Year ${yearHint}</label>
<fieldset class="dateTime" >
<input class="text-field" name="startField-year" id="startField-year" type="text" value="${startYear}" size="4" maxlength="4" />
</fieldset>
<label for="endField">End Year ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="endField-year" id="endField-year" type="text" value="${endYear}" size="4" maxlength="4" />
</fieldset>
<p class="submit">
<input type="hidden" name = "editKey" value="${???}"/>
<input type="submit" id="submit" value="editConfiguration.submitLabel"/><span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<#assign acUrl="/autocomplete?tokenize=true&stem=true" >
<script type="text/javascript">
var customFormData = {
acUrl: '${acUrl}?url',
editMode: '${editMode}',
submitButtonTextType: 'compound',
defaultTypeName: 'person'
};
</script>
</section>
</#if>

View file

@ -0,0 +1,143 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this is in request.subject.name -->
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
<#import "lib-vivo-form.ftl" as lvf>
<#if editConfig.object?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#if editMode == "edit">
<#assign titleVerb="Edit">
<#assign submitButtonText="Edit Educational Training">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="Create">
<#assign submitButtonText="Educational Training">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
<#if editMode = “ERROR”>
<div>This form is unable to handle the editing of this position because it is associated with
multiple Position individuals.</div>
<#else>
<h2>${titleVerb}&nbsp;educational training entry for ${subjectName}</h2>
<#if errorTypeFieldIsEmpty??>
<#assign errorMessage = "Select a type of organization." />
</#if>
<#if errorNameFieldIsEmpty??>
<#assign errorMessage = "Enter a name for the organization." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<section id="personHasEducationalTraining" role="region">
<@lvf.unsupportedBrowser>
<div id="ie67DisableWrapper">
<div id="ie67DisableContent">
<img src="/vivo/site_icons/iconAlertBig.png" alt="Alert Icon"/>
<p>This form is not supported in versions of Internet Explorer below version 8. Please upgrade your browser, or
switch to another browser, such as FireFox.</p>
</div>
</div>
<form id="personHasEducationalTraining" class="customForm noIE67" action="${submitUrl}" role="add/edit educational training">
<label for="orgType">Select Organization Type ${requiredHint}</label>
<select id="typeSelector" name="orgType" disabled="${disabledVal}" >
<option value="" selected="selected">Select one</option>
<#list rangeOptionKeys as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_contant && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
<p>
<label for="relatedIndLabel">Organization Name ${requiredHint}</label>
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="orgLabel" disabled="${disabledVal}" value="${???}" />
</p>
<div class="acSelection">
<p class="inline">
<label>Selected Organization:</label>
<span class="acSelectionInfo"></span>
<a href="/vivo/individual?uri=" class="verifyMatch">(Verify this match)</a>
</p>
<input class="acUriReceiver" type="hidden" id="${roleActivityUri}" name="org" value="" />
<input class="acLabelReceiver" type="hidden" id="existingOrgLabel" name="existingOrgLabel" value="${orgLabel}" />
</div>
<p>
<label for="dept">Department or School Name within the Organization</label>
<input size="50" type="text" id="dept" name="dept" value="" />
</p>
<div class="entry">
<label for="degreeUri">Degree</label>
<select name="degreeUri" id="degreeUri" >
<option value="" selected="selected">Select one</option>
<#list rangeOptionKeys as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_contant && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
</div>
<p>
<label for="majorField">Major Field of Degree</label>
<input type="text" id="majorField" name="majorField" size="30" value="${???}"/>
</p>
<p>
<label for="info">Supplemental Information</label>
<input size="50" type="text" id="info" name="info" value="${???}" />
<p>e.g., <em>Postdoctoral training</em> or <em>Transferred</em></p>
</p>
<label for="startField">Start Year ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="startField-year" id="startField-year" type="text" value="${startYear}" size="4" maxlength="4" />
</fieldset>
<label for="endField">End Year ${yearHint}</label>
<fieldset class="dateTime">
<input class="text-field" name="endField-year" id="endField-year" type="text" value="${endYear}" size="4" maxlength="4" />
</fieldset>
<p class="submit">
<input type="submit" id="submit" value="editConfiguration.submitLabel"/><span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<#assign acUrl="/autocomplete?tokenize=true&stem=true" >
<script type="text/javascript">
var customFormData = {
acUrl: '${acUrl?url}',
editMode: '${editMode}',
submitButtonTextType: 'compound',
defaultTypeName: 'organization'
};
</script>
</section>
</#if>