updates for page management - code.
This commit is contained in:
parent
4a9f6a6f28
commit
3646a214a5
12 changed files with 450 additions and 177 deletions
|
@ -190,8 +190,10 @@ public class ManagePageGenerator extends BaseEditConfigurationGenerator implemen
|
||||||
//In the case where this is a new page, need to ensure page gets a new
|
//In the case where this is a new page, need to ensure page gets a new
|
||||||
private void setNewResources(EditConfigurationVTwo conf) {
|
private void setNewResources(EditConfigurationVTwo conf) {
|
||||||
//null makes default namespace be triggered
|
//null makes default namespace be triggered
|
||||||
conf.addNewResource("page", defaultDisplayNs);
|
//conf.addNewResource("page", defaultDisplayNs);
|
||||||
conf.addNewResource("menuItem", defaultDisplayNs);
|
//conf.addNewResource("menuItem", defaultDisplayNs);
|
||||||
|
conf.addNewResource("page", null);
|
||||||
|
conf.addNewResource("menuItem", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,13 @@ public class ManagePagePreprocessor extends
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
List<String> newResources = pn.getNewResources(counter);
|
List<String> newResources = pn.getNewResources(counter);
|
||||||
for(String newResource:newResources) {
|
for(String newResource:newResources) {
|
||||||
editConfiguration.addNewResource(newResource, ManagePageGenerator.defaultDisplayNs);
|
//Will null get us display vocabulary or something else?
|
||||||
|
|
||||||
|
editConfiguration.addNewResource(newResource, null);
|
||||||
|
//Weirdly enough, the defaultDisplayNS doesn't act as a namespace REALLY
|
||||||
|
//as it first gets assigned as the URI itself and this lead to an error
|
||||||
|
//instead of repetitively trying to get another URI
|
||||||
|
//editConfiguration.addNewResource(newResource, ManagePageGenerator.defaultDisplayNs );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||||
|
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
import net.sf.json.JSONSerializer;
|
||||||
|
//Returns the appropriate n3 based on data getter
|
||||||
|
public class ProcessClassGroupDataGetterN3 extends ProcessDataGetterAbstract {
|
||||||
|
private static String classType = "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupDataGetter";
|
||||||
|
|
||||||
|
public ProcessClassGroupDataGetterN3(){
|
||||||
|
|
||||||
|
}
|
||||||
|
//Pass in variable that represents the counter
|
||||||
|
|
||||||
|
//TODO: ensure correct model returned
|
||||||
|
//We shouldn't use the ACTUAL values here but generate the n3 required
|
||||||
|
public List<String> retrieveN3Required(int counter) {
|
||||||
|
String dataGetterVar = getDataGetterVar(counter);
|
||||||
|
String n3 = dataGetterVar + " a <" + classType + ">; \n" +
|
||||||
|
"<" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup .";
|
||||||
|
List<String> requiredList = new ArrayList<String>();
|
||||||
|
requiredList.add(getPrefixes() + n3);
|
||||||
|
return requiredList;
|
||||||
|
|
||||||
|
}
|
||||||
|
public List<String> retrieveN3Optional(int counter) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//These methods will return the literals and uris expected within the n3
|
||||||
|
//and the counter is used to ensure they are numbered correctly
|
||||||
|
|
||||||
|
public List<String> retrieveLiteralsOnForm(int counter) {
|
||||||
|
//no literals, just the class group URI
|
||||||
|
List<String> literalsOnForm = new ArrayList<String>();
|
||||||
|
return literalsOnForm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> retrieveUrisOnForm(int counter) {
|
||||||
|
List<String> urisOnForm = new ArrayList<String>();
|
||||||
|
//Class group is a URI
|
||||||
|
urisOnForm.add(getVarName("classGroup", counter));
|
||||||
|
return urisOnForm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FieldVTwo> retrieveFields(int counter) {
|
||||||
|
List<FieldVTwo> fields = new ArrayList<FieldVTwo>();
|
||||||
|
fields.add(new FieldVTwo().setName(getVarName("classGroup", counter)));
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
//These var names match the names of the elements within the json object returned with the info required for the data getter
|
||||||
|
|
||||||
|
public List<String> getLiteralVarNamesBase() {
|
||||||
|
return Arrays.asList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//these are for the fields ON the form
|
||||||
|
public List<String> getUriVarNamesBase() {
|
||||||
|
return Arrays.asList("classGroup");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||||
|
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
import net.sf.json.JSONSerializer;
|
||||||
|
//Returns the appropriate n3 based on data getter
|
||||||
|
public abstract class ProcessDataGetterAbstract implements ProcessDataGetterN3 {
|
||||||
|
|
||||||
|
public ProcessDataGetterAbstract(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//placeholder so need "?" in front of the variable
|
||||||
|
public String getDataGetterVar(int counter) {
|
||||||
|
return "?dataGetter" + counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrefixes() {
|
||||||
|
return "@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> . \n" +
|
||||||
|
"@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> . \n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVarName(String base, int counter) {
|
||||||
|
return base + counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
//For use within n3 strings, need a "?"
|
||||||
|
public String getN3VarName(String base, int counter) {
|
||||||
|
return "?" + getVarName(base, counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return name of new resources
|
||||||
|
public List<String> getNewResources(int counter) {
|
||||||
|
//Each data getter requires a new resource
|
||||||
|
List<String> newResources = new ArrayList<String>();
|
||||||
|
newResources.add("dataGetter" + counter);
|
||||||
|
return newResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import net.sf.json.JSONSerializer;
|
import net.sf.json.JSONSerializer;
|
||||||
//Returns the appropriate n3 based on data getter
|
//Returns the appropriate n3 based on data getter
|
||||||
public class ProcessSparqlDataGetterN3 implements ProcessDataGetterN3 {
|
public class ProcessSparqlDataGetterN3 extends ProcessDataGetterAbstract {
|
||||||
private static String classType = "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter";
|
private static String classType = "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter";
|
||||||
|
|
||||||
public ProcessSparqlDataGetterN3(){
|
public ProcessSparqlDataGetterN3(){
|
||||||
|
@ -39,15 +39,6 @@ public class ProcessSparqlDataGetterN3 implements ProcessDataGetterN3 {
|
||||||
public List<String> retrieveN3Optional(int counter) {
|
public List<String> retrieveN3Optional(int counter) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//placeholder so need "?" in front of the variable
|
|
||||||
public String getDataGetterVar(int counter) {
|
|
||||||
return "?dataGetter" + counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPrefixes() {
|
|
||||||
return "@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> . \n" +
|
|
||||||
"@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> . \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Need to add method sfor returning the fields, literals on form, and all that
|
//Need to add method sfor returning the fields, literals on form, and all that
|
||||||
|
@ -105,22 +96,7 @@ public class ProcessSparqlDataGetterN3 implements ProcessDataGetterN3 {
|
||||||
return Arrays.asList("queryModel");
|
return Arrays.asList("queryModel");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVarName(String base, int counter) {
|
|
||||||
return base + counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//For use within n3 strings, need a "?"
|
|
||||||
public String getN3VarName(String base, int counter) {
|
|
||||||
return "?" + getVarName(base, counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return name of new resources
|
|
||||||
public List<String> getNewResources(int counter) {
|
|
||||||
//Each data getter requires a new resource
|
|
||||||
List<String> newResources = new ArrayList<String>();
|
|
||||||
newResources.add("dataGetter" + counter);
|
|
||||||
return newResources;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,33 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
var pageManagementUtils = {
|
var pageManagementUtils = {
|
||||||
|
dataGetterLabelToURI:null,//initialized by custom data
|
||||||
|
processDataGetterUtils:processDataGetterUtils,//an external class that should exist before this one
|
||||||
// on initial page setup
|
// on initial page setup
|
||||||
onLoad:function(){
|
onLoad:function(){
|
||||||
if (this.disableFormInUnsupportedBrowsers()) {
|
if (this.disableFormInUnsupportedBrowsers()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.mixIn();
|
this.mixIn();
|
||||||
|
this.initDataGetterProcessors(),
|
||||||
this.initObjects();
|
this.initObjects();
|
||||||
this.bindEventListeners();
|
this.bindEventListeners();
|
||||||
this.initDisplay();
|
this.initDisplay();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
initDataGetterProcessors:function() {
|
||||||
|
//data getter processor map should come in from custom data
|
||||||
|
//Go through each and initialize with their class
|
||||||
|
|
||||||
|
if(pageManagementUtils.processDataGetterUtils != null) {
|
||||||
|
var dataGetterProcessorMap = pageManagementUtils.processDataGetterUtils.dataGetterProcessorMap;
|
||||||
|
$.each(dataGetterProcessorMap, function(key, dataGetterProcessorObject) {
|
||||||
|
//passes class name from data getter label to uri to processor
|
||||||
|
dataGetterProcessorObject.initProcessor(pageManagementUtils.dataGetterLabelToURI[key]);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
disableFormInUnsupportedBrowsers: function() {
|
disableFormInUnsupportedBrowsers: function() {
|
||||||
var disableWrapper = $('#ie67DisableWrapper');
|
var disableWrapper = $('#ie67DisableWrapper');
|
||||||
|
|
||||||
|
@ -28,6 +43,7 @@ var pageManagementUtils = {
|
||||||
},
|
},
|
||||||
|
|
||||||
mixIn: function() {
|
mixIn: function() {
|
||||||
|
//Data getter process list input should be retrieved from the custom data
|
||||||
// Mix in the custom form utility methods
|
// Mix in the custom form utility methods
|
||||||
$.extend(this, vitro.customFormUtils);
|
$.extend(this, vitro.customFormUtils);
|
||||||
// Get the custom form data from the page
|
// Get the custom form data from the page
|
||||||
|
@ -38,8 +54,9 @@ var pageManagementUtils = {
|
||||||
this.contentTypeSelect = $("#typeSelect");
|
this.contentTypeSelect = $("#typeSelect");
|
||||||
//list of options
|
//list of options
|
||||||
this.contentTypeSelectOptions = $('select#typeSelect option');
|
this.contentTypeSelectOptions = $('select#typeSelect option');
|
||||||
this.classGroupSection = $("section#classGroup");
|
this.classGroupSection = $("section#browseClassGroup");
|
||||||
this.nonClassGroupSection = $("section#nonClassGroup");
|
this.sparqlQuerySection = $("section#sparqlQuery");
|
||||||
|
this.fixedHTMLSection = $("section#fixedHtml");
|
||||||
//From original menu management edit
|
//From original menu management edit
|
||||||
this.defaultTemplateRadio = $('input.default-template');
|
this.defaultTemplateRadio = $('input.default-template');
|
||||||
this.customTemplateRadio = $('input.custom-template');
|
this.customTemplateRadio = $('input.custom-template');
|
||||||
|
@ -54,6 +71,13 @@ var pageManagementUtils = {
|
||||||
this.allClassesSelectedCheckbox = $('#allSelected');
|
this.allClassesSelectedCheckbox = $('#allSelected');
|
||||||
this.displayInternalMessage = $('#internal-class label em');
|
this.displayInternalMessage = $('#internal-class label em');
|
||||||
this.pageContentSubmissionInputs = $("#pageContentSubmissionInputs");
|
this.pageContentSubmissionInputs = $("#pageContentSubmissionInputs");
|
||||||
|
this.headerBar = $("section#headerBar");
|
||||||
|
this.moreContentButton = $("input#moreContent");
|
||||||
|
this.isMenuCheckbox = $("input#menuCheckbox");
|
||||||
|
this.menuSection = $("section#menu");
|
||||||
|
this.submitButton = $("input#submit");
|
||||||
|
this.leftSideDiv = $("div#leftSide");
|
||||||
|
this.rightSideDiv = $("div#ri;ghtSide")
|
||||||
},
|
},
|
||||||
initDisplay: function(){
|
initDisplay: function(){
|
||||||
//right side components
|
//right side components
|
||||||
|
@ -62,43 +86,45 @@ var pageManagementUtils = {
|
||||||
|
|
||||||
//Why would you want to hide this? This hides everything
|
//Why would you want to hide this? This hides everything
|
||||||
// $("section#pageDetails").hide();
|
// $("section#pageDetails").hide();
|
||||||
$("section#headerBar").hide();
|
this.headerBar.hide();
|
||||||
this.classGroupSection.hide();
|
this.classGroupSection.hide();
|
||||||
this.nonClassGroupSection.hide();
|
this.sparqlQuerySection.hide();
|
||||||
$("section#classesInSelectedGroup").addClass('hidden');
|
this.fixedHTMLSection.hide();
|
||||||
$("input#moreContent").hide();
|
this.classesForClassGroup.addClass('hidden');
|
||||||
|
this.moreContentButton.hide();
|
||||||
//left side components
|
//left side components
|
||||||
$("input.default-template").attr('checked',true);
|
this.defaultTemplateRadio.attr('checked',true);
|
||||||
$("input#menuCheckbox").attr('checked',false);
|
this.isMenuCheckbox.attr('checked',false);
|
||||||
$("section#menu").hide();
|
this.menuSection.hide();
|
||||||
|
|
||||||
},
|
},
|
||||||
bindEventListeners:function(){
|
bindEventListeners:function(){
|
||||||
$("input.default-template").click( function() {
|
|
||||||
$("section#custom-template").addClass('hidden');
|
this.defaultTemplateRadio.click( function() {
|
||||||
|
pageManagementUtils.customTemplateRadio.addClass('hidden');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input.custom-template").click( function() {
|
this.customTemplateRadio.click( function() {
|
||||||
$("section#custom-template").removeClass('hidden');
|
pageManagementUtils.defaultTemplateRadio.removeClass('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input#menuCheckbox").click( function() {
|
this.isMenuCheckbox.click( function() {
|
||||||
if ( $("section#menu").is(':hidden') ) {
|
if ( pageManagementUtils.menuSection.is(':hidden') ) {
|
||||||
$("section#menu").show();
|
pageManagementUtils.menuSection.show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("section#menu").hide();
|
pageManagementUtils.menuSection.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input#submit").click( function() {
|
this.submitButton.click( function() {
|
||||||
$("section#pageDetails").show();
|
$("section#pageDetails").show();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Collapses the current content and creates a new section of content
|
//Collapses the current content and creates a new section of content
|
||||||
//Resets the content to be cloned to default settings
|
//Resets the content to be cloned to default settings
|
||||||
$("input#moreContent").click( function() {
|
this.moreContentButton.click( function() {
|
||||||
var selectedType = pageManagementUtils.contentTypeSelect.val();
|
var selectedType = pageManagementUtils.contentTypeSelect.val();
|
||||||
var selectedTypeText = $("#typeSelect option:selected").text();
|
var selectedTypeText = $("#typeSelect option:selected").text();
|
||||||
//Not sure why selected group here? This won't always be true for more content
|
//Not sure why selected group here? This won't always be true for more content
|
||||||
|
@ -106,21 +132,22 @@ var pageManagementUtils = {
|
||||||
|
|
||||||
//Aren't these already hidden?
|
//Aren't these already hidden?
|
||||||
//Hide both sections
|
//Hide both sections
|
||||||
$("section#classGroup").hide();
|
pageManagementUtils.classGroupSection.hide();
|
||||||
$("section#nonClassGroup").hide();
|
pageManagementUtils.fixedHTMLSection.hide();
|
||||||
|
pageManagementUtils.sparqlQuerySection.hide();
|
||||||
|
|
||||||
//Reset class group
|
//Reset class group
|
||||||
pageManagementUtils.resetClassGroupSection();
|
pageManagementUtils.resetClassGroupSection();
|
||||||
pageManagementUtils.contentTypeSelectOptions.eq(0).attr('selected', 'selected');
|
pageManagementUtils.contentTypeSelectOptions.eq(0).attr('selected', 'selected');
|
||||||
$("input#moreContent").hide();
|
pageManagementUtils.moreContentButton.hide();
|
||||||
if ( $("div#leftSide").css("height") != undefined ) {
|
if ( pageManagementUtils.leftSideDiv.css("height") != undefined ) {
|
||||||
$("div#leftSide").css("height","");
|
pageManagementUtils.leftSideDiv.css("height","");
|
||||||
if ( $("div#leftSide").height() < $("div#rightSide").height() ) {
|
if ( pageManagementUtils.leftSideDiv.height() < pageManagementUtils.rightSideDiv.height() ) {
|
||||||
$("div#leftSide").css("height",$("div#rightSide").height() + "px");
|
pageManagementUtils.leftSideDiv.css("height",pageManagementUtils.rightSideDiv.height() + "px");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("section#headerBar").hide();
|
pageManagementUtils.headerBar.hide();
|
||||||
$("section#headerBar").text("");
|
pageManagementUtils.headerBar.text("");
|
||||||
//pageManagementUtils.cloneContentArea(selectedType,selectedGroup);
|
//pageManagementUtils.cloneContentArea(selectedType,selectedGroup);
|
||||||
pageManagementUtils.cloneContentArea(selectedType, selectedTypeText);
|
pageManagementUtils.cloneContentArea(selectedType, selectedTypeText);
|
||||||
pageManagementUtils.contentTypeSelect.focus();
|
pageManagementUtils.contentTypeSelect.focus();
|
||||||
|
@ -146,20 +173,22 @@ var pageManagementUtils = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
|
//TODO: These will all change
|
||||||
$("select#typeSelect").change( function() {
|
$("select#typeSelect").change( function() {
|
||||||
|
_this = pageManagementUtils;
|
||||||
$('input#variable').val("");
|
$('input#variable').val("");
|
||||||
$('textarea#textArea').val("");
|
$('textarea#textArea').val("");
|
||||||
if ( $("#typeSelect").val() == "browseClassGroup" ) {
|
if ( _this.contentTypeSelect.val() == "browseClassGroup" ) {
|
||||||
$("section#classGroup").show();
|
pageManagementUtils.classGroupSection.show();
|
||||||
$("section#nonClassGroup").hide();
|
pageManagementUtils.fixedHTMLSection.hide();
|
||||||
|
pageManagementUtils.sparqlQuerySection.hide();
|
||||||
$("input#moreContent").hide();
|
$("input#moreContent").hide();
|
||||||
$("section#headerBar").text("Browse Class Group - ");
|
$("section#headerBar").text("Browse Class Group - ");
|
||||||
$("section#headerBar").show();
|
$("section#headerBar").show();
|
||||||
}
|
}
|
||||||
if ( $("#typeSelect").val() == "fixedHtml" || $("#typeSelect").val() == "sparqlQuery" ) {
|
if ( _this.contentTypeSelect.val() == "fixedHtml" || _this.contentTypeSelect.val() == "sparqlQuery" ) {
|
||||||
$("section#classGroup").hide();
|
pageManagementUtils.classGroupSection.hide();
|
||||||
if ( $("#typeSelect").val() == "fixedHtml" ) {
|
if ( _this.contentTypeSelect.val() == "fixedHtml" ) {
|
||||||
$('span#taSpan').text("Enter fixed HTML here");
|
$('span#taSpan').text("Enter fixed HTML here");
|
||||||
$("section#headerBar").text("Fixed HTML - ");
|
$("section#headerBar").text("Fixed HTML - ");
|
||||||
}
|
}
|
||||||
|
@ -167,13 +196,20 @@ var pageManagementUtils = {
|
||||||
$('span#taSpan').text("Enter SPARQL query here");
|
$('span#taSpan').text("Enter SPARQL query here");
|
||||||
$("section#headerBar").text("SPARQL Query Results - ");
|
$("section#headerBar").text("SPARQL Query Results - ");
|
||||||
}
|
}
|
||||||
$("section#nonClassGroup").show();
|
//if fixhed html show that, otherwise show sparq
|
||||||
|
if(_this.contentTypeSelect.val() == "fixedHtml") {
|
||||||
|
pageManagementUtils.fixedHTMLSection.show();
|
||||||
|
pageManagementUtils.sparqlQuerySection.hide();
|
||||||
|
} else {
|
||||||
|
pageManagementUtils.sparqlQuerySection.show();
|
||||||
|
pageManagementUtils.fixedHTMLSection.hide();
|
||||||
|
}
|
||||||
$("section#headerBar").show();
|
$("section#headerBar").show();
|
||||||
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
||||||
$("section#classesInSelectedGroup").addClass('hidden');
|
$("section#classesInSelectedGroup").addClass('hidden');
|
||||||
$("input#moreContent").show();
|
$("input#moreContent").show();
|
||||||
}
|
}
|
||||||
if ( $("#typeSelect").val() == "" ) {
|
if ( _this.contentTypeSelect.val() == "" ) {
|
||||||
$("section#classGroup").hide();
|
$("section#classGroup").hide();
|
||||||
$("section#nonClassGroup").hide();
|
$("section#nonClassGroup").hide();
|
||||||
$("input#moreContent").hide();
|
$("input#moreContent").hide();
|
||||||
|
@ -199,8 +235,11 @@ var pageManagementUtils = {
|
||||||
if (validationError == "") {
|
if (validationError == "") {
|
||||||
//Create the appropriate json objects
|
//Create the appropriate json objects
|
||||||
pageManagementUtils.createPageContentForSubmission();
|
pageManagementUtils.createPageContentForSubmission();
|
||||||
return true;
|
//return true;
|
||||||
|
//For testing, not submitting anything
|
||||||
|
return false;
|
||||||
} else{
|
} else{
|
||||||
|
|
||||||
$('#error-alert').removeClass('hidden');
|
$('#error-alert').removeClass('hidden');
|
||||||
$('#error-alert p').html(validationError);
|
$('#error-alert p').html(validationError);
|
||||||
//TODO: Check why scrolling appears to be a problem
|
//TODO: Check why scrolling appears to be a problem
|
||||||
|
@ -214,64 +253,25 @@ var pageManagementUtils = {
|
||||||
cloneContentArea: function(contentType, contentTypeLabel) {
|
cloneContentArea: function(contentType, contentTypeLabel) {
|
||||||
var ctr = pageManagementUtils.counter;
|
var ctr = pageManagementUtils.counter;
|
||||||
var counter = pageManagementUtils.counter;
|
var counter = pageManagementUtils.counter;
|
||||||
var varOrClas;
|
var varOrClass;
|
||||||
|
|
||||||
|
//Clone the object, renaming ids and copying text area values as well
|
||||||
|
$newContentObj = pageManagementUtils.createCloneObject(contentType, counter);
|
||||||
|
|
||||||
if ( contentType == "fixedHTML" || contentType == "sparqlQuery") {
|
if ( contentType == "fixedHTML" || contentType == "sparqlQuery") {
|
||||||
var taValue = $('textarea#textArea').val();
|
varOrClass = $newContentObj.find('input#saveToVar').val();
|
||||||
alert("original text area value is " + taValue);
|
|
||||||
var $newContentObj = $('section#nonClassGroup').clone();
|
|
||||||
$newContentObj.addClass("pageContent");
|
|
||||||
varOrClass = $newContentObj.find('input').val();
|
|
||||||
$newContentObj.show();
|
|
||||||
//Save content type
|
|
||||||
$newContentObj.attr("contentType", contentType);
|
|
||||||
$newContentObj.attr("id", contentType + counter);
|
|
||||||
$newContentObj.find('input#variable').attr("id","variable" + counter);
|
|
||||||
$newContentObj.find('textarea#textArea').attr("id","textArea" + counter);
|
|
||||||
$newContentObj.find('label#variableLabel').attr("id","variableLabel" + counter);
|
|
||||||
$newContentObj.find('label#taLabel').attr("id","taLabel" + counter);
|
|
||||||
|
|
||||||
//Keep the name of the inputs the same
|
|
||||||
// $newContentObj.find('input#variable').attr("name","variable" + counter);
|
|
||||||
// $newContentObj.find('textarea#textArea').attr("name","textArea" + counter);
|
|
||||||
// There's a jquery bug when cloning textareas: the value doesn't
|
|
||||||
// get cloned. So
|
|
||||||
// copy the value "manually."
|
|
||||||
$newContentObj.find("textarea[name='textArea']").val(taValue);
|
|
||||||
}
|
}
|
||||||
else if ( contentType == "browseClassGroup" ) {
|
else if ( contentType == "browseClassGroup" ) {
|
||||||
|
|
||||||
var $newContentObj = $('section#classGroup').clone();
|
|
||||||
|
|
||||||
$newContentObj.addClass("pageContent");
|
|
||||||
$newContentObj.show();
|
|
||||||
$newContentObj.attr("contentType", contentType);
|
|
||||||
$newContentObj.attr("id", "classGroup" + counter);
|
|
||||||
$newContentObj.find('section#selectContentType').attr("id", "selectContentType" + counter);
|
|
||||||
$newContentObj.find('select#selectClassGroup').val(groupValue);
|
|
||||||
$newContentObj.find('select#selectClassGroup').attr("id","selectClassGroup" + counter);
|
|
||||||
$newContentObj.find('select#selectClassGroup' + counter).attr("name","selectClassGroup" + counter);
|
|
||||||
$newContentObj.find('section#classesInSelectedGroup').attr("id","classesInSelectedGroup" + counter);
|
|
||||||
$newContentObj.find('section#classesInSelectedGroup' + counter).removeClass('hidden');
|
$newContentObj.find('section#classesInSelectedGroup' + counter).removeClass('hidden');
|
||||||
$newContentObj.find('p#selectClassesMessage').attr("id","selectClassesMessage" + counter);
|
|
||||||
// Will need to uncomment this and find a way to apply the css style
|
|
||||||
// $newContentObj.find('section#internal-class').attr("id","internal-class" +
|
|
||||||
// counter);
|
|
||||||
$newContentObj.find("input[name='display-internalClass']").attr("name","display-internalClass" + counter);
|
|
||||||
$newContentObj.find('ul#selectedClasses').attr("id","selectedClasses" + counter);
|
|
||||||
$newContentObj.find('ul#selectedClasses' + counter).attr("name","selectedClasses" + counter);
|
|
||||||
|
|
||||||
$newContentObj.find('ul#selectedClasses' + counter).children("li").each( function(i,abc) {
|
|
||||||
var $theCheckbox = $(this).find('input');
|
|
||||||
$theCheckbox.attr("name", $theCheckbox.attr("name") + counter);
|
|
||||||
});
|
|
||||||
|
|
||||||
varOrClass = $newContentObj.find('select#selectClassGroup' + counter + ' option:selected').text();
|
varOrClass = $newContentObj.find('select#selectClassGroup' + counter + ' option:selected').text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pageManagementUtils.createClonedContentContainer($newContentObj, counter, contentTypeLabel, varOrClass);
|
||||||
|
//previously increased by 10, just increasing by 1 here
|
||||||
|
counter++;
|
||||||
|
},
|
||||||
|
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>", {
|
||||||
id: "divContainer" + counter,
|
id: "divContainer" + counter,
|
||||||
"class": "pageContentContainer",
|
"class": "pageContentContainer",
|
||||||
|
@ -281,9 +281,19 @@ var pageManagementUtils = {
|
||||||
+ "' class='pageContentWrapper'><input id='remove" + counter
|
+ "' class='pageContentWrapper'><input id='remove" + counter
|
||||||
+ "' type='button' class='delete' value='Delete' class='deleteButton' /></div>"
|
+ "' type='button' class='delete' value='Delete' class='deleteButton' /></div>"
|
||||||
});
|
});
|
||||||
var $clickableSpan = $newDivContainer.children('span#clickable' + counter);
|
//Hide inner div
|
||||||
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
|
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
|
||||||
$innerDiv.hide();
|
$innerDiv.hide();
|
||||||
|
//Bind event listers for the new content for display/removal etc.
|
||||||
|
pageManagementUtils.bindClonedContentContainerEvents($newDivContainer, counter);
|
||||||
|
//Append the new container to the section storing these containers
|
||||||
|
$newDivContainer.appendTo($('section#contentDivs'));
|
||||||
|
//place new content object
|
||||||
|
$newContentObj.prependTo($innerDiv);
|
||||||
|
},
|
||||||
|
bindClonedContentContainerEvents:function($newDivContainer, counter) {
|
||||||
|
var $clickableSpan = $newDivContainer.children('span#clickable' + counter);
|
||||||
|
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
|
||||||
//Expand/collapse toggle
|
//Expand/collapse toggle
|
||||||
$clickableSpan.click(function() {
|
$clickableSpan.click(function() {
|
||||||
if ( $innerDiv.is(':visible') ) {
|
if ( $innerDiv.is(':visible') ) {
|
||||||
|
@ -302,26 +312,17 @@ var pageManagementUtils = {
|
||||||
}
|
}
|
||||||
window.setTimeout('pageManagementUtils.adjustSaveButtonHeight()', 223);
|
window.setTimeout('pageManagementUtils.adjustSaveButtonHeight()', 223);
|
||||||
});
|
});
|
||||||
|
//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.
|
// this will have to disable submitted fields as well as hide them.
|
||||||
$newRemoveButton.click(function() {
|
$newRemoveButton.click(function() {
|
||||||
$innerDiv.parent("div").css("display","none");
|
$innerDiv.parent("div").css("display","none");
|
||||||
pageManagementUtils.adjustSaveButtonHeight();
|
pageManagementUtils.adjustSaveButtonHeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
$newDivContainer.appendTo($('section#contentDivs'));
|
|
||||||
$newContentObj.prependTo($innerDiv);
|
|
||||||
counter = counter + 10;
|
|
||||||
},
|
},
|
||||||
resetClassGroupSection:function() {
|
resetClassGroupSection:function() {
|
||||||
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
$('select#selectClassGroup option').eq(0).attr('selected', 'selected');
|
||||||
$("section#classesInSelectedGroup").addClass('hidden');
|
$("section#classesInSelectedGroup").addClass('hidden');
|
||||||
},
|
|
||||||
//finalize later, but basically use same attribute across page content and use attribute instead of id
|
|
||||||
//Attribute would be what keeps track of content, so contentCounter or something like that
|
|
||||||
toggleArrow:function() {
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
//Adjust save button height
|
//Adjust save button height
|
||||||
adjustSaveButtonHeight:function() {
|
adjustSaveButtonHeight:function() {
|
||||||
|
@ -345,7 +346,6 @@ var pageManagementUtils = {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//update existing content type with correct class group name and hide class group select again
|
//update existing content type with correct class group name and hide class group select again
|
||||||
var _this = pageManagementUtils;
|
|
||||||
// pageManagementUtils.hideClassGroups();
|
// pageManagementUtils.hideClassGroups();
|
||||||
|
|
||||||
pageManagementUtils.selectedGroupForPage.html(results.classGroupName);
|
pageManagementUtils.selectedGroupForPage.html(results.classGroupName);
|
||||||
|
@ -390,24 +390,6 @@ var pageManagementUtils = {
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
showClassGroups: function() { //User has clicked change content type
|
|
||||||
//Show the section with the class group dropdown
|
|
||||||
this.selectContentType.removeClass("hidden");
|
|
||||||
//Hide the "change content type" section which shows the selected class group
|
|
||||||
this.existingContentType.addClass("hidden");
|
|
||||||
//Hide the checkboxes for classes within the class group
|
|
||||||
this.classesForClassGroup.addClass("hidden");
|
|
||||||
},
|
|
||||||
hideClassGroups: function() { //User has selected class group/content type, page should show classes for class group and 'existing' type with change link
|
|
||||||
//Hide the class group dropdown
|
|
||||||
this.selectContentType.addClass("hidden");
|
|
||||||
//Show the "change content type" section which shows the selected class group
|
|
||||||
this.existingContentType.removeClass("hidden");
|
|
||||||
//Show the classes in the class group
|
|
||||||
this.classesForClassGroup.removeClass("hidden");
|
|
||||||
|
|
||||||
},*/
|
|
||||||
toggleClassSelection: function() {
|
toggleClassSelection: function() {
|
||||||
// Check/unckeck all classes for selection
|
// Check/unckeck all classes for selection
|
||||||
$('input:checkbox[name=allSelected]').click(function(){
|
$('input:checkbox[name=allSelected]').click(function(){
|
||||||
|
@ -482,29 +464,62 @@ var pageManagementUtils = {
|
||||||
//Create a new hidden input with a specific name and assign value per page content
|
//Create a new hidden input with a specific name and assign value per page content
|
||||||
pageManagementUtils.createPageContentInputForSubmission(jsonObjectString);
|
pageManagementUtils.createPageContentInputForSubmission(jsonObjectString);
|
||||||
});
|
});
|
||||||
//in this case it's a sparql data getter, but what about the others
|
|
||||||
/*
|
|
||||||
var len = pageContentSections.length;
|
|
||||||
var i;
|
|
||||||
for(i = 0; i < len; i++) {
|
|
||||||
var pageContentSection = $(pageContentSections[i]);
|
|
||||||
var pageContentSectionId = pageContentSection.attr("id");
|
|
||||||
var jsonObject = pageManagementUtils.processPageContentSection(pageContentSection);
|
|
||||||
var jsonObjectString = JSON.stringify(jsonObject);
|
|
||||||
//Create a new hidden input with a specific name and assign value per page content
|
|
||||||
pageManagementUtils.createPageContentInputForSubmission(jsonObjectString);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
},
|
},
|
||||||
createPageContentInputForSubmission: function(inputValue) {
|
createPageContentInputForSubmission: function(inputValue) {
|
||||||
$("<input type='hidden' name='pageContentUnit' value='" + inputValue + "'>").appendTo(pageManagementUtils.pageContentSubmissionInputs);
|
$("<input type='hidden' name='pageContentUnit' value='" + inputValue + "'>").appendTo(pageManagementUtils.pageContentSubmissionInputs);
|
||||||
},
|
},
|
||||||
|
//returns a json object with the data getter information required
|
||||||
processPageContentSection:function(pageContentSection) {
|
processPageContentSection:function(pageContentSection) {
|
||||||
|
//This processing should be specific to the type and so that content type's specific processor will
|
||||||
var variableValue = pageContentSection.find("input[name='variable']").val();
|
//return the json object required
|
||||||
var queryValue = pageContentSection.find("textarea[name='textArea']").val();
|
if(pageManagementUtils.processDataGetterUtils != null) {
|
||||||
var returnObject = {saveToVar:variableValue, query:queryValue, dataGetterClass:pageManagementUtils.dataGetterLabelToURI["sparqlDataGetter"], queryModel:"vitro:contextDisplayModel"};
|
var dataGetterType = pageManagementUtils.processDataGetterUtils.selectDataGetterType(pageContentSection);
|
||||||
return returnObject;
|
if(dataGetterProcessorMap != null) {
|
||||||
|
var dataGetterProcessor = dataGetterProcessorMap[dataGetterType];
|
||||||
|
dataGetterProcessor.processPageContentSection(pageContentSection);
|
||||||
|
return dataGetterProcessor;
|
||||||
|
} else {
|
||||||
|
//ERROR handling
|
||||||
|
alert("An error has occurred and the map of processors for this content is missing. Please contact the administrator");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alert("An error has occurred and the code for processing this content is missing a component. Please contact the administrator.");
|
||||||
|
//Error handling here
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
//clones and returns cloned object for content type
|
||||||
|
createCloneObject:function(contentType, counter) {
|
||||||
|
var originalObjectPath = 'section#' + contentType;
|
||||||
|
var $newContentObj = $(originalObjectPath).clone();
|
||||||
|
$newContentObj.addClass("pageContent");
|
||||||
|
//Save content type
|
||||||
|
$newContentObj.attr("contentType", contentType);
|
||||||
|
//Set id for object
|
||||||
|
$newContentObj.attr("id", "contentType" + counter);
|
||||||
|
$newContentObj.show();
|
||||||
|
pageManagementUtils.renameIdsInClone($newContentObj, counter);
|
||||||
|
// pageManagementUtils.cloneTextAreaValues(originalObjectPath, $newContentObj);
|
||||||
|
return $newContentObj;
|
||||||
|
},
|
||||||
|
//This is specifically for cloning text area values
|
||||||
|
//May not need this if implementing the jquery fix
|
||||||
|
///would need a similar function for select as well
|
||||||
|
cloneTextAreaValues:function(originalAncestorPath, $newAncestorObject) {
|
||||||
|
$(originalAncestorPath + " textarea").each(function(index, el) {
|
||||||
|
var originalTextAreaValue = $(this).val();
|
||||||
|
var originalTextAreaName = $(this).attr("name");
|
||||||
|
$newAncestorObject.find("textarea[name='" + originalTextAreaName + "']").val(originalTextAreaValue);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//given an object and a counter, rename all the ids
|
||||||
|
renameIdsInClone:function($newContentObj, counter) {
|
||||||
|
$newContentObj.find("[id]").each(function(index, el) {
|
||||||
|
var originalId = $(this).attr["id"];
|
||||||
|
var newId = originalId + counter;
|
||||||
|
$(this).attr(newId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
21
webapp/web/js/menupage/processClassGroupDataGetterContent.js
Normal file
21
webapp/web/js/menupage/processClassGroupDataGetterContent.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
//Process sparql data getter and provide a json object with the necessary information
|
||||||
|
//Depending on what is included here, a different type of data getter might be used
|
||||||
|
var processClassGroupDataGetterContent = {
|
||||||
|
dataGetterClass:null,
|
||||||
|
//can use this if expect to initialize from elsewhere
|
||||||
|
initProcessor:function(dataGetterClassInput) {
|
||||||
|
this.dataGetterClass = dataGetterClassInput;
|
||||||
|
},
|
||||||
|
//Do we need a separate content type for each of the others?
|
||||||
|
processPageContentSection:function(pageContentSection) {
|
||||||
|
//Will look at classes etc.
|
||||||
|
var classGroup = pageContentSection.find("select[name='selectClassGroup']").val();
|
||||||
|
//query model should also be an input
|
||||||
|
var returnObject = {classGroup:classGroup, dataGetterClass:this.dataGetterClass};
|
||||||
|
return returnObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
29
webapp/web/js/menupage/processDataGetterUtils.js
Normal file
29
webapp/web/js/menupage/processDataGetterUtils.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
//This class is responsible for the product-specific form processing/content selection that might be possible
|
||||||
|
//Overrides the usual behavior of selecting the specific JavaScript class needed to convert the form inputs
|
||||||
|
//into a JSON object for submission based on the page content type
|
||||||
|
|
||||||
|
//This will need to be overridden or extended, what have you.. in VIVO
|
||||||
|
var processDataGetterUtils = {
|
||||||
|
dataGetterProcessorMap:{"browseClassGroup": processClassGroupDataGetterContent,
|
||||||
|
"sparqlDataGetter": processSparqlDataGetterContent,
|
||||||
|
"fixedHTML":processFixedHTMLDataGetterContent,
|
||||||
|
"individualsForClasses":processIndividualsForClassesDataGetterContent},
|
||||||
|
selectDataGetterType:function(pageContentSection) {
|
||||||
|
var contentType = pageContentSection.attr("contentType");
|
||||||
|
//The form can provide "browse class group" as content type but need to check
|
||||||
|
//whether this is in fact individuals for classes instead
|
||||||
|
if(contentType == "browseClassGroup") {
|
||||||
|
//Is ALL NOT selected and there are other classes, pick one
|
||||||
|
//this SHOULD be an array
|
||||||
|
var allClassesSelected = pageContentSection.find("input[name='allSelected']:checked");
|
||||||
|
//If all NOT selected then need to pick a different content type
|
||||||
|
if(allClassesSelected.length == 0) {
|
||||||
|
contentType = "individualsForClasses";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentType;
|
||||||
|
}
|
||||||
|
};
|
20
webapp/web/js/menupage/processFixedHTMLDataGetterContent.js
Normal file
20
webapp/web/js/menupage/processFixedHTMLDataGetterContent.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
//Process sparql data getter and provide a json object with the necessary information
|
||||||
|
var processFixedHTMLDataGetterContent = {
|
||||||
|
dataGetterClass:null,
|
||||||
|
//can use this if expect to initialize from elsewhere
|
||||||
|
initProcessor:function(dataGetterClass) {
|
||||||
|
this.dataGetterClass =dataGetterClass;
|
||||||
|
},
|
||||||
|
//requires variable and text area
|
||||||
|
processPageContentSection:function(pageContentSection) {
|
||||||
|
var variableValue = pageContentSection.find("input[name='variable']").val();
|
||||||
|
var queryValue = pageContentSection.find("textarea[name='textArea']").val();
|
||||||
|
//query model should also be an input
|
||||||
|
var returnObject = {saveToVar:variableValue, query:queryValue, dataGetterClass:this.dataGetterClass, queryModel:"vitro:contextDisplayModel"};
|
||||||
|
return returnObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
var processIndividualsForClassesDataGetterContent = {
|
||||||
|
dataGetterClass:null,
|
||||||
|
//can use this if expect to initialize from elsewhere
|
||||||
|
initProcessor:function(dataGetterClassInput) {
|
||||||
|
this.dataGetterClass = dataGetterClassInput;
|
||||||
|
},
|
||||||
|
//Do we need a separate content type for each of the others?
|
||||||
|
processPageContentSection:function(pageContentSection) {
|
||||||
|
//Will look at classes etc.
|
||||||
|
var classGroup = pageContentSection.find("select[name='selectClassGroup']").val();
|
||||||
|
//query model should also be an input
|
||||||
|
//Get classes selected
|
||||||
|
var classesSelected = pageContentSection.find("input[name='classInClassGroup']:checked").val();
|
||||||
|
var returnObject = {classGroup:classGroup, classesSelected:classesSelected, dataGetterClass:this.dataGetterClass};
|
||||||
|
return returnObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
23
webapp/web/js/menupage/processSparqlDataGetterContent.js
Normal file
23
webapp/web/js/menupage/processSparqlDataGetterContent.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
//Process sparql data getter and provide a json object with the necessary information
|
||||||
|
var processSparqlDataGetterContent = {
|
||||||
|
dataGetterClass:null,
|
||||||
|
//can use this if expect to initialize from elsewhere
|
||||||
|
initProcessor:function(dataGetterClass) {
|
||||||
|
this.dataGetterClass =dataGetterClass;
|
||||||
|
},
|
||||||
|
processPageContentSection:function(pageContentSection) {
|
||||||
|
|
||||||
|
var variableValue = pageContentSection.find("input[name='saveToVar']").val();
|
||||||
|
var queryValue = pageContentSection.find("textarea[name='query']").val();
|
||||||
|
var queryModel = pageContentSection.find("input[name='queryModel']").val();
|
||||||
|
|
||||||
|
//query model should also be an input
|
||||||
|
//set query model to query model here - vitro:contentDisplayModel
|
||||||
|
var returnObject = {saveToVar:variableValue, query:queryValue, dataGetterClass:this.dataGetterClass, queryModel:queryModel};
|
||||||
|
return returnObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
|
@ -51,7 +51,7 @@
|
||||||
<section id="headerBar" style="background-color:#f5f5f5;border-color:#ccc;border-width:1px;border-style:solid;border-bottom-width:0px;padding-left:6px">
|
<section id="headerBar" style="background-color:#f5f5f5;border-color:#ccc;border-width:1px;border-style:solid;border-bottom-width:0px;padding-left:6px">
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="classGroup" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
|
<section id="browseClassGroup" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
|
||||||
|
|
||||||
<section id="selectContentType" name="selectContentType" ${selectClassGroupStyle} role="region">
|
<section id="selectContentType" name="selectContentType" ${selectClassGroupStyle} role="region">
|
||||||
|
|
||||||
|
@ -96,15 +96,28 @@
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section id="nonClassGroup" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
|
<!--Broken fixed html and sparql content into separate portions-->
|
||||||
<label id="variableLabel" for="variable">Variable Name<span class="requiredHint"> *</span></label>
|
<!--This content will be copied/shown for these particular content types, so any fields for n3 editing need to be included
|
||||||
<input type="text" name="variable" size="20" value="" id="variable" role="input" />
|
here that correspond to a specific content type. These are related to specific "data getters" on the server side. -->
|
||||||
<label id="taLabel" for="selectClassGroup"><span id="taSpan"></span><span class="requiredHint"> *</span></label>
|
<section id="fixedHtml" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
|
||||||
<textarea id="textArea" name="textArea" cols="70" rows="15" style="margin-bottom:7px"></textarea>
|
<label id="fixedHTMLVariableLabel" for="fixedHTMLVariable">Variable Name<span class="requiredHint"> *</span></label>
|
||||||
|
<input type="text" name="saveToVar" size="20" value="" id="fixedHTMLSaveToVar" role="input" />
|
||||||
|
<label id="fixedHTMLValueLabel" for="fixedHTMLValue">HTML<span id="fixedHTMLValueSpan"></span><span class="requiredHint"> *</span></label>
|
||||||
|
<textarea id="fixedHTMLValue" name="htmlValue" cols="70" rows="15" style="margin-bottom:7px"></textarea>
|
||||||
</section>
|
</section>
|
||||||
|
<section id="sparqlQuery" style="background-color:#f9f9f9;padding-left:6px;padding-top:2px;border-width:1px;border-style:solid;border-color:#ccc;">
|
||||||
|
<label id="variableLabel" for="variable">Variable Name<span class="requiredHint"> *</span></label>
|
||||||
|
<input type="text" name="saveToVar" size="20" value="" id="saveToVar" role="input" />
|
||||||
|
<label id="queryModelLabel" for="queryModel">Query Model</label>
|
||||||
|
<input type="text" name="queryModel" size="20" value="" id="queryModel" role="input" />
|
||||||
|
<label id="queryLabel" for="queryLabel"><span id="querySpan">Query</span><span class="requiredHint"> *</span></label>
|
||||||
|
<textarea id="query" name="query" cols="70" rows="15" style="margin-bottom:7px"></textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
<input type="button" id="moreContent" name="moreContent" value="Add More Content" class="delete" style="margin-top:8px" />
|
<input type="button" id="moreContent" name="moreContent" value="Add More Content" class="delete" style="margin-top:8px" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<!--Information for page or menu item level-->
|
||||||
<div id="leftSide">
|
<div id="leftSide">
|
||||||
<section id="addPageOne" role="region" style="background-color:#fff;">
|
<section id="addPageOne" role="region" style="background-color:#fff;">
|
||||||
<label for="page-name">Title<span class="requiredHint"> *</span></label>
|
<label for="page-name">Title<span class="requiredHint"> *</span></label>
|
||||||
|
@ -137,7 +150,8 @@
|
||||||
<br />
|
<br />
|
||||||
<p class="requiredHint">* required fields</p>
|
<p class="requiredHint">* required fields</p>
|
||||||
</section>
|
</section>
|
||||||
<!--Hidden input with JSON objects added will be included here-->
|
<!--Hidden input with JSON objects added will be included here. This is the field with the page content information
|
||||||
|
mirroring what is required by the Data getter server side objects. -->
|
||||||
<div id="pageContentSubmissionInputs" style="display:none"></div>
|
<div id="pageContentSubmissionInputs" style="display:none"></div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
@ -145,27 +159,42 @@
|
||||||
<!-
|
<!-
|
||||||
|
|
||||||
<!--Hardcoding for now but should be retrieved from generator-->
|
<!--Hardcoding for now but should be retrieved from generator-->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var customFormData = {
|
var customFormData = {
|
||||||
dataGetterLabelToURI:{
|
dataGetterLabelToURI:{
|
||||||
//maps labels to URIs
|
//maps labels to URIs
|
||||||
"browseClassGroup": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData",
|
"browseClassGroup": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData",
|
||||||
"sparqlDataGetter":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter"
|
"individualsForClasses": "java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter",
|
||||||
|
"sparqlQuery":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter",
|
||||||
|
"fixedHtml":"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.FixedHTMLDataGetter"
|
||||||
},
|
},
|
||||||
dataGetterMap:{"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData": "Class Group Page",
|
dataGetterMap:{"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ClassGroupPageData": "Class Group Page",
|
||||||
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter": "Browse Page",
|
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.BrowseDataGetter": "Browse Page",
|
||||||
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter": "Class Group Page - Selected Classes",
|
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.IndividualsForClassesDataGetter": "Class Group Page - Selected Classes",
|
||||||
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter": "Sparql Query Results" }
|
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter": "Sparql Query Results",
|
||||||
|
"java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.FixedHTMLDataGetter": "Fixed HTML Page"}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
||||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menuManagement.css" />')}
|
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menuManagement.css" />')}
|
||||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/pageManagement.css" />')}
|
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/pageManagement.css" />')}
|
||||||
|
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>')}
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>')}
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery.fix.clone.js"></script>')}
|
||||||
|
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/json2.js"></script>')}
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/json2.js"></script>')}
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>')}
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>')}
|
||||||
|
<#--Include additional templates here to allow for additional data getters etc. for other products-->
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processFixedHTMLDataGetterContent.js"></script>')}
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processClassGroupDataGetterContent.js"></script>')}
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processSparqlDataGetterContent.js"></script>')}
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processIndividualsForClassesDataGetterContent.js"></script>')}
|
||||||
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/processDataGetterUtils.js"></script>')}
|
||||||
|
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/pageManagementUtils.js"></script>')}
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/pageManagementUtils.js"></script>')}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue