diff --git a/productMods/js/menupage/processInternalClassDataGetterContent.js b/productMods/js/menupage/processInternalClassDataGetterContent.js index db6c7757..45338752 100644 --- a/productMods/js/menupage/processInternalClassDataGetterContent.js +++ b/productMods/js/menupage/processInternalClassDataGetterContent.js @@ -31,9 +31,12 @@ var processInternalClassDataGetterContent = { }, //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 classGroupValue = existingContentObject["classGroup"]; + //var classesSelected = existingContentObject["classesSelectedInClassGroup"]; var isInternal = existingContentObject["isInternal"]; + //Select the class group, display classes in class group, and select classes that are included + processIndividualsForClassesDataGetterContent.populatePageContentSection(existingContentObject, pageContentSection); + /* //Set class group pageContentSection.find("select[name='selectClassGroup']").val(classGroupValue); //Set classes selected within class group @@ -43,19 +46,23 @@ var processInternalClassDataGetterContent = { 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 + var results = pageContentSection.results; + if(results != null && results.classGroupName != null) { + var displayInternalMessage = pageContentSection.find('label[for="display-internalClass"] em'); + displayInternalMessage.filter(":first").html(results.classGroupName); + } }, //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 ""; + return processClassGroupDataGetterContent.retrieveAdditionalLabelText(existingContentObject); + } } \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/utils/ProcessInternalClassDataGetterN3.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/utils/ProcessInternalClassDataGetterN3.java index 646eecfc..1a01477a 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/utils/ProcessInternalClassDataGetterN3.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/utils/ProcessInternalClassDataGetterN3.java @@ -25,6 +25,7 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; +import javax.servlet.ServletContext; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -171,9 +172,17 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas } - public JSONObject getExistingValuesJSON(String dataGetterURI, OntModel queryModel) { + public JSONObject getExistingValuesJSON(String dataGetterURI, OntModel queryModel, ServletContext context) { JSONObject jObject = new JSONObject(); jObject.element("dataGetterClass", classType); + //Get selected class group, if internal class, and classes selected from class group + getExistingClassGroupAndInternalClass(dataGetterURI, jObject, queryModel); + //Get all classes in the class group + ((ProcessClassGroupDataGetterN3) this).getExistingClassesInClassGroup(context, dataGetterURI, jObject); + return jObject; + } + + private void getExistingClassGroupAndInternalClass(String dataGetterURI, JSONObject jObject, OntModel queryModel) { String querystr = getExistingValuesInternalClass(dataGetterURI); QueryExecution qe = null; Literal internalClassLiteral = null; @@ -212,10 +221,8 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas } catch(Exception ex) { log.error("Exception occurred in retrieving existing values with query " + querystr, ex); } - return jObject; } - }