NIHVIVO-646 Using Javascript on page rather than hidden divs to pass information to the addAuthorsForm Javascript. Fix problems in DataPropertyComparator that were causing errors to be thrown on the page when no xsd datatype defined for an authorship rank.

This commit is contained in:
rjy7 2010-07-12 14:47:35 +00:00
parent b8cf560daa
commit 57a8cdcbe8
7 changed files with 34 additions and 36 deletions

View file

@ -379,13 +379,6 @@ SPARQL queries for existing values. --%>
<v:input type="submit" value="Add Author" id="showAddFormButton" cancel="true" cancelLabel="Return to Publication" cancelUrl="/individual" />
</div>
<div id="infoForJs">
<span class="rankPred" id="${rankPred}"></span>
<span class="rankXsdType" id="${intDatatypeUri}"></span>
<span class="acUrl" id="<c:url value="/autocomplete?type=${foaf}Person&stem=false" />"></span>
<span class="reorderUrl" id="<c:url value="/edit/primitiveRdfEdit" />"></span>
</div>
<form id="addAuthorForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
<h3>Add an Author</h3>
@ -408,5 +401,17 @@ SPARQL queries for existing values. --%>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<c:url var="baseAcUrl" value="/autocomplete?type=${foaf}Person&tokenize=false&stem=false" />
<c:url var="reorderUrl" value="/edit/primitiveRdfEdit" />
<script type="text/javascript">
var customFormData = {
rankPred: '${rankPred}',
rankXsdType: '${intDatatypeUri}',
baseAcUrl: '${baseAcUrl}',
reorderUrl: '${reorderUrl}'
};
</script>
<jsp:include page="${postForm}"/>

View file

@ -124,7 +124,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPri
"sparqlForExistingUris" : { },
"fields" : {
"grant" : {
"newResource" : "true",
"newResource" : "false",
"validators" : [ ],
"optionsType" : "UNDEFINED",
"literalOptions" : [ ],
@ -187,10 +187,6 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPri
<jsp:include page="${preForm}" />
<c:url var="acUrl" value="/autocomplete?stem=true" />
<c:url var="sparqlQueryUrl" value="/admin/sparqlquery" />
<h2>${formHeading}</h2>
<form id="addGrantRoleToPerson" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
@ -200,7 +196,7 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPri
<div class="acSelection">
<p class="inline"><label></label><span class="acSelectionInfo"></span></p>
<%-- bdc34: for some odd reason id and name should not be grant in this input element. --%>
<input type="hidden" class="acReceiver" value="" /> <!-- Field value populated by JavaScript -->
<input type="hidden" id="grant" name="grant" class="acReceiver" value="" /> <!-- Field value populated by JavaScript -->
</div>
<p class="submit"><v:input type="submit" id="submit" value="${submitButtonLabel}" cancel="true" /></p>
@ -208,13 +204,16 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPri
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<script>
<c:url var="acUrl" value="/autocomplete?tokenize=true&stem=true" />
<c:url var="sparqlQueryUrl" value="/admin/sparqlquery" />
<script type="text/javascript">
var customFormData = {
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',
acUrl: '${acUrl}',
acType: '${vivoCore}Grant'
}
};
</script>
<jsp:include page="${postForm}"/>

View file

@ -207,9 +207,6 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
<c:set var="requiredHint" value="<span class='requiredHint'> *</span>" />
<c:url var="acUrl" value="/autocomplete?stem=true" />
<c:url var="sparqlQueryUrl" value="/admin/sparqlquery" />
<jsp:include page="${preForm}" />
<h2>Create a new publication entry for <%= subjectName %></h2>
@ -233,7 +230,10 @@ PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:author
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
<script>
<c:url var="acUrl" value="/autocomplete?tokenize=true&stem=true" />
<c:url var="sparqlQueryUrl" value="/admin/sparqlquery" />
<script type="text/javascript">
var customFormData = {
sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}',

View file

@ -32,10 +32,6 @@
margin-left: 2em;
}
#infoForJs {
display: none;
}
form h3 {
margin-bottom: .5em;
}

View file

@ -9,11 +9,6 @@
display: none;
}
/* Always hidden, JS or no JS */
#infoForJs {
display: none;
}
#content form p.inline label {
display: inline;
clear: none;

View file

@ -13,6 +13,9 @@ var addAuthorForm = {
mixIn: function() {
// Mix in the custom form utility methods
vitro.utils.borrowMethods(vitro.customFormUtils, this);
// Get the custom form data from the page
$.extend(this, customFormData);
},
// On page load, create references for easy access to form elements.
@ -157,8 +160,7 @@ var addAuthorForm = {
// Make cache a property of this so we can access it after removing
// an author.
this.acCache = {};
this.baseAcUrl = $('.acUrl').attr('id');
this.acCache = {};
this.setAcUrl();
$('#lastName').autocomplete({
@ -260,8 +262,8 @@ var addAuthorForm = {
// Reorder authors. Called on page load and after author drag-and-drop.
// Event and ui parameters are defined only in the case of drag-and-drop.
reorderAuthors: function(event, ui) {
var predicateUri = '<' + $('.rankPred').attr('id') + '>',
rankXsdType = $('.rankXsdType').attr('id'),
var predicateUri = '<' + this.rankPred + '>',
rankXsdType = this.rankXsdType,
additions = '',
retractions = '',
authorships = [];
@ -305,7 +307,7 @@ var addAuthorForm = {
// console.log('retractions: ' + retractions);
$.ajax({
url: $('.reorderUrl').attr('id'),
url: addAuthorForm.reorderUrl,
data: {
additions: additions,
retractions: retractions

View file

@ -13,6 +13,9 @@ var customForm = {
mixIn: function() {
// Mix in the custom form utility methods
vitro.utils.borrowMethods(vitro.customFormUtils, this);
// Get the custom form data from the page
$.extend(this, customFormData);
},
// On page load, create references for easy access to form elements.
@ -39,8 +42,6 @@ var customForm = {
this.acSelector = this.form.find('.acSelector');
this.acSelection = this.form.find('.acSelection');
this.acReceiver = this.form.find('.acReceiver');
$.extend(this, customFormData);
},
@ -49,7 +50,7 @@ var customForm = {
if (!this.typeSelector.length) {
this.formSteps = 1;
// there's also going to be a 3-step form
// there's also going to be a 3-step form - look for this.subTypeSelector
} else {
this.formSteps = 2;
}