Use login widget on login page (committing files that got skipped in r6451). Add help() method to WidgetDirective.

This commit is contained in:
rjy7 2010-11-16 15:10:10 +00:00
parent 252edbe863
commit 9435d42a87
2 changed files with 32 additions and 3 deletions

View file

@ -5,6 +5,9 @@ package edu.cornell.mannlib.vitro.webapp.web.directives;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -90,5 +93,32 @@ public class WidgetDirective extends BaseTemplateDirectiveModel {
} }
public String help(Environment env) {
Map<String, Object> map = new HashMap<String, Object>();
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 &lt;head&gt; 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<String, String> params = new HashMap<String, String>();
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<String> examples = new ArrayList<String>();
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 &lt;head&gt; element)");
map.put("examples", examples);
return mergeToHelpTemplate(map, env);
}
} }

View file

@ -60,7 +60,6 @@ public class DumpDirective extends BaseTemplateDirectiveModel {
helper.writeDump("dump.ftl", map, var); helper.writeDump("dump.ftl", map, var);
} }
public String help(Environment env) { public String help(Environment env) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();