calendar1Add my vote for this tag date_time1Add my vote for this tag create new tag
, view all tags

CalendarPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on CalendarPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please file bug reports in the CalendarPlugin bug database.
• See CalendarPluginDevArchive for older discussions.

Development discussion for CalendarPlugin

-- AndreaSterbini - 27 Jan 2001

Should this format work:

  • L Fri - [[RedbournRecreationCentre][Recreation Centre]] Social events last Friday of the month

The documentation says that:

  • L Mon May - The last Monday of May

I just want the last Monday of every month.


  • (I removed the pre tags, FF did not display anything for some reason -- PTh)

-- MartinCleaver - 06 Jan 2006


I just installed the plugin and have gone over the install instructions several times. Still cant get a calendar to display. Is there a debug or a help section for the install?

-- AsimKhan - 16 Jan 2006

Did you ensure that CPAN:HTML::CalendarMonthSimple and CPAN:Date::Calc are installed and accessible by your web server? Please post a full support question at Support. This topic is for development issues (enhancements, bugfixes, ...) only. Thanks.

-- FranzJosefSilli - 16 Jan 2006

I have been thinking about how to make this plugin look more professional (IMHO the current table based rendering is quite ugly), and it seems to me that we are not using the JS calendar to its fullest potential. The utility has all the tools (see demo) to be able to highlight specific dates (e.g. days that have appointments) and upon clicking a date show additional information in a separate div.

The way this can be used is to display a flat calendar with the focus on the current date, and the associated appointments somewhere (e.g. right below the calendar). Then the user can click on other dates to see what's coming up.

All that is missing is a way to convert the calendar items into a JS data-structure that can be passed to the JScalendar.

Any thoughts?

-- PankajPant - 23 Jan 2006

I tried out the 1.018 with Dakar but all the descitions are empty (also the day). Only the days witout a description are seen. Now i go back 1.017 and all seems to be well.

-- GuentherFischer - 04 Feb 2006

To the Plugin maintainer: HandlingCairoDakarPluginDifferences has some tips to keep Plugins compatible with Cairo and Dakar codebase.

-- PeterThoeny - 08 Feb 2006

Our users have asked if will be possible with a later version of this plugin, to click on a date and make an entry rather than adding a line manually to a list of entries.

-- PeterJones - 08 Feb 2006

I've been promising an update to the plugin and finally did so today. I tried to clean up the documentation to describe what the plugin actually does; there have been several comments in the past that it doesn't seem to behave the way the documentation says it does.

MartinCleaver: Regarding a specification of "L Fri" to get the last Friday of every month. That isn't within the specification of monthly repeating events, but I don't see why it couldn't be. I'll look into that.

PankajPant: Interesting idea on using JSCalendar. I've thought about it a little, but haven't settled in my mind how to go about it. Do you have a prototype implementation?

GuentherFischer: I'm not sure why you are seeing blank descriptions. If this version does not clear up the problem, perhaps you could post a short example of that shows the problem. I've run this version on both Cairo and Dakar (4.0.0 & 4.0.1) and it seems to work on all of them.

PeterJones: I've briefly thought about doing some sort of CommentPlugin approach to entering dates. If you do something along that line (or some other approach), please share it here.

-- DavidBright - 08 Feb 2006

David, thanks for fixing the Plugin and publishing the new version. The version info looks incorrect. Shouldn't that be 1.024 since it is Cairo compatible?

-- PeterThoeny - 09 Feb 2006

1.024? I just incremented the version number from the previous. Is there some scheme to the version numbers for indicating TWiki version compatibility? If so, I missed it. I'm happy to change something if it needs it; just let me know.

-- DavidBright - 09 Feb 2006

There is a note on the CalendarPlugin page that the plugin does not honor topic permissions. Can anyone think of any reason not to do so? It would seem to be a fairly trivial modification.

-- DavidBright - 09 Feb 2006

David, the JS calendar can take an onSelect() function. For instance, on the demo page, this is defined as:

function flatSelected(cal, date) {
  var el = document.getElementById("preview");
  el.innerHTML = date;

What this does is show the selected date in the "preview" area (below the flat calendar). All CalendarPlugin needs to do is to generate this function on the fly, based on the event information. It will need to be restricted to a certain duration (e.g. the current month or current-1 to current+1 month) to prevent recurring events from making this an infinite list. Then let the JS calendar do the rest.

-- PankajPant - 09 Feb 2006

TWiki Dependency: $TWiki::Plugins::VERSION 1.1 indicates that this Plugin requires Dakar. If you set this to $TWiki::Plugins::VERSION 1.024 it indicates that this Plugin also works for Cairo.

-- PeterThoeny - 09 Feb 2006

Ah, the Plugins version! OK, I've changed that in svn and I'll update the topic soon. Actually, looks like the plugin can support the Plugins API back to at least 1.010, so that's what I'll put as the dependency.

-- DavidBright - 09 Feb 2006

I've implemented the suggestion by MartinCleaver to allow a monthly repeat to specify "last x of the month" where x is a day name. The new version has been posted on CalendarPlugin.

-- DavidBright - 11 Feb 2006

Hm, I'm wondering how difficult it would be to design a form (and implement it for example as template for the CommentPlugin) that allows an even more user friendly adding of events for this plugin.

recurrent_events.gif recurrent_events_web.gif

As can be seen above this can't be that difficult, as even M$ can do this. wink I'm pretty sure we could do this more KISS-like.

-- FranzJosefSilli - 11 Feb 2006

Aren't there any standards (XML or something) out there for easier exchange between different event management systems? Why not support (at least) one format (e.g. iCal) for import/export purposes?

-- FranzJosefSilli - 11 Feb 2006

David, maybe you should add an intuitive example for the formatting of a multi-day event and the new multi-months per line feature.

BTW: What happened to the multi-time-events per day enhancement, proposed by BradDixon? He even had implemented a script that triggered local alarms based on events in a wiki calendar (see patches attached below).

-- FranzJosefSilli - 11 Feb 2006

TWiki:Plugins.CommentPlugin example - an early draft of something I'm messing around with. In your TWiki.CommentsTmpl (or better, the suggested UserTemplates topic so it doesn't get overwritten):

<hr width="60%"/> Date: <input %DISABLED% type="text" size="12" name="comment_date" value="01 Jan 2006" /> Event: <input %DISABLED% type="text" size="40" name="comment_text" value="Enter event description here." /> <input %DISABLED% type="submit" value="%button|Add%" />   event <hr width="90%"/>
and then
%POS:BEFORE%   * %URLPARAM{"comment_date"}% - %URLPARAM{"comment_text" }%
Then put %COMMENT{type="calendar"}% wherever and it appends calendar lines. This isn't very flash at the moment, would be nice to use date-picker etc.

-- MarcusLeonard - 18 Feb 2006

Check out CalendarPluginFormTest for an example form (modeled on Outlook's appt. form) for creating events. Note that this is currently not functional, as it needs to be converted into a comment template. However, the form itself is more or less complete.

Marcus, sorry if this duplicates your effort.

-- PankajPant - 23 Feb 2006

The multidayformat didn't work properly for me when used in a list showing the next x days - middle-unseen and last-unseen would not be properly used. This is because CalendarPlugin.pm first collects all events for the current month (i.e., starting at day 1), and only later decides what to display. If an event already started , say, on the 5th of this month, the seen variable would thus claim it had been seen, even though my list started today, say, on the 8th.

My attached CalendarPlugin.pm.diff fixes this by starting the event collection on listStartDay if there is such a thing defined, or on the 1st if not. Works for me!

-- MarcLangheinrich - 06 Mar 2006

Thanks, Marc! I've incorporated the patch into SVN 9113 (see Item1794) and uploaded the new version to CalendarPlugin.

-- DavidBright - 06 Mar 2006

This topic is getting way to long. Some older content should be moved to CalendarPluginDevArchive (with attachments.)

-- PeterThoeny - 22 Mar 2006

Yet another Web Calendar, now by Google.

-- FranzJosefSilli - 13 Apr 2006

Hi, there is a nice weekly timetable view now that works with all CalendarPlugin event types: TWiki:Plugins.TimeTablePlugin.

-- DanielRohde - 24 May 2006

I wonder if the nice form in CalendarPluginFormTest was actually finished and/or made into a CommentPlugin template?

-- JosMaccabiani - 14 Jun 2006

Nope. I've been too busy recently to be able to work on this. Please feel welcome to adopt it.

-- PankajPant - 15 Jun 2006

I'd like to be able to hide weekends.

-- DenisHowe - 23 Jun 2006

From the comments it seems a safe bet that this works on 4.0.3, but I was wondering (and not just for this plugin) if there could be clearer communication about what TWiki version a plugin works on/has been tested on?

A low TWiki::Plugins::Version number doesn't mean much to most people and it doesn't mean that its been kept upto date like this plugin.


-- EricHanson - 28 Jun 2006

Each Plugin package has a TestedOnTWiki form field. The CalendarPlugin is developed in SVN and should work also on 4.0.x releases (code has $RELEASE = 'Dakar';). I added the 4.0.0 value accordingly to the form field.

FYI, the PluginPackage topic has links to "Plugins tested against [version]" topics, where you can see the list of Plugins that work on a particular TWiki version.

-- PeterThoeny - 28 Jun 2006

Thanks Peter. Seems like it might be nice to have the latest stable version listed with each TWiki though. I know from personal experience that not every TWiki installation will upgrade right away (including twiki.org) or perhaps not at all even.

-- EricHanson - 08 Aug 2006

Jos - Check out CalendarPluginAddEventCommentPluginTemplate. I made the CalendarPluginFormTest into a CommentPlugin template. Also expanded functionality a bit.

-- CynthiaManuel - 10 Aug 2006

Have a look at UserCommentsTemplate#Add_Calendar_Event for a live sample of CynthiaManuels work (thanks for that) here on TWiki.org.

-- FranzJosefSilli - 10 Aug 2006

BUG REPORT: When using months="2" or more, headercolor="" attribute only applies to the first month, other months still have default headercolor

-- NikolaiSvakhine - 23 Aug 2006

Hi Cynthia! I somehow missed your template before, but thanks! Great work and very useful. I'll implement this straight away.

-- JosMaccabiani - 25 Aug 2006

Hmmm... The demo URL works perfect, however on my installation clicking the date fields does not show ('pop up') the JSCalendar. I've confirmed that JSCalendarContrib, ToolTipPlugin, CommentPlugin and CalendarPlugin all work.

There's a javascript error (in IE6) that says: "Line 452 - Calendar is undefined". Any ideas what's going wrong? Thanks

-- JosMaccabiani - 25 Aug 2006

It would be nice if the calendar could show some buttons with which the displayed month can be manipulated. I.e.: you click >> and august will be september.

-- JosMaccabiani - 27 Aug 2006

The calendar itself cannot do that, because it isn't a capability of the underlying perl module. However, you can add some text to the topic which calls %CALENDAR% to give that capability. It is surprisingly ugly (at least my version is --- maybe someone can come up with something better). First, there is code to figure out the current month and the previous/next month:

<!-- Skip the space left by these calculations
Get the month and year specified in the URL, if any

%CALC{"$SET(month, %URLPARAM{"month"}%)"}%
%CALC{"$SET(year, %URLPARAM{"year"}%)"}%

If the month and/or year is unspecified (blank), then we set it to the current month/year.
The month calculation is nasty. Because FORMATTIME will return a leading zero on a month less than
10, EVAL will see an "octal" number like 08 (August) or 09 (September). These are, of course, invalid
octal numbers. So, we prepend a 1 to the GET, effectively adding 100 to any month number. To counteract
this, we add an initial -100 to get the actual month number. Gad.

%CALC{"$IF($EXACT($GET(month),), $SET(month, $EVAL(-100+1$FORMATTIME($TIME(), $month))),)"}%
%CALC{"$IF($EXACT($GET(year),), $SET(year, $FORMATTIME($TIME(), $year)),)"}%

Set up the month and year for the previous and next month.

%CALC{"$IF($GET(month) == 1, $SET(pmonth, 12),$SET(pmonth, $EVAL($GET(month)-1)))"}%
%CALC{"$IF($GET(month) == 1, $SET(pyear, $EVAL($GET(year)-1)), $SET(pyear, $GET(year)))"}%
%CALC{"$IF($GET(month) == 12, $SET(nmonth, 1), $SET(nmonth, $EVAL($GET(month)+1)))"}%
%CALC{"$IF($GET(month) == 12, $SET(nyear, $EVAL($GET(year)+1)), $SET(nyear, $GET(year)))"}%

Then, there is the actual code to go to the previous/next month:

<!-- Go to previous month: -->
<a href="%TOPICURL%?month=%CALC{"$GET(pmonth)"}%&year=%CALC{"$GET(pyear)"}%"> &lt;&lt; previous month</a>

<!-- Go to next month: -->
<a href="%TOPICURL%?month=%CALC{"$GET(nmonth)"}%&year=%CALC{"$GET(nyear)"}%"> next month &gt;&gt;</a>

-- DavidBright - 28 Aug 2006

I know this is an odd request but is there a way to show what time (hh:mm) the calendar plugin thinks it is?

I am on TWiki4 and have an issue where the TWiki is setup to user servertime, but the Calendar plugin seems to stil be on gmt. From my impression of the plugin, I thought it would use servertime if that was specified. Do I need to use GMTOFFSET or could there be some other issue I am overlooking?

Thanks for any pointers.

-- EricHanson - 22 Sep 2006

Too bad it only reads bulleted lists, because the EditTablePlugin would make such a cool tool for maintaining the events in the calendar. Something like this:

%TABLE{sort="on"}%%EDITTABLE{ header = "|*date*|*comment*|" format="|date,20,,%d %b %Y|text,30|" }%
| 05 Oct 2006 | Ballot recount |

Wouldn't that be cool. wink Here's the change to do it:

> # Copyright (c) 2006 Fred Morris, m3047@inwa.net
<       }
>       }
<       my @bullets = grep { /^\s+\*/ } split( /[\n\r]+/, $text );
>       # Allow for tables, by converting them to bullets. FWM, 03-Oct-2006
>       my @bullets;
>       foreach my $bullet (grep { /^(:?\s+\*.+|\s*(?:\|.+?){2,}\|\s*)$/ } split( /[\n\r]+/, $text )) {
>           if ($bullet =~ m/^\s*\|(.*)\|\s*$/) {
>               $bullet = $1;
>               my @event_fields;
>               foreach my $field (split /\|/,$bullet) {
>                     $field =~ s/^\s+//o;
>                     $field =~ s/\s+$//o;
>                     push @event_fields, $field;
>               }
>               my $event_date = join ' ', @event_fields[0..(@event_fields-2)];
>               my $event_comment = $event_fields[@event_fields-1];
>               $bullet = "   * $event_date - $event_comment";
>             }
>           push @bullets, $bullet;
>       }


-- FredMorris - 04 Oct 2006

That's great. Since EditTablePlugin is included in the standard twiki distro, what do folks think about making this change permanent for the CalendarPlugin ?

A couple of issues that may be worth working around :

  • The change would create a backwards compatability problem for those who already have large calendars using bullets, but tables are just so much nicer.
    • Is there a way to ask CalendarPlugin to accept both bullets and tables ?

-- KeithHelfrich - 04 Oct 2006

Hm, wouldn't it be more nice if PreferencesPlugin could be generalised to allow for easier editing of lists (not preference settings only)?! And it's pretty easy to write a search that kind of converts a table into a list that can be used by the CalendarPlugin (see CalendarTable).

-- FranzJosefSilli - 04 Oct 2006

That code is backwards compatible: it converts tables into the bulleted syntax which is expected.

In a nutshell what it does is:

  1. IF it sees a table.
  2. Split it into columns.
  3. Concatenate all but the last column, separated by spaces as the date.
  4. The last column is considered the comment.
  5. Create a new "bullet" record which is the expected bullet + date + - + the last column.

This means that not only does the , I get "invalid year syntax"

Actually using "year=" anything gives me invalid year syntax.

-- MichelleHedstrom - 11 Apr 2008

I've hacked this plugin so that it now observes file permissions. Does anyone want it? I've attached the patch file.

-- ChrisCauser - 18 Apr 2008

Michelle: Oops, that isnot good. I hope someone will find time to investigate and merge the lost functionality soon.

Chris: In your patch you basically removed the page access check. Although it violates the permissions, in this case I do not see a big issue since "only" calendar event dates and descriptions get exposed. Possibly make the ignore access check configurable?

-- PeterThoeny - 19 Apr 2008

Sorry Peter, can you please clarify - What have I removed? I thought I hadn't made the plugin any less usable, and only made it slightly more secure for the security concious wink

-- ChrisCauser - 20 Apr 2008

Ah, sorry Chris, I was confused because the patch is backwards, minuses indicating stuff you added. So, reading your patch backwards you are adding more security, not less as I assumed. smile

-- PeterThoeny - 20 Apr 2008

You can tell I'm new to this programming game when I can't even write a proper patch! I'll write a new one and post it up later.

-- ChrisCauser - 20 Apr 2008

The patch has been updated...

-- ChrisCauser - 21 Apr 2008

@Michelle: Sorry to seem patronizing, but are you actually putting in year="+yy" rather than eg. year="+01"?

It seems to work OK for me.

-- ChrisCauser - 21 Apr 2008

Dear friends: iCal is here! I finally took the time to implement a very simple iCalendar "bridge" that works great for certain situations. With this "trick", you can actually map TWiki dates, calendars, etc. into your favourite iCal client (iCal, Evolution, Lightning). It even works through https and applies all normal TWiki access control since it is just like viewing a topic!

See all the details at LuziSchucan

Any help on improving the "trick" or even incorporating it into the Calendar Plugin will be greatly appreciated! wink

-- LuziSchucan - 27 Apr 2008

I got this pointer for a potential input selector for events: http://stephencelis.com/projects/timeframe

Alternative could be a custom JSCalendarContrib / CommentPlugin combo that shows a date picker and adds a bullet in the CalendarPlugin format upon submit. (For inspiration see the "Add new action item" form at Sandbox.EditActionItems. The form submit there creates a table row, but you get the idea.)

-- PeterThoeny - 28 Apr 2008

I have seen the "range date picker" as well. But I wonder how it copes with ranges extending several months. I could not infer this from the demo.

-- ArthurClemens - 28 Apr 2008

Chris, doing year="+yy" used to work. I'm just reporting for several groups at my company who were doing that, whose calendars broke once we upgraded to the new version. They all were doing year="+yy" and it used to work fine. If it was a bug that wasn't supposed to work previously, that's fine. I'm telling them all to fix their syntax, but like I said, since it used to work I'm reporting it here.

-- MichelleHedstrom - 29 Apr 2008

Help: Just installed latest TWiki (first time). Tried to use the configure script to add extensions, but it's horked for some reason (gotta check support) So, I downloaded Calendar plugin -- unpacked and placed all the files in their respective directories. Loaded the install .pl script at the top level /twiki and made sure that the permissions are all set correctly. When I ran "sudo perl CalendarPlugin _installer.pl " I get the following error:

Can't locate object method "findUser" via package "TWiki::Users" at CalendarPlugin _installer.pl line 563, <STDIN> line 1.

All of the dependencies check out, too.

-- RedByer - 06 May 2008

The file data/TWiki/CalendarPlugin.txt,v is missing in the installation package. I have to remove the file data/TWiki/CalendarPlugin.txt, otherwise I would have the similar problem as ThYang's. However, it causes data/warnXXXXXX.txt file keeps reporting an error message as:

| 2008-05-26 - 19:17 | Plugins: could not fully register CalendarPlugin, no plugin topic

-- WangMeng - 26 May 2008

The .txt,v file is not needed, however you need the .txt file. Once you update the plugin topic, the .txt,v file is created for you. But it does not matter for the operation of the plugin if the .txt,v file exists or not. Make sure all files are readable by the webserver user (such as nobody, www-run or the like.) Please ask installation questions in the Support web.

-- PeterThoeny - 28 May 2008

Thank you! It works now.

-- WangMeng - 29 May 2008

The question on easily adding events comes up quite often, see for example TWikiGroupEventCalendarProject. It would be nice if this plugin ships with CommentPlugin template based form to pick a date and to add a new event bullet. This can be realized with a section in the plugin topic that can be included in a calendar event page. Not sure how to handle single date and date range. Two forms? One form with some Javascript magic?

-- PeterThoeny - 04 Jun 2008

As mentioned by EricHanson, above, the GMTOFFSET variable doesn't work in v1.020. I looked at the code. It doesn't work because gmtoffset isn't defined in the %defaults hash. The attached patch gmtoffset_patch1.txt should fix it -- it's only one line smile

-- TroyGoodson - 11 Jun 2008

Does anyone have a clever solution to the following? I'm trying to pull an uber calendar together based off of events scattered throughout a number of topics off a common parent topic.

This gets me the right set of events... %CALENDAR{ topic="%SEARCH{ "parent.name='%TOPIC%'" type="query" nonoise="on" format="$topic" separator=", " }%" aslist="1" days="20" format="$old - $topic - $description
...but the $topic variable in the format pulls the value of $topic passed in from the SEARCH result and doesn't allow me to show Topic1.Event1 Topic2.Event2 etc and I end up with:

I'm guessing line 559 of CalendarPlugin.pm is the reason as it looks like all events are pulled into @bullets in one shot without preserving the web.topic info along with... has anyone figured out a clever workaround? I'd love to either show the Web.Topic info in the format line with the event and, even better, allow a link back to the topic the event originated from.

-- JasonLeeTaylor - 23 Jun 2008

sorry the markup I meant to put that got cutoff was:

%CALENDAR{ topic="%SEARCH{ "parent.name='%TOPIC%'" type="query" nonoise="on" format="$topic" separator=", " }%" aslist="1" days="20" format="$old - $topic - $description<br />$n"}%

-- JasonLeeTaylor - 23 Jun 2008

I too had the Can't locate TWiki/Plugins/CalendarPlugin.pm in @INC problem which I eventually solved. The problem was that the downloaded tarball has screwed up file ownership and permissions. viz:

tar tvfz ~dan/landing/CalendarPlugin.tgz
-rw-r----- david/david   23264 2006-03-06 19:25 CalendarPlugin_installer.pl
drwxrwxr-x david/david       0 2006-03-06 19:25 data/
drwxrwxr-x david/david       0 2006-03-06 19:25 data/TWiki/
-rw-rw---- david/david   27000 2006-03-06 19:25 data/TWiki/CalendarPlugin.txt
drwxrwxr-x david/david       0 2006-03-06 19:25 lib/
drwxrwxr-x david/david       0 2006-03-06 19:25 lib/TWiki/
drwxrwxr-x david/david       0 2006-03-06 19:25 lib/TWiki/Plugins/
-r--r----- david/david   42821 2006-03-06 19:25 lib/TWiki/Plugins/CalendarPlugin.pm
drwxrwxr-x david/david       0 2006-03-06 19:25 pub/
drwxrwxr-x david/david       0 2006-03-06 19:25 pub/TWiki/
drwxrwxr-x david/david       0 2006-03-06 19:25 pub/TWiki/CalendarPlugin/
-rw-rw---- david/david      79 2006-03-06 19:25 pub/TWiki/CalendarPlugin/exclam.gif

It works if you chown these files to www-data:www-data after you untar them

-- DanielKidger - 23 Jul 2008

@User.JasonLeeTaylor: You can use the TreePlugin to create a comma separated list of child topics from a parent topic and pass that into the topic argument of the Calendar plugin. Example:

%CALENDAR{topic="%TREEVIEW{topic="ParentTopic" format="$topic" nodiv="1" separator=", "}%"}%

I use this to do exactly what you are trying to accomplish.

-- DeanSpicer - 24 Jul 2008

Found this, so I put it here before it gets lost: CalendarPluginNeedsGui

-- TWikiJanitor - 04 Sep 2008

Hi, I would like the CalendarPlugin to have the capability of expanding variables. I believe this can be done by replacing line 457,

$text =~ s/%INCLUDE{(.*?)}%/&expandIncludedEvents( $1, $options{web}, $options{topic}, () )/geo;
, of the current distribution with the following:
        $text =~ s/%CALENDAR{(.*?)}%//g;
        $text =~ s/%CALENDAR%//g;
        $text = TWiki::Func::expandCommonVariables($text,$options{topic},$options{web});
However, this solution seems to simple so let me know if I am missing something.

-- AshleyKelly - 11 Sep 2008


I came up with a slightly different solution that is a little more complicated. I added a new global variable $recurse_check that is initialized to 0. I then replaced the commonTagsHandler with the following code:

sub commonTagsHandler
    if ($recurse_check == 0) {
   $recurse_check = 1;
   $_[0] =~ s/%CALENDAR{(.*?)}%/&handleCalendar( $1, \$_[0], $_[1], $_[2] )/geo;
   $_[0] =~ s/%CALENDAR%/&handleCalendar(        '', \$_[0], $_[1], $_[2] )/geo;
   $recurse_check = 0;
    } else {
   $_[0] =~ s/%CALENDAR{(.*?)}%/<!-- calendar -->/go;
   $_[0] =~ s/%CALENDAR%/<!-- calendar -->/go;

I then added the call to expandCommonVariables right after the expandIncludedEvents call. (I could have removed the expandIncludedEvents call, but I left it in).

I hope to find some time in the near future to post a diff of my changes for consideration for the next release.

-- SteveCarlock - 03 Oct 2008

The example format setting in CalendarPlugin#EventFormatting does not seem to work properly without an "$n" at the end. For example,

 format="$old - $description$n" 

-- DevinBougie - 09 Oct 2008

Has anyone ever figured out how to get Calendar to read a bullet list of events that is generated by a SEARCH? See Sandbox/CalendarEvent and Sandbox/CalendarTable

-- VickiBrown - 15 Dec 2008

Here is a working example of a calendar app that pulls events from TWiki forms based event pages. This app is used by the committee of a local Swiss club to organize events.

%SEARCH{ "[M]ETA:FORM.*[E]ventPlanForm" topic="EventPlan*" excludetopic="EventPlanTemplate" type="regex" nonoise="on" format="   * $percntCALC{$FORMATTIME($TIME($formfield(Date)), $day $mon $year)}$percnt - [[$topic][$formfield(Name)]]" }%

-- PeterThoeny - 15 Dec 2008

Peter - what version of Calendar Plugin are you using there? According to Sandbox/CalendarEvent this doesn't always work. I have CalendarPlugin 1.020.

Is there a URL that I could view to see?

-- VickiBrown - 16 Dec 2008

I also use 1.020. And in {PluginsOrder} I have SpreadSheetPlugin.

-- PeterThoeny - 16 Dec 2008

No, for reason of member data protection, it is an access restricted TWiki only accessible by PSC committee members. We can meet in person where I can show you the app.

-- PeterThoeny - 16 Dec 2008

Peter - you say "And in {PluginsOrder} I have SpreadSheetPlugin." did you not add some things to that list? smile

-- VickiBrown - 27 Jan 2009

In {PluginsOrder} I just have "SpreadSheetPlugin", which is the default.

-- PeterThoeny - 01 Feb 2009

Just looking at the great code DavidBright added above for moving between months, I've added here the missing code to control the calender itself. Here's all that code together showing how it could be placed into a calender topic page.

Editors - Here's where to add dates:

   * 23 Feb 2009 - Event 1
   * 20 Mar 2009 - Event 2

<!-- Skip the space left by these calculations
Get the month and year specified in the URL, if any

%CALC{"$SET(month, %URLPARAM{"month"}%)"}%
%CALC{"$SET(year, %URLPARAM{"year"}%)"}%

If the month and/or year is unspecified (blank), then we set it to the current month/year.
The month calculation is nasty. Because FORMATTIME will return a leading zero on a month less than
10, EVAL will see an "octal" number like 08 (August) or 09 (September). These are, of course, invalid
octal numbers. So, we prepend a 1 to the GET, effectively adding 100 to any month number. To counteract
this, we add an initial -100 to get the actual month number.

%CALC{"$IF($EXACT($GET(month),), $SET(month, $EVAL(-100+1$FORMATTIME($TIME(), $month))),)"}%
%CALC{"$IF($EXACT($GET(year),), $SET(year, $FORMATTIME($TIME(), $year)),)"}%

Set up the month and year for the previous and next month.

%CALC{"$IF($GET(month) == 1, $SET(pmonth, 12),$SET(pmonth, $EVAL($GET(month)-1)))"}%
%CALC{"$IF($GET(month) == 1, $SET(pyear, $EVAL($GET(year)-1)), $SET(pyear, $GET(year)))"}%
%CALC{"$IF($GET(month) == 12, $SET(nmonth, 1), $SET(nmonth, $EVAL($GET(month)+1)))"}%
%CALC{"$IF($GET(month) == 12, $SET(nyear, $EVAL($GET(year)+1)), $SET(nyear, $GET(year)))"}%

| <!-- Go to previous month: --><a href="%TOPICURL%?month=%CALC{"$GET(pmonth)"}%&year=%CALC{"$GET(pyear)"}%"> &lt;&lt; previous month</a> | <!-- Go to next month: --><a href="%TOPICURL%?month=%CALC{"$GET(nmonth)"}%&year=%CALC{"$GET(nyear)"}%"> next month &gt;&gt;</a> |

%CALENDAR{ showweekdayheaders="1" weekstartsonmonday="1" weekdayheadersbig="1" bgcolor="white" month="%CALC{"$GET(month)"}%"  year="%CALC{"$GET(year)"}%" }%

I also placed the forward/back controls into a table for neatness.

-- StephenHallett - 23 Feb 2009

Hi, I am just working on extension which would allow you to specify events including time like hh:mm:ss. Next new function should be generating of iCal and link to that file,which you can simply add into your email client or organizer. Part of our project also focus on view and through CalendarMonthSimple we would like to make calendar much more Googel Calendar like. Here is a snapshot of new version with extended events and link to iCal file (*.ics). It is still testing version so I will be thanfull for any coment or improve idea.

CalendarPlugin 1.021

There is a list if new bullets with following syntax

including time:

* dd MMM yyyy hh:mm(:ss) – hh:mm(:ss) - description

* dd MMM yyyy hh:mm(:ss) – description

09 Dec 2002 14:00(:00) -15:00(:00) – Expo

(Same day)

09 Dec 2002 14:00(:00) – Expo

(from 14 to the end of the day)

including time:

* dd MMM yyyy hh:mm:ss - dd MMM yyyy hh:mm:ss - description

* dd MMM yyyy hh:mm:ss - dd MMM yyyy hh:mm:ss - description

02 Feb 2002 14:00:00 - 04 Feb 2002 14:00:00 - Vacation

02 Feb 2002 14:00 - 04 Feb 2002 14:00 - Vacation

ncluding time:

* w DDD hh:mm:ss - hh:mm:ss description

1 Fri 14:00:00 - 15:00:00 - Every 1st Friday of the month from 14:00 to 15:00

* L DDD hh:mm:ss - hh:mm:ss description

L Mon 14:00:00 - 15:00:00 - The last Monday of each month from 14:00 to 15:00

* dd hh:mm:ss - hh:mm:ss description

14 14:00:00 - 15:00:00 - The 14th of every month from 14:00 to 15:00

including time:

* E DDD hh:mm:ss - hh:mm:ss - description

E Wed 14:00:00 - 15:00:00 - Every Wednesday 14:00 – 15:00

* E DDD dd MMM yyyy hh:mm:ss - hh:mm:ss - description

E Wed 27 Jan 2005 14:00:00 - 15:00:00 - Every Wednesday Starting 27 Jan 2005

* E DDD dd MMM yyyy hh:mm:ss - hh:mm:ss - dd MMM yyyy - description

E Wed 1 Jan 2005 14:00:00 - 15:00:00 - 27 Jan 2005 - Every Wednesday from 1 Jan 2005 through 27 Jan 2005 (inclusive)

-- PavelJenicek - 24 Apr 2009

Pavel, these enhancements look very promising and are in line with the TWikiMission. I am looking forward to seeing your enhancements contributed back to the TWiki community. If inclined consider requesting SVN checkin rights. ReadmeFirst has more.

-- PeterThoeny - 2009-04-28

Is there any way to get the Calendar plugin to read dates in the format mm-dd-yy, where the month is a number rather than a 3-letter abbreviation?

Here's my situation...I have a table listing events and I want the dates there in the format "05-07-09" so that I can sort the table by chronological order (which doesn't work if it's "07 May 09").

Then I'm using a SEARCH to pick up those dates (which are actually pulled into the table from form fields on separate topics) and create a bulleted list out of them. And then I want CALENDAR to read that bullet list to create my event calendar.

Any help with this would be greatly appreciated!

-- GarySprague - 2009-05-07

Might also be worth mentioning that my SEARCH is a query search. Here's the markup:

%SEARCH{"web = "Communications/Events" AND form.name = "EventForm"" nosearch="on" nototal="on" type="query" excludetopic="EventPageTemplate" format=" * $formfield(StartDate) - $web.$topic - $formfield(EndDate)" }%

-- GarySprague - 2009-05-07

Use some SpreadSheetPlugin magic to transform the date into the format the CalendarPlugin expects. Here is a working example from one of my TWiki installations:

  format="   * $percntCALC{$FORMATTIME($TIME($formfield(Date)), $day $mon $year)}$percnt - [[$topic][$formfield(Name)]]"

-- PeterThoeny - 2009-05-07

Hi, I would like to kindly ask you for a hint regarding our new version of CalendarPlugin with iCal export. Our current version generates the iCal export each time the topic containing the plugin is displayed, which works fine as long as the plugin's attribute "topic" is not specified. If the attribute specifies other topic(s) than the one with the plugin, no changes to these topics will occur in the iCal export until the main topic with the plugin has been viewed.

It may be more obvious from this example:

%CALENDAR{topic="EventsListA, EventsListB"}%

Changes of topics EvantListA and EventListB are not exported until somebody views the OurCalendar topic.

Is there a simple way that would enable us to trigger the export once the EventListA or EventListB has been updated? Any advice, help or idea will be appreciated.


-- PavelJenicek - 2009-05-07

Thanks, Peter! Worked like a charm.

-- GarySprague - 2009-05-07

I would dearly love a new option for Calendar Plugin. I would like to be able to specify, in an event description, the color to use for the background of the event cell!

-- VickiBrown - 2009-09-09

How apropos. I'll try to work through the process of getting my subversion access working, but I'll just post my changes here.

I wanted to create something like a "holiday" type (or, maybe "hilight" is more appropriate), with an entry like this:

 * H green 07 Sep - Labor Day
where the type is "H", you put the color, the date, and text.

To CalendarPlugin.pm , I added:

local $holiday_date_rx = "H\\s+([A-Za-z]+)\\s+$date_rx";
datecolor                       => $webColor,

and then the following block after the # collect all anniversary dates block (not sure how well this will render):

# collect all holiday dates
        @days = fetchDays( "$holiday_date_rx", \@bullets );
        foreach $d (@days) {
            ($hcolor, $dd, $mm, $xs, $xcstr, $descr) = split( /\|/, $d);
            eval {
                if ($months{$mm} == $m) {
                    $cal->datecolor("$dd", lc("$hcolor"));
                    &highlightDay( $cal, $dd, $descr, %options);
            &TWiki::Func::writeWarning( "$pluginName: $@ " ) if $@ && $debug;

Works good so far with limited testing. Does not take the

type colors yet.

-- AaronLWalker - 2009-10-27

I would like to suggest a hange to the way aslist presents data.

Say today is Dec 7, 2009.

If I have these dates:

  • 2 Dec 2009 - Event 1
  • 7 Dec 2009 - Event 2
  • 1 Dec 2009 - 10 Dec 2009 - Event 3
  • 1 Dec 2009 - 24 Dec 2009 - Event 4
  • 15 Dec 2009 - Event 5

Then %CALENDAR{aslist="1"}% presents

   * 07 Dec 2009 - Event 3
      - Event 4
      - Event 2

I would prefer top see this instead: presents

   * 07 Dec 2009 
      - Event 3
      - Event 4
      - Event 2

-- VickiBrown - 2009-12-07

For the aslist question, Vicki, you can just do something like

%CALENDAR{aslist="1" format=" $old $description %BR%" datenumberformat="[[Main.GroupCalendar][ *$day $mon $year* ]]  %BR%"}%

-- AaronLWalker - 2010-02-25

Check out our new CalendarPlugin2 in Google Calendar visual style featuring iCal export and time specification support.

-- PavelJenicek - 2010-03-29

When you set the headercolor, and you have a multi-month calendar, it only sets it for the first month. The following months still take on the web bg color. I'm looking at the plugin, but not sure where to fix that.

-- AaronLWalker - 2012-01-10

That looks like a bug that needs to be fixed. The todaycolor and headercolor are currently initialized in the while loop that handles all calendars. This should be moved to the handleCalendar function after setting the defaults. The defaults set the web color, but to the system web, so the web color needs to be set explicitly handleCalendar.

-- PeterThoeny - 2012-01-10

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatJPG CP_1.021beta_snap.JPG r1 manage 28.2 K 2009-04-24 - 08:21 PavelJenicek TestVersion CalendarPlugin 1.021beta
Texttxt Calendar.pl.txt r1 manage 2.0 K 2007-05-07 - 08:18 KlausFueller KlausFueller's conversion script CAL->CalendarPlugin
Unknown file formatpatch CalendarPlugin.patch r2 r1 manage 1.4 K 2008-04-21 - 10:28 ChrisCauser Patch for Calendar to observe topic permissions
Unknown file formatdiff CalendarPlugin.pm.diff r1 manage 1.7 K 2006-03-06 - 10:31 MarcLangheinrich fix for getting multidayformat to properly work with aslist; incorporated into version 1.020 (SVN 9113)
Unknown file formatgz calendar-plugin-iso-8601-parser-2006-11-23.patch.gz r1 manage 0.7 K 2006-11-23 - 10:02 MarcSCHAEFER Parsing of ISO-8601 dates
Compressed Zip archivetgz calendarplugin-fwm-061006.tgz r1 manage 26.4 K 2006-10-06 - 22:59 FredMorris Enhanced to read events in tabular format.
JPEGjpg calplugin_snap.jpg r1 manage 22.6 K 2006-10-11 - 17:37 VickiBrown header cells are not centered
Texttxt gmtoffset_patch1.txt r3 r2 r1 manage 0.9 K 2008-06-11 - 02:02 TroyGoodson patch to allow users to set GMTOFFSET variable
Unknown file formatdiff maxlistdays.diff r1 manage 1.3 K 2006-11-03 - 05:04 JonathanKamens Patch to add "maxlistdays" functionality to "aslist"
PNGpng mini-calendar.png r2 r1 manage 14.3 K 2006-10-15 - 13:10 SteffenPoulsen Mini-calendar for saving screen estate
GIFgif recurrent_events.gif r1 manage 7.7 K 2006-02-11 - 20:48 UnknownUser  
GIFgif recurrent_events_web.gif r1 manage 9.5 K 2006-02-11 - 20:57 UnknownUser  
Texttxt workingday_of_month.diff.txt r1 manage 2.2 K 2007-11-28 - 08:14 MartinRothbaum Patch to allow rule for Nth working day of the month
Edit | Attach | Watch | Print version | History: r399 < r398 < r397 < r396 < r395 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r399 - 2012-01-10 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.