diff --git a/productMods/edit/forms/addGrantRoleToPerson.jsp b/productMods/edit/forms/addGrantRoleToPerson.jsp index 241ef53a..4023ad4b 100644 --- a/productMods/edit/forms/addGrantRoleToPerson.jsp +++ b/productMods/edit/forms/addGrantRoleToPerson.jsp @@ -89,9 +89,9 @@ if ( ((String)request.getAttribute("predicateUri")).endsWith("hasPrincipalInvest ?grant rdfs:label ?grantLabel . -<%-- Must be all one line for JavaScript. --%> +<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%> -PREFIX core: <${vivoCore}> SELECT ?grantURI WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?grantURI .} +PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?individual .} ${vivoOnt}#Grant @@ -189,14 +189,7 @@ PREFIX core: <${vivoCore}> SELECT ?grantURI WHERE {<${subjectUri}> core:hasPrinc - +

${formHeading}

@@ -215,4 +208,13 @@ var customFormData = {

* required fields

+ + \ No newline at end of file diff --git a/productMods/edit/forms/addPublicationToAuthor.jsp b/productMods/edit/forms/addPublicationToAuthor.jsp index 3b97cc9e..ec47826a 100644 --- a/productMods/edit/forms/addPublicationToAuthor.jsp +++ b/productMods/edit/forms/addPublicationToAuthor.jsp @@ -52,19 +52,14 @@ core:informationResourceInAuthorship (InformationResource : Authorship) - invers String subjectName = ((Individual) request.getAttribute("subject")).getName(); vreq.setAttribute("subjectUriJson", MiscWebUtils.escape(subjectUri)); - String vivoOnt = "http://vivoweb.org/ontology"; - String vivoCore = vivoOnt + "/core#"; - vreq.setAttribute("vivoOnt", vivoOnt); - vreq.setAttribute("vivoCore", vivoCore); - vreq.setAttribute("vivoCoreJson", MiscWebUtils.escape(vivoCore)); - vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); String intDatatypeUri = XSD.xint.toString(); vreq.setAttribute("intDatatypeUri", intDatatypeUri); vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri)); %> - + + @@ -107,7 +102,7 @@ SPARQL queries for existing values. --%> ?newPub core:informationResourceInAuthorship ?authorshipUri . -<%-- Must be all one line for JavaScript. --%> +<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%> PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri .?authorshipUri core:linkedInformationResource ?individual .} diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js index d253941a..1123ea86 100644 --- a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js +++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js @@ -27,10 +27,12 @@ var customForm = { if (!this.typeSelector) { this.formSteps = 1; + // there's also going to be a 3-step form } else { this.formSteps = 2; } + // This is the label element for the field with name 'label' this.labelFieldLabel = $('label[for=' + $('#label').attr('id') + ']'); // Get this on page load, so we can prepend to it. We can't just prepend to the current label text, @@ -100,7 +102,8 @@ var customForm = { var typeVal = $(this).val(); // Set the type of individual that the autocomplete will search for. // We do this even if typeVal is empty, to clear out a previous value. - customForm.resetAutocomplete(typeVal); + //customForm.resetAutocomplete(typeVal); + customForm.acType = typeVal; if (typeVal.length) { customForm.labelFieldLabel.html(customForm.getSelectedTypeName() + ' ' + customForm.baseLabelText); customForm.initFormFullView(); @@ -116,7 +119,7 @@ var customForm = { this.getAcFilter(); this.acCache = {}; - this.baseAcUrl = customFormData.acUrl; + //this.baseAcUrl = customFormData.acUrl; this.acSelector.autocomplete({ minLength: 3, @@ -127,11 +130,14 @@ var customForm = { return; } // console.log('not getting term from cache'); - + $.ajax({ url: customForm.acUrl, dataType: 'json', - data: request, + data: { + term: request.term, + type: customForm.acType, + }, complete: function(xhr, status) { // Not sure why, but we need an explicit json parse here. jQuery // should parse the response text and return a json object. @@ -152,9 +158,6 @@ var customForm = { }, getAcFilter: function() { - // RY This gets put on the page for now. May want to put into a js file instead. - var url = $('.sparqlQueryUrl').attr('id'), - filter; $.ajax({ url: customFormData.sparqlQueryUrl, @@ -184,13 +187,13 @@ var customForm = { return results; } $.each(results, function() { - if (! $.inArray(this.uri, this.acFilter)) { + if ($.inArray(this.uri, customForm.acFilter) == -1) { + console.log("adding " + this.label + " to filtered results"); filteredResults.push(this); } -// Debugging -// else { -// console.log("filtering out " + this.label); -// } + else { + console.log("filtering out " + this.label); + } }); return filteredResults; },