diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerSetup.java index 14f22dffb..e43637540 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerSetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerSetup.java @@ -64,7 +64,6 @@ public class FreeMarkerSetup implements ServletContextListener { try { cfg.setSetting("url_escaping_charset", "ISO-8859-1"); } catch (TemplateException e) { - // TODO Auto-generated catch block log.error("Error setting value for url_escaping_charset."); } diff --git a/webapp/web/templates/freemarker/lib/list.ftl b/webapp/web/templates/freemarker/lib/list.ftl index 40be53196..e5a75bb61 100644 --- a/webapp/web/templates/freemarker/lib/list.ftl +++ b/webapp/web/templates/freemarker/lib/list.ftl @@ -1,5 +1,39 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + <#-- Macro: firstLastList + + Output a sequence of
  • elements, adding classes "first" and "last" to first and last list elements, respectively. + Especially useful when the list elements are generated conditionally, to avoid complex tests for the presence/absence + of other list elements in order to assign these classes. + + Input should be a series of
  • elements. It is currently not supported for these
  • elements to contain nested +
  • elements. An
  • element may span multiple lines. + + Usage: + <@firstLastList> +
  • apples
  • +
  • bananas
  • +
  • oranges
  • + <@firstLastList> + + RY Consider rewriting in Java. Probably designers won't want to modify this. That would allow us to support + nested
  • elements. + +--> +<#macro firstLastList> + <#assign text> + <#nested> + + + <@processListItems text?matches("
  • .*?
  • ", "s") /> + + + +<#----------------------------------------------------------------------------> + +<#-- + Macro: firstLastListNested Output a sequence of
  • elements, adding classes "first" and "last" to first and last list elements, respectively. Especially useful when the list elements are generated conditionally, to avoid complex tests for the presence/absence @@ -9,31 +43,64 @@ Tolerates a delimiter following the last
  • element. + Unlike firstLastList, this macro can process
  • elements that contain other
  • elements, because the delimiters + indicate how to split the text. + Usage: - <@firstLastList> + <@firstLastListNested>
  • apples
  • ,
  • bananas
  • ,
  • oranges
  • - <@firstLastList> + <@firstLastListNested> - <@firstLastList delim="??"> + <@firstLastListNested delim="??">
  • apples, oranges
  • ??
  • bananas, lemons
  • ??
  • grapefruit, limes
  • - <@firstLastList> + <@firstLastListNested> + + <@firstLastListNested delim="??"> +
  • Books + +
  • , +
  • Magazines + +
  • + <@firstLastListNested> RY Consider rewriting in Java. Probably designers won't want to modify this. --> -<#macro firstLastList delim=","> +<#macro firstLastListNested delim=","> <#assign text> <#nested> - <#-- Strip out a list-final delimiter, else (unlike most languages) it results in an empty final array item. --> + <#-- Strip out a list-final delimiter, else (unlike most languages) it + results in an empty final array item. --> <#assign text = text?replace("${delim}\\s*$", "", "r")> - <#assign items = text?split(delim)> - + <@processListItems text?split(delim) /> + + + +<#----------------------------------------------------------------------------> + +<#-- + Macro: processListItems + + Given a list of
  • elements, adds class "first" to the first item and + "last" to the last item. The
  • elements must have already been put into + a list; this macro does not handle the raw text. Can be called from + firstLastList + +--> +<#macro processListItems items> <#list items as item> <#-- A FreeMarker loop variable cannot have its value modified, so we use a new variable. --> <#assign newItem = item?trim> @@ -63,6 +130,4 @@ -<#-----------------------------------------------------------------------------> - diff --git a/webapp/web/templates/freemarker/page/partials/footer.ftl b/webapp/web/templates/freemarker/page/partials/footer.ftl index 19f2be83c..61d0d5512 100644 --- a/webapp/web/templates/freemarker/page/partials/footer.ftl +++ b/webapp/web/templates/freemarker/page/partials/footer.ftl @@ -11,10 +11,7 @@ diff --git a/webapp/web/templates/freemarker/page/partials/identity.ftl b/webapp/web/templates/freemarker/page/partials/identity.ftl index d72ff9a44..dc0d2a05a 100644 --- a/webapp/web/templates/freemarker/page/partials/identity.ftl +++ b/webapp/web/templates/freemarker/page/partials/identity.ftl @@ -15,16 +15,13 @@ <#if loginName??>
  • Logged in as ${loginName} (Log out) -
  • , -
  • Site Admin
  • , + +
  • Site Admin
  • <#else> -
  • Log in
  • , +
  • Log in
  • -
  • About
  • , - <#if urls.contact??> -
  • Contact Us
  • - + <#include "subMenuLinks.ftl"> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/page/partials/subMenuLinks.ftl b/webapp/web/templates/freemarker/page/partials/subMenuLinks.ftl new file mode 100644 index 000000000..7c53d9553 --- /dev/null +++ b/webapp/web/templates/freemarker/page/partials/subMenuLinks.ftl @@ -0,0 +1,9 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- List of links that appear in submenus, like the header and footer. --> + +
  • About
  • +<#if urls.contact??> +
  • Contact Us
  • + +
  • Support
  • \ No newline at end of file