From 9435d42a87f136f459284d500ce050313d0da7a0 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Tue, 16 Nov 2010 15:10:10 +0000 Subject: [PATCH] Use login widget on login page (committing files that got skipped in r6451). Add help() method to WidgetDirective. --- .../web/directives/WidgetDirective.java | 32 ++++++++++++++++++- .../web/directives/dump/DumpDirective.java | 3 +- 2 files changed, 32 insertions(+), 3 deletions(-) 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 2a967f341..993d5550d 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 @@ -5,6 +5,9 @@ package edu.cornell.mannlib.vitro.webapp.web.directives; import java.io.IOException; import java.io.Writer; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; @@ -89,6 +92,33 @@ public class WidgetDirective extends BaseTemplateDirectiveModel { } } - + + public String help(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."); + + map.put("comments", "From a body template, insert widget directive in desired location with no include value or include=\"markup\". Both assets and markup will be included. " + + "From a page template, insert widget directive at top of template with include=\"assets\". Insert widget directive in desired location " + + "with no include value or include=\"markup\"."); + + Map params = new HashMap(); + params.put("name", "name of widget"); + params.put("include", "values: \"assets\" to include scripts and stylesheets associated with the widget; \"markup\" to include the markup. " + + "\"markup\" is default value, so does not need to be specified."); + map.put("params", params); + + List examples = new ArrayList(); + examples.add("<@" + name + " name=\"login\" /> (use in body and page templates where markup should be inserted)"); + examples.add("<@" + name + " name=\"login\" include=\"markup\" /> (same as example 1)"); + examples.add("<@" + name + " name=\"login\" include=\"assets\" /> (use at top of page template to get scripts and stylesheets inserted into the <head> element)"); + + map.put("examples", examples); + + return mergeToHelpTemplate(map, env); + } } 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 435434432..a666b499a 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 @@ -59,8 +59,7 @@ public class DumpDirective extends BaseTemplateDirectiveModel { helper.writeDump("dump.ftl", map, var); } - - + public String help(Environment env) { Map map = new HashMap();