updates for page management
This commit is contained in:
parent
8d353cf977
commit
075f7338c3
2 changed files with 23 additions and 9 deletions
|
@ -31,9 +31,12 @@ var processInternalClassDataGetterContent = {
|
||||||
},
|
},
|
||||||
//For an existing set of content where form is already set, fill in the values
|
//For an existing set of content where form is already set, fill in the values
|
||||||
populatePageContentSection:function(existingContentObject, pageContentSection) {
|
populatePageContentSection:function(existingContentObject, pageContentSection) {
|
||||||
var classGroupValue = existingContentObject["classGroup"];
|
//var classGroupValue = existingContentObject["classGroup"];
|
||||||
var classesSelected = existingContentObject["classesSelectedInClassGroup"];
|
//var classesSelected = existingContentObject["classesSelectedInClassGroup"];
|
||||||
var isInternal = existingContentObject["isInternal"];
|
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
|
//Set class group
|
||||||
pageContentSection.find("select[name='selectClassGroup']").val(classGroupValue);
|
pageContentSection.find("select[name='selectClassGroup']").val(classGroupValue);
|
||||||
//Set classes selected within class group
|
//Set classes selected within class group
|
||||||
|
@ -43,19 +46,23 @@ var processInternalClassDataGetterContent = {
|
||||||
for(i = 0; i < numberSelected; i++) {
|
for(i = 0; i < numberSelected; i++) {
|
||||||
var classSelected = classesSelected[i];
|
var classSelected = classesSelected[i];
|
||||||
pageContentSection.find("input[name='classInClassGroup'][value='" + classSelected + "']").attr("checked", "checked");
|
pageContentSection.find("input[name='classInClassGroup'][value='" + classSelected + "']").attr("checked", "checked");
|
||||||
}
|
}*/
|
||||||
//Also internal class needs to be selected
|
//Also internal class needs to be selected
|
||||||
if(isInternal == "true") {
|
if(isInternal == "true") {
|
||||||
pageContentSection.find("input[name='display-internalClass']").attr("checked", "checked");
|
pageContentSection.find("input[name='display-internalClass']").attr("checked", "checked");
|
||||||
}
|
}
|
||||||
//Since this is populating content from the template, no need to "uncheck" anything
|
//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
|
//For the label of the content section for editing, need to add additional value
|
||||||
retrieveAdditionalLabelText:function(existingContentObject) {
|
retrieveAdditionalLabelText:function(existingContentObject) {
|
||||||
//Right now return empty but can hook this into a hashmap with labels and uris
|
return processClassGroupDataGetterContent.retrieveAdditionalLabelText(existingContentObject);
|
||||||
//set up in browse class group
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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.dao.DisplayVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
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();
|
JSONObject jObject = new JSONObject();
|
||||||
jObject.element("dataGetterClass", classType);
|
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);
|
String querystr = getExistingValuesInternalClass(dataGetterURI);
|
||||||
QueryExecution qe = null;
|
QueryExecution qe = null;
|
||||||
Literal internalClassLiteral = null;
|
Literal internalClassLiteral = null;
|
||||||
|
@ -212,10 +221,8 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas
|
||||||
} catch(Exception ex) {
|
} catch(Exception ex) {
|
||||||
log.error("Exception occurred in retrieving existing values with query " + querystr, ex);
|
log.error("Exception occurred in retrieving existing values with query " + querystr, ex);
|
||||||
}
|
}
|
||||||
return jObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue