org.opencms.frontend.templateone.modules
Class CmsTemplateModules

java.lang.Object
  extended by org.opencms.jsp.CmsJspBean
      extended by org.opencms.jsp.CmsJspActionElement
          extended by org.opencms.frontend.templateone.CmsTemplateBase
              extended by org.opencms.frontend.templateone.modules.CmsTemplateModules

public class CmsTemplateModules
extends CmsTemplateBase

A helper bean for the template one modules.

Provides methods to create list views with category browsing and convenience methods to display date values and links.

Since:
6.0.0

Field Summary
static java.lang.String PARAM_CATEGORYFOLDER
          Request parameter name for the category folder.
static java.lang.String PARAM_COLLECTOR
          Request parameter name for the collector.
static java.lang.String PARAM_COUNT
          Request parameter name for the list count.
static java.lang.String PARAM_ELEMENTCOUNT
          Request parameter name maximum number of elements to show.
static java.lang.String PARAM_FOLDER
          Request parameter name for the xmlcontent folder.
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase
ATTRIBUTE_ORIGINAL_URI
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsTemplateModules(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 
Method Summary
 java.lang.String buildHtmlNavBreadcrumb(java.lang.String separator)
          Creates a html breadcrumb navigation.
 java.lang.String buildHtmlNavList(int resourceTypeId, java.lang.String attrs)
          Creates a html <li> list of all folders inside the current folder.
 java.lang.String buildHtmlNavList(java.lang.String resourceTypeName, java.lang.String attrs)
          Creates a html <li> list of all folders inside the current folder.
 java.lang.String getAnchor(java.lang.String hrefAttrib, java.lang.String descrAttrib, java.lang.String targetAttrib)
          Creates a HTML anchor from the values of three page context attribute names.
 java.lang.String getCategoryFolder()
          Returns the URI of the currently displayed category folder.
 int getResourceCount(java.lang.String foldername, int resourceTypeId)
          Returns the number of resources with a given resource type inside a folder.
 int getResourceCount(java.lang.String foldername, java.lang.String resourceTypeName)
          Returns the number of resources with a given resource type inside a folder.
 boolean hasCategoryFolders()
          Returns true if the currently displayed folder contains subfolders which are used as category folders.
 boolean isSameDate(java.lang.String startDateAttrib, java.lang.String endDateAttrib)
          Checks if two dates in the page context attributes have the same date and differ only from their time.
 void setDate(java.lang.String dateAttrib)
          Saves a Date object in the page context that was created from the value of a specified page context attribute.
 boolean showNavBreadCrumb()
          Returns true if the bread crumb navigation should be shown.
 
Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBase
getOriginalUri, initUri, isUriChanged
 
Methods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user
 
Methods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_CATEGORYFOLDER

public static final java.lang.String PARAM_CATEGORYFOLDER
Request parameter name for the category folder.

See Also:
Constant Field Values

PARAM_COLLECTOR

public static final java.lang.String PARAM_COLLECTOR
Request parameter name for the collector.

See Also:
Constant Field Values

PARAM_COUNT

public static final java.lang.String PARAM_COUNT
Request parameter name for the list count.

See Also:
Constant Field Values

PARAM_ELEMENTCOUNT

public static final java.lang.String PARAM_ELEMENTCOUNT
Request parameter name maximum number of elements to show.

See Also:
Constant Field Values

PARAM_FOLDER

public static final java.lang.String PARAM_FOLDER
Request parameter name for the xmlcontent folder.

See Also:
Constant Field Values
Constructor Detail

CmsTemplateModules

public CmsTemplateModules(javax.servlet.jsp.PageContext context,
                          javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res)
See Also:
CmsJspActionElement.CmsJspActionElement(PageContext, HttpServletRequest, HttpServletResponse)
Method Detail

buildHtmlNavBreadcrumb

public java.lang.String buildHtmlNavBreadcrumb(java.lang.String separator)
Creates a html breadcrumb navigation.

Instead of the NavText properties the title properties are used as anchor texts in this breadcrumb navigation! The navigation starts from a folder as specified in the request parameter "folder" and goes to the folder specified in the request parameter "categoryfolder".

Parameters:
separator - a String to separate the anchors in the breadcrumb navigation
Returns:
the html for the breadcrumb navigation

buildHtmlNavList

public java.lang.String buildHtmlNavList(int resourceTypeId,
                                         java.lang.String attrs)
                                  throws org.opencms.main.CmsException
Creates a html <li> list of all folders inside the current folder.

Additionally, behind each folder the number of resources of a specified resource type gets listed.

Parameters:
resourceTypeId - the resource type to count resources inside folders
attrs - optional html attributes to use in the <ul> tag
Returns:
a html <li> list of all folders inside the current folder
Throws:
org.opencms.main.CmsException - if something goes wrong

buildHtmlNavList

public java.lang.String buildHtmlNavList(java.lang.String resourceTypeName,
                                         java.lang.String attrs)
                                  throws org.opencms.main.CmsException
Creates a html <li> list of all folders inside the current folder.

Additionally, behind each folder the number of resources of a specified resource type gets listed.

Parameters:
resourceTypeName - the resource type name to count resources inside folders
attrs - optional html attributes to use in the <ul> tag
Returns:
a html <li> list of all folders inside the current folder
Throws:
org.opencms.main.CmsException - if something goes wrong

getAnchor

public java.lang.String getAnchor(java.lang.String hrefAttrib,
                                  java.lang.String descrAttrib,
                                  java.lang.String targetAttrib)
Creates a HTML anchor from the values of three page context attribute names.

Parameters:
hrefAttrib - the name of the page context attribute containing the link URL
descrAttrib - the name of the page context attribute containing the link description
targetAttrib - the name of the page context attribute containing the link target
Returns:
an HTML anchor

getCategoryFolder

public java.lang.String getCategoryFolder()
Returns the URI of the currently displayed category folder.

Returns:
the URI of the currently displayed category folder

getResourceCount

public int getResourceCount(java.lang.String foldername,
                            int resourceTypeId)
Returns the number of resources with a given resource type inside a folder.

Parameters:
foldername - the folder to read resources
resourceTypeId - the desired resource type ID
Returns:
the number of resources

getResourceCount

public int getResourceCount(java.lang.String foldername,
                            java.lang.String resourceTypeName)
Returns the number of resources with a given resource type inside a folder.

Parameters:
foldername - the folder to read resources
resourceTypeName - the desired resource type name
Returns:
the number of resources

hasCategoryFolders

public boolean hasCategoryFolders()
Returns true if the currently displayed folder contains subfolders which are used as category folders.

This method has to be called after the method buildHtmlNavList(int, String).

Returns:
true if the currently displayed folder contains subfolders which are used as category folders

isSameDate

public boolean isSameDate(java.lang.String startDateAttrib,
                          java.lang.String endDateAttrib)
Checks if two dates in the page context attributes have the same date and differ only from their time.

Parameters:
startDateAttrib - the name of the page context attribute containing the start date string
endDateAttrib - the name of the page context attribute containing the end date string
Returns:
true if the two dates differ only in time, otherwise false

setDate

public void setDate(java.lang.String dateAttrib)
Saves a Date object in the page context that was created from the value of a specified page context attribute.

Parameters:
dateAttrib - the name of the page context attribute containing the date string

showNavBreadCrumb

public boolean showNavBreadCrumb()
Returns true if the bread crumb navigation should be shown.

This method has to be called after the method buildHtmlNavList(int, String).

Returns:
true if the bread crumb navigation should be shown