Plugins by Scott Hurlbert

The CalendarListPlugin provides a view into a schedule of events. There are 3 available views--a list, a weekly calendar, and a monthly calendar. Views are generated from a 2-column table of events, date on the left, description on the right. The view selects events from the list which are between a given number of days in the past and a given number of days in the future and generates a colored display of those events.

This page of events: this page of events

generates this calendar:

This calendar

Using this plugin you can have a calendar of the the year's events, recording them as you discover them, and the plugin will display a list of the most recent and upcoming events.

The schedule pages uses wiki markup to build the schedule list. Currently the date format must be precise - exactly the date, or exactly the date, a space, and the time with leading zero if the hour is under 10. I'm working on making the formatting more flexible and the date/time entry lest strict. I'd also like to be able to show unscheduled events.

CalendarListPlugin depends heavily on CSS. It wraps every output item in a span or div with a classname. In order for this all to work, you must either get a calendar-specific CSS file integrated with jspwiki.css, or you must deploy a separate .css file in your JSPWiki package and specify it using plugin parameters (see below). If you don't do this, your calendar will not even have separator lines between days (though the LIST format does work reasonably well).

There are a lot of parameters, but most of them are optional. The line below shows the minimum you need. Remember you can add the com.hurlbert.jspwiki.plugin to your jspwiki.properties file to shorten the line further.

CalendarListPlugin syntax:#

[{INSERT com.hurlbert.jspwiki.plugin.CalendarList listpagename='MyEvents'}]

Parameters#

listpagename (mandatory)
This is the name of the wiki page containing the schedule events. The must be in a table, as described below.
format (optional)
Default: list
This defines the output format. Valid values are LIST, WEEKLY, or MONTHLY.
futuredays (optional)
Default: 3
This is the number of days of events to show on the output. futuredays=21 will show 3 weeks worth of events.
pastdays (optional)
Default: 1
This is the number of past days events. pastdays=7 will show a weeks worth of past events.
stylesheet (optional)
Path to a style sheet to include in the generated page. If you don't include this parameter, you must integrate the stylesheet containing your calendar styles with jspwiki.css or other main stylesheet in the template you're using. By specifying the stylesheet path relative to the JSPWiki root directory, you can avoid this problem. Drop your calendar stylesheet (several are included in the distribution) in the main JSPWiki deployment directory (e.g. same directory as "Wiki.jsp"), and specify the path with this item, e.g. "stylesheet=WhiteCalendar.css" (or "stylesheet=templates/default/WhiteCalendar.css").
stylename (mandatory)
This defines a prefix for all the css stylenames build in to the calendar. When the calendar renders, it generates html div blocks for almost all elements. Each of these is given a class with the stylename prefixed to it. This is so you can have multiple styles in your css stylesheets and still assign them seperately on your calendar pages. For example, one of the styles the calendar outputs is called prefix_TimedEventDesc. If you make the stylename parameter equal "myCal_" then the output for this style in the rendered HTML will be myCal_TimedEventDesc and if there is a matching style in your stylesheets, it will get applied.

Format of the schedule page (not the output page, the page holding the events). #

