NIHVIVO-564 Work on dump directive

This commit is contained in:
rjy7 2010-07-27 22:00:13 +00:00
parent 83938a2c19
commit b9ac586c20
5 changed files with 27 additions and 12 deletions

View file

@ -11,6 +11,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHelper;
import freemarker.core.Environment;
import freemarker.template.Configuration;
import freemarker.template.SimpleDate;
import freemarker.template.SimpleHash;
import freemarker.template.SimpleScalar;
import freemarker.template.SimpleSequence;
import freemarker.template.TemplateBooleanModel;
@ -66,7 +67,8 @@ public class DumpDirective implements TemplateDirectiveModel {
type = "boolean";
} else if (val instanceof SimpleSequence){
includeTemplate = "dump-array.ftl";
type = "array";
} else if (val instanceof SimpleHash) {
includeTemplate = "dump-hash.ftl";
} else {
includeTemplate = "dump-string.ftl";
value = value.toString();

View file

@ -1,7 +1,9 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for dumping string values -->
<#-- Template for dumping array values -->
<strong>Type:</strong> array<br />
<strong>Values:</strong><br />
<ul>
<#list value as item>
<li>${item_index}: ${item}</li>

View file

@ -0,0 +1,12 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for dumping hash values -->
<strong>Type:</strong> hash<br />
<strong>Values:</strong><br />
<ul>
<#list value?keys as key>
<li>${key} = ${value[key]}</li>
</#list>
</ul>

View file

@ -2,5 +2,6 @@
<#-- Template for dumping string values -->
${value}
<strong>Type:</strong> ${type}<br />
<strong>Value:</strong> ${value}<br />

View file

@ -2,16 +2,14 @@
<#-- Template for dumping a template variable -->
<hr />
<hr /> <#-- turn these into borders once css is working -->
<div class="dump">
<h6>Freemarker template variable dump</h6>
<strong>Variable <em>${var}</em>:</strong><br/ >
<strong>Type:</strong> ${type}<br />
<strong>Value:</strong>
<#include includeTemplate />
</div>
<hr />
<hr /> <#-- turn these into borders once css is working -->