page management related updates

This commit is contained in:
hjkhjk54 2012-06-15 22:14:29 +00:00
parent a103fdc486
commit 00338b05d9
2 changed files with 129 additions and 40 deletions

View file

@ -8,6 +8,8 @@ var processInternalClassDataGetterContent = {
},
//Do we need a separate content type for each of the others?
processPageContentSection:function(pageContentSection) {
//get class group
var classGroup = pageContentSection.find("select[name='selectClassGroup']").val();
//Get classes selected
var classesSelected = [];
pageContentSection.find("input[name='classInClassGroup']:checked").each(function(){
@ -15,16 +17,45 @@ var processInternalClassDataGetterContent = {
classesSelected.push($(this).val());
});
//If internal class selected, include here
var isInternal=false;
var isInternal="false";
//if this checkbox is checked, then isInternal should be true
pageContentSection.find("input[name='display-internalClass']:checked").each(function() {
isInternal=true;
isInternal="true";
});
//Not returning class group although could if need be..
var returnObject = { classesSelectedInClassGroup:classesSelected,
//JSON Object to be returned
var returnObject = { classGroup: classGroup,
classesSelectedInClassGroup:classesSelected,
isInternal:isInternal,
dataGetterClass:this.dataGetterClass};
return returnObject;
}
},
//For an existing set of content where form is already set, fill in the values
populatePageContentSection:function(existingContentObject, pageContentSection) {
var classGroupValue = existingContentObject["classGroup"];
var classesSelected = existingContentObject["classesSelectedInClassGroup"];
var isInternal = existingContentObject["isInternal"];
//Set class group
pageContentSection.find("select[name='selectClassGroup']").val(classGroupValue);
//Set classes selected within class group
//TODO: Add magic for "all" if all classes selected
var numberSelected = classesSelected.length;
var i;
for(i = 0; i < numberSelected; i++) {
var classSelected = classesSelected[i];
pageContentSection.find("input[name='classInClassGroup'][value='" + classSelected + "']").attr("checked", "checked");
}
//Also internal class needs to be selected
if(isInternal == "true") {
pageContentSection.find("input[name='display-internalClass']").attr("checked", "checked");
}
//Since this is populating content from the template, no need to "uncheck" anything
},
//For the label of the content section for editing, need to add additional value
retrieveAdditionalLabelText:function(existingContentObject) {
//Right now return empty but can hook this into a hashmap with labels and uris
//set up in browse class group
return "";
}
}