Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.roller.presentation.velocity
Class Macros  view Macros download Macros.java

java.lang.Object
  extended byorg.roller.presentation.velocity.Macros

public class Macros
extends java.lang.Object

Provides the macros object that is available to Roller templates and weblog entries.


Field Summary
static int MAX_RECURSION_DEPTH
          Maximum depth of recursion for includePage and showWeblogEntry calls
protected static java.lang.ThreadLocal mEntriesDayTLS
          Keep track of each thread's recursive depth in showWeblogEntries(s
protected static java.lang.ThreadLocal mEntriesTLS
          Keep track of each thread's recursive depth in showWeblogEntries(s
protected static java.lang.ThreadLocal mIncludePageTLS
          Keep track of each thread's recursive depth in includePage().
private static org.apache.commons.logging.Log mLogger
           
protected  javax.servlet.jsp.PageContext mPageContext
           
protected  PageHelper mPageHelper
           
 
Constructor Summary
Macros(javax.servlet.jsp.PageContext ctx, PageHelper helper)
          Construts a macros object for a JSP page context.
 
Method Summary
static java.lang.String escapeHTML(java.lang.String s)
          Escape all characters that need to be escaped for HTML.
 java.lang.String formatCurrentDate(java.lang.String pattern)
          Returns the current date formatted according to the specified pattern.
 java.lang.String formatUpdateTime(java.util.ArrayList weblogEntries, java.lang.String pattern)
          Returns most recent update time of collection of weblog entries using the specified pattern.
protected  org.roller.presentation.RollerRequest getRollerRequest()
          Get the Roller request object associated with this instance
 java.util.Date getUpdateTime(java.util.ArrayList weblogEntries)
          Returns most recent update time of collection of weblog entries.
 org.roller.pojos.UserData getUser()
          Get UserData object.
 org.roller.pojos.WebsiteData getWebsite()
          Get WebsiteDataEx object.
 java.lang.String includePage(java.lang.String pageName)
          Expand macros in specified page and include the results in this page.
static java.lang.String removeAndEscapeHTML(java.lang.String s)
          Run both removeHTML and escapeHTML on a string.
static java.lang.String removeHTML(java.lang.String s)
          Remove occurences of HTML from a string.
 java.lang.String showAllNewsfeeds(boolean desc, int max)
          Show all newsfeeds.
 java.lang.String showAllNewsfeeds(boolean desc, int max, boolean expandingFolder)
          Show all newsfeeds with expanding folder option.
 java.lang.String showBigWeblogCalendar()
          Display big weblog calendar, well suited for an archive page.
 java.lang.String showBookmarks(java.lang.String folderName, boolean showFolderName)
          Display bookmarks in specified folder using specified title.
 java.lang.String showBookmarks(java.lang.String folderName, boolean showFolderName, boolean expandingFolder)
          Display bookmarks in specified folder as an expandable link.
 java.lang.String showBookmarks(java.lang.String folderName, java.lang.String title)
          Display bookmarks in specified folder using specified title.
 java.lang.String showEditorNavBar(boolean vertical)
          Show the Roller Editor menu as a navigation bar.
 java.lang.String showImage(java.lang.String imageUrl, java.lang.String linkUrl, java.lang.String alt, int border, java.lang.String halign, java.lang.String valign)
          Shows HTML for an image in user's resource directory.
 java.lang.String showImagePath()
          Gets path to images directory on your Roller server.
 java.lang.String showNavBar(boolean vertical)
          Show navigation links for pages that are not hidden.
 java.lang.String showNavBar(boolean vertical, java.lang.String delimiter)
          Show navigation links for pages that are not hidden, separated by a specified delimeter.
 java.lang.String showNewsfeed(java.lang.String name, boolean desc, int max)
          Show one newsfeed.
 java.lang.String showNewsfeed(java.lang.String name, boolean desc, int max, boolean expandingFolder)
          Show one newsfeed, with expanding folder option.
 java.lang.String showPageDescription()
          Return the description of the current Roller page being processed.
 java.lang.String showPageName()
          Return the title of the current Roller page being processed.
 java.lang.String showPageUpdateTime()
          Return the updateTime of the current Roller page being processed.
 java.lang.String showReferers()
          Show list of links to today's biggest referers.
 java.lang.String showReferers(int max)
          Show list of links to today's biggest referers.
 java.lang.String showReferers(int max, int maxWidth)
          Show list of links to today's biggest referers.
 java.lang.String showResourceImage(java.lang.String fileName, java.lang.String linkUrl, java.lang.String alt, int border, java.lang.String halign, java.lang.String valign)
          Shows HTML for an image in user's resource directory.
 java.lang.String showResourcePath()
          Gets path to your /resources directory, where you may have uploaded files.
 java.lang.String showRSSAutodiscoveryLink()
          Show RSS auto-discovery element.
 java.lang.String showRSSBadge()
          Show RSS badge with link to your main RSS feed.
 java.lang.String showRSSLinks()
          Show a list of links to each of your RSS feeds.
 java.lang.String showThemeImage(java.lang.String theme, java.lang.String imageName)
          Display a theme image.
 java.lang.String showThemeImagePath(java.lang.String theme, java.lang.String imageName)
          This is a convenience method to calculate the path to a theme image.
 java.lang.String showThemePath(java.lang.String theme)
          This is a convenience method to calculate the path to a theme.
 java.lang.String showThemeScript(java.lang.String theme, java.lang.String scriptFile)
          Return the full HTML to use a scriptFile, for example:
 java.lang.String showThemeScriptPath(java.lang.String theme, java.lang.String scriptFile)
          Return the path to a theme's scripts directory.
 java.lang.String showThemeStyle(java.lang.String theme, java.lang.String stylesheet, boolean useImport)
          Return HTML for referencing a theme.
 java.lang.String showThemeStyleImport(java.lang.String theme, java.lang.String stylesheet)
          Convenience macro to import a stylesheet using the import statement.
 java.lang.String showThemeStylePath(java.lang.String theme, java.lang.String stylesheet)
          Return the path to a theme's styles directory.
 java.lang.String showVersion()
          Version number of Roller.
 java.lang.String showWeblogCalendar()
          Display weblog calendar.
 java.lang.String showWeblogCalendar(boolean big)
          Weblog calendar display implementation.
 java.lang.String showWeblogCategoryChooser()
          Show a list of links to each of your weblog categores.
 java.lang.String showWeblogEntries()
          Show weblog enties using the day template specified in your site settings.
 java.lang.String showWeblogEntries(int maxEntries)
          Show weblog enties using the day template specified in your site settings.
 java.lang.String showWeblogEntries(java.lang.String dayTemplate)
          Show most recent 15 weblog enties using specified day template.
 java.lang.String showWeblogEntries(java.lang.String dayTemplate, int maxEntries)
          Show weblog enties using specified day template.
 java.lang.String showWebsiteDescription()
          Website description.
 java.lang.String showWebsiteTitle()
          Title of your website.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLogger

private static org.apache.commons.logging.Log mLogger

mPageContext

protected javax.servlet.jsp.PageContext mPageContext

mPageHelper

protected PageHelper mPageHelper

MAX_RECURSION_DEPTH

public static final int MAX_RECURSION_DEPTH
Maximum depth of recursion for includePage and showWeblogEntry calls

See Also:
Constant Field Values

mIncludePageTLS

protected static java.lang.ThreadLocal mIncludePageTLS
Keep track of each thread's recursive depth in includePage().


mEntriesTLS

protected static java.lang.ThreadLocal mEntriesTLS
Keep track of each thread's recursive depth in showWeblogEntries(s


mEntriesDayTLS

