updates for page management
This commit is contained in:
parent
9bf32fb36b
commit
7c0f00e7e9
6 changed files with 79 additions and 43 deletions
|
@ -316,9 +316,17 @@ public class ManagePageGenerator extends BaseEditConfigurationGenerator implemen
|
||||||
if(pn.retrieveN3Optional(counter) != null) {
|
if(pn.retrieveN3Optional(counter) != null) {
|
||||||
n3.addAll(pn.retrieveN3Optional(counter));
|
n3.addAll(pn.retrieveN3Optional(counter));
|
||||||
}
|
}
|
||||||
|
//Add n3 connecting page to this data getter
|
||||||
|
n3.add(getPageToDataGetterN3(pn, counter));
|
||||||
editConfig.addN3Optional(n3);
|
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,
|
private void addExistingLiteralsAndUrisOnForm(EditConfigurationVTwo editConfig, ProcessDataGetterN3 pn,
|
||||||
int counter) {
|
int counter) {
|
||||||
|
|
|
@ -97,13 +97,14 @@ public class ManagePagePreprocessor extends
|
||||||
for(String literalName: literalKeys) {
|
for(String literalName: literalKeys) {
|
||||||
|
|
||||||
//if submission already has value for this, then leave be
|
//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);
|
boolean haslv = submission.hasLiteralValue(literalName);
|
||||||
if(!submission.hasLiteralValue(literalName)) {
|
if(!submission.hasLiteralValue(literalName)) {
|
||||||
submission.addLiteralToForm(editConfiguration,
|
submission.addLiteralToForm(editConfiguration,
|
||||||
editConfiguration.getField(literalName),
|
editConfiguration.getField(literalName),
|
||||||
literalName,
|
literalName,
|
||||||
(new String[] {EditConfigurationConstants.BLANK_SENTINEL}));
|
(new String[] {null}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ public class IndividualsForClassesDataGetter extends DataGetterBase implements D
|
||||||
|
|
||||||
//Get data servuice
|
//Get data servuice
|
||||||
public String getDataServiceUrl() {
|
public String getDataServiceUrl() {
|
||||||
return UrlBuilder.getUrl("/dataservice?getSolrIndividualsByVClasses=1&vclassId=");
|
return UrlBuilder.getUrl("/dataservice?getRenderedSolrIndividualsByVClass=1&vclassId=");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* For processig of JSONObject
|
* For processig of JSONObject
|
||||||
|
|
|
@ -305,6 +305,8 @@ var pageManagementUtils = {
|
||||||
if(varOrClass == null || varOrClass==undefined) {
|
if(varOrClass == null || varOrClass==undefined) {
|
||||||
varOrClass = "";
|
varOrClass = "";
|
||||||
}
|
}
|
||||||
|
//Attach event handlers if they exist
|
||||||
|
pageManagementUtils.bindClonedContentEventHandlers($newContentObj);
|
||||||
pageManagementUtils.createClonedContentContainer($newContentObj, counter, contentTypeLabel, varOrClass);
|
pageManagementUtils.createClonedContentContainer($newContentObj, counter, contentTypeLabel, varOrClass);
|
||||||
//previously increased by 10, just increasing by 1 here
|
//previously increased by 10, just increasing by 1 here
|
||||||
pageManagementUtils.counter++;
|
pageManagementUtils.counter++;
|
||||||
|
@ -320,6 +322,13 @@ var pageManagementUtils = {
|
||||||
pageManagementUtils.counter++;
|
pageManagementUtils.counter++;
|
||||||
return $newContentObj;
|
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) {
|
createClonedContentContainer:function($newContentObj, counter, contentTypeLabel, varOrClass) {
|
||||||
//Create the container for the new content
|
//Create the container for the new content
|
||||||
$newDivContainer = $("<div></div>", {
|
$newDivContainer = $("<div></div>", {
|
||||||
|
@ -397,7 +406,7 @@ var pageManagementUtils = {
|
||||||
$.getJSON(url, function(results) {
|
$.getJSON(url, function(results) {
|
||||||
//Moved the function to processClassGroupDataGetterContent
|
//Moved the function to processClassGroupDataGetterContent
|
||||||
//Should probably remove this entire method and copy there
|
//Should probably remove this entire method and copy there
|
||||||
processClassGroupDataGetterContent.displayClassesForClassGroup(results);
|
pageManagementUtils.displayClassesForClassGroup(results);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
displayClassesForClassGroup:function(results) {
|
displayClassesForClassGroup:function(results) {
|
||||||
|
@ -463,7 +472,7 @@ var pageManagementUtils = {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input:checkbox[name=classInClassGroup]').click(function(){
|
$('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
|
}, //This is SPECIFIC to VIVO so should be moved there
|
||||||
updateInternalClassMessage:function(classGroupName) { //User has changed content type
|
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
|
//Toggle class selection already deals with names but want to attach that event
|
||||||
//handler to THIS new section
|
//handler to THIS new section
|
||||||
toggleClassSelection: function(pageContentSection) {
|
toggleClassSelection: function(pageContentSection) {
|
||||||
// Check/unckeck all classes for selection
|
// Check/unckeck all classes for selection
|
||||||
pageContentSection.find('input:checkbox[name=allSelected]').click(function(){
|
pageContentSection.find('input:checkbox[name=allSelected]').click(function(){
|
||||||
if ( this.checked ) {
|
if ( this.checked ) {
|
||||||
// if checked, select all the checkboxes for this particular section
|
// if checked, select all the checkboxes for this particular section
|
||||||
$(this).closest("ul").find('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
$(this).closest("ul").find('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
||||||
//$('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
//$('input:checkbox[name=classInClassGroup]').attr('checked','checked');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// if not checked, deselect all the checkboxes
|
// if not checked, deselect all the checkboxes
|
||||||
$(this).closest("ul").find('input:checkbox[name=classInClassGroup]').removeAttr('checked');
|
$(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(){
|
pageContentSection.find('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');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
bindEventHandlers:function(pageContentSection) {
|
bindEventHandlers:function(pageContentSection) {
|
||||||
processClassGroupDataGetterContent.toggleClassSelection(pageContentSection);
|
processClassGroupDataGetterContent.toggleClassSelection(pageContentSection);
|
||||||
|
|
||||||
var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']");
|
var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']");
|
||||||
selectClassGroupDropdown.change(function(e, el) {
|
selectClassGroupDropdown.change(function(e, el) {
|
||||||
processClassGroupDataGetterContent.chooseClassGroup(pageContentSection);
|
processClassGroupDataGetterContent.chooseClassGroup(pageContentSection);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
chooseClassGroup: function(pageContentSection) {
|
chooseClassGroup: function(pageContentSection) {
|
||||||
var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']");
|
var selectClassGroupDropdown = pageContentSection.find("select[name='selectClassGroup']");
|
||||||
var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri=";
|
var url = "dataservice?getVClassesForVClassGroup=1&classgroupUri=";
|
||||||
var vclassUri = selectClassGroupDropdown.val();
|
var vclassUri = selectClassGroupDropdown.val();
|
||||||
url += encodeURIComponent(vclassUri);
|
url += encodeURIComponent(vclassUri);
|
||||||
//Get the page content section
|
//Get the page content section
|
||||||
//Make ajax call to retrieve vclasses
|
//Make ajax call to retrieve vclasses
|
||||||
$.getJSON(url, function(results) {
|
$.getJSON(url, function(results) {
|
||||||
//Moved the function to processClassGroupDataGetterContent
|
//Moved the function to processClassGroupDataGetterContent
|
||||||
//Should probably remove this entire method and copy there
|
//Should probably remove this entire method and copy there
|
||||||
processClassGroupDataGetterContent.displayClassesForClassGroup(results, pageContentSection);
|
processClassGroupDataGetterContent.displayClassesForClassGroup(results, pageContentSection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,17 @@
|
||||||
<section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region">
|
<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>
|
<input type="text" name="customTemplate" value="${customTemplate!''}" size="40" role="input" /><span class="requiredHint"> *</span>
|
||||||
</section>
|
</section>
|
||||||
<p style="margin-top:10px;margin-bottom:0px"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"> This is a menu page</p>
|
<p style="margin-top:10px;margin-bottom:0px"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"
|
||||||
<section id="menu" role="region" style="margin-top:10px">
|
<#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>
|
<label for="default">Menu Item Name</label>
|
||||||
<input type="hidden" id="menuItem" name="menuItem" value="${menuItem!''}" />
|
<input type="hidden" id="menuItem" name="menuItem" value="${menuItem!''}" />
|
||||||
<input type="text" id="menuLinkText" name="menuLinkText" value="${menuLinkText!''}" size="28" role="input" />
|
<input type="text" id="menuLinkText" name="menuLinkText" value="${menuLinkText!''}" size="28" role="input" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue