updates for page management

This commit is contained in:
hjkhjk54 2012-06-05 21:34:41 +00:00
parent 9047ce5a9c
commit 5472c77cee
3 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
//This class is responsible for the product-specific form processing/content selection that might be possible
//Overrides the usual behavior of selecting the specific JavaScript class needed to convert the form inputs
//into a JSON object for submission based on the page content type
//VIVO Specific version includes individuals for classes data getter in addition to the others
//The internal class specific processor class is in VIVO, while all other javascript files are in Vitro
var processDataGetterUtils = {
dataGetterProcessorMap:{"browseClassGroup": processClassGroupDataGetterContent,
"sparqlQuery": processSparqlDataGetterContent,
"fixedHtml":processFixedHTMLDataGetterContent,
"internalClass":processInternalClassDataGetterContent},
selectDataGetterType:function(pageContentSection) {
var contentType = pageContentSection.attr("contentType");
//The form can provide "browse class group" as content type but need to check
//whether this is in fact individuals for classes instead
if(contentType == "browseClassGroup") {
//Is ALL NOT selected and there are other classes, pick one
//this SHOULD be an array
var allClassesSelected = pageContentSection.find("input[name='allSelected']:checked");
var isInternalSelected = pageContentSection.find("input[name='display-internalClass']:checked");
//If all NOT selected then need to pick a different content type OR if internal class selected
if( isInternalSelected.length > 0 || allClassesSelected.length == 0) {
contentType = "internalClass";
}
}
return contentType;
}
};

View file

@ -0,0 +1,30 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var processIndividualsForClassesDataGetterContent = {
dataGetterClass:null,
//can use this if expect to initialize from elsewhere
initProcessor:function(dataGetterClassInput) {
this.dataGetterClass = dataGetterClassInput;
},
//Do we need a separate content type for each of the others?
processPageContentSection:function(pageContentSection) {
//Get classes selected
var classesSelected = [];
pageContentSection.find("input[name='classInClassGroup']:checked").each(function(){
//Need to make sure that the class is also saved as a URI
classesSelected.push($(this).val());
});
//If internal class selected, include here
var isInternal:false;
//if this checkbox is checked, then isInternal should be true
pageContentSection.find("input[name='display-internalClass']:checked").each(function() {
isInternal:true;
});
var returnObject = {classGroup:classGroup,
classesSelectedInClassGroup:classesSelected,
isInternal:isInternal,
dataGetterClass:this.dataGetterClass};
return returnObject;
}
}