Adding user defined concept generators and updating publication and authors generators/forms. Adding validation to addAuthorsToInformationResource
This commit is contained in:
parent
57dfb86262
commit
c5743ce2fa
9 changed files with 384 additions and 103 deletions
|
@ -2,6 +2,8 @@
|
|||
<#import "lib-vivo-form.ftl" as lvf>
|
||||
|
||||
<#assign existingConcepts = editConfiguration.pageData.existingConcepts/>
|
||||
<#assign userDefinedConceptUrl = editConfiguration.pageData.userDefinedConceptUrl/>
|
||||
|
||||
<#--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/>
|
||||
|
@ -97,7 +99,7 @@
|
|||
<!-- Field value populated by JavaScript -->
|
||||
</div>
|
||||
|
||||
<a href="" > Can't find the concept you want? Create your own.</a>
|
||||
<a href="${userDefinedConceptUrl}" > Can't find the concept you want? Create your own.</a>
|
||||
|
||||
<p class="submit">
|
||||
<input type="submit" id="submit" name="submit" value="Add Term" />
|
||||
|
|
|
@ -9,7 +9,15 @@
|
|||
<#assign existingAuthorInfo = editConfiguration.pageData.existingAuthorInfo />
|
||||
<#assign rankPredicate = editConfiguration.pageData.rankPredicate />
|
||||
|
||||
<#--Values from edit configuration to populate fields -->
|
||||
<#--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>
|
||||
|
||||
<#--Submission values for these fields may be returned if user did not fill out fields for new person-->
|
||||
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") />
|
||||
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") />
|
||||
<#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") />
|
||||
|
||||
|
||||
|
||||
|
@ -27,6 +35,20 @@
|
|||
|
||||
<h2>${title}</h2>
|
||||
|
||||
<#if submissionErrors?has_content>
|
||||
<section id="error-alert" role="alert" class="validationError">
|
||||
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
|
||||
<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>
|
||||
${errorFieldName} : ${submissionErrors[errorFieldName]} <br/>
|
||||
</#list>
|
||||
|
||||
</p>
|
||||
</section>
|
||||
</#if>
|
||||
|
||||
|
||||
<ul id="authorships" ${ulClass}>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -89,18 +111,18 @@
|
|||
should be visible even when first name/middle name are not, the parents should be separate for each field-->
|
||||
<p class="inline">
|
||||
<label for="lastName">Last name <span class='requiredHint'> *</span></label>
|
||||
<input class="acSelector" size="35" type="text" id="lastName" name="lastName" value="" role="input" />
|
||||
<input class="acSelector" size="35" type="text" id="lastName" name="lastName" value="${lastNameValue}" role="input" />
|
||||
</p>
|
||||
|
||||
<p class="inline">
|
||||
<label for="firstName">First name ${requiredHint} ${initialHint}</label>
|
||||
<input size="20" type="text" id="firstName" name="firstName" value="" role="input" />
|
||||
<input size="20" type="text" id="firstName" name="firstName" value="${firstNameValue}" role="input" />
|
||||
</p>
|
||||
|
||||
|
||||
<p class="inline">
|
||||
<label for="middleName">Middle name <span class='hint'>(initial okay)</span></label>
|
||||
<input size="20" type="text" id="middleName" name="middleName" value="" role="input" />
|
||||
<input size="20" type="text" id="middleName" name="middleName" value="${middleNameValue}" role="input" />
|
||||
</p>
|
||||
|
||||
<input type="hidden" id="label" name="label" value="" role="input" /> <!-- Field value populated by JavaScript -->
|
||||
|
|
|
@ -4,61 +4,74 @@
|
|||
|
||||
<#import "lib-vivo-form.ftl" as lvf>
|
||||
|
||||
<#if editConfig.object?has_content>
|
||||
<#assign editMode = "edit">
|
||||
<#else>
|
||||
<#assign editMode = "add">
|
||||
<#--Retrieve certain edit configuration information-->
|
||||
<#assign editMode = editConfiguration.pageData.editMode />
|
||||
<#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter />
|
||||
|
||||
<#--assign htmlForElements = editConfiguration.pageData.htmlForElements ! {}/-->
|
||||
|
||||
<#--drop down options for a field are included in page data with that field name-->
|
||||
<#assign pubTypeLiteralOptions = editConfiguration.pageData.pubType />
|
||||
<#--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>
|
||||
|
||||
<#--In case of submission error, may already have publication type or title - although latter not likely, but storing values to be on safe side-->
|
||||
<#assign publicationTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "pubType") />
|
||||
<#assign titleValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "title") />
|
||||
<#if editMode == "edit">
|
||||
<#assign titleVerb="Edit">
|
||||
<#assign submitButtonText="Edit Publication">
|
||||
<#assign disabledVal="disabled">
|
||||
<#else>
|
||||
<#assign titleVerb="Create">
|
||||
<#assign submitButtonText="Create Publication">
|
||||
<#assign submitButtonText="Publication">
|
||||
<#assign disabledVal=""/>
|
||||
</#if>
|
||||
|
||||
<h2>${titleVerb} ${roleDescriptor} entry for ${subjectName}</h2>
|
||||
<h2>${titleVerb} publication entry for ${editConfiguration.subjectName}</h2>
|
||||
|
||||
<#if errorTitleFieldIsEmpty??>
|
||||
<#assign errorMessage = "Enter a title for the publication." />
|
||||
</#if>
|
||||
|
||||
<#if errorMessage?has_content>
|
||||
<#if submissionErrors?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>
|
||||
<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>
|
||||
${errorFieldName} : ${submissionErrors[errorFieldName]}
|
||||
</#list>
|
||||
|
||||
</p>
|
||||
</section>
|
||||
</#if>
|
||||
|
||||
|
||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||
<#assign yearHint = "<span class='hint'>(YYYY)</span>" />
|
||||
|
||||
<#if editMode = “ERROR”>
|
||||
<#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">
|
||||
<@lvf.unsupportedBrowser urls.base/>
|
||||
<form id="addpublicationToPerson" class="customForm noIE67" action="${submitUrl}" role="add/edit publication">
|
||||
|
||||
<#--TODO: Check if possible to have existing publication options here in order to select-->
|
||||
<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>
|
||||
<select id="typeSelector" name="pubType" <#if (disabledVal?length > 0)>disabled="${disabledVal}"</#if> >
|
||||
<option value="" <#if (publicationTypeValue?length = 0)>selected="selected"</#if>>Select one</option>
|
||||
<#list pubTypeLiteralOptions?keys as key>
|
||||
<option value="${key}" <#if (publicationTypeValue = key)>selected="selected"</#if>>${pubTypeLiteralOptions[key]}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="relatedIndLabel">Title ${requiredHint}</label>
|
||||
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="publicationLabel" disabled="${disabledVal}" value="${???}" />
|
||||
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="title"
|
||||
<#if (disabledVal?length > 0)>disabled="${disabledVal}"</#if> value="" />
|
||||
</p>
|
||||
|
||||
<div class="acSelection">
|
||||
|
@ -67,20 +80,21 @@
|
|||
<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}" />
|
||||
<input class="acUriReceiver" type="hidden" id="pubUri" name="pubUri" value="" />
|
||||
</div>
|
||||
|
||||
|
||||
<#--Commenting out as unclear whether this contains any dates to begin with
|
||||
<#if htmlForElements?keys?seq_contains("dateField")>
|
||||
<label class="dateTime" for="dateField">Publication Date ${yearHint}</label>
|
||||
${htmlForElements["dateField"]} ${yearHint}
|
||||
</#if>
|
||||
-->
|
||||
|
||||
<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 </span><a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
|
||||
<input type="hidden" name = "editKey" value="${editKey}"/>
|
||||
<input type="submit" id="submit" value="${submitButtonText}"/><span class="or"> or </span><a class="cancel" href="${cancelUrl}">Cancel</a>
|
||||
</p>
|
||||
|
||||
<p id="requiredLegend" class="requiredHint">* required fields</p>
|
||||
|
@ -89,8 +103,6 @@
|
|||
|
||||
<#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}',
|
||||
|
@ -101,19 +113,19 @@
|
|||
defaultTypeName: 'publication' // used in repair mode to generate button text
|
||||
};
|
||||
</script>
|
||||
|
||||
</section>
|
||||
</#if>
|
||||
|
||||
<#/if>
|
||||
|
||||
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customForm.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customFormWithAutocomplete.css" />')}
|
||||
|
||||
|
||||
${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/extensions/String.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/browserUtils.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/edit/forms/js/customFormWithAutocomplete.js"></script>')}
|
||||
|
||||
<#-- '<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>',
|
||||
-->
|
|
@ -0,0 +1,66 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#--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>
|
||||
|
||||
<#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter />
|
||||
<#assign returnUrl = ""/>
|
||||
|
||||
<h2>Add Your Own Concept</h2>
|
||||
|
||||
|
||||
<form id="addUserDefinedConceptForm" class="editForm" action = "${submitUrl}" method="post">
|
||||
<input type="hidden" name="editKey" id="editKey" value="${editKey}" role="input" />
|
||||
<#--Autocomplete for looking up existing skos concepts -->
|
||||
<p>
|
||||
<label for="relatedIndLabel">Concept <span class='requiredHint'> *</span></label>
|
||||
<input class="acSelector" size="50" type="text" id="relatedIndLabel" name="conceptLabel"
|
||||
<#if (disabledVal?length > 0)>disabled="${disabledVal}"</#if> 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="conceptNode" name="conceptNode" value="" />
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name = "editKey" value="${editKey}"/>
|
||||
<input type="submit" id="submit" value="Add Concept"/><span class="or"> or </span><a class="cancel" href="${returnUrl}">Return to Manage Concepts</a>
|
||||
</p>
|
||||
|
||||
<p id="requiredLegend" class="requiredHint">* required fields</p>
|
||||
|
||||
</form>
|
||||
|
||||
<#assign sparqlQueryUrl = "/ajax/sparqlQuery" >
|
||||
|
||||
<script type="text/javascript">
|
||||
var customFormData = {
|
||||
sparqlForAcFilter: '${sparqlForAcFilter}',
|
||||
sparqlQueryUrl: '${sparqlQueryUrl}',
|
||||
acUrl: '${urls.base}/autocomplete?tokenize=true',
|
||||
submitButtonTextType: 'simple',
|
||||
editMode: 'add',
|
||||
defaultTypeName: 'concept' // used in repair mode to generate button text
|
||||
};
|
||||
</script>
|
||||
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customForm.css" />')}
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/customFormWithAutocomplete.css" />')}
|
||||
|
||||
|
||||
${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/browserUtils.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/edit/forms/js/customFormWithAutocomplete.js"></script>')}
|
Loading…
Add table
Add a link
Reference in a new issue