The schedule format is pretty strict right now. Build a page anyway you like, lines with the following format will be picked up and put in the schedule.
|02/01/04 03:00 PM|Superbowl
|02/02/04 08:00 PM|Antiques Roadshow SF
|02/09/04 08:00 PM|Antiques Roadshow SF
|02/29/04 05:00 PM|[The Oscars - 76th Annual|http://www.oscar.com]
|03/09/04 10:00 PM|The Shield, Season 3 premier

Using CalendarListPlugin#

Display a weekly calendar, with a header like this screenshot (Generated from these events)

%%( font-family: Arial; font-size: 60%; )
[{INSERT CalendarList listpagename='SVSchedule' pastdays='3' futuredays='35' format=WEEKLY stylename='PinkCal_'}]
%%

Display a simple list with the default coloring

[{INSERT com.hurlbert.jspwiki.plugin.CalendarList listpagename='SVSchedule'}]

Bugs, unfinished items.#

  • The date parsing is very strict. It currently generates a PluginException if the format is wrong. It should ignore or warn.
  • Items with no time show up as starting at 12:00 AM. I'd like to just have them sort to the top of the day and have no time, but until I can program someway to tell them apart from something that does start at 12:00 AM I'll leave this alone.

Some possible enhancements (feel free to add others)#

  • Add a calendar title parameter.
  • More layouts.
  • Move the defaults to the jspwiki.properties file.
  • Add categories to the events.
  • Add an option for hard coding the start and end dates. Currently, the calendar floats through time. I thought of this feature for creating things like a schedule of holidays, or in my case, the year in pictures. Since I already store most of my pictures on line, by date - why not display them as a calendar.

Enjoy - Scott Hurlbert


PS - Now that all that is out of the way, let me add a disclaimer. I have no freaking idea how to code like this! I seem to have a hard time making HTML generation clean. The code always seems to be getting in it's own way. So please, take this program with a grain of salt. I plan on cleaning it up here and there.

If you have any suggestions on how to write such a plugin with a better seperation of event handling vs HTML generation, please share. Thanks, Scott


Love this plugin, I use it on my News page to keep track of upcoming birthdays. I added:

time (optional)
Default: show time in a HH:MM format. time=NONE do not show the time. Good for tables with just events, like birthdays.
to stop the time from showing. (It's set up to do time='HH:MM' or time='HH' if the user wants some other time setup. Thanks again for the code!! -- FosterSchucker

Glad you like the plugin. Whenever I get back to it I'm reworking most of the formatting parameters to be CSS based. I'm glad you found the code useful. -- Scott


I am kinda new to wiki. I have two questions:

Where do the class files go? Web-inf\lib ? Do I change the text in the line to insert it at all and if so, how?

[{INSERT com.hurlbert.jspwiki.plugin.CalendarList listpagename='SVSchedule'}]
I have changed the listpagename to a wiki page I have created. Anything else?

This is what I see:

%%( font-family: Arial; font-size: 60%; ) 
Plugin insertion failed: Could not find plugin com.hurlbert.jspwiki.plugin.CalendarList %% 

Thanks -- Dave S

Hi Dave

I run several wikis from set of source code by having a common jar file (renamed to *.war of course) with the wiki code and setting the properties of each wiki to use the jar (the properties and content of each wiki are obviously not in the jar :-). Setting up multi wikis to share a jar is described here, MultipleWikis . So, in the case of a jar, the plugins go in the jar under the folder:

jspwiki\WEB-INF\classes\com\hurlbert\jspwiki\plugin

where "jspwiki" is the folder that gets made into the jar/war file - jspwiki.war.

However, if you're not running as a war file, then you would put the plugin in a folder called:

"WikiHome"\WEB-INF\classes\com\hurlbert\jspwiki\plugin

However, you can really put the file anywhere you want below ..\classes and then reference it in the insert command. For example:

[{INSERT com.wherever.someplace.anywhere.plugin.CalendarList ...}]

Remember that where ever you place it you can shorten the insert command by adding the path to the SearchPath in the jspwiki.properties file.

-- Scott Hurlbert


Thanks Scott. One important thing to note is that this Plugin requires the TodoListPlugin. -- Dave S

David, thanks for pointing this out. This is a bug. You are correct, the CalendarListPlugin currently depends on the TodoListPlugin, but that was not my intention. I'll fix it as soon as I post an update.

-- Thanks, Scott Hurlbert


The error message is saying it can not find the class file. You need to make sure that you have put the class so it can be found. In my case it's in the JSPWiki/WEB-INF/classes directory -- FosterSchucker


5/13/05 NT:
Here is a little tip: If you can't get the schedule to display, CHECK THE YEAR! :-)


06/19/06 Mike:
My plugin installation seems to work in LIST format only. When setting format to WEEKLY and pressing save, the web page hangs, displaying an empty screen. Does anyone have an idea what may be wrong? I really want to use nice display of calendar entries...


2007-23-07 Torben (Torben.Fojuth de.adp.com):
I have exactly the same Problemen. Has someone solved it in the meanwhile? Any kind of hint would be useful. :D


Q: And where should I put the stylesheets?

--AnonymousCoward, 03-Nov-2006


31/07/07 Rauly
Hi i have a proglem when install CalendarListPlugin, the error is:
Plugin insertion failed: class "com.hurlbert.jspwiki.plugin.CalendarList"'s signer information does not match signer information of other classes in the same package
Know some way to resolve it? thaks


Hi, I have the same problem as above when trying the 'weekly' format. Did anyone manage to solve this issue? Thanks a lot, Julien

--AnonymousCoward, 21-Nov-2007


Hi, Am interested in this plugin. Can u give me a jar file.My mail id d.ravikumar83@gmail.com I compiled the java code and got lot of errors.
I am having problems in the way the calendar is displayed. I don't see the borders for the calendar. Here is what I see...


I used the following event list....
\


I'm putted:
[{INSERT com.hurlbert.jspwiki.plugin.CalendarList listpagename='MyEvents'}]

And what I see it's

Plugin insertion failed: Plugin failed


calendars without dividing lines (as above) are caused by not including a stylesheet.

--Jerry Andrews, 11-Oct-2011 11:27

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
zip
CalendarListPlugin v2.zip.zip 11.6 kB 1 06-Jul-2006 14:13 24.4.113.204
jpg
CalendarListPlugin.JPG 75.2 kB 1 03-Feb-2004 12:42 24.4.112.168
zip
CalendarListPlugin.zip 29.8 kB 2 11-Oct-2011 19:53 Jerry Andrews version 3
jpg
SVSchedule.JPG 105.6 kB 1 03-Feb-2004 12:42 24.4.112.168
jpg
calendarplugin1.jpg 100.5 kB 1 08-Jun-2009 18:48 198.204.133.208
jpg
calendarplugin2.jpg 66.1 kB 1 08-Jun-2009 18:48 198.204.133.208
« This page (revision-83) was last changed on 11-Oct-2011 20:27 by Jerry Andrews