From c391a35b3d16805e712b012c8ec7560e33bf1216 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Mon, 25 Jun 2012 17:34:55 +0000 Subject: [PATCH] updates for page management - specifically handling of internal class etc. --- .../js/menupage/processDataGetterUtils.js | 6 +++++ .../processInternalClassDataGetterContent.js | 27 ++++++++++--------- .../ProcessInternalClassDataGetterN3.java | 17 ++++-------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/productMods/js/menupage/processDataGetterUtils.js b/productMods/js/menupage/processDataGetterUtils.js index 3fc11025..297445c0 100644 --- a/productMods/js/menupage/processDataGetterUtils.js +++ b/productMods/js/menupage/processDataGetterUtils.js @@ -30,5 +30,11 @@ var processDataGetterUtils = { }, isRelatedToBrowseClassGroup:function(contentType) { return (contentType == "browseClassGroup" || contentType == "internalClass"); + }, + getContentTypeForCloning:function(contentType) { + if(contentType == "browseClassGroup" || contentType == "internalClass") { + return "browseClassGroup"; + } + return contentType; } }; \ No newline at end of file diff --git a/productMods/js/menupage/processInternalClassDataGetterContent.js b/productMods/js/menupage/processInternalClassDataGetterContent.js index c8504c2f..1ea4beaf 100644 --- a/productMods/js/menupage/processInternalClassDataGetterContent.js +++ b/productMods/js/menupage/processInternalClassDataGetterContent.js @@ -31,22 +31,19 @@ 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 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 - //TODO: Add magic for "all" if all classes selected + //select class group in dropdown and append the classes within that class group + processClassGroupDataGetterContent.populatePageContentSection(existingContentObject, pageContentSection); + 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"); - }*/ + } + //internal class + var isInternal = existingContentObject["isInternal"]; //Also internal class needs to be selected if(isInternal == "true") { pageContentSection.find("input[name='display-internalClass']").attr("checked", "checked"); @@ -60,13 +57,17 @@ var processInternalClassDataGetterContent = { }, //For the label of the content section for editing, need to add additional value + retrieveContentLabel:function() { + return processClassGroupDataGetterContent.retrieveContentLabel(); + }, + //For the label of the content section for editing, need to add additional value retrieveAdditionalLabelText:function(existingContentObject) { return processClassGroupDataGetterContent.retrieveAdditionalLabelText(existingContentObject); }, //Validation on form submit: Check to see that class group has been selected - validateFormSubmission: function(pageContentSection) { - return processClassGroupDataGetterContent.validateFormSubmission(pageContentSection); + validateFormSubmission: function(pageContentSection, pageContentSectionLabel) { + return processClassGroupDataGetterContent.validateFormSubmission(pageContentSection, pageContentSectionLabel); } } \ 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 1a01477a..269d99bb 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 @@ -37,8 +37,8 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas private static String internalClassVarNameBase = "isInternal"; private Log log = LogFactory.getLog(ProcessInternalClassDataGetterN3.class); - public ProcessInternalClassDataGetterN3(JSONObject jsonObject){ - super(jsonObject); + public ProcessInternalClassDataGetterN3(){ + super(); } //Pass in variable that represents the counter @@ -46,13 +46,6 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas //That can be included here if need be, but for now just adding the type alone public List retrieveN3Required(int counter) { return super.retrieveN3Required(counter); - /* - List requiredN3 = new ArrayList(); - String partialN3 = this.getN3ForTypePartial(counter) + "."; - requiredN3.add(getPrefixes() + partialN3); - requiredN3.addAll(this.addIndividualClassesN3(counter)); - return requiredN3; - */ } @@ -211,12 +204,12 @@ public class ProcessInternalClassDataGetterN3 extends ProcessIndividualsForClas jObject.element("classGroup", classGroupURI); //this is a json array - jObject.element("individualsForClasses", individualsForClasses); + jObject.element(individualClassVarNameBase, individualsForClasses); //Internal class - if null then add false otherwise use the value if(internalClassLiteral != null) { - jObject.element("internalClass", internalClassLiteral.getString()); + jObject.element(internalClassVarNameBase, internalClassLiteral.getString()); } else { - jObject.element("internalClass", "false"); + jObject.element(internalClassVarNameBase, "false"); } } catch(Exception ex) { log.error("Exception occurred in retrieving existing values with query " + querystr, ex);