diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManagePageGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManagePageGenerator.java index 622cbae5e..6e985d2ee 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManagePageGenerator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManagePageGenerator.java @@ -316,9 +316,17 @@ public class ManagePageGenerator extends BaseEditConfigurationGenerator implemen if(pn.retrieveN3Optional(counter) != null) { n3.addAll(pn.retrieveN3Optional(counter)); } + //Add n3 connecting page to this data getter + n3.add(getPageToDataGetterN3(pn, counter)); editConfig.addN3Optional(n3); } + + private String getPageToDataGetterN3(ProcessDataGetterN3 pn, int counter) { + String dataGetterVar = pn.getDataGetterVar(counter); + //Put this method in the generator but can be put elsewhere + return getDataGetterN3(dataGetterVar); + } private void addExistingLiteralsAndUrisOnForm(EditConfigurationVTwo editConfig, ProcessDataGetterN3 pn, int counter) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java index 51f4f100c..112e24fc2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java @@ -97,13 +97,14 @@ public class ManagePagePreprocessor extends for(String literalName: literalKeys) { //if submission already has value for this, then leave be - //otherwise replace with blank value sentinel + //otherwise replace with null which will not be valid N3 + //TODO: Replace with better solution for forcing literal deletion boolean haslv = submission.hasLiteralValue(literalName); if(!submission.hasLiteralValue(literalName)) { submission.addLiteralToForm(editConfiguration, editConfiguration.getField(literalName), literalName, - (new String[] {EditConfigurationConstants.BLANK_SENTINEL})); + (new String[] {null})); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java index b6c16a6ff..4e40a8a11 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java @@ -350,7 +350,7 @@ public class IndividualsForClassesDataGetter extends DataGetterBase implements D //Get data servuice public String getDataServiceUrl() { - return UrlBuilder.getUrl("/dataservice?getSolrIndividualsByVClasses=1&vclassId="); + return UrlBuilder.getUrl("/dataservice?getRenderedSolrIndividualsByVClass=1&vclassId="); } /** * For processig of JSONObject diff --git a/webapp/web/js/menupage/pageManagementUtils.js b/webapp/web/js/menupage/pageManagementUtils.js index 75a85d095..84bfa3b8c 100644 --- a/webapp/web/js/menupage/pageManagementUtils.js +++ b/webapp/web/js/menupage/pageManagementUtils.js @@ -305,6 +305,8 @@ var pageManagementUtils = { if(varOrClass == null || varOrClass==undefined) { varOrClass = ""; } + //Attach event handlers if they exist + pageManagementUtils.bindClonedContentEventHandlers($newContentObj); pageManagementUtils.createClonedContentContainer($newContentObj, counter, contentTypeLabel, varOrClass); //previously increased by 10, just increasing by 1 here pageManagementUtils.counter++; @@ -320,6 +322,13 @@ var pageManagementUtils = { pageManagementUtils.counter++; return $newContentObj; }, + //For binding content type specific event handlers should they exist + bindClonedContentEventHandlers:function($newContentObj) { + var dataGetterProcessorObj = pageManagementUtils.getDataGetterProcessorObject($newContentObj); + if($.isFunction(dataGetterProcessorObj.bindEventHandlers)) { + dataGetterProcessorObj.bindEventHandlers($newContentObj); + } + }, createClonedContentContainer:function($newContentObj, counter, contentTypeLabel, varOrClass) { //Create the container for the new content $newDivContainer = $("
", { @@ -397,7 +406,7 @@ var pageManagementUtils = { $.getJSON(url, function(results) { //Moved the function to processClassGroupDataGetterContent //Should probably remove this entire method and copy there - processClassGroupDataGetterContent.displayClassesForClassGroup(results); + pageManagementUtils.displayClassesForClassGroup(results); }); }, displayClassesForClassGroup:function(results) { @@ -463,7 +472,7 @@ var pageManagementUtils = { }); $('input:checkbox[name=classInClassGroup]').click(function(){ - $(this).closest(ul).find('input:checkbox[name=allSelected]').removeAttr('checked'); + $(this).closest("ul").find('input:checkbox[name=allSelected]').removeAttr('checked'); }); }, //This is SPECIFIC to VIVO so should be moved there updateInternalClassMessage:function(classGroupName) { //User has changed content type @@ -617,6 +626,15 @@ var pageManagementUtils = { } } + }, + //Get the data getter processor + getDataGetterProcessorObject:function(pageContentSection) { + var dataGetterType = pageManagementUtils.processDataGetterUtils.selectDataGetterType(pageContentSection); + var dataGetterProcessor = null; + if(pageManagementUtils.dataGetterProcessorMap != null) { + dataGetterProcessor = pageManagementUtils.dataGetterProcessorMap[dataGetterType]; + } + return dataGetterProcessor; } }; diff --git a/webapp/web/js/menupage/processClassGroupDataGetterContent.js b/webapp/web/js/menupage/processClassGroupDataGetterContent.js index 853bfbbb5..1d2bde229 100644 --- a/webapp/web/js/menupage/processClassGroupDataGetterContent.js +++ b/webapp/web/js/menupage/processClassGroupDataGetterContent.js @@ -87,46 +87,46 @@ var processClassGroupDataGetterContent = { //Toggle class selection already deals with names but want to attach that event //handler to THIS new section toggleClassSelection: function(pageContentSection) { - // Check/unckeck all classes for selection - pageContentSection.find('input:checkbox[name=allSelected]').click(function(){ - if ( this.checked ) { - // if checked, select all the checkboxes for this particular section - $(this).closest("ul").find('input:checkbox[name=classInClassGroup]').attr('checked','checked'); - //$('input:checkbox[name=classInClassGroup]').attr('checked','checked'); + // Check/unckeck all classes for selection + pageContentSection.find('input:checkbox[name=allSelected]').click(function(){ + if ( this.checked ) { + // if checked, select all the checkboxes for this particular section + $(this).closest("ul").find('input:checkbox[name=classInClassGroup]').attr('checked','checked'); + //$('input:checkbox[name=classInClassGroup]').attr('checked','checked'); - } else { - // if not checked, deselect all the checkboxes - $(this).closest("ul").find('input:checkbox[name=classInClassGroup]').removeAttr('checked'); + } else { + // if not checked, deselect all the checkboxes + $(this).closest("ul").find('input:checkbox[name=classInClassGroup]').removeAttr('checked'); - // $('input:checkbox[name=classInClassGroup]').removeAttr('checked'); - } - }); + // $('input:checkbox[name=classInClassGroup]').removeAttr('checked'); + } + }); - pageContentSection.find('input:checkbox[name=classInClassGroup]').click(function(){ - $(this).closest(ul).find('input:checkbox[name=allSelected]').removeAttr('checked'); - }); - }, - bindEventHandlers:function(pageContentSection) { - processClassGroupDataGetterContent.toggleClassSelection(pageContentSection); + pageContentSection.find('input:checkbox[name=classInClassGroup]').click(function(){ + $(this).closest("ul").find('input:checkbox[name=allSelected]').removeAttr('checked'); + }); + }, + bindEventHandlers:function(pageContentSection) { + processClassGroupDataGetterContent.toggleClassSelection(pageContentSection); - var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']"); - selectClassGroupDropdown.change(function(e, el) { - processClassGroupDataGetterContent.chooseClassGroup(pageContentSection); - }); - }, - chooseClassGroup: function(pageContentSection) { - var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']"); - var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri="; - var vclassUri = selectClassGroupDropdown.val(); - url += encodeURIComponent(vclassUri); - //Get the page content section - //Make ajax call to retrieve vclasses - $.getJSON(url, function(results) { - //Moved the function to processClassGroupDataGetterContent - //Should probably remove this entire method and copy there - processClassGroupDataGetterContent.displayClassesForClassGroup(results, pageContentSection); - }); - } + var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']"); + selectClassGroupDropdown.change(function(e, el) { + processClassGroupDataGetterContent.chooseClassGroup(pageContentSection); + }); + }, + chooseClassGroup: function(pageContentSection) { + var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']"); + var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri="; + var vclassUri = selectClassGroupDropdown.val(); + url += encodeURIComponent(vclassUri); + //Get the page content section + //Make ajax call to retrieve vclasses + $.getJSON(url, function(results) { + //Moved the function to processClassGroupDataGetterContent + //Should probably remove this entire method and copy there + processClassGroupDataGetterContent.displayClassesForClassGroup(results, pageContentSection); + }); + } diff --git a/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl b/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl index 840a96a3e..f4ea847ef 100644 --- a/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl +++ b/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl @@ -84,8 +84,17 @@This is a menu page
-