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).

This commit is contained in:
hjkhjk54 2012-01-09 18:58:31 +00:00
parent 9000616bcc
commit 8d9a59c1bf
2 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -37,6 +37,8 @@
<#else>
<#assign formTitle = editConfiguration.formTitle />
</#if>
<#--In order to fill out the subject-->
<#assign acFilterForIndividuals = "['" + editConfiguration.subjectUri + "']" />
<h2>${formTitle}</h2>
@ -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
};
</script>