Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
CalendarExample.png 2.9 kB 1 20-Apr-2004 18:09 MDeichsel

This page (revision-17) was last changed on 09-Mar-2006 16:11 by  

This page was created on 26-Aug-2003 11:30 by FrancoisParlant

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 1 changed one line
!Question : How-to call dynamically the calendar, the name of the current page changing for each page ?
!Question : How-to make the Calendar to adapt to each blog page instead of staying fixed on the Main_blogentry?
At line 3 changed 7 lines
The calendar is really interesting to filter the blogs. But the weblog plugin allows any page to start a blog: if I start a blog inside a page named MyLog, all the entries will be named MyBlog_blogentry_DDMMyy_x. I'd like the calendar to change its parameters for each page.
At line 11 changed one line
But of course impossible to insert a "<wiki:" inside another "<wiki:" (well I guess).
OK, sorry for taking so long. I was initially going to say that it cannot be done, but then I realized that yes, it's quite doable. It basically just requires changing the "jspwiki.tld" file to have the following:
At line 13 changed 2 lines
Can someone tell me how to do this, I don't really master the jsp.
Note that for each attribute you will have to define the "rtexprvalue" to be "true". This has now been enabled for JSPWiki 2.1.60 onwards, so you don't have to change anything if you're tracking the CVS version.
At line 16 changed one line
It does add some performance penalty, though.
At line 30 added 16 lines
After the change, you can do it like this:
<% String pagename = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute("jspwiki.context",
PageContext.REQUEST_SCOPE)).getPage().getName(); %>
<wiki:Calendar pageformat="<%="'"+pagename+"_blogentry_'ddMMyy'_1'"%>"
monthurlformat="<%="'Wiki.jsp?page="+pagename+"&weblog.startDate='ddMMyy'&weblog.days=%d'"%>" />
Yup. It's extraordinarily ugly, but it works. The problem is that for some really, really strange reason (at least with JakartaTomcat 4.1) it is impossible to specify a tag within the ' -signs. It all works fine if you skip the single quotes, but those are required for the ~SimpleDateFormat.
-- JanneJalkanen
Thank you for this nice bit of code which works really great (without any performance change, and I'm running a 233mhz) REALLY COOL.--FrancoisParlant
At line 53 added one line
At line 26 changed one line
And if yes, how-to insert a $pagename variable inside it (see previous question)?
No, this is not possible, as the CalendarTag is a JSP Tag, not a plugin. It is meant for building your template, not for inserting on a page.
At line 28 changed 2 lines
{{{[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'[{$pagename}]_blogentry_'ddMMyy'_1'";
There is actually a (good) reason for it being a tag instead of a plugin, but I just can't remember it right now.
At line 31 changed one line
or inside a jsp:
At line 33 changed 3 lines
{{{[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'<%=pagereq%>_blogentry_'ddMMyy'_1'";
Apart from this (good) reason I would prefer a ~CalendarPlugin so the same JSPWiki instance could be used as a Wiki and as a Weblog. Now if they are integrated I should decide between show the calendar in whe Wiki pages (something weird) or miss the Calendar in the blogs.
At line 37 changed one line
{{{[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'<wiki:variable var="pagename">_blogentry_'ddMMyy'_1'";
In 2.2 you can do it by saying [[{SET template='weblogtemplate'}] on your weblog page. This allows you to have different templates: one with the calendar and one without the calendar (for normal wiki pages). You can also do the same thing with stylesheets...
-- JanneJalkanen
!I'd like to use the Calendar not only for blogs
-- [MDeichsel]\\
In my wiki-installation I would like to add 'blog-entries' to days in the past or in the future (like a normal calendar) not only for the current day. I know that you can do this by editing the URL but I was looking for a more convenient method.
For this reason I've done some minor modifications:
* remove the condition that restricts the calendar-navigation to the current date.
* changed the implementation of ''getDayLink()''. The main goal of this change is that days without existing blog-entry are rendered using an anchor-tag whose ''onDblClick''-event is used to switch to the edit-view for the blog-entry of this date. So a double-click will create a new blog-entry for the relevant day.
private String getDayLink(Calendar day)
WikiEngine engine = m_wikiContext.getEngine();
StringBuffer result = new StringBuffer();
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
Date today = cal.getTime();
cal.add(Calendar.DAY_OF_MONTH, 1);
Date tomorrow = cal.getTime();
String pagename =
m_pageFormat != null ? m_pageFormat.format(day.getTime()) : null;
String url =
m_urlFormat != null ? m_urlFormat.format(day.getTime()) : null;
StringBuffer sb = new StringBuffer();
int weekDay = day.get(Calendar.DAY_OF_WEEK);
if (weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY)
boolean isToday =
!day.getTime().before(today) && day.getTime().before(tomorrow);
if (isToday)
result.append("<td class=\"");
if ((pagename != null && engine.pageExists(pagename)) || url != null)
if (pagename != null && engine.pageExists(pagename))
if (url != null)
result.append(" href=\"").append(url).append("\"");
result.append(" href=\"").append(
else if (pagename == null && url != null)
result.append(" href=\"").append(url).append("\"");
if (pagename != null)
.append(" onDblClick=\"javascript:document.location.replace('")
return result.toString();
At line 154 added 3 lines
* Add some styles to ''jsswiki.css''
/* ----- For the CalendarTag -----------------------------*/
At line 158 added 6 lines
TABLE.calendar {
padding: 4;
spacing: 4;
color: white;
text-align: center;
At line 41 changed one line
TD.month { font-weight: bold; }
At line 167 added 15 lines
TD.weekdays { font-size: 85%; }
TD.days { background: #9999aa; }
TD.daysWeekend { background: #ccccee; }
TD.daysToday { background: #9999aa; border-style: solid; border-color: #dd2222;}
TD.daysWeekendToday { background: #ccccee; border-style: solid; border-color: #dd2222;}
TD.daysLink { background: #dddddd; }
TD.daysWeekendLink { background: white; }
TD.daysTodayLink { background: #dddddd; border-style: solid; border-color: #dd2222;}
TD.daysWeekendTodayLink { background: white; border-style: solid; border-color: #dd2222;}
TD.othermonth { color: #707070;
font-size: 75%; }
At line 183 added 3 lines
!Question: How can i get the calendar to show >> to next month.
When viewing the current month, I would like the calendar to show << and >> but currently it only has a link to past dates (Imagine today is April & look at the atached png). \\
At line 187 added one line
Version Date Modified Size Author Changes ... Change note
17 09-Mar-2006 16:11 7.147 kB to previous
16 09-Mar-2006 16:10 7.093 kB to previous | to last
15 15-Mar-2005 23:29 6.889 kB to previous | to last
14 15-Mar-2005 23:26 6.965 kB to previous | to last
13 21-Apr-2004 13:44 6.889 kB MDeichsel to previous | to last
12 20-Apr-2004 18:11 6.871 kB MDeichsel to previous | to last
11 20-Apr-2004 18:09 6.858 kB MDeichsel to previous | to last
10 20-Apr-2004 18:07 6.833 kB MDeichsel to previous | to last
9 18-Sep-2003 12:27 3.242 kB JanneJalkanen to previous | to last
8 17-Sep-2003 23:54 2.958 kB JoseMRus to previous | to last
7 27-Aug-2003 21:26 2.668 kB FrancoisParlant to previous | to last
6 26-Aug-2003 22:22 3.645 kB JanneJalkanen to previous | to last
5 26-Aug-2003 22:21 3.634 kB JanneJalkanen to previous | to last
4 26-Aug-2003 15:13 1.872 kB JanneJalkanen to previous | to last
3 26-Aug-2003 11:39 1.59 kB FrancoisParlant to previous | to last
2 26-Aug-2003 11:35 1.32 kB FrancoisParlant to previous | to last
1 26-Aug-2003 11:30 1.12 kB FrancoisParlant to last
« This page (revision-17) was last changed on 09-Mar-2006 16:11 by