From 8d9a59c1bf13d1b2b76d388243d5fcdff5b3f5f5 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Mon, 9 Jan 2012 18:58:31 +0000 Subject: [PATCH] updates for nihvivo-3357: including update for javascript and freemarker template that allows inclusion of hard-coded URIS to exclude from autocomplete results. This allows the subject uri to be excluded from the results for an object property form (e.g. collaborators auto-complete will exclude the subject from showing up in the list of person results). --- .../edit/forms/js/customFormWithAutocomplete.js | 16 +++++++++++++++- .../edit/forms/autoCompleteObjectPropForm.ftl | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/productMods/edit/forms/js/customFormWithAutocomplete.js b/productMods/edit/forms/js/customFormWithAutocomplete.js index 4b4d92f8..b42da315 100644 --- a/productMods/edit/forms/js/customFormWithAutocomplete.js +++ b/productMods/edit/forms/js/customFormWithAutocomplete.js @@ -236,6 +236,9 @@ var customForm = { } this.getAcFilter(); + //If specific individuals are to be filtered out, add them here + //to the filtering list + this.getAcFilterForIndividuals(); this.acCache = {}; this.acSelector.autocomplete({ @@ -289,7 +292,7 @@ var customForm = { this.verifyMatch.data('baseHref', this.verifyMatch.attr('href')); }, - + //get autocomplete filter with sparql query getAcFilter: function() { if (!this.sparqlForAcFilter) { @@ -344,7 +347,18 @@ var customForm = { }); return filteredResults; }, + //To filter out specific individuals, not part of a query + //Pass in list of individuals to be filtered out + getAcFilterForIndividuals: function() { + if (!this.acFilterForIndividuals || !this.acFilterForIndividuals.length) { + this.acFilterForIndividuals = null; + return; + } + //add this list to the ac filter list + customForm.acFilter = customForm.acFilter.concat(this.acFilterForIndividuals); + + }, // Reset some autocomplete values after type is changed resetAutocomplete: function(typeVal) { // Append the type parameter to the base autocomplete url diff --git a/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl b/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl index 5303fba9..a864e68d 100644 --- a/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl +++ b/productMods/templates/freemarker/edit/forms/autoCompleteObjectPropForm.ftl @@ -37,6 +37,8 @@ <#else> <#assign formTitle = editConfiguration.formTitle /> +<#--In order to fill out the subject--> +<#assign acFilterForIndividuals = "['" + editConfiguration.subjectUri + "']" />

${formTitle}

@@ -115,6 +117,7 @@ Also multiple types parameter set to true only if more than one type returned--> supportEdit: 'true', sparqlForAcFilter: '${sparqlForAcFilter}', sparqlQueryUrl: '${sparqlQueryUrl}', + acFilterForIndividuals: ${acFilterForIndividuals}, defaultTypeName: '${propertyNameForDisplay}' // used in repair mode to generate button text };