protected static java.lang.ThreadLocal mEntriesDayTLS
Keep track of each thread's recursive depth in showWeblogEntries(s

Constructor Detail

Macros

public Macros(javax.servlet.jsp.PageContext ctx,
              PageHelper helper)
Construts a macros object for a JSP page context.

Method Detail

getRollerRequest

protected org.roller.presentation.RollerRequest getRollerRequest()
Get the Roller request object associated with this instance


formatCurrentDate

public java.lang.String formatCurrentDate(java.lang.String pattern)
Returns the current date formatted according to the specified pattern.


formatUpdateTime

public java.lang.String formatUpdateTime(java.util.ArrayList weblogEntries,
                                         java.lang.String pattern)
Returns most recent update time of collection of weblog entries using the specified pattern.


getUpdateTime

public java.util.Date getUpdateTime(java.util.ArrayList weblogEntries)
Returns most recent update time of collection of weblog entries.


showVersion

public java.lang.String showVersion()
Version number of Roller.


showWebsiteTitle

public java.lang.String showWebsiteTitle()
Title of your website.


showWebsiteDescription

public java.lang.String showWebsiteDescription()
Website description.


showNavBar

public java.lang.String showNavBar(boolean vertical)
Show navigation links for pages that are not hidden.


showNavBar

public java.lang.String showNavBar(boolean vertical,
                                   java.lang.String delimiter)
Show navigation links for pages that are not hidden, separated by a specified delimeter.


showEditorNavBar

public java.lang.String showEditorNavBar(boolean vertical)
Show the Roller Editor menu as a navigation bar. specified delimeter.


showBookmarks

public java.lang.String showBookmarks(java.lang.String folderName,
                                      java.lang.String title)
Display bookmarks in specified folder using specified title.


showBookmarks

public java.lang.String showBookmarks(java.lang.String folderName,
                                      boolean showFolderName)
Display bookmarks in specified folder using specified title.


showBookmarks

public java.lang.String showBookmarks(java.lang.String folderName,
                                      boolean showFolderName,
                                      boolean expandingFolder)
Display bookmarks in specified folder as an expandable link.


showAllNewsfeeds

public java.lang.String showAllNewsfeeds(boolean desc,
                                         int max)
Show all newsfeeds.


showAllNewsfeeds

public java.lang.String showAllNewsfeeds(boolean desc,
                                         int max,
                                         boolean expandingFolder)
Show all newsfeeds with expanding folder option.


showNewsfeed

public java.lang.String showNewsfeed(java.lang.String name,
                                     boolean desc,
                                     int max)
Show one newsfeed.


showNewsfeed

public java.lang.String showNewsfeed(java.lang.String name,
                                     boolean desc,
                                     int max,
                                     boolean expandingFolder)
Show one newsfeed, with expanding folder option.


getUser

public org.roller.pojos.UserData getUser()
Get UserData object.


getWebsite

public org.roller.pojos.WebsiteData getWebsite()
Get WebsiteDataEx object.


showWeblogEntries

public java.lang.String showWeblogEntries()
Show weblog enties using the day template specified in your site settings.


showWeblogEntries

public java.lang.String showWeblogEntries(int maxEntries)
Show weblog enties using the day template specified in your site settings.


showWeblogEntries

public java.lang.String showWeblogEntries(java.lang.String dayTemplate)
Show most recent 15 weblog enties using specified day template.


showWeblogEntries

public java.lang.String showWeblogEntries(java.lang.String dayTemplate,
                                          int maxEntries)
Show weblog enties using specified day template.


showWeblogCalendar

public java.lang.String showWeblogCalendar()
Display weblog calendar.


showBigWeblogCalendar

public java.lang.String showBigWeblogCalendar()
Display big weblog calendar, well suited for an archive page.


showWeblogCalendar

public java.lang.String showWeblogCalendar(boolean big)
Weblog calendar display implementation.


showWeblogCategoryChooser

public java.lang.String showWeblogCategoryChooser()
Show a list of links to each of your weblog categores.


showRSSLinks

public java.lang.String showRSSLinks()
Show a list of links to each of your RSS feeds.


showRSSAutodiscoveryLink

public java.lang.String showRSSAutodiscoveryLink()
Show RSS auto-discovery element.


showRSSBadge

public java.lang.String showRSSBadge()
Show RSS badge with link to your main RSS feed.


includePage

public java.lang.String includePage(java.lang.String pageName)
Expand macros in specified page and include the results in this page.


showResourceImage

public java.lang.String showResourceImage(java.lang.String fileName,
                                          java.lang.String linkUrl,
                                          java.lang.String alt,
                                          int border,
                                          java.lang.String halign,
                                          java.lang.String valign)
Shows HTML for an image in user's resource directory.


showImage

public java.lang.String showImage(java.lang.String imageUrl,
                                  java.lang.String linkUrl,
                                  java.lang.String alt,
                                  int border,
                                  java.lang.String halign,
                                  java.lang.String valign)
Shows HTML for an image in user's resource directory.


showImagePath

public java.lang.String showImagePath()
Gets path to images directory on your Roller server.


showResourcePath

public java.lang.String showResourcePath()
Gets path to your /resources directory, where you may have uploaded files.


showThemePath

public java.lang.String showThemePath(java.lang.String theme)
This is a convenience method to calculate the path to a theme. It basically adds a contextPath and the themes directory.


showThemeImagePath

public java.lang.String showThemeImagePath(java.lang.String theme,
                                           java.lang.String imageName)
This is a convenience method to calculate the path to a theme image.


showThemeImage

public java.lang.String showThemeImage(java.lang.String theme,
                                       java.lang.String imageName)
Display a theme image.


showThemeStylePath

public java.lang.String showThemeStylePath(java.lang.String theme,
                                           java.lang.String stylesheet)
Return the path to a theme's styles directory.


showThemeStyle

public java.lang.String showThemeStyle(java.lang.String theme,
                                       java.lang.String stylesheet,
                                       boolean useImport)
Return HTML for referencing a theme.


showThemeStyleImport

public java.lang.String showThemeStyleImport(java.lang.String theme,
                                             java.lang.String stylesheet)
Convenience macro to import a stylesheet using the import statement.


showThemeScriptPath

public java.lang.String showThemeScriptPath(java.lang.String theme,
                                            java.lang.String scriptFile)
Return the path to a theme's scripts directory.


showThemeScript

public java.lang.String showThemeScript(java.lang.String theme,
                                        java.lang.String scriptFile)
Return the full HTML to use a scriptFile, for example:
 .
 


showPageName

public java.lang.String showPageName()
Return the title of the current Roller page being processed.


showPageDescription

public java.lang.String showPageDescription()
Return the description of the current Roller page being processed.


showPageUpdateTime

public java.lang.String showPageUpdateTime()
Return the updateTime of the current Roller page being processed.


showReferers

public java.lang.String showReferers()
Show list of links to today's biggest referers. Shows up to up referers and limits each to 20 characters width.


showReferers

public java.lang.String showReferers(int max)
Show list of links to today's biggest referers. Shows up to up specified number referers and limits each to 20 characters width.


showReferers

public java.lang.String showReferers(int max,
                                     int maxWidth)
Show list of links to today's biggest referers. Shows up to up specified number referers and limits each to specified characters width.


removeHTML

public static java.lang.String removeHTML(java.lang.String s)
Remove occurences of HTML from a string. Does this by stripping out any text that exists between the characters "<" and ">".


escapeHTML

public static java.lang.String escapeHTML(java.lang.String s)
Escape all characters that need to be escaped for HTML.


removeAndEscapeHTML

public static java.lang.String removeAndEscapeHTML(java.lang.String s)
Run both removeHTML and escapeHTML on a string.