updates for page management
This commit is contained in:
parent
9bf32fb36b
commit
7c0f00e7e9
6 changed files with 79 additions and 43 deletions
|
@ -316,10 +316,18 @@ 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) {
|
||||
List<String> literalsOnForm = pn.retrieveLiteralsOnForm(counter);
|
||||
|
|
|
@ -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}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = $("<div></div>", {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -84,8 +84,17 @@
|
|||
<section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region">
|
||||
<input type="text" name="customTemplate" value="${customTemplate!''}" size="40" role="input" /><span class="requiredHint"> *</span>
|
||||
</section>
|
||||
<p style="margin-top:10px;margin-bottom:0px"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"> This is a menu page</p>
|
||||
<section id="menu" role="region" style="margin-top:10px">
|
||||
<p style="margin-top:10px;margin-bottom:0px"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"
|
||||
<#if menuAction="Edit" && menuItem?has_content>checked="checked"</#if>
|
||||
> This is a menu page</p>
|
||||
<section id="menu" role="region"
|
||||
<#--Do not display menu section unless editing an existing menu item-->
|
||||
<#if menuAction = "Add" || (menuAction="Edit" && (!menuItem?has_content || menuItem = "")) >
|
||||
style="margin-top:10px;display:none"
|
||||
<#else>
|
||||
style="margin-top:10px"
|
||||
</#if>
|
||||
>
|
||||
<label for="default">Menu Item Name</label>
|
||||
<input type="hidden" id="menuItem" name="menuItem" value="${menuItem!''}" />
|
||||
<input type="text" id="menuLinkText" name="menuLinkText" value="${menuLinkText!''}" size="28" role="input" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue