updates for page management
This commit is contained in:
parent
7808d72eec
commit
9ca30d634a
8 changed files with 114 additions and 58 deletions
|
@ -40,7 +40,6 @@ public class ProcessSparqlDataGetterN3 extends ProcessDataGetterAbstract {
|
||||||
public List<String> retrieveN3Required(int counter) {
|
public List<String> retrieveN3Required(int counter) {
|
||||||
String dataGetterVar = getDataGetterVar(counter);
|
String dataGetterVar = getDataGetterVar(counter);
|
||||||
String n3 = dataGetterVar + " a <" + classType + ">; \n" +
|
String n3 = dataGetterVar + " a <" + classType + ">; \n" +
|
||||||
"display:queryModel " + getN3VarName("queryModel", counter) + "; \n" +
|
|
||||||
"display:saveToVar " + getN3VarName("saveToVar", counter) + "; \n" +
|
"display:saveToVar " + getN3VarName("saveToVar", counter) + "; \n" +
|
||||||
"display:query " + getN3VarName("query", counter) + " .";
|
"display:query " + getN3VarName("query", counter) + " .";
|
||||||
List<String> requiredList = new ArrayList<String>();
|
List<String> requiredList = new ArrayList<String>();
|
||||||
|
@ -48,8 +47,13 @@ public class ProcessSparqlDataGetterN3 extends ProcessDataGetterAbstract {
|
||||||
return requiredList;
|
return requiredList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//Query model is optional
|
||||||
public List<String> retrieveN3Optional(int counter) {
|
public List<String> retrieveN3Optional(int counter) {
|
||||||
return null;
|
String dataGetterVar = getDataGetterVar(counter);
|
||||||
|
String n3 = dataGetterVar + " display:queryModel " + getN3VarName("queryModel", counter) + ". ";
|
||||||
|
List<String> optionalList = new ArrayList<String>();
|
||||||
|
optionalList.add(getPrefixes() + n3);
|
||||||
|
return optionalList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,8 @@ public class SparqlQueryDataGetter extends DataGetterBase implements DataGetter{
|
||||||
|
|
||||||
//put results in page data, what key to use for results?
|
//put results in page data, what key to use for results?
|
||||||
Map<String, Object> rmap = new HashMap<String,Object>();
|
Map<String, Object> rmap = new HashMap<String,Object>();
|
||||||
|
//also store the variable name within which results will be returned
|
||||||
|
rmap.put("variableName", this.saveToVar);
|
||||||
rmap.put(this.saveToVar, results);
|
rmap.put(this.saveToVar, results);
|
||||||
//This will be overridden at page level in display model if template specified there
|
//This will be overridden at page level in display model if template specified there
|
||||||
rmap.put("bodyTemplate", defaultTemplate);
|
rmap.put("bodyTemplate", defaultTemplate);
|
||||||
|
|
|
@ -27,7 +27,8 @@ display:Home
|
||||||
a display:Page ;
|
a display:Page ;
|
||||||
display:title "Home" ;
|
display:title "Home" ;
|
||||||
display:urlMapping "/" ;
|
display:urlMapping "/" ;
|
||||||
display:hasDataGetter display:homeDataGetter .
|
display:hasDataGetter display:homeDataGetter;
|
||||||
|
display:cannotDeletePage "true" .
|
||||||
|
|
||||||
########## Data Getter ############
|
########## Data Getter ############
|
||||||
|
|
||||||
|
@ -40,7 +41,8 @@ display:pageListPage
|
||||||
display:title "Pages" ;
|
display:title "Pages" ;
|
||||||
display:urlMapping "/pageList" ;
|
display:urlMapping "/pageList" ;
|
||||||
display:requiresBodyTemplate "pageList.ftl" ;
|
display:requiresBodyTemplate "pageList.ftl" ;
|
||||||
display:hasDataGetter display:pageListData .
|
display:hasDataGetter display:pageListData;
|
||||||
|
display:cannotDeletePage "true" .
|
||||||
|
|
||||||
display:pageListData
|
display:pageListData
|
||||||
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter>;
|
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter>;
|
||||||
|
@ -50,13 +52,14 @@ display:pageListData
|
||||||
display:query """
|
display:query """
|
||||||
PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#>
|
PREFIX display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#>
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
SELECT ?listedPageUri ?listedPageTitle ?listedPageUrlMapping ?listedPageTemplate ?listedPageMenuItem
|
SELECT ?listedPageUri ?listedPageTitle ?listedPageUrlMapping ?listedPageTemplate ?listedPageMenuItem ?listedPageCannotDeletePage
|
||||||
WHERE {
|
WHERE {
|
||||||
?listedPageUri a display:Page .
|
?listedPageUri a display:Page .
|
||||||
OPTIONAL{ ?listedPageUri display:urlMapping ?listedPageUrlMapping. }
|
OPTIONAL{ ?listedPageUri display:urlMapping ?listedPageUrlMapping. }
|
||||||
OPTIONAL{ ?listedPageUri display:title ?listedPageTitle. }
|
OPTIONAL{ ?listedPageUri display:title ?listedPageTitle. }
|
||||||
OPTIONAL {?listedPageUri display:requiresBodyTemplate ?listedPageTemplate .}
|
OPTIONAL {?listedPageUri display:requiresBodyTemplate ?listedPageTemplate .}
|
||||||
OPTIONAL {?listedPageMenuItem display:toPage ?listedPageUri .}
|
OPTIONAL {?listedPageMenuItem display:toPage ?listedPageUri .}
|
||||||
|
OPTIONAL {?listedPageUri display:cannotDeletePage ?listedPageCannotDeletePage .}
|
||||||
} """ .
|
} """ .
|
||||||
###Page Management and Data Getters
|
###Page Management and Data Getters
|
||||||
#Data getter type labels
|
#Data getter type labels
|
||||||
|
|
|
@ -117,6 +117,9 @@ owl:versionInfo
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#htmlValue>
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#htmlValue>
|
||||||
a owl:DatatypeProperty.
|
a owl:DatatypeProperty.
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#cannotDeletePage>
|
||||||
|
a owl:DatatypeProperty.
|
||||||
|
|
||||||
######### Object Properties#########
|
######### Object Properties#########
|
||||||
###Basic
|
###Basic
|
||||||
rdfs:range
|
rdfs:range
|
||||||
|
|
|
@ -116,7 +116,9 @@ var pageManagementUtils = {
|
||||||
this.menuSection = $("section#menu");
|
this.menuSection = $("section#menu");
|
||||||
this.submitButton = $("input#submit");
|
this.submitButton = $("input#submit");
|
||||||
this.leftSideDiv = $("div#leftSide");
|
this.leftSideDiv = $("div#leftSide");
|
||||||
this.rightSideDiv = $("div#rightSide")
|
this.rightSideDiv = $("div#rightSide");
|
||||||
|
//contentDivs container where content added/existing placed
|
||||||
|
this.savedContentDivs = $("section#contentDivs");
|
||||||
},
|
},
|
||||||
initDisplay: function(){
|
initDisplay: function(){
|
||||||
//right side components
|
//right side components
|
||||||
|
@ -191,7 +193,12 @@ var pageManagementUtils = {
|
||||||
pageManagementUtils.resetClassGroupSection();
|
pageManagementUtils.resetClassGroupSection();
|
||||||
//Clear all inputs values
|
//Clear all inputs values
|
||||||
pageManagementUtils.clearSourceTemplateValues();
|
pageManagementUtils.clearSourceTemplateValues();
|
||||||
|
//If adding browse classgroup, need to remove the classgroup option from the dropdown
|
||||||
|
if(selectedType == "browseClassGroup") {
|
||||||
|
pageManagementUtils.handleAddBrowseClassGroupPageContent();
|
||||||
|
}
|
||||||
pageManagementUtils.contentTypeSelect.focus();
|
pageManagementUtils.contentTypeSelect.focus();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//replacing with menu management edit version which is extended with some of the logic below
|
//replacing with menu management edit version which is extended with some of the logic below
|
||||||
|
@ -200,6 +207,29 @@ var pageManagementUtils = {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.contentTypeSelect.change( function() {
|
this.contentTypeSelect.change( function() {
|
||||||
|
pageManagementUtils.handleContentTypeSelect();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Submission: validate as well as create appropriate hidden json inputs
|
||||||
|
$("form").submit(function (event) {
|
||||||
|
var validationError = pageManagementUtils.validateMenuItemForm();
|
||||||
|
if (validationError == "") {
|
||||||
|
//Create the appropriate json objects
|
||||||
|
pageManagementUtils.createPageContentForSubmission();
|
||||||
|
return true;
|
||||||
|
} else{
|
||||||
|
|
||||||
|
$('#error-alert').removeClass('hidden');
|
||||||
|
$('#error-alert p').html(validationError);
|
||||||
|
$.scrollTo({ top:0, left:0}, 500)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
//Select content type
|
||||||
|
handleContentTypeSelect:function() {
|
||||||
_this = pageManagementUtils;
|
_this = pageManagementUtils;
|
||||||
pageManagementUtils.clearSourceTemplateValues();
|
pageManagementUtils.clearSourceTemplateValues();
|
||||||
if ( _this.contentTypeSelect.val() == "browseClassGroup" ) {
|
if ( _this.contentTypeSelect.val() == "browseClassGroup" ) {
|
||||||
|
@ -212,7 +242,7 @@ var pageManagementUtils = {
|
||||||
}
|
}
|
||||||
if ( _this.contentTypeSelect.val() == "fixedHtml" || _this.contentTypeSelect.val() == "sparqlQuery" ) {
|
if ( _this.contentTypeSelect.val() == "fixedHtml" || _this.contentTypeSelect.val() == "sparqlQuery" ) {
|
||||||
pageManagementUtils.classGroupSection.hide();
|
pageManagementUtils.classGroupSection.hide();
|
||||||
//if fixed html show that, otherwise show sparq
|
//if fixed html show that, otherwise show sparql results
|
||||||
if ( _this.contentTypeSelect.val() == "fixedHtml" ) {
|
if ( _this.contentTypeSelect.val() == "fixedHtml" ) {
|
||||||
pageManagementUtils.headerBar.text("Fixed HTML - ");
|
pageManagementUtils.headerBar.text("Fixed HTML - ");
|
||||||
pageManagementUtils.fixedHTMLSection.show();
|
pageManagementUtils.fixedHTMLSection.show();
|
||||||
|
@ -225,7 +255,6 @@ var pageManagementUtils = {
|
||||||
}
|
}
|
||||||
|
|
||||||
pageManagementUtils.headerBar.show();
|
pageManagementUtils.headerBar.show();
|
||||||
//$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
|
||||||
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
||||||
pageManagementUtils.moreContentButton.show();
|
pageManagementUtils.moreContentButton.show();
|
||||||
}
|
}
|
||||||
|
@ -233,39 +262,23 @@ var pageManagementUtils = {
|
||||||
pageManagementUtils.classGroupSection.hide();
|
pageManagementUtils.classGroupSection.hide();
|
||||||
pageManagementUtils.fixedHTMLSection.hide();
|
pageManagementUtils.fixedHTMLSection.hide();
|
||||||
pageManagementUtils.sparqlQuerySection.hide();
|
pageManagementUtils.sparqlQuerySection.hide();
|
||||||
|
|
||||||
pageManagementUtils.moreContentButton.hide();
|
pageManagementUtils.moreContentButton.hide();
|
||||||
|
|
||||||
//$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
|
||||||
|
|
||||||
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
pageManagementUtils.classesForClassGroup.addClass('hidden');
|
||||||
pageManagementUtils.headerBar.hide();
|
pageManagementUtils.headerBar.hide();
|
||||||
pageManagementUtils.headerBar.text("");
|
pageManagementUtils.headerBar.text("");
|
||||||
}
|
}
|
||||||
|
//Collapse any divs for existing content if it exists
|
||||||
|
pageManagementUtils.collapseAllExistingContent();
|
||||||
|
//adjust save button height
|
||||||
pageManagementUtils.adjustSaveButtonHeight();
|
pageManagementUtils.adjustSaveButtonHeight();
|
||||||
});
|
},
|
||||||
|
collapseAllExistingContent:function() {
|
||||||
|
var $clickableSpan = $newDivContainer.children('span#clickable' + counter);
|
||||||
//Submission: validate as well as create appropriate hidden json inputs
|
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
|
||||||
$("form").submit(function (event) {
|
var spanArrows = pageManagementUtils.savedContentDivs.find("span.pageContentExpand div.arrow");
|
||||||
var validationError = pageManagementUtils.validateMenuItemForm();
|
spanArrows.removeClass("collapseArrow");
|
||||||
if (validationError == "") {
|
spanArrows.addClass("expandArrow");
|
||||||
//Create the appropriate json objects
|
pageManagementUtils.savedContentDivs.find("div.pageContentContainer div.pageContentWrapper").slideUp(222);
|
||||||
pageManagementUtils.createPageContentForSubmission();
|
|
||||||
//return true;
|
|
||||||
//For testing, not submitting anything
|
|
||||||
//event.preventDefault();
|
|
||||||
return true;
|
|
||||||
} else{
|
|
||||||
|
|
||||||
$('#error-alert').removeClass('hidden');
|
|
||||||
$('#error-alert p').html(validationError);
|
|
||||||
//TODO: Check why scrolling appears to be a problem
|
|
||||||
$.scrollTo({ top:0, left:0}, 500)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
//Clear values in content areas that are cloned to create the page content type specific sections
|
//Clear values in content areas that are cloned to create the page content type specific sections
|
||||||
//i.e. reset sparql query/class group areas
|
//i.e. reset sparql query/class group areas
|
||||||
|
@ -373,9 +386,15 @@ var pageManagementUtils = {
|
||||||
});
|
});
|
||||||
//remove button
|
//remove button
|
||||||
$newRemoveButton = $innerDiv.find('input#remove' + counter);
|
$newRemoveButton = $innerDiv.find('input#remove' + counter);
|
||||||
// this will have to disable submitted fields as well as hide them.
|
//remove the content entirely
|
||||||
$newRemoveButton.click(function() {
|
$newRemoveButton.click(function() {
|
||||||
//$innerDiv.parent("div").css("display","none");
|
//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");
|
||||||
|
if(pageManagementUtils.processDataGetterUtils.isRelatedToBrowseClassGroup(contentType)) {
|
||||||
|
pageManagementUtils.handleRemoveBrowseClassGroupPageContent();
|
||||||
|
}
|
||||||
|
//remove the section
|
||||||
$innerDiv.parent("div").remove();
|
$innerDiv.parent("div").remove();
|
||||||
pageManagementUtils.adjustSaveButtonHeight();
|
pageManagementUtils.adjustSaveButtonHeight();
|
||||||
});
|
});
|
||||||
|
@ -625,6 +644,10 @@ var pageManagementUtils = {
|
||||||
dataGetterProcessorObject.populatePageContentSection(JSONContentObject, $newContentObj);
|
dataGetterProcessorObject.populatePageContentSection(JSONContentObject, $newContentObj);
|
||||||
//Also include a hidden input with data getter URI
|
//Also include a hidden input with data getter URI
|
||||||
pageManagementUtils.includeDataGetterURI(JSONContentObject, $newContentObj);
|
pageManagementUtils.includeDataGetterURI(JSONContentObject, $newContentObj);
|
||||||
|
//If content type is browseClassGroup or other 'related types' that are derived from it
|
||||||
|
if(pageManagementUtils.processDataGetterUtils.isRelatedToBrowseClassGroup(contentType)) {
|
||||||
|
pageManagementUtils.handleAddBrowseClassGroupPageContent();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//error condition
|
//error condition
|
||||||
}
|
}
|
||||||
|
@ -648,6 +671,19 @@ var pageManagementUtils = {
|
||||||
dataGetterProcessor = pageManagementUtils.dataGetterProcessorMap[dataGetterType];
|
dataGetterProcessor = pageManagementUtils.dataGetterProcessorMap[dataGetterType];
|
||||||
}
|
}
|
||||||
return dataGetterProcessor;
|
return dataGetterProcessor;
|
||||||
|
},
|
||||||
|
handleAddBrowseClassGroupPageContent:function() {
|
||||||
|
//if browse class group content has been added, then remove browse classgroup option from dropdown
|
||||||
|
if(pageManagementUtils.contentTypeSelect.find("option[value='browseClassGroup']").length > 0) {
|
||||||
|
pageManagementUtils.contentTypeSelect.find("option[value='browseClassGroup']").remove();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemoveBrowseClassGroupPageContent:function() {
|
||||||
|
if(pageManagementUtils.contentTypeSelect.find("option[value='browseClassGroup']").length == 0) {
|
||||||
|
//if removed, add browse class group back
|
||||||
|
var classGroupOption = '<option value="browseClassGroup">Browse Class Group</option>';
|
||||||
|
pageManagementUtils.contentTypeSelect.find('option:eq(0)').after(classGroupGroupOption);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,5 +25,8 @@ var processDataGetterUtils = {
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentType;
|
return contentType;
|
||||||
|
},
|
||||||
|
isRelatedToBrowseClassGroup:function(contentType) {
|
||||||
|
return (contentType == "browseClassGroup" || contentType == "individualsForClasses");
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
<#--Save to variable is sparqlResults -->
|
<#--Save to variable is sparqlResults -->
|
||||||
<#assign resultsExist = false/>
|
<#assign resultsExist = false/>
|
||||||
<#if sparqlResults?has_content>
|
<#if variableName?has_content>
|
||||||
<#assign resultsExist = true/>
|
<#assign resultsExist = true/>
|
||||||
|
<#--This will retrieve the results stored in the variable name being returned from the sparql query.
|
||||||
|
For example, if "results" was specified as the variable storing the sparql results, the value
|
||||||
|
of "results" will not be assigned to "sparqlResults" below. -->
|
||||||
|
<#assign sparqlResults = .globals[variableName]/>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<h3>Sparql Query Results</h3>
|
<h3>Sparql Query Results</h3>
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
<label id="variableLabel" for="variable">Variable Name<span class="requiredHint"> *</span></label>
|
<label id="variableLabel" for="variable">Variable Name<span class="requiredHint"> *</span></label>
|
||||||
<input type="text" name="saveToVar" size="20" value="" id="saveToVar" role="input" />
|
<input type="text" name="saveToVar" size="20" value="" id="saveToVar" role="input" />
|
||||||
<label id="queryModelLabel" for="queryModel">Query Model</label>
|
<label id="queryModelLabel" for="queryModel">Query Model</label>
|
||||||
<input type="text" name="queryModel" size="20" value="" id="queryModel" role="input" />
|
<#--Hiding query model for now-->
|
||||||
|
<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>
|
<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>
|
<textarea id="query" name="query" cols="70" rows="15" style="margin-bottom:7px"></textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue