updates for returning array of most specific types and incorporating that check in removeConceptSubclasses in the client-side code VIVO-826

This commit is contained in:
hudajkhan 2014-07-10 12:37:16 -04:00
parent 8591894262
commit 72fbcedcba
2 changed files with 57 additions and 13 deletions

View file

@ -429,10 +429,28 @@ var customForm = {
removeConceptSubclasses: function(array) {
$(array).each(function(i) {
if(this["msType"] != "http://www.w3.org/2004/02/skos/core#Concept") {
var allMsTypes = this["allMsTypes"];
var removeElement = false;
if(allMsTypes.length == 1 && this["msType"] != "http://www.w3.org/2004/02/skos/core#Concept") {
//Remove from array
array.splice(i, 1);
}
removeElement = true;
} else if(allMsTypes.length > 1) {
//If there are multiple most specific types returned, check if none of them equals concept
removeElement = true;
var j;
for(j = 0; j < allMsTypes.length; j++) {
//this refers to the element itself
if(allMsTypes[j] == "http://www.w3.org/2004/02/skos/core#Concept") {
//don't remove this element if one of the most specific types is a concept
removeElement = false;
break;
}
}
}
if(removeElement) {
array.splice(i, 1);
}
});
return array;
},