@Override
public final int doWikiStartTag()
throws IOException,
ProviderException
{
WikiEngine engine = m_wikiContext.getEngine();
JspWriter out = pageContext.getOut();
Calendar cal = Calendar.getInstance();
Calendar prevCal = Calendar.getInstance();
Calendar nextCal = Calendar.getInstance();
//
// Check if there is a parameter in the request to set the date.
//
String calendarDate = pageContext.getRequest().getParameter( "calendar.date" );
if( calendarDate == null )
{
calendarDate = pageContext.getRequest().getParameter( "weblog.startDate" );
}
if( calendarDate != null )
{
try
{
Date d = m_dateFormat.parse( calendarDate );
cal.setTime( d );
prevCal.setTime( d );
nextCal.setTime( d );
}
catch( ParseException e )
{
log.warn( "date format wrong: "+calendarDate );
}
}
cal.set( Calendar.DATE, 1 ); // First, set to first day of month
prevCal.set( Calendar.DATE, 1 );
nextCal.set( Calendar.DATE, 1 );
prevCal.add(Calendar.MONTH, -1); // Now move to first day of previous month
nextCal.add(Calendar.MONTH, 1); // Now move to first day of next month
out.write( "<table class=\"calendar\">\n" );
HttpServletRequest httpServletRequest = m_wikiContext.getHttpRequest();
String queryString = engine.safeGetQueryString( httpServletRequest );
out.write( "<tr>"+
getMonthNaviLink(prevCal,"<<", queryString)+
"<td colspan=5 class=\"month\">"+
getMonthLink( cal )+
"</td>"+