From c4da8ffc07d08fc38590727df6151922d70e2edb Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 22 Feb 2011 18:06:02 +0000 Subject: [PATCH] NIHVIVO-1563 Add template method models to dumpAll directive --- .../freemarker/FreemarkerHttpServlet.java | 4 +- .../freemarker/IndividualController.java | 2 +- .../BaseTemplateDirectiveModel.java | 17 ++---- .../webapp/web/directives/UrlDirective.java | 3 +- .../web/directives/WidgetDirective.java | 5 +- .../directives/dump/DescribeDirective.java | 7 +-- .../web/directives/dump/DumpAllDirective.java | 16 ++++-- .../web/directives/dump/DumpDirective.java | 4 +- .../web/directives/dump/DumpHelper.java | 23 ++++++-- .../web/directives/dump/HelpDirective.java | 10 ++-- .../web/methods/BaseTemplateMethodModel.java | 56 +++++++++++++++++++ .../IndividualLocalNameMethod.java | 29 ++++++++-- .../IndividualProfileUrlMethod.java | 25 ++++++++- webapp/web/css/dump.css | 20 ++++++- .../freemarker/body/partials/dump/dumpAll.ftl | 27 ++++++--- .../body/partials/dump/help-directive.ftl | 2 +- .../body/partials/dump/help-method.ftl | 40 +++++++++++++ 17 files changed, 229 insertions(+), 61 deletions(-) create mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/BaseTemplateMethodModel.java rename webapp/src/edu/cornell/mannlib/vitro/webapp/web/{functions => methods}/IndividualLocalNameMethod.java (58%) rename webapp/src/edu/cornell/mannlib/vitro/webapp/web/{functions => methods}/IndividualProfileUrlMethod.java (58%) create mode 100644 webapp/web/templates/freemarker/body/partials/dump/help-method.ftl diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java index b7e733705..9c8175206 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerHttpServlet.java @@ -339,8 +339,8 @@ public class FreemarkerHttpServlet extends VitroHttpServlet { public static Map getMethods() { Map map = new HashMap(); - map.put("profileUrl", new edu.cornell.mannlib.vitro.webapp.web.functions.IndividualProfileUrlMethod()); - map.put("localName", new edu.cornell.mannlib.vitro.webapp.web.functions.IndividualLocalNameMethod()); + map.put("profileUrl", new edu.cornell.mannlib.vitro.webapp.web.methods.IndividualProfileUrlMethod()); + map.put("localName", new edu.cornell.mannlib.vitro.webapp.web.methods.IndividualLocalNameMethod()); return map; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java index 6cf75dd40..9719bdbc2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java @@ -56,7 +56,7 @@ import edu.cornell.mannlib.vitro.webapp.reasoner.SimpleReasoner; import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapper; import edu.cornell.mannlib.vitro.webapp.utils.NamespaceMapperFactory; import edu.cornell.mannlib.vitro.webapp.web.ContentType; -import edu.cornell.mannlib.vitro.webapp.web.functions.IndividualLocalNameMethod; +import edu.cornell.mannlib.vitro.webapp.web.methods.IndividualLocalNameMethod; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel; import freemarker.ext.beans.BeansWrapper; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/BaseTemplateDirectiveModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/BaseTemplateDirectiveModel.java index b1adba4ca..daa48b0a3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/BaseTemplateDirectiveModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/BaseTemplateDirectiveModel.java @@ -14,27 +14,20 @@ import freemarker.core.Environment; import freemarker.template.Template; import freemarker.template.TemplateDirectiveModel; import freemarker.template.TemplateException; +import freemarker.template.TemplateHashModel; +import freemarker.template.TemplateModelException; +import freemarker.template.utility.DeepUnwrap; public abstract class BaseTemplateDirectiveModel implements TemplateDirectiveModel { private static final Log log = LogFactory.getLog(BaseTemplateDirectiveModel.class); - public String help(Environment environment) { + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); - return mergeToHelpTemplate(map, environment); - } - - protected String getDirectiveName() { - String className = this.getClass().getName(); - String[] nameParts = className.split("\\."); - String directiveName = nameParts[nameParts.length-1]; - directiveName = directiveName.replaceAll("Directive$", ""); - directiveName = directiveName.substring(0, 1).toLowerCase() + directiveName.substring(1); - return directiveName; + return mergeToHelpTemplate(map, env); } protected String mergeToHelpTemplate(Map map, Environment env) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/UrlDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/UrlDirective.java index 67d5ca875..6106115c2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/UrlDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/UrlDirective.java @@ -60,10 +60,9 @@ public class UrlDirective extends BaseTemplateDirectiveModel { out.write(url); } - public String help(Environment env) { + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); map.put("effect", "Generate a full url from a path. Use for generating src attribute of image tags."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/WidgetDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/WidgetDirective.java index 993d5550d..b9dc5e0b9 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/WidgetDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/WidgetDirective.java @@ -93,10 +93,9 @@ public class WidgetDirective extends BaseTemplateDirectiveModel { } - public String help(Environment env) { + public String help(String name, Environment env) { Map map = new HashMap(); - - String name = getDirectiveName(); + map.put("name", name); map.put("effect", "Add a reuseable block of markup and functionality to the template, with associated scripts and stylesheets injected into the page <head> element."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DescribeDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DescribeDirective.java index 9b7ace9db..9faf90a82 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DescribeDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DescribeDirective.java @@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.web.directives.dump; import java.io.IOException; import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -14,7 +13,6 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import edu.cornell.mannlib.vitro.webapp.utils.StringUtils; import edu.cornell.mannlib.vitro.webapp.web.directives.BaseTemplateDirectiveModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel; import freemarker.core.Environment; @@ -93,11 +91,10 @@ public class DescribeDirective extends BaseTemplateDirectiveModel { helper.writeDump("describe.ftl", map, varName); } - - public String help(Environment env) { + @Override + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); map.put("effect", "Describe the methods callable on a template variable."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpAllDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpAllDirective.java index 81670d632..0e6087bda 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpAllDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpAllDirective.java @@ -13,8 +13,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.web.directives.BaseTemplateDirectiveModel; +import edu.cornell.mannlib.vitro.webapp.web.methods.BaseTemplateMethodModel; import freemarker.core.Environment; -import freemarker.template.Configuration; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateException; import freemarker.template.TemplateHashModel; @@ -52,12 +52,16 @@ public class DumpAllDirective extends BaseTemplateDirectiveModel { DumpHelper helper = new DumpHelper(env); List models = new ArrayList(); List directives = new ArrayList(); - + List methods = new ArrayList(); + for (String var : varNames) { Object value = dm.get(var); if (value instanceof BaseTemplateDirectiveModel) { - String help = ((BaseTemplateDirectiveModel) value).help(env); + String help = ((BaseTemplateDirectiveModel) value).help(var, env); directives.add(help); + } else if (value instanceof BaseTemplateMethodModel) { + String help = ((BaseTemplateMethodModel) value).help(var, env); + methods.add(help); } else { models.add(helper.getVariableDump(var)); } @@ -66,6 +70,7 @@ public class DumpAllDirective extends BaseTemplateDirectiveModel { Map map = new HashMap(); map.put("models", models); map.put("directives", directives); + map.put("methods", methods); map.put("containingTemplate", env.getTemplate().getName()); try { @@ -78,11 +83,10 @@ public class DumpAllDirective extends BaseTemplateDirectiveModel { } - @Override - public String help(Environment env) { + @Override + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); map.put("effect", "Dump the contents of the template data model."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpDirective.java index a666b499a..358c5d2ed 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpDirective.java @@ -60,10 +60,10 @@ public class DumpDirective extends BaseTemplateDirectiveModel { helper.writeDump("dump.ftl", map, var); } - public String help(Environment env) { + @Override + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); map.put("effect", "Dump the contents of a template variable."); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpHelper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpHelper.java index 39170a09c..ec127a265 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpHelper.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/DumpHelper.java @@ -4,11 +4,9 @@ package edu.cornell.mannlib.vitro.webapp.web.directives.dump; import java.io.IOException; import java.io.Writer; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -22,7 +20,9 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.BaseTemplateModel; import freemarker.core.Environment; import freemarker.template.TemplateBooleanModel; import freemarker.template.TemplateDateModel; +import freemarker.template.TemplateDirectiveModel; import freemarker.template.TemplateHashModel; +import freemarker.template.TemplateMethodModel; import freemarker.template.TemplateModel; import freemarker.template.TemplateModelException; import freemarker.template.TemplateNumberModel; @@ -52,6 +52,7 @@ public class DumpHelper { tm = dataModel.get(varName); } catch (TemplateModelException tme) { log.error("Error getting value of template model " + varName + " from data model."); + return null; } Map map = new HashMap(); @@ -63,6 +64,7 @@ public class DumpHelper { unwrappedModel = DeepUnwrap.permissiveUnwrap(tm); } catch (TemplateModelException e) { log.error("Cannot unwrap template model " + varName + "."); + return null; } // Just use toString() method for now. Handles nested collections. Could make more sophisticated later. @@ -148,7 +150,8 @@ public class DumpHelper { for (Method m : declaredMethods) { int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isStatic(mod)) { - // if the method takes args, make sure the BeanWrapper used makes this method visible + // If the method takes args, make sure the BeanWrapper used makes this method visible. + // RY It may not be possible to determine this. methods.add(m); } } @@ -192,11 +195,19 @@ public class DumpHelper { methods.add(key); } else { try { - Object value = method.invoke(model); - if (value == null) { + Object result = method.invoke(model); + String value = null; + if (result == null) { value = "null"; // distinguish a null from an empty string +// } else if (result instanceof TemplateDirectiveModel) { +// // value = string output of the help() method processed through template +// } else if (result instanceof TemplateMethodModel) { +// // value = string output of the help() method processed through template + } else { + value = result.toString(); } - properties.put(key, value.toString()); + + properties.put(key, value); } catch (Exception e) { log.error(e, e); continue; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/HelpDirective.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/HelpDirective.java index 979774fd1..93fcadea5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/HelpDirective.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/directives/dump/HelpDirective.java @@ -59,7 +59,7 @@ public class HelpDirective extends BaseTemplateDirectiveModel { Configuration config = env.getConfiguration(); Map map = new HashMap(); - String help = ((BaseTemplateDirectiveModel) value).help(env); + String help = ((BaseTemplateDirectiveModel) value).help(directiveName, env); map.put("help", help); try { @@ -74,20 +74,20 @@ public class HelpDirective extends BaseTemplateDirectiveModel { } - public String help(Environment env) { + public String help(String name, Environment env) { Map map = new HashMap(); - String name = getDirectiveName(); map.put("name", name); - map.put("effect", "Output directive help."); + map.put("effect", "Output help for directive or method."); Map params = new HashMap(); - params.put("var", "name of directive"); + params.put("var", "name of directive/method"); map.put("params", params); List examples = new ArrayList(); examples.add("<@" + name + " directive=\"dump\" />"); + examples.add("<@" + name + " method=\"profileUrl\" />"); map.put("examples", examples); return mergeToHelpTemplate(map, env); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/BaseTemplateMethodModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/BaseTemplateMethodModel.java new file mode 100644 index 000000000..6c291ebe4 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/BaseTemplateMethodModel.java @@ -0,0 +1,56 @@ +package edu.cornell.mannlib.vitro.webapp.web.methods; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import freemarker.core.Environment; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.TemplateMethodModel; + +public abstract class BaseTemplateMethodModel implements TemplateMethodModel { + + private static final Log log = LogFactory.getLog(BaseTemplateMethodModel.class); + + public String help(String name, Environment env) { + Map map = new HashMap(); + + map.put("name", name); + + return mergeToHelpTemplate(map, env); + } + + protected String mergeToHelpTemplate(Map map, Environment env) { + return processTemplateToString("help-method.ftl", map, env); + } + + public static String processTemplateToString(String templateName, Map map, Environment env) { + Template template = getTemplate(templateName, env); + StringWriter sw = new StringWriter(); + try { + template.process(map, sw); + } catch (TemplateException e) { + log.error("Template Exception creating processing environment", e); + } catch (IOException e) { + log.error("IOException creating processing environment", e); + } + return sw.toString(); + } + + private static Template getTemplate(String templateName, Environment env) { + Template template = null; + try { + template = env.getConfiguration().getTemplate(templateName); + } catch (IOException e) { + // RY Should probably throw this error instead. + log.error("Cannot get template " + templateName, e); + } + return template; + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualLocalNameMethod.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualLocalNameMethod.java similarity index 58% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualLocalNameMethod.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualLocalNameMethod.java index 7bc07b868..b2d44220d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualLocalNameMethod.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualLocalNameMethod.java @@ -1,22 +1,24 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.web.functions; +package edu.cornell.mannlib.vitro.webapp.web.methods; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import freemarker.core.Environment; -import freemarker.template.TemplateMethodModel; import freemarker.template.TemplateModelException; -public class IndividualLocalNameMethod implements TemplateMethodModel { +public class IndividualLocalNameMethod extends BaseTemplateMethodModel { + @SuppressWarnings("rawtypes") @Override public String exec(List args) throws TemplateModelException { if (args.size() != 1) { @@ -33,4 +35,23 @@ public class IndividualLocalNameMethod implements TemplateMethodModel { return individual.getLocalName(); } + @Override + public String help(String name, Environment env) { + Map map = new HashMap(); + + map.put("name", name); + + map.put("returnValue", "The local name of the individual"); + + Listparams = new ArrayList(); + params.add("Uri of individual"); + map.put("params", params); + + List examples = new ArrayList(); + examples.add(name + "(individual.uri)"); + map.put("examples", examples); + + return mergeToHelpTemplate(map, env); + } + } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualProfileUrlMethod.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualProfileUrlMethod.java similarity index 58% rename from webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualProfileUrlMethod.java rename to webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualProfileUrlMethod.java index 370c7a92b..a3871bdd5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/functions/IndividualProfileUrlMethod.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/methods/IndividualProfileUrlMethod.java @@ -1,8 +1,11 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -package edu.cornell.mannlib.vitro.webapp.web.functions; +package edu.cornell.mannlib.vitro.webapp.web.methods; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -12,7 +15,7 @@ import freemarker.core.Environment; import freemarker.template.TemplateMethodModel; import freemarker.template.TemplateModelException; -public class IndividualProfileUrlMethod implements TemplateMethodModel { +public class IndividualProfileUrlMethod extends BaseTemplateMethodModel { @Override public String exec(List args) throws TemplateModelException { @@ -29,4 +32,22 @@ public class IndividualProfileUrlMethod implements TemplateMethodModel { return (url == null) ? "" : url; // don't return a null to the template } + @Override + public String help(String name, Environment env) { + Map map = new HashMap(); + + map.put("name", name); + + map.put("returnValue", "The profile url of the individual"); + + Listparams = new ArrayList(); + params.add("Uri of individual"); + map.put("params", params); + + List examples = new ArrayList(); + examples.add(name + "(individual.uri)"); + map.put("examples", examples); + + return mergeToHelpTemplate(map, env); + } } diff --git a/webapp/web/css/dump.css b/webapp/web/css/dump.css index d81e26e02..411080e52 100644 --- a/webapp/web/css/dump.css +++ b/webapp/web/css/dump.css @@ -8,18 +8,36 @@ padding: 1em 0; margin: 1em 0; } + .dump li { list-style-type: none; } -.dump.directive h6 { + +.dump .directive h6 { margin-top: 1em; } + .dump.datamodel .var, .dump.datamodel .directive { border-bottom: 1px solid #ccc; padding: 1em 0; margin: 1em 0; } + .dump .var p { margin-bottom: .3em; +} + +.dump .directive ol, +.dump .directive ul { + margin-left: 1.5em; +} + +.dump .directive ol li, +.dump .directive ul li { + margin-bottom: .5em; +} + +.dump .directive ol li { + list-style: decimal inside none; } \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/partials/dump/dumpAll.ftl b/webapp/web/templates/freemarker/body/partials/dump/dumpAll.ftl index 14fb2b16c..f6609e583 100644 --- a/webapp/web/templates/freemarker/body/partials/dump/dumpAll.ftl +++ b/webapp/web/templates/freemarker/body/partials/dump/dumpAll.ftl @@ -6,21 +6,30 @@

Data model dump for template ${containingTemplate}

-

VARIABLES

- +

VARIABLES

    <#list models as model>
  • ${model}
-

DIRECTIVES

- -
    - <#list directives as directive> -
  • ${directive}
  • - -
+ <#if directives?has_content> +

DIRECTIVES

+
    + <#list directives as directive> +
  • ${directive}
  • + +
+ + + <#if methods?has_content> +

METHODS

+
    + <#list methods as method> +
  • ${method}
  • + +
+ diff --git a/webapp/web/templates/freemarker/body/partials/dump/help-directive.ftl b/webapp/web/templates/freemarker/body/partials/dump/help-directive.ftl index e54c1c081..fd15ae23e 100644 --- a/webapp/web/templates/freemarker/body/partials/dump/help-directive.ftl +++ b/webapp/web/templates/freemarker/body/partials/dump/help-directive.ftl @@ -13,7 +13,7 @@

Parameters: - <#if params?? && params?keys?has_content> + <#if params??>

    <#list params?keys as param> diff --git a/webapp/web/templates/freemarker/body/partials/dump/help-method.ftl b/webapp/web/templates/freemarker/body/partials/dump/help-method.ftl new file mode 100644 index 000000000..5b4f4f24d --- /dev/null +++ b/webapp/web/templates/freemarker/body/partials/dump/help-method.ftl @@ -0,0 +1,40 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Template for displaying directive help --> + +
    +

    Method name: ${name}

    + + <#if returnValue??> +

    Return value: ${returnValue}

    + + <#if comments??> +

    Comments: ${comments}

    + + +

    Parameters: + <#if params??> +

    +
      + <#list params as param> +
    1. ${param}
    2. + +
    + <#else> + none

    + +
    + +

    Examples:

    + <#if examples??> +
      + <#list examples as example> +
    • ${example}
    • + +
    + + + <#else> +

    No help available for this method.

    + +
    \ No newline at end of file