apache > cocoon
 
Font size:      

DateSelector in Cocoon (2.1 legacy document)

Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not yet been fully reviewed or moved to its new home.

DateSelector

NAMEdate
WHATThe DateSelector component is used to select appropriate sitemap processing depending on the current date, and time.
TYPESelector, Sitemap Component
BLOCKScratchpad
CLASSorg.apache.cocoon.selection.DateSelector
SINCECocoon 2.1
CACHEABLEnot applicable

Description

The DateSelector tests the current date, and time against the test attribute of the selectors when clause.

Usage

The DateSelector allows to define date, and time specific sitemap processing. This way Cocoon can do date, and time specific sitemap processing.

Sitemap pipeline examples

<map:select type="daytime">
  <map:when test="night">
    <!-- do something for night publishing -->
    <map:read src="resources/{2}-night.css" mime-type="text/css>
  </map:when>
  <map:when test="morning">
    <!-- do something for morning publishing -->
    <map:read src="resources/{2}-morning.css" mime-type="text/css>
  </map:when>
  ...
  <map:otherwise>
    <!-- define for completness, and if selecting fails due to errors -->
  </map:otherwise>
</map:select>

Sitemap component configuration example

The following snippet defines a DateSelector named daytime. A day is partioned into four daytime areas: night, morning, afternoon, and evening. These daytime names are used to define daytime specific pipeline processing for each daytime area.

<map:selectors default="browser">
  ...
  <map:selector type="daytime" src="org.apache.cocoon.selection.DateSelector">
    <before name="night" date="06:00:00" dateformat="HH:mm:ss"/>
    <before name="morning" date="12:00:00" dateformat="HH:mm:ss"/>
    <before name="afternoon" date="18:00:00" dateformat="HH:mm:ss"/>
    <before name="evening" date="23:59:59" dateformat="HH:mm:ss"/>
  </map:selector>
...
</map:selectors>

Configuration

Explain the sitemap selector configuration, options when declaring date selector

Setup

Explain the sitemap selector setup, ie options when using date selector

Effect on Object Model and Sitemap Parameters

Bugs/Caveats

Describe limitation, bugs of DateSelector

History

11-28-03: initial creation

See also

A general documentation about selectors is available at Matchers and Selectors.

Comments

add your comments