updates for page management - page deletion as well as changing menu management to menu ordering
This commit is contained in:
parent
54941a201b
commit
e3f9caced1
11 changed files with 81 additions and 18 deletions
|
@ -130,7 +130,7 @@ public class DeletePageController extends VitroHttpServlet {
|
|||
(RDFNode) null);
|
||||
while(dataGetterIt.hasNext()) {
|
||||
Statement dataGetterStmt = dataGetterIt.nextStatement();
|
||||
Resource dataGetterResource = dataGetterStmt.getSubject();
|
||||
Resource dataGetterResource = dataGetterStmt.getResource();
|
||||
dataGettersModel.add(displayModel.listStatements(dataGetterResource, null, (RDFNode) null));
|
||||
}
|
||||
return dataGettersModel;
|
||||
|
@ -160,11 +160,7 @@ public class DeletePageController extends VitroHttpServlet {
|
|||
//This should be in write mode
|
||||
//TODO: find better way of doing this
|
||||
private OntModel getDisplayModel(VitroRequest vreq) {
|
||||
if(vreq.getAttribute(vreq.SPECIAL_WRITE_MODEL) != null) {
|
||||
return vreq.getWriteModel();
|
||||
} else {
|
||||
return (OntModel) getServletContext().getAttribute("http://vitro.mannlib.cornell.edu/default/vitro-kb-displayMetadata");
|
||||
}
|
||||
return vreq.getDisplayModel();
|
||||
}
|
||||
|
||||
Log log = LogFactory.getLog(MenuManagementEdit.class);
|
||||
|
|
|
@ -366,9 +366,43 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
|||
// }
|
||||
|
||||
try {
|
||||
//If RDFService is null, will do what code used to do before, otherwise employ rdfservice
|
||||
if(rdfService == null) {
|
||||
log.debug("RDF Service null, Using CONSTRUCT query string for object property " +
|
||||
propertyUri + ": " + queryString);
|
||||
Query query = null;
|
||||
try {
|
||||
query = QueryFactory.create(queryString, Syntax.syntaxARQ);
|
||||
} catch(Throwable th){
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
||||
"string. " + th.getMessage());
|
||||
log.error(queryString);
|
||||
return constructedModel;
|
||||
}
|
||||
|
||||
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||
Dataset dataset = w.getDataset();
|
||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||
QueryExecution qe = null;
|
||||
try {
|
||||
qe = QueryExecutionFactory.create(
|
||||
query, dataset);
|
||||
qe.execConstruct(constructedModel);
|
||||
} catch (Exception e) {
|
||||
log.error("Error getting constructed model for subject " + subjectUri + " and property " + propertyUri);
|
||||
} finally {
|
||||
if (qe != null) {
|
||||
qe.close();
|
||||
}
|
||||
dataset.getLock().leaveCriticalSection();
|
||||
w.close();
|
||||
}
|
||||
} else {
|
||||
constructedModel.read(
|
||||
rdfService.sparqlConstructQuery(
|
||||
queryString, RDFService.ModelSerializationFormat.N3), null, "N3");
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error getting constructed model for subject " + subjectUri + " and property " + propertyUri);
|
||||
}
|
||||
|
|
|
@ -508,7 +508,12 @@ private String getExistingCustomTemplateQuery() {
|
|||
data.put("title", "Add Menu Item");
|
||||
data.put("menuAction", "Add");
|
||||
data.put("selectedTemplateType", "default");
|
||||
//defaults to regular class group page
|
||||
//Check for parameter specifying that this is a new menu page, in which case
|
||||
//menu item should be selected
|
||||
String menuItemParam = vreq.getParameter("addMenuItem");
|
||||
if(menuItemParam != null) {
|
||||
data.put("addMenuItem", menuItemParam);
|
||||
}
|
||||
}
|
||||
|
||||
//N3 strings
|
||||
|
|
|
@ -34,6 +34,12 @@ var pageManagementUtils = {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
isAddMenuItem:function() {
|
||||
if(pageManagementUtils.addMenuItem != null && pageManagementUtils.addMenuItem == "true") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
initExistingContent:function() {
|
||||
this.generateExistingContentSections();
|
||||
//display more content button - will need to review how to hit save etc.
|
||||
|
@ -135,7 +141,7 @@ var pageManagementUtils = {
|
|||
// tlw72 this.moreContentButton.hide();
|
||||
//left side components
|
||||
//These depend on whether or not this is an existing item or not
|
||||
if(this.isAdd()) {
|
||||
if(this.isAdd() && !this.isAddMenuItem()) {
|
||||
this.defaultTemplateRadio.attr('checked',true);
|
||||
this.isMenuCheckbox.attr('checked',false);
|
||||
this.menuSection.hide();
|
||||
|
@ -345,6 +351,8 @@ var pageManagementUtils = {
|
|||
if($.isFunction(dataGetterProcessorObj.bindEventHandlers)) {
|
||||
dataGetterProcessorObj.bindEventHandlers($newContentObj);
|
||||
}
|
||||
//Bind done event as the done button is within the cloned content
|
||||
pageManagementUtils.bindClonedContentDoneEvent($newContentObj);
|
||||
},
|
||||
createClonedContentContainer:function($newContentObj, counter, contentTypeLabel, varOrClass) {
|
||||
//Create the container for the new content
|
||||
|
@ -367,6 +375,17 @@ var pageManagementUtils = {
|
|||
//place new content object
|
||||
$newContentObj.prependTo($innerDiv);
|
||||
},
|
||||
bindClonedContentDoneEvent:function($newContentObj) {
|
||||
//Done button should just collapse the cloned content
|
||||
$newContentObj.find("input[name='doneWithContent']").click(function() {
|
||||
var thisInnerDiv = $(this).closest("div.pageContentWrapper");
|
||||
thisInnerDiv.slideUp(222);
|
||||
var thisClickableSpan = $(this).closest("span.pageContentExpand");
|
||||
var thisArrowDiv = thisClickableSpan.find('div.arrow');
|
||||
thisArrowDiv.removeClass("collapseArrow");
|
||||
thisArrowDiv.addClass("expandArrow");
|
||||
});
|
||||
},
|
||||
bindClonedContentContainerEvents:function($newDivContainer, counter) {
|
||||
var $clickableSpan = $newDivContainer.children('span#clickable' + counter);
|
||||
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
|
||||
|
@ -389,10 +408,11 @@ var pageManagementUtils = {
|
|||
}
|
||||
window.setTimeout('pageManagementUtils.adjustSaveButtonHeight()', 223);
|
||||
});
|
||||
|
||||
//remove button
|
||||
$newRemoveLink = $innerDiv.find('a#remove' + counter); // tlw72 changed button to link
|
||||
//remove the content entirely
|
||||
$newRemoveLink.click(function() {
|
||||
$newRemoveLink.click(function(event) {
|
||||
//if content type of what is being deleted is browse class group, then
|
||||
//add browse classgroup back to set of options
|
||||
var contentType = $innerDiv.find("section.pageContent").attr("contentType");
|
||||
|
@ -402,6 +422,8 @@ var pageManagementUtils = {
|
|||
//remove the section
|
||||
$innerDiv.parent("div").remove();
|
||||
pageManagementUtils.adjustSaveButtonHeight();
|
||||
//Because this is now a link, have to prevent default action of navigating to link
|
||||
event.preventDefault();
|
||||
});
|
||||
},
|
||||
resetClassGroupSection:function() {
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
var menuItemData = [];
|
||||
</script>
|
||||
|
||||
<h3>Menu management</h3>
|
||||
<h3>Menu Ordering</h3>
|
||||
|
||||
<#-- List the menu items -->
|
||||
<ul class="menuItems">
|
||||
<#list hasElement.statements as statement>
|
||||
<li class="menuItem"><#include "${hasElement.template}"> <span class="controls"><@p.editingLinks "hasElement" statement editable /></span></li>
|
||||
<li class="menuItem"><#include "${hasElement.template}"> <span class="controls"><!--p.editingLinks "hasElement" statement editable /--></span></li>
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
|||
<input type="hidden" name="typeOfNew" value="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page">
|
||||
<input type="hidden" name="switchToDisplayModel" value="1">
|
||||
<input type="hidden" name="editForm" value="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManagePageGenerator" role="input">
|
||||
<input type="hidden" name="addMenuItem" value="true" />
|
||||
<input id="submit" value="Add new menu page" role="button" type="submit" >
|
||||
|
||||
</form>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</#if>
|
||||
|
||||
<#if siteConfig.menuManagement?has_content>
|
||||
<li role="listitem"><a href="${siteConfig.menuManagement}" title="Menu management">Menu management</a></li>
|
||||
<li role="listitem"><a href="${siteConfig.menuManagement}" title="Menu ordering">Menu ordering</a></li>
|
||||
</#if>
|
||||
|
||||
<#if siteConfig.restrictLogins?has_content>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
</li>
|
||||
</#list>
|
||||
</ul><br />
|
||||
<input type="button" id="doneWithContent" class="doneWithContent" name="moreContent" value="Done" />
|
||||
<input type="button" id="doneWithContent" class="doneWithContent" name="doneWithContent" value="Done" />
|
||||
</section>
|
||||
</section>
|
||||
<#--Include JavaScript specific to the types of data getters related to this content-->
|
||||
|
|
|
@ -6,6 +6,7 @@ scripts list.-->
|
|||
<script type="text/javascript">
|
||||
var customFormData = {
|
||||
menuAction:"${menuAction}",
|
||||
addMenuItem:"${addMenuItem}",
|
||||
dataGetterLabelToURI:{
|
||||
//maps labels to URIs
|
||||
"browseClassGroup": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData",
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
<input type="text" name="saveToVar" size="20" value="" id="fixedHTMLSaveToVar" role="input" />
|
||||
<label id="fixedHTMLValueLabel" for="fixedHTMLValue">Enter fixed HTML here<span id="fixedHTMLValueSpan"></span><span class="requiredHint"> *</span></label>
|
||||
<textarea id="fixedHTMLValue" name="htmlValue" cols="70" rows="15" style="margin-bottom:7px"></textarea><br />
|
||||
<input type="button" id="doneWithContent" name="moreContent" value="Done" class="doneWithContent" />
|
||||
<input type="button" id="doneWithContent" name="doneWithContent" value="Done" class="doneWithContent" />
|
||||
</section>
|
||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processFixedHTMLDataGetterContent.js"></script>')}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
<input type="text" name="queryModel" size="20" value="" id="queryModel" role="input" style="display:none"/>
|
||||
<label id="queryLabel" for="queryLabel"><span id="querySpan">Enter SPARQL query here</span><span class="requiredHint"> *</span></label>
|
||||
<textarea id="query" name="query" cols="70" rows="15" style="margin-bottom:7px"></textarea><br />
|
||||
<input type="button" id="doneWithContent" class="doneWithContent" name="moreContent" value="Done" />
|
||||
<input type="button" id="doneWithContent" class="doneWithContent" name="doneWithContent" value="Done" />
|
||||
</section>
|
||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processSparqlDataGetterContent.js"></script>')}
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
<#assign menuItem = ""/>
|
||||
<#assign menuLinkText = "" />
|
||||
<#assign menuPosition = pageData.highestMenuPosition />
|
||||
<#assign addMenuItem = "" />
|
||||
<#if pageData.addMenuItem?has_content>
|
||||
<#assign addMenuItem = pageData.addMenuItem />
|
||||
</#if>
|
||||
<#--Existing Values For Editing condition-->
|
||||
<#assign literalValues = editConfiguration.existingLiteralValues />
|
||||
<#assign uriValues = editConfiguration.existingUriValues />
|
||||
|
@ -84,11 +88,11 @@
|
|||
<input type="text" name="customTemplate" value="${customTemplate!''}" size="40" role="input" /><span class="requiredHint"> *</span>
|
||||
</section>
|
||||
<p id="checkboxPTag"><input id="menuCheckbox" type="checkbox" name="menuCheckbox"
|
||||
<#if menuAction="Edit" && menuItem?has_content>checked="checked"</#if>
|
||||
<#if (menuAction="Edit" && menuItem?has_content) || (menuAction="Add" && addMenuItem = "true")>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 = "")) >
|
||||
<#if (menuAction = "Add" && addMenuItem != "true") || (menuAction="Edit" && (!menuItem?has_content || menuItem = "")) >
|
||||
class="hideMenuSection"
|
||||
<#else>
|
||||
class="showMenuSection"
|
||||
|
|
Loading…
Add table
Reference in a new issue