Fixing problem with FM dump directive. Working on SparqlQueryDataGetter.
This commit is contained in:
parent
558985d542
commit
d9669acddb
8 changed files with 159 additions and 80 deletions
|
@ -443,6 +443,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
|
|
||||||
map.put("url", new edu.cornell.mannlib.vitro.webapp.web.directives.UrlDirective());
|
map.put("url", new edu.cornell.mannlib.vitro.webapp.web.directives.UrlDirective());
|
||||||
map.put("widget", new edu.cornell.mannlib.vitro.webapp.web.directives.WidgetDirective());
|
map.put("widget", new edu.cornell.mannlib.vitro.webapp.web.directives.WidgetDirective());
|
||||||
|
map.putAll( FreemarkerConfiguration.getDirectives() );
|
||||||
|
|
||||||
// Add these accumulator objects. They will collect tags so the template can write them
|
// Add these accumulator objects. They will collect tags so the template can write them
|
||||||
// at the appropriate location.
|
// at the appropriate location.
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.hp.hpl.jena.rdf.model.Model;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.jena.JenaIngestController;
|
import edu.cornell.mannlib.vitro.webapp.controller.jena.JenaIngestController;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaModelMaker;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaModelMaker;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaSDBModelMaker;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.VitroJenaSDBModelMaker;
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ public abstract class DataGetterBase implements DataGetter {
|
||||||
return vreq.getDisplayModel();
|
return vreq.getDisplayModel();
|
||||||
}else if( REQUEST_JENA_ONT_MODEL.equals(modelName)){
|
}else if( REQUEST_JENA_ONT_MODEL.equals(modelName)){
|
||||||
return vreq.getJenaOntModel();
|
return vreq.getJenaOntModel();
|
||||||
|
}else if( CONTEXT_DISPLAY_MODEL.equals(modelName)){
|
||||||
|
return (Model)context.getAttribute( DisplayVocabulary.DISPLAY_ONT_MODEL);
|
||||||
}else if( ! StringUtils.isEmpty( modelName)){
|
}else if( ! StringUtils.isEmpty( modelName)){
|
||||||
Model model = JenaIngestController.getModel( modelName, vreq, context);
|
Model model = JenaIngestController.getModel( modelName, vreq, context);
|
||||||
if( model == null )
|
if( model == null )
|
||||||
|
@ -41,5 +44,6 @@ public abstract class DataGetterBase implements DataGetter {
|
||||||
|
|
||||||
public final static String REQUEST_DISPLAY_MODEL = "vitro:requestDisplayModel";
|
public final static String REQUEST_DISPLAY_MODEL = "vitro:requestDisplayModel";
|
||||||
public final static String REQUEST_JENA_ONT_MODEL = "vitro:requestJenaOntModel";
|
public final static String REQUEST_JENA_ONT_MODEL = "vitro:requestJenaOntModel";
|
||||||
|
public final static String CONTEXT_DISPLAY_MODEL = "vitro:contextDisplayModel";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class SparqlQueryDataGetter extends DataGetterBase implements DataGetter{
|
||||||
this.queryText = value.getLexicalForm();
|
this.queryText = value.getLexicalForm();
|
||||||
|
|
||||||
//model is OPTIONAL
|
//model is OPTIONAL
|
||||||
RDFNode node = soln.getResource("model");
|
RDFNode node = soln.get("queryModel");
|
||||||
if( node != null && node.isURIResource() ){
|
if( node != null && node.isURIResource() ){
|
||||||
this.modelURI = node.asResource().getURI();
|
this.modelURI = node.asResource().getURI();
|
||||||
}else if( node != null && node.isLiteral() ){
|
}else if( node != null && node.isLiteral() ){
|
||||||
|
@ -116,7 +116,7 @@ public class SparqlQueryDataGetter extends DataGetterBase implements DataGetter{
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
//this may throw an error
|
//this may throw a SPARQL syntax error
|
||||||
Query query = QueryFactory.create( this.queryText );
|
Query query = QueryFactory.create( this.queryText );
|
||||||
|
|
||||||
//build query bindings
|
//build query bindings
|
||||||
|
@ -206,14 +206,14 @@ public class SparqlQueryDataGetter extends DataGetterBase implements DataGetter{
|
||||||
public static final String defaultVarNameForResults = "results";
|
public static final String defaultVarNameForResults = "results";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query to get the definition of the SparqlDataGetter for a given data getter URI.
|
* Query to get the definition of the SparqlDataGetter for a given URI.
|
||||||
*/
|
*/
|
||||||
private static final String dataGetterQuery =
|
private static final String dataGetterQuery =
|
||||||
"PREFIX display: <" + DisplayVocabulary.DISPLAY_NS +"> \n" +
|
"PREFIX display: <" + DisplayVocabulary.DISPLAY_NS +"> \n" +
|
||||||
"SELECT ?query ?saveToVar ?model WHERE { \n" +
|
"SELECT ?query ?saveToVar ?queryModel WHERE { \n" +
|
||||||
" ?dataGetterUri "+queryPropertyURI+" ?query . \n" +
|
" ?dataGetterURI "+queryPropertyURI+" ?query . \n" +
|
||||||
" OPTIONAL{ ?dataGetterUri "+saveToVarPropertyURI+" ?saveToVar } \n " +
|
" OPTIONAL{ ?dataGetterURI "+saveToVarPropertyURI+" ?saveToVar } \n " +
|
||||||
" OPTIONAL{ ?dataGetterUri "+queryModelPropertyURI+" ?model } \n" +
|
" OPTIONAL{ ?dataGetterURI "+queryModelPropertyURI+" ?queryModel } \n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,12 @@ import freemarker.core.Environment;
|
||||||
import freemarker.ext.beans.BeanModel;
|
import freemarker.ext.beans.BeanModel;
|
||||||
import freemarker.ext.beans.BeansWrapper;
|
import freemarker.ext.beans.BeansWrapper;
|
||||||
import freemarker.ext.beans.CollectionModel;
|
import freemarker.ext.beans.CollectionModel;
|
||||||
import freemarker.ext.beans.MapModel;
|
|
||||||
import freemarker.ext.beans.SimpleMethodModel;
|
import freemarker.ext.beans.SimpleMethodModel;
|
||||||
import freemarker.ext.beans.StringModel;
|
import freemarker.ext.beans.StringModel;
|
||||||
import freemarker.ext.beans.WrapperExtractor;
|
import freemarker.ext.beans.WrapperExtractor;
|
||||||
|
import freemarker.template.Configuration;
|
||||||
import freemarker.template.ObjectWrapper;
|
import freemarker.template.ObjectWrapper;
|
||||||
|
import freemarker.template.SimpleScalar;
|
||||||
import freemarker.template.Template;
|
import freemarker.template.Template;
|
||||||
import freemarker.template.TemplateBooleanModel;
|
import freemarker.template.TemplateBooleanModel;
|
||||||
import freemarker.template.TemplateCollectionModel;
|
import freemarker.template.TemplateCollectionModel;
|
||||||
|
@ -146,28 +147,28 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateHashModel dataModel = env.getDataModel();
|
TemplateHashModel dataModel = env.getDataModel();
|
||||||
TemplateModel model = dataModel.get(varName);
|
TemplateModel valueToDump = dataModel.get(varName);
|
||||||
return getTemplateVariableDump(varName, model);
|
return getTemplateVariableDump(varName, valueToDump);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, Object> getTemplateVariableDump(String varName, TemplateModel model)
|
protected Map<String, Object> getTemplateVariableDump(String varName, TemplateModel valueToDump)
|
||||||
throws TemplateModelException {
|
throws TemplateModelException {
|
||||||
|
|
||||||
Map<String, Object> value = new HashMap<String, Object>();
|
Map<String, Object> value = new HashMap<String, Object>();
|
||||||
|
|
||||||
if (model == null) {
|
if (valueToDump == null) {
|
||||||
value.put(Key.VALUE.toString(), Value.UNDEFINED.toString());
|
value.put(Key.VALUE.toString(), Value.UNDEFINED.toString());
|
||||||
|
|
||||||
// TemplateMethodModel and TemplateDirectiveModel objects can only be
|
// TemplateMethodModel and TemplateDirectiveModel objects can only be
|
||||||
// included in the data model at the top level.
|
// included in the data model at the top level.
|
||||||
} else if (model instanceof TemplateMethodModel) {
|
} else if (valueToDump instanceof TemplateMethodModel) {
|
||||||
value.putAll( getTemplateModelDump( ( TemplateMethodModel)model, varName ) );
|
value.putAll( getTemplateModelDump( ( TemplateMethodModel)valueToDump, varName ) );
|
||||||
|
|
||||||
} else if (model instanceof TemplateDirectiveModel) {
|
} else if (valueToDump instanceof TemplateDirectiveModel) {
|
||||||
value.putAll( getTemplateModelDump( ( TemplateDirectiveModel)model, varName ) );
|
value.putAll( getTemplateModelDump( ( TemplateDirectiveModel)valueToDump, varName ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
value.putAll(getDump(model));
|
value.putAll(getDump(valueToDump));
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> dump = new HashMap<String, Object>();
|
Map<String, Object> dump = new HashMap<String, Object>();
|
||||||
|
@ -175,57 +176,57 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
|
||||||
return dump;
|
return dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getDump(TemplateModel model) throws TemplateModelException {
|
private Map<String, Object> getDump(TemplateModel valueToDump) throws TemplateModelException {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
// Don't return null if model == null. We still want to send the map to the template.
|
// Don't return null if model == null. We still want to send the map to the template.
|
||||||
if (model != null) {
|
if (valueToDump != null) {
|
||||||
|
|
||||||
if ( model instanceof TemplateSequenceModel ) {
|
if ( valueToDump instanceof TemplateSequenceModel ) {
|
||||||
if (model instanceof CollectionModel && ! ((CollectionModel)model).getSupportsIndexedAccess()) {
|
if (valueToDump instanceof CollectionModel && ! ((CollectionModel)valueToDump).getSupportsIndexedAccess()) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateCollectionModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateCollectionModel)valueToDump ) );
|
||||||
} else {
|
} else {
|
||||||
map.putAll( getTemplateModelDump( (TemplateSequenceModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateSequenceModel)valueToDump ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( model instanceof TemplateNumberModel ) {
|
} else if ( valueToDump instanceof TemplateNumberModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateNumberModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateNumberModel)valueToDump ) );
|
||||||
|
|
||||||
} else if ( model instanceof TemplateBooleanModel ) {
|
} else if ( valueToDump instanceof TemplateBooleanModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateBooleanModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateBooleanModel)valueToDump ) );
|
||||||
|
|
||||||
} else if ( model instanceof TemplateDateModel ) {
|
} else if ( valueToDump instanceof TemplateDateModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateDateModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateDateModel)valueToDump ) );
|
||||||
|
|
||||||
} else if ( model instanceof TemplateCollectionModel ) {
|
} else if ( valueToDump instanceof TemplateCollectionModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateCollectionModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateCollectionModel)valueToDump ) );
|
||||||
|
|
||||||
} else if ( model instanceof StringModel ) {
|
} else if ( valueToDump instanceof StringModel ) {
|
||||||
// A StringModel can wrap either a String or a plain Java object.
|
// A StringModel can wrap either a String or a plain Java object.
|
||||||
// Unwrap it to figure out what to do.
|
// Unwrap it to figure out what to do.
|
||||||
Object unwrappedModel = DeepUnwrap.permissiveUnwrap(model);
|
Object unwrappedModel = DeepUnwrap.permissiveUnwrap(valueToDump);
|
||||||
|
|
||||||
if (unwrappedModel instanceof String) {
|
if (unwrappedModel instanceof String) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateScalarModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateScalarModel)valueToDump ) );
|
||||||
} else {
|
} else {
|
||||||
map.putAll( getTemplateModelDump( (TemplateHashModelEx)model ) );
|
map.putAll( getTemplateModelDump( (TemplateHashModelEx)valueToDump ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( model instanceof TemplateScalarModel ) {
|
} else if ( valueToDump instanceof TemplateScalarModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateScalarModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateScalarModel)valueToDump ) );
|
||||||
|
|
||||||
} else if ( model instanceof TemplateHashModelEx ) {
|
} else if ( valueToDump instanceof TemplateHashModelEx ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateHashModelEx)model ) );
|
map.putAll( getTemplateModelDump( (TemplateHashModelEx)valueToDump ) );
|
||||||
|
|
||||||
} else if (model instanceof TemplateHashModel ) {
|
} else if (valueToDump instanceof TemplateHashModel ) {
|
||||||
map.putAll( getTemplateModelDump( (TemplateHashModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateHashModel)valueToDump ) );
|
||||||
|
|
||||||
// Nodes and transforms not included here
|
// Nodes and transforms not included here
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We shouldn't get here; provide as a safety net.
|
// We shouldn't get here; provide as a safety net.
|
||||||
map.putAll( getTemplateModelDump( (TemplateModel)model ) );
|
map.putAll( getTemplateModelDump( (TemplateModel)valueToDump ) );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
map.put(Key.VALUE.toString(), Value.NULL.toString());
|
map.put(Key.VALUE.toString(), Value.NULL.toString());
|
||||||
|
@ -564,14 +565,6 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private Map<String, Object> getSimpleMethodModelDump(Object object, SimpleMethodModel model) throws TemplateModelException {
|
|
||||||
// Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
// Method method = (Method)DeepUnwrap.permissiveUnwrap(model);
|
|
||||||
// TemplateModel value = model.get(method.getName());
|
|
||||||
// map.put(Key.VALUE.toString(), getDump(value));
|
|
||||||
// return map;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private Map<String, Object> getTemplateModelDump(TemplateModel model) throws TemplateModelException {
|
private Map<String, Object> getTemplateModelDump(TemplateModel model) throws TemplateModelException {
|
||||||
// One of the more specific cases should have applied. Track whether this actually occurs.
|
// One of the more specific cases should have applied. Track whether this actually occurs.
|
||||||
log.debug("Found template model of type " + model.getClass().getName());
|
log.debug("Found template model of type " + model.getClass().getName());
|
||||||
|
@ -593,24 +586,68 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
|
||||||
// Wrap the dump in another map so the template has a handle to iterate through
|
// Wrap the dump in another map so the template has a handle to iterate through
|
||||||
// the values: <#list dump?keys as key>...</#list>
|
// the values: <#list dump?keys as key>...</#list>
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("dump", dump);
|
|
||||||
|
//put the TemplateModel to be dumped at 'dumpValue'
|
||||||
|
map.put("dumpValue", dump);
|
||||||
map.put("title", title);
|
map.put("title", title);
|
||||||
writeDump(map, env, templateName);
|
writeDump(map, env, templateName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeDump(Map<String, Object> map, Environment env, String templateName)
|
protected void writeDump(Map<String, Object> map, Environment env, String templateName)
|
||||||
throws TemplateException, IOException {
|
throws TemplateException, IOException {
|
||||||
// Make the stylesheets list visible to dump.ftl
|
|
||||||
map.put("stylesheets", env.getVariable("stylesheets"));
|
//bdc34: not sure what to do there to
|
||||||
|
//get the scope from the env to this dump template, trying an ugly copy
|
||||||
|
map.putAll( toMap( env.getDataModel() ));
|
||||||
|
|
||||||
Template template = env.getConfiguration().getTemplate(templateName);
|
Template template = env.getConfiguration().getTemplate(templateName);
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
template.process(map, sw);
|
template.process(map, sw);
|
||||||
Writer out = env.getOut();
|
Writer out = env.getOut();
|
||||||
out.write(sw.toString());
|
out.write(sw.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> help(String name) {
|
public Map<String, Object> help(String name) {
|
||||||
return new HashMap<String, Object>();
|
return new HashMap<String, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a Freemarker TemplateObject to a usable map.
|
||||||
|
* @throws TemplateModelException
|
||||||
|
*/
|
||||||
|
protected Map<? extends String, ? extends Object> toMap( Object hash ) throws TemplateModelException{
|
||||||
|
Map<String,Object> outMap = new HashMap<String,Object>();
|
||||||
|
|
||||||
|
if( hash instanceof TemplateHashModelEx ){
|
||||||
|
TemplateHashModelEx thme = (TemplateHashModelEx) hash;
|
||||||
|
for( String key : junkToStrings( thme.keys() )){
|
||||||
|
outMap.put(key, thme.get(key));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log.error("Freemarker is passing odd objects to method toMap(): " + hash.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return outMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<String> junkToStrings( TemplateCollectionModel junk ){
|
||||||
|
List<String> keys = new ArrayList<String>();
|
||||||
|
try{
|
||||||
|
TemplateModelIterator it = junk.iterator();
|
||||||
|
while( it.hasNext() ){
|
||||||
|
Object obj = it.next();
|
||||||
|
if( obj instanceof StringModel){
|
||||||
|
keys.add( ((StringModel)obj).getAsString() );
|
||||||
|
}else if( obj instanceof SimpleScalar ){
|
||||||
|
keys.add( ((SimpleScalar)obj).getAsString());
|
||||||
|
}else{
|
||||||
|
log.error("Freemarker is setting keys to hashes as non-strings: " + obj.getClass().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception ex){
|
||||||
|
log.error("Freemarker is messing with us",ex);
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ owl:ObjectProperty
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#DataGetter>
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#DataGetter>
|
||||||
a owl:Class .
|
a owl:Class .
|
||||||
|
|
||||||
|
<java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
|
||||||
########Data Properties#########
|
########Data Properties#########
|
||||||
|
@ -102,13 +104,15 @@ owl:versionInfo
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#usesDataGetterClass>
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#usesDataGetterClass>
|
||||||
a owl:DatatypeProperty .
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
###Custom data getters that may or may not be associated with a page use the following relationships
|
|
||||||
###E.g. sparql data getters can specify the query to be used as well as what variable in the template
|
|
||||||
###should store the results
|
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#saveToVar>
|
|
||||||
a owl:DatatypeProperty .
|
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#query>
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#query>
|
||||||
a owl:DatatypeProperty .
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#saveToVar>
|
||||||
|
a owl:DatatypeProperty.
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#queryModel>
|
||||||
|
a owl:DatatypeProperty.
|
||||||
|
|
||||||
######### Object Properties#########
|
######### Object Properties#########
|
||||||
###Basic
|
###Basic
|
||||||
rdfs:range
|
rdfs:range
|
||||||
|
@ -179,7 +183,4 @@ owl:topObjectProperty
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#restrictResultsByClass>
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#restrictResultsByClass>
|
||||||
a owl:ObjectProperty .
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
###Custom data getters that may or may not be associated with a page use the following relationships
|
|
||||||
###E.g. sparql data getters can specify what model to use for querying
|
|
||||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#queryModel>
|
|
||||||
a owl:ObjectProperty .
|
|
||||||
|
|
|
@ -5,4 +5,6 @@
|
||||||
|
|
||||||
<p>Implement a <a href="${urls.base}/display?uri=${page.pageUri?url}&switchToDisplayModel=1">link</a> to configure this page if the user has permission.</p>
|
<p>Implement a <a href="${urls.base}/display?uri=${page.pageUri?url}&switchToDisplayModel=1">link</a> to configure this page if the user has permission.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<#if pages?has_content >
|
||||||
|
<table>
|
||||||
|
<th>Title</th><th>URI</th>
|
||||||
|
|
||||||
|
<#list pages as pagex>
|
||||||
|
<tr>
|
||||||
|
<td>${(pagex.title)!'-untitled-'}</td>
|
||||||
|
<#if pagex.pageUri??>
|
||||||
|
<td><a href="${urls.base}/individual?uri=${pagex.pageUri?url}&switchToDisplayModel=1">${pagex.pageUri}</a></td>
|
||||||
|
<#else>
|
||||||
|
<td>URI for page not defined</td>
|
||||||
|
</#if>
|
||||||
|
</tr>
|
||||||
|
</#list>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
<p>There are no pages defined yet.</p>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<form id="addIndividualClass" action="${urls.base}/editRequestDispatch" method="get">
|
||||||
|
<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.NewIndividualFormGenerator" role="input">
|
||||||
|
<input type="submit" id="submit" value="Add Page" role="button">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
|
@ -7,21 +7,23 @@
|
||||||
<div class="dump">
|
<div class="dump">
|
||||||
<h3>${title}</h3>
|
<h3>${title}</h3>
|
||||||
|
|
||||||
<@doDump dump />
|
<#-- dump has been changed to dumpValue to avoid confusion
|
||||||
|
with the dump directive which is stored in the DataModel as 'dump' -->
|
||||||
|
<@doDump dumpValue />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<#macro doDump dump>
|
<#macro doDump dumpValue>
|
||||||
<#if dump?keys?has_content>
|
<#if dumpValue?keys?has_content>
|
||||||
<ul>
|
<ul>
|
||||||
<#list dump?keys as key>
|
<#list dumpValue?keys as key>
|
||||||
<li class="variable">
|
<li class="variable">
|
||||||
<p><strong>Variable name:</strong> ${key}</p>
|
<p><strong>Variable name:</strong> ${key}</p>
|
||||||
|
|
||||||
<#local type = dump[key].type!>
|
<#local type = dumpValue[key].type!>
|
||||||
<#if type == "Directive" || type == "Method">
|
<#if type == "Directive" || type == "Method">
|
||||||
<@doMethod dump[key] />
|
<@doMethod dumpValue[key] />
|
||||||
<#else>
|
<#else>
|
||||||
<@doTypeAndValue dump[key] />
|
<@doTypeAndValue dumpValue[key] />
|
||||||
</#if>
|
</#if>
|
||||||
</li>
|
</li>
|
||||||
</#list>
|
</#list>
|
||||||
|
|
Loading…
Add table
Reference in a new issue