Description
There are actually two calendar plugins. The Calendar Filter plugin handles the filtering of blog entries based on the URL parameters, "year", "month", and "day". The Velocity Calendar plugin handles the ability to render a visual calendar component for use in the Velocity templates.
Installation and setup
In your /WEB-INF/classes/blojsom-plugins.xml file, add the following:
<bean id="calendar-filter" class="org.blojsom.plugin.calendar.CalendarFilterPlugin" init-method="init"
destroy-method="destroy">
<property name="fetcher">
<ref bean="fetcher"/>
</property>
</bean>
<bean id="calendar-gui" class="org.blojsom.plugin.calendar.VelocityCalendarPlugin" init-method="init"
destroy-method="destroy">
<property name="fetcher">
<ref bean="fetcher"/>
</property>
</bean>
You may then add "calendar-gui" to the beginning of a flavor-based plugin chain, and "calendar-filter" after the calendar GUI plugin.
Usage and URL Parameters
URL Parameters
The following table describes the URL parameters that the Calendar Filter plugin accepts and how they affect the entries that get displayed by your blog.
| URL parameter |
Default value |
Accepted values |
Usage |
| year |
|
Users can request to see blog entries that fall under a certain date range. The "year" parameter must be a valid 4-digit year. |
/blog/?year=2003 |
| month |
|
The "month" parameter must be used in conjunction with the "year" parameter. Users cannot request blog entries for a month by itself. |
/blog/?year=2003&month=2 |
| day |
|
The "day" parameter must be used in conjunction with the "year" and "month" parameters. Users cannot request blog entries for a day by itself. |
/blog/?year=2003&month=2&day=14 |
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| BLOJSOM_CALENDAR |
Output |
org.blojsom.plugin.calendar.BlogCalendar |
Calendar object to indicate on which days there are blog entries. This object is added by the org.blojsom.plugin.calendar.CalendarFilterPlugin |
| BLOJSOM_CALENDAR_VTLHELPER |
Output |
org.blojsom.plugin.calendar.VelocityHelper |
Helper class for creating the visual calendar output for Velocity, but this could also be used for JSPs as well. This object is added by the org.blojsom.plugin.calendar.VelocityCalendarPlugin |