From 35747e8eb87ab927224c103fb1d5949437268cd7 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Tue, 26 Jun 2012 17:49:31 +0000 Subject: [PATCH] fixed error in ProcessInternalClassDataGetterN3 after deleting JSON object from constructor in previous update. Also updated web.xml to remove Menu Management class paths that are no longer used. --- productMods/WEB-INF/web.xml | 18 ------------------ .../processInternalClassDataGetterContent.js | 13 ++++++++----- .../ProcessInternalClassDataGetterN3.java | 14 ++++++++------ 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/productMods/WEB-INF/web.xml b/productMods/WEB-INF/web.xml index 84c31ec5..3976e3d9 100644 --- a/productMods/WEB-INF/web.xml +++ b/productMods/WEB-INF/web.xml @@ -230,15 +230,6 @@ SDBSetupController /sdbsetup - - - MenuN3EditController - edu.cornell.mannlib.vitro.webapp.controller.freemarker.MenuN3EditController - - - MenuN3EditController - /menuN3Editor - DeletePropertyController @@ -267,15 +258,6 @@ /deletePageController - - MenuManagementController - edu.cornell.mannlib.vitro.webapp.controller.freemarker.MenuManagementController - - - MenuManagementController - /menuManagementController - - MenuManagementEdit edu.cornell.mannlib.vitro.webapp.controller.edit.MenuManagementEdit diff --git a/productMods/js/menupage/processInternalClassDataGetterContent.js b/productMods/js/menupage/processInternalClassDataGetterContent.js index 1ea4beaf..699d7801 100644 --- a/productMods/js/menupage/processInternalClassDataGetterContent.js +++ b/productMods/js/menupage/processInternalClassDataGetterContent.js @@ -36,11 +36,14 @@ var processInternalClassDataGetterContent = { var classesSelected = existingContentObject["classesSelectedInClassGroup"]; var numberSelected = classesSelected.length; var i; - //Uncheck all since default is checked - pageContentSection.find("input[name='classInClassGroup']").removeAttr("checked"); - for(i = 0; i < numberSelected; i++) { - var classSelected = classesSelected[i]; - pageContentSection.find("input[name='classInClassGroup'][value='" + classSelected + "']").attr("checked", "checked"); + //Uncheck all since default is checked - but only if classesSelected is nonempty - + //if no individual classes returned, then assume entire class group is selected + if(numberSelected > 0) { + pageContentSection.find("input[name='classInClassGroup']").removeAttr("checked"); + for(i = 0; i < numberSelected; i++) { + var classSelected = classesSelected[i]; + pageContentSection.find("input[name='classInClassGroup'][value='" + classSelected + "']").attr("checked", "checked"); + } } //internal class var isInternal = existingContentObject["isInternal"]; 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 269d99bb..57edd13e 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 @@ -156,10 +156,10 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas //?dataGetter a FixedHTMLDataGetter ; display:saveToVar ?saveToVar; display:htmlValue ?htmlValue . protected String getExistingValuesInternalClass(String dataGetterURI) { - String query = this.getSparqlPrefix() + "SELECT ?classGroup ?individualForClass ?internalClass WHERE {" + + String query = this.getSparqlPrefix() + " SELECT ?classGroup ?individualForClass ?internalClass WHERE {" + "<" + dataGetterURI + "> <" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup . \n" + - "<" + dataGetterURI + "> <" + DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS + "> ?individualForClass . \n" + - "OPTIONAL {<" + dataGetterURI + "> <" + DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL + "> ?internaClass .} \n" + + "OPTIONAL {<" + dataGetterURI + "> <" + DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS + "> ?individualForClass . }\n" + + "OPTIONAL {<" + dataGetterURI + "> <" + DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL + "> ?internalClass .} \n" + "}"; return query; } @@ -191,9 +191,11 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas Resource classGroupResource = qs.getResource("classGroup"); classGroupURI = classGroupResource.getURI(); } - //individuals for classes - Resource individualForClassResource = qs.getResource("individualForClass"); - individualsForClasses.add(individualForClassResource.getURI()); + //individuals for classes - this may also be optional in case entire class group selected and internal class + if(qs.get("individualForClassResource") != null ) { + Resource individualForClassResource = qs.getResource("individualForClass"); + individualsForClasses.add(individualForClassResource.getURI()); + } //Put both literals in existing literals //If internal class value is present and we have not already saved it in a previous result iteration if(qs.get("internalClass") != null && internalClassLiteral == null) {