r3 - 14 Jun 2006 - 21:49:02 - PeterThoenyYou are here: TWiki >  Plugins Web > CalendarPluginDev > CalendarPluginDevArchive
Tags:
, create new tag

Archives of Calendar Plugin Development Discussions

This topic contains older content moved over from CalendarPluginDev

-- PeterThoeny - 10 May 2003

  • Adds a %CALENDAR% tag that shows a monthly calendar (current month).
  • Highlights days corresponding to Events or to Recurring Events

Download it from TWikiPluginAPI and give it a try...

-- AndreaSterbini - 27 Jan 2001

TODO

  • when including the topic, filter event list to show only events falling in the chosen month
  • move defaults to preferences?
  • add a parameter to use CalendarMonthSimple instead than the heavier CalendarMonth (see below)

-- AndreaSterbini - 27 Feb 2001

Nice Plugin, however problem with netscape - the alt text doesn't seem to work at all... (Using Linux Netscape version 4.73) As a result you get a nice calendar, but no indication of what's going on... :-/

-- MichaelSparks - 13 Mar 2001

me too .... (version 4.76) ... here it works ....

PS ... the plugin wants european dates .... is it this the problem?

-- AndreaSterbini - 14 Mar 2001

[ It turns out it's a Netscape limitation. If you have tool tips turned off in your preferences, you don't get the alt text, and if you have the tool tips enabled, you do get the alt text pop up. MichaelSparks - 24 Mar 2001
]

I have tried to make a three month calender, using three %CALENDAR% items in one page. There was an error in the HTML::ElementSuper.pm so I started to use three different pages with links.

A nice feature would be to configure a delta to the current month. Now it is only possible to set a special month or use the current month. How about a delta item to use it like this

  • %CALENDAR{delta="1"}% to show the next month
  • %CALENDAR{delta="-1"}% to show the last month

-- StefanScherer - 15 Mar 2001

The Calendar plugin is great. I like Stefan's delta idea (may be call the parameter offset=".." ? )

I suggest to change the date format to the ISO date format TWiki is using elsewhere. Also, it is better to find a syntax that does not have unwanted side effects. How about this:

  • 2 Feb: Andrea's birthday
  • 7 Mar: Nicoletta's birthday
  • 29 May 1996: Maria Teresa is born!
  • 29 Sep 1998: Davide is born!

or:

  • 2 Feb - Andrea's birthday
  • 7 Mar - Nicoletta's birthday
  • 29 May 1996 - Maria Teresa is born!
  • 29 Sep 1998 - Davide is born!

I installed it on a not so fast machine and found out the the plugin eats lots of resources.

  • Here are the real CPAN dependencies: HTML::AsSubs.pm, HTML::CalendarMonth.pm, HTML::Element.pm, HTML::ElementGlob.pm, HTML::ElementSuper.pm, HTML::ElementTable.pm, HTML::Tagset.pm

  • The execution time drops to almost half, also for topics that have no calendar.

Benchmarks:

  • Testing non existing topic, Calendar is ENABLED:
    • user: 1.25 (0.02), system: 0.13 (0.00)
  • Testing non existing topic, Calendar is DISABLED:
    • user: 0.76 (0.02), system: 0.08 (0.00)
  • Testing CalendarPlugin topic with a calendar, Calendar is ENABLED:
    • user: 1.82 (0.02), system: 0.13 (0.00)
  • Testing CalendarPlugin topic with a calendar, Calendar is DISABLED:
    • user: 0.84 (0.02), system: 0.04 (0.00)

I can't install it at work with this performance hit. Any chance to reduce the module dependencies and increase the performance?

  • May be a first step to do a lazy load of modules CalendarPlugin.pm needs, e.g. only if the text to be rendered contains a calendar tag.
  • Reduce or eliminate dependencies on HTML modules?

-- PeterThoeny - 22 Mar 2001

Thanks for pointing it out, I'll do Lazy use-eing ...

-- AndreaSterbini - 29 Mar 2001

Another calendar worth checking out: http://myphpcalendar.sourceforge.net/

-- PeterThoeny - 08 Apr 2001

While getting all the CPAN modules, I've seen also the HTML::CalendarMonthSimple module. I don't know how it looks like, but it has the same intend to reduce the CPAN dependencies.

http://search.cpan.org/search?dist=HTML-CalendarMonthSimple

-- StefanScherer - 12 Apr 2001

Thanks for the pointer, as soon I find time I will add it to the plugin (it's a rather nice package!!!).

-- AndreaSterbini - 09 May 2001

Updated to:

  • init returns 1 if correctly initted
  • use lazy load to lower the plugin memory footprint (see above)

-- AndreaSterbini - 10 Jun 2001

Thanks for the plugin, Andrea!

However, I've added two features I missed (see the attached CalendarPlugin.pm; my editing is marked "#cs#"):

  • allow for relative month/year attributes, e.g. month="+1" for the next month
  • highlight current day (using bgcolor as for calendar heading)

I've also fixed an entry to the httpd error log, which occured on every call of the plugin, due to a missing sub in one of the *.pm used.

-- ChristianSchultze - 25 Sep 2001

As StefanScherer pointed out, whenever I tried to make multi-month calendar in one page, HTML::ElementSuper.pm suffers from taint problem which I cannot understand. It seems occurs only after the first time handleCalendar subroutine called. The exact sentence that causes this error is

$c->item($c->year,$c->month)->wrap_content(font({size => '+2'}));

I tried wrap it up with eval[] and it worked, though not sure why the error occurs without eval[].

eval q[$c->item($c->year,$c->month)->wrap_content(font({size => '+2'}))];

Anyway, now I have multi-month calendar without separating the page into several pages. Hope I can have it without the eval[].

-- JikhanJung - 28 Nov 2001

Fixed a bug in the plugin's use of HTML::CalendarMonth: $c->item() must be used with day numbers without leading zeroes. For just the fix, replace the following in CalendarPlugin.pm (2 occurences!):

item($d  =>  item(0+$d

For the fix plus my modifications to the original plugin (see above), download the attached version of the *.pm.

The bug was encountered and reported to me (why me? wink ) by MatthiasWientapper.

-- ChristianSchultze - 04 Mar 2002

Great plugin! I am new to TWiki configuration...been using it for class and work since August 2001. Just installed on Windows 2000 using Opera browser...plugin works fine, thanks!

-- RobertRaygan - 06 Mar 2002

I've just uploaded version 1.003 of CalendarPlugin. It adds:

  • all ChristianSchultze very good improvements (thanks!)
  • uses HTML::CalendarMonthSimple by default else falls on HTML::CalendarMonth

TODO: parse ISO dates

  • I will probably change slightly the event syntax to:
   * *<date specification>* - Description
i.e. I will add "space minus space"

This would allow to make full use of the Date perl module for date parsing.

-- AndreaSterbini - 25 Mar 2002

How about adding

$cal->showweekdayheaders(1);
$cal->weekdayheadersbig(0);
or maybe making this a configuration option in %CALENDAR% ? Well, weekdaynames are rather big, but they are pretty usefull, too. Maybe there will be the option of abbreviated weekdaynames or even weeknumbers in upcoming versions of HTML::CalendarMonthSimple?
Furthermore I encountered some error-messages of this type in my apache error.log:
[Sun Mar 31 16:06:46 2002] null: Use of uninitialized value in numeric eq (==) at /usr/local/share/perl/5.6.1/HTML/CalendarMonthSimple.pm line 197.
(As I am not a perl wizzard - not yet - all I can do is mentioning errors and feature requests than solving/implementing them)

-- MatthiasWientapper - 31 Mar 2002

I am considering the idea of simplifying the plugin:

  • remove the HTML::CalendarMonth support and use only HTML::CalendarMonthSimple
  • move all default settings of the calendar to the CalendarPlugin topic
  • allow the usage of all settings as attributes of the %CALENDAR% tag
E.g.: %CALENDAR{showweekdayheaders="1"}%

Is there anybody against the removal of the heavy HTML::CalendarMonth dependence?

-- AndreaSterbini - 03 Apr 2002

Simplifying is always good, go for it! Also the * *<date specification>* - Description syntax sounds good so that it does not clash with other bullets in the topic.

-- PeterThoeny - 03 Apr 2002

I'd like the calendar to show the day names (as above), but also show the events inside the calendar table.

Also, have the performance issues reported by Peter been taken care of?

  • yes! [Main.AndreaSterbini]

-- ChrisRiley - 17 Apr 2002

I have just uploaded version 1.004

  • uses only HTML::CalendarMonthSimple
  • uses all HTML::CalendarMonthSimple (you can set almost all of its settings)
  • has ISO dates

-- AndreaSterbini - 05 May 2002

Found a bug in 1.004. Not sure if it's a typo or an Italian->English (missed) translation issue (I can't believe every month but July abbreviates the same way in Italian and English, so I can't believe this was intentional). The abbreviation for July was listed as "Lug" which mean that all July entries didn't work. I'm attaching diffs to fix it.

-- RobNapier - 18 May 2002

Thanks a LOT for the fix! I have just uploaded the updated version. (I am really ashamed for the stupid error embarrassment )

The correction on HTML::CalendarMonthSimple has been added to the last version (1.17), and it's coming to the CPAN nearest to you! smile

-- AndreaSterbini - 19 May

Got another little patch here. First part is just a small perl correction for (probably very slight) performance and simpler code with much less duplication. At the end of handleCalendar, change the map/grep combos this way:

@days = grep { s/^\s*\*\s+([0-9]?[0-9])\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+([12][0-9][0-9][0-9])\s+-\s+(.*)$/$1|$2|$3|$4 / ? $_ : '' }
                split( /\n/, $text);
and
@days = grep { s/^\s*\*\s+([0-9]?[0-9])\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+-\s+(.*)$/$1|$2|$3 / ? $_ : ''}
                split( /\n/, $text);

There's no reason for the extra map{}. grep{} can do all the magic for you just as easily with grep{s/.../ ? $_ : ''} since s// returns true if it fired.

The second piece of magic is the extra space I stuck at the end of the substitutions (after $4 and $3 above). This fixes a bug related to this kind of entry:

  • 21 Jun 2002 - Stuff to do

For some reason, this will render correctly in the list, but will render with the stars intact (not bolded) in the calendar table. If you add a space (or anything else) to the end of the list entry, it renders correctly in the table. Adding the space as part of the substitute makes it magically work, too (and ensures that it's always there). I don't understand this, so it may be worth investigating further, but the issue feels like its either somewhere in TWiki itself (versus your plugin), or some kind of interaction between HTML::CalendarMonthSimple's HTML and TWiki's "wiki inside of HTML" parser.

BTW, just for coding style, I recommend factoring out the common parts of the two massive regexes into a constant and using that instead of duplicating it. But then I have a real aversion to duplicated code.

-- RobNapier - 21 May 2002

It appears to me that the CalendarPlugin uses different defaults for settings inherited from HTML::CalendarMonthSimple. E.g., CalendarPlugin seems to use center as the default for cellalginment or vcellalignment, but the perl module uses left and top, respectively. Is that on purpose?

-- ThomasWeigert - 31 May 2002

The following would be two great enhancements to this wonderful plugin:

  • Allow the entering of date ranges, e.g., * 21 Jun 2002 - 23 Jun 2002 - Vacation
  • When entering a date range, optionally create entries for weekdays only.

-- ThomasWeigert - 31 May 2002

This is a nice plugin, and dates are now in the regular TWiki format smile

I did some new benchmarking at work with the plugin:

Topic Not installed Disabled Enabled
WelcomeGuest 2.64 2.68 2.68
TWikiRegistration 1.16 1.20 1.22
CalendarPlugin 1.38 1.43 1.60

There is no noticable performance hit anymore if there is no CALENDAR in the topic.

Small suggestion. Some of the generated code is not XHTML, look at the HTML source of a topic that has a CALENDAR. Would be nice if this gets fixed.

-- PeterThoeny - 08 Jun 2002

This is a really useful plugin, thanks everyone! Would there be any easy way of making some entry visible only to "registered users" (i.e. those logged in with a login name + passwd)?

-- MarkoNiinimaki - 09 Sep 2002

In my case, CalendarPlugin doesn't appear with %ACTIONSEARCH{....}% (ActionTrackerPlugin) in the same page

-- JungwooHa - 05 Oct 2002

%ACTIONSEARCH{....}% probably changes the path, and TWiki has a relative path to load Plugin modules. Plugins with a problem fail silently with the current production TWiki. The fix is to use an absolute lib search path. Read details in TroubleWithPlugins, SettingLibPath, TracePluginSyntaxErrors

-- PeterThoeny - 06 Oct 2002

Sorry, I feel like blind. Can please somebody point me to what I did wrong? I receive

Undefined subroutine &TWiki::Plugins::CalendarPlugin::handleCalendar 
called at ../lib/TWiki/Plugins/CalendarPlugin.pm line 107.
But handleCalendar is defined in this same file. So what?

-- NorbertGawor - 13 Nov 2002

  • I got the same message. My fault was: I didn't install the CPAN prerequisits. I had to install the following CPAN modules:
    • Bit::Vector
    • Date::Calc (needs Bit::Vector)
    • HTML::CalendarMonthSimple (needs Date::Calc)
  • Now the CalendarPlugin runs.
-- GuentherSchmid - 14 Nov 2002

  • After I installed all those modules, I still got same messages and I solved this problem by moving sub commonTagsHandler to the end of the CalendarPlugin.pm file before '1;' line. -- KyuwoongHwang - 04 Mar 2005

It would be nice to have the possibility of putting more than one calendar in one line (or row), using the | | | TextFormatingRule.

-- DiegoPamio - 11 Dec 2002

I've posted an updated version of the plugin to CalendarPlugin and attached my version of the module to this page. It adds the ability to put montly repeating items in. (Ex. third wednesday every month -> " * 3 Wed - Description")

-- DanBoitnott - 10 Dec 2002

Dan, thanks for your update, but I'm not able to say every 5. Monday. If this would be possible, I could use the monthly repeating as weekly repeating.

-- GuentherSchmid - 11 Dec 2002

I'm sorry about that. I found the problem, the regex that looks for the number is [1-4] instead of [1-5] like it should be. The line is close to the bottom of handleCalendar() (I think) and I'll fix it ASAP. Also, I'm not sure I understand what you meant about "weekly repeating." Are you looking for something that would do like "Every Monday" or something like that?

-- DanBoitnott - 11 Dec 2002

I've posted the fix. I changed $montly_rx to look for [1-6] just in case. I'd like to do another type of montly repeater that keys on date (ie. 1st of the month or 15th of the month) but haven't fixed on a syntax. My ideas are:

  • 1 - First of the month
  • 15 EMON - 15 of the month (EMON standing for "Every Month")
  • 6 Monthly - 6th of the month

I'm not really satisfied with any of these ideas but am leaning toward "6 Monthly." Thoughts? Also, any thoughts on a syntax for "Every Monday" sort of repeaters? I'm thinking:

  • Every Mon - Every Monday

-- DanBoitnott - 11 Dec 2002

How about this syntax for a weekly event:

  • E Mon - Every Monday

and this for a bi-weekly event:

  • EO Fri 06 Dec 2002 - Every other Friday starting 06 Dec 2002

-- DanBoitnott - 11 Dec 2002

I've posted another small fix to the module. Date::Calc uses 7 for Sunday and I had it down as 0. This will fix any problems someone might have were their Sunday items don't show up properly.

-- DanBoitnott - 11 Dec 2002

I've posted another version which includes weekly and bi-weekly syntax:

  • E Mon - Every Monday
  • EO Fri 06 Dec 2002 - Every other Friday starting 06 Dec 2002
While working on it I realized two things:
  1. The weekly and bi-weekly functionality would be better replaced with En where n is the number of days between events. Weekly would become E7, bi-weekly E14, daily E1, etc. I'll work this out soon. For this reason (and the one below) I did not post this update to the CalendarPlugin page.
  2. I was probably jumping the usual development cycle by posting a new version of the plugin to the CalendarPlugin page. If this is the case, I am very, very sorry and can only offer the excuse that I wasn't aware of the dev page until after I posted. This is also my fault for not reading the page fully before posting. Again, sorry for any trouble I've caused.
    • If I jumped the gun, what is the ussual cycle for formal releases?

-- DanBoitnott - 11 Dec 2002

I've posted a test version with the repeating syntax above. I dropped the bi-weekly option because you have to give a start date anyway for it to work. I retained the weekly syntax so you don't have to give a start date if you don't need one and the system won't wast time counting out from your start date. Here's the syntax for the two setups:

  Syntax Example
Weekly Event <3 spaces>* E DDD - description E Wed - Every Wednesday
Periodic Event <3 spaces>* En dd MMM yyyy - description E3 02 Dec 2002 - Every three days starting 02 Dec 2002

TODO:

  • Add start date support to Weekly events
  • Add end date support to Weekly and Periodic events
  • Add support for monthly events like "1st of the month" and "15th of the month." Suggestions on syntax?

-- DanBoitnott - 12 Dec 2002

Cant solve this error, please help

Undefined subroutine &TWiki::Plugins::CalendarPlugin::handleCalendar
called at ../lib/TWiki/Plugins/CalendarPlugin.pm line 107.

I followed instructions above and installed Bit-Vector and Date-Calc,
but what is install here. Should I follow INSTALL.txt in the
packages ?
I only copied the xxx.pm files into Twiki/plugins.
Is that enough, and if not what may be wrong ??
By the way, thanks for TWiki and the plugins!!
/Tore Agblad in Sweden
-- ToreAgblad - 16 dec 2002

You do need to follow the INSTALL.txt. You also need to install the rest of the package. Did you install the HTML::CalendarMonthSimple CPAN module? That's required for this plugin.

-- DanBoitnott - 17 Dec 2002

Yes I started with that one. But I have not followed INSTALL.txt. So back to work I guess. Thanks, Tore -- ToreAgblad - 17 dec 2002

I've posted my latest version. This one adds a few things including monthly items which occur on numbered days like 15th of each month. I'm not sure exactly what I've updated so here's the complete syntax as it is in the version I posted:

  Syntax Example
Normal Event <3 spaces>* dd MMM yyyy - description 09 Dec 2002 - Expo
Interval Event <3 spaces>* dd MMM yyyy - dd MMM yyyy - description 02 Feb 2002 - 04 Feb 2002 - Vacation
Yearly Event <3 spaces>* dd MMM - description 05 Jun - Every 5th of June
Monthly Event <3 spaces>* w DDD - description 1 Fri - Every 1st Friday of the month
Monthly Event <3 spaces>* dd - description 14 - The 14th of every month
Weekly Event <3 spaces>* E DDD - description E Wed - Every Wednesday
Periodic Event <3 spaces>* En dd MMM yyyy - description E3 02 Dec 2002 - Every three days starting 02 Dec 2002

I've been running this version for a while and done lots of testing on a few of my sites and it seems to work alright. I thought I'd put it out there and see what others think. If nobody objects, I'd like to post it to CalendarPlugin as a new version.

I'm still planning to add interval support to those that don't have them but haven't found the time.

-- DanBoitnott - 18 Dec 2002

Here's a new syntax I've come up with to allow exceptions in items which produce more than one highlight:

  • 03 Dec 2002 - 22 Dec 2002 X { 06 Dec 2002, 09 Dec 2002 - 12 Dec 2002 } - Description
I have a need for something like this because of one-time schedule changes to repeating events due to holidays etc. Thoughts?

-- DanBoitnott - 19 Dec 2002

I've posted a new version of the module with the exception support mentioned above. All item types support this feature except single dates with years (it would be a waste of time). The exception list is marked like this:

  • 03 Dec 2002 - 22 Dec 2002 X { 06 Dec 2002, 09 Dec 2002 - 12 Dec 2002 } - Description
The exception list is a comma delimited list of full dates and date ranges. As far a I can tell it works alright, but I haven't tested it much yet so be warned. Also, I need to go through some of the exception code and make it faster.

-- DanBoitnott - 20 Dec 2002

I've posted a new version of the module which improves the way the modules are loaded and used in the code I added. I wasn't taking full advantage of Perl's selective loading features.

-- DanBoitnott - 20 Dec 2002

I must have forgotten to "Save"... one possible enhancement would be the ability to define alternate day headings, which HTML:CalendarMonthSimple doesn't provide attributes for (i.e., it provides accessor methods instead).

-- AnthonPang - 25 Dec 2002

small suggestion: being able to read dates/periods from more than one topic could be useful.(having bank holidays in one topic, web specific dates in an others ...). An other + would to render this events differently depending on the topic the date read from. (specifying the rendering in the topic the dates are read from instead of the Plugin preference topic )

-- MarcelTrap - 27 Dec 2002

At the moment the only way read from multiple topics is to include them onto a single page with the INCLUDE tag. And then specify that master page as the topic for the CALENDAR tag. The include method will not work if the calendar is drawing from it's own page because it relies on tag expansion and this would create a circular reference. I don't know if this functionality is included in the main release on the CalendarPlugin page but it is in the dev release attached to this page. As far as different rendering for different source topics, it may be possible to do something clever with the format parameter but I'm not sure.

-- DanBoitnott - 27 Dec 2002

I just found the CalendarPlugin and would like to suggest the following features (not sure whether they are already in one ofthe Dev versions):

  1. The calendar should (optionally) show anniversaries when a full date is given:

Event Definition on 10 Feb 2000 on 10 Feb 2001
* 10 Feb 2000 - Pete Pete Pete [1]

  1. The calendar should allow event definition in several separate topics and merge these so that eg one can have one topic for national holidays, one for personal events etc and then can select which ones to include.
    • I too would really like this feature. -- MC.
  2. For that purpose there should maybe be an optional 'importance' of events to control in which sequence they are shown in one day's field if more than one apply (plus a max # events to show per day)
  3. There should be a 'redletter' option to make an event create a red-letter day.
  4. The calendar could look up user-specific variables (defined in a user's personal topic?) to decide which event topics to actually read or which sequence of importance to use? Not sure how this woudl exactly look, but it could allow a single calendar to be personalized by user reading it?

-- MathiasKoerber - 30 Dec 2002

I've just installed CalendarPlugin, and things are looking really promising here. I do have one question..... what I'm primarily interested in using it for is a sort of WikiLog? .

Is there anyway (as the plugin currently stands, or through a simple hack - my perl is nearly non-existant, but I'm not afraid to break things and start over if someone can give me a push in the right direction) to have the calendar automatically link to daily topics, rather than listing events directly within the calendar itself.

What I mean is, having each date be automatically set as a WikiWord or link, which would lead to the topic (in this case, a blog entry) for that day (i.e. "13Feb2003", or a more appropriate date format)

-- StephanieSmith - 13 Feb 2003

I'd like to add a web-form to the Calendar page that would take a date and a description as parameters and on submit would do two things:

  1. create an entry in the current calendar
  2. create a new topic with a name based on a predefined template, topic name prefix (using hidden paramaters) and the entered date

I'd appreciate if authors would add such a feature or maybe let me know how I can do this myself. I know perl, but very little php and I am a novice in TWiki.

Thanks.

-- NicholasSushkin - 18 Mar 2003

If you view previous versions of a topic with the calendar entries defined in the same topic you still see the current callendar. This is probably just another manifestation of the preview bug.

-- SamHasler - 02 May 2003

It seems that automatically generated appointments (e.g. calculated dates) dont show up in the calendar. A (silly) example:

   * %GMTIME{"$day $month $year"}% - Today
   * %CALC{"$EVAL(%GMTIME{"$day"}% + 1)"}% %GMTIME{"$month $year"}% - Tomorrow
   %CALENDAR%

Nothing will show up in the calendar. We found out that a web's source file is used without beeing 'pre-compiled' by the TWiki layout mechanism. It would be great to have it.

-- JensKloecker - 07 May 2003

I host two sites on the same server in America. One site serves the UK and the other Australia. Presently both sites highlight the date that is current in America!

  1. Has anyone got a fix that will fudge the hightlighting to force it to a given single timezone?
  2. Has anyone any thoughts as to how to fix this generally problem generally so that a site that serves multiple timezones shows the appropriate setting according to a user preference?

-- MartinCleaver - 07 May 2003

It seems that the dev version of this plugin has been sitting around being tested for quite some time. I've added the patches provided by AnthonPang & JensKloecker, added a new yearly syntax, and posted it as V 1.008 to the release page. The new yearly syntax allows for events like "The 3rd Friday in June" and "The last Sunday in April." You can see this version of the plugin in action at http://www.lclinux.org/twiki/bin/view/Test/CalendarTest. I'm also looking at how to handle the timezone issue.

-- DanBoitnott - 07 May 2003

I just added a new attribute "lang" to the calendar to select the language for the month and day names. Example:

   %CALENDAR{ lang = "de" showweekdayheaders="1" }%

produces German language month and day headings. The attribute values are those of Date::Calc (see the module documentation). A patch is attached.

-- JensKloecker - 07 May 2003

After a few hours of frustration I discovered the problem with the timezone issue. I had coded in the ability to set the $currentDay variable using an offset from GMT but it wouldn't highlight the offset day on the calendar. It turns out that HTML::CalendarMonthSimple figures out the date on it's own and doesn't accept explicit values. There are three ways to fix this:

  1. Have the script temporarily set the date on the server and set it back when it's finished. - This would be silly in the extreme and would be forbidden by any decent OS.
  2. Patch HTML::CalendarMonthSimple to accept the new values, post the patch here, and try to get it accepted into CPAN
  3. Do away with the HTML::CalendarMonthSimple dependency by integrating the calendar rendering functionality into the plugin
Any thoughts? Also, would anybody mind the refactoring of this page? It's gotten really long and most of the issues have long since been addressed.

-- DanBoitnott - 08 May 2003

Just upgraded from v1.006 to v1.008 Plugin seems not working for Windows Twiki. (calendar page was working fine on v1.006 but not on v1.008)

This problem only exist on calendar with events. Any other people having similar experience?

-- HengMengDIY - 09 May 2003

The first thing to check is that you have the CPAN dependencies installed. v1.008 depends on:

To install these modules from CPAN:

  1. Run: perl -MCPAN -e shell - If this is the first time you've run this it'll ask you to configure it. Do this.
  2. When you get the CPAN prompt type: install Date::Calc - This will do the install for you. Repeat for HTML::CalendarMonthSimple if you don't have it. If you were running v1.006 you probably do have it.

-- DanBoitnott - 09 May 2003

I've just posted a new version to the main package page which corrects a FIXME that was in the original plugin. The plugin is now able to have an event topic on a web other than it's own. I posted it directly to the release page because I've received some help requests related to this issue.

I've also viciously refactored this topic. I've tried to retain bug reports that still apply and feature requests. If you need to reference previous content see version 1.67 of this topic.

-- DanBoitnott - 10 May 2003

I recovered older content and archived it in CalendarPluginDevArchive.

-- PeterThoeny - 10 May 2003

In an attempt to solve MartinCleaver's timezone issue I've made a patch to the HTML::CalendarMonthSimple module to allow an explicit date to be passed in. I've also made a slightly modified version of this plugin to take advantage of it. It works by taking an extra parameter: gmtoffset and using it to calculate today's date. If you live East of Greenwich this value will be positive and can be set with or without the plus sign (+). If you are west of Greenwich you must provide the minus sign (-).

I hope this helps and would be very interested to know one way or the other. If you'd like to see this property in action visit http://www.lclinux.org/twiki/bin/view/Test/CalendarTest.

-- DanBoitnott - 10 May 2003

Looks great Dan, so thankyou. Sorry I've not responded earlier - I've been away on hols.

Marc Kerr says in http://search.cpan.org/author/STRYTOAST/HTML-Calendar-Simple-0.04/Simple.pm "that it was a bit depressing to keep writing modules but never get any feedback. So, if you use and like this module then please send me an email and make my day", so I'm sure he'd appreciate the feedback/modification.

I'd like to strongly discourage you from duplicating the code and forking away from HTML::CalendarMonthSimple; but if you or anyone does have a mod that the author won't take the appropriate place to push the new version is on CPAN where it can be advertised next to the author's version. That way other potential users of the module get the chance to question which version to use and to push for or implement a version with the features integrated.

To back this up, I had confused CPAN:HTML-Calendar-Simple-0.04 with v1.08 of CPAN:Calendar-Simple (released by Dave Cross yesterday, CPANRssNews told me), just suggesting there is enough duplication of effort out there in the CPAN world without the TWiki community forking their work as well.

Lastly, whilst a great way to give feedback to the CPAN author and to provide interim functionality to bleeding-edge users, getting people to patch their CPAN modules is something we should avoid. The TWiki community has not yet standardised on where patched CPAN modules should be placed (see CpanPerlModulesRequirement) and without guidance, some users may be tempted to alter their core version (both bringing instability to other programs that use it and an invitation for some automated update program to wipe over the patched version with the authors new version) or to duplicate the install (potentially confusing for administrators who don't know that their is a locally patched version).

So, in short, patches are at best unorthodox and without some control mechanism are a recipe for confusion.

-- MartinCleaver - 15 May 2003

This plugin (and me, in the process) suffers from being packaged for a Plugins web rather than the TWiki web.

To correct:

  • mv data/Plugins/CalendarPlugin.txt data/TWiki/CalendarPlugin.txt
  • mv pub/Plugins/CalendarPlugin/* pub/TWiki/CalendarPlugin/

This issue was recently discussed about KoalaSkinDev - Colas now provides a second version for those people who don't have a separate Plugins web.

There exists a topic that talks about this issue. I don't recall its name.

Thanks a lot for the new version, Dan.

-- MartinCleaver - 15 May 2003

Also, the data/Plugins/CalendarPlugins.txt file says it is version 1.005 not 1.009.

-- MartinCleaver - 15 May 2003

I've posted a new package which addresses both of the above issues. About the patch: I've been thinking along similar lines. I don't really want to reimplement the calendar functionality in the plugin and it's not the Open Source thing to do. The patch I posted is intended for bleeding-edge users. I've been meaning to send the patch off but haven't had the time. Have you tried it yet? Does it work?

-- DanBoitnott - 16 May 2003

I've sent the patch off for consideration by the author of HTML::CalendarMonthSimple, Gregor Mosheh (stigmata@blackangelPLEASENOSPAM.net) in the hope that he'll integrate it into his next version. I'll keep everybody updated on developments.

-- DanBoitnott - 16 May 2003

Thanks for that Dan. I've not tried the patch because I neither have a cpan override directory (See CpanPerlModulesRequirement) nor root access at my hosting provider. I look forward to Gregor releasing the new version though.

BTW, the documentation bundled using +++ for headings. This does not work on most TWikis, the correct format for a level three heading is ---+++. Ta.

-- MartinCleaver - 17 May 2003

It might be possible to put a patched version of the module in the bin directory (or somewhere else you have access to) and modify the plugin slightly to access it instead. Also, I left the headings as they were when I started work on the plugin. I'll clean them up in the next release.

-- DanBoitnott - 17 May 2003

The author of HTML::CalendarMonthSimple, Gregor Mosheh (stigmata@blackangelPLEASENOSPAM.net) has integrated my patch (with a few changes) into v1.23 of his module. You can now enjoy the gmtoffset option using standard CPAN modules. I've attached a version of the CalendarPlugin below that uses this version of HTML::CalendarMonthSimple.

-- DanBoitnott - 20 May 2003

Fantastic. This is a fine example of how TWiki contributors should work with CPAN authors. Well done.

I'll instruct my hosting provider to upgrade the module and test it ASAP.

Thanks again Dan.

-- MartinCleaver - 20 May 2003

It occurred to me that I would want to be able to add events on the calendar to my MS Outlook schedule. Obviously the way to do this is via internet calendaring schedule (ICS) files. Today I discovered that there is a CPAN module (CPAN:Net-ICal) that does this, but development seems to have petered out last September; I read the developers mailing list archive (http://www.geocrawler.com/archives/3/7859/2002/9/0/) it said:

> After getting very stuck on timezones and how to handle
> recurrences, I got kind of... demotivated about working on this
> stuff. I'd still like to work on it, but I really need other people
> with bright ideas to help out.
> 
> I have a feeling that Apple's new iCal application & hype might
> provoke a  nice little resurge in development of the project.

I guess we need to contact Shane R. Landrum (slandrum AT cs DOT smith DOT edu)/http://www.cs.smith.edu/~slandrum/ and ask him the status of the project; the functionality that is there looked great.

-- MartinCleaver - 24 May 2003

Another implementation: http://search.cpan.org/author/FGLOCK/DateTime-Event-ICal-0.01/

-- MartinCleaver - 24 May 2003 Dan, I just started using the topic= parameter, e.g.

---+Stream A: TermTwoStreamATimetable
%CALENDAR{showweekdayheaders="1", topic="TermTwoStreamATimetable"}%
---+Stream B: TermTwoStreamBTimetable
%CALENDAR{showweekdayheaders="1", topic="TermTwoStreamBTimetable"}%
---+Stream C: TermTwoStreamCTimetable
%CALENDAR{showweekdayheaders="1", topic="TermTwoStreamCTimetable"}%

What I also want to do is have a combined calendar, but the following, and several variants don't work:

%CALENDAR{showweekdayheaders="1", topic="TermTwoStreamATimetable,TermTwoStreamBTimetable,TermTwoStreamCTimetable"}%

Is there a syntax for this already?

Many thanks, Martin.

-- MartinCleaver - 25 May 2003

The plugin won't process two topics at once but you can put together another topic like "TermTwoAllStreamsTimetable" and use it to include the other topics and make it the topic for your combined calendar. An example of this is my event list which has events of it's own and some included from other topics.

-- DanBoitnott - 25 May 2003

Here's my experience installing verion 1.009 of this plugin. I saw some CPAN modules were needed and I felt unhappy. The Perl for this machine was not configured for CPAN but it seemed to work out OK with an auto-configuration rather than a manual config. I noticed that that the Bit::Vector module is a pre-requisite for the Date::Calc CPAN module is a prerequisite for the HTML::CalendarMonthSimple module. I am running a Debian system so I don't know if Bit::Vector is installed by default on other systems so I didn't change it, but I did change the order of the modules listed on the main plugin page. I went to cpan.org and looked in the FAQ and found this command line which I typed and it worked flawlessly perl -MCPAN -e 'install HTML::CalendarMonthSimple'. I hope this helps others who attempt this install.

I also find that my /usr/local/share/perl/5.6.1/HTML/CalendarMonthSimple.pm file is not editable per the instructions at line 197 so I have not performed this edit. I hope I don't get spurious error messages as are promised without this modification. The installation looks to work just fine.

Oops, I also got an error when I run my cron mailnotify script:

Parentheses missing around "my" list at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.
Useless use of a variable in void context at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.
Useless use of a variable in void context at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.
Useless use of a variable in void context at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.
Useless use of a variable in void context at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.
Useless use of a variable in void context at ../lib/TWiki/Plugins/CalendarPlugin.pm line 216.

This diff seems to make it mostly work but there's still a problem.

216c216
<     my $currentYear, $currentMonth, $currentDay, $hh, $mm, $ss;
---
>     my ($currentYear, $currentMonth, $currentDay, $hh, $mm, $ss);

Now I get an error of

"my" variable $mm masks earlier declaration in same scope at ../lib/TWiki/Plugins/CalendarPlugin.pm line 281.

So now I'm trying this out. I'm hoping this hunk won't change the functioning of the code.

281,282c281,284
<     my ($descr, $dd, $mm, $yy, $text) =
<        ('',     '',  '',  '',  ''   );
---
>     my ($descr, $dd, $yy, $text) =
>        ('',     '',  '',  ''   );
>     $mm = '';
>

-- GrantBow - 26 May 2003

That was all my fault. I failed to note that $mm was already being used. I've corrected the code and posted it to the plugin page. Also note that this release (v. 1.010) contains the gmtoffset option so I've added it to the documentation. I've also addressed the the documentation issues brought up by MartinCleaver. Sorry about the trouble, I hope this release sets everything right.

As per MartinCleaver's other suggestion, I'm also very keen to get this plugin to sync with a client-side calendar.

-- DanBoitnott - 26 May 2003

Eek. I implemented v1.010 (thanks, Dan, BTW) and all my calendar entries have turned to "!", i.e. point to exclaim.gif! What have I done wrong?!

-- MartinCleaver - 27 May 2003

Hi. This is one of the most useful plugins I install to our TWiki. But I found big problem. When you have more events in one day you are very limited with possible layout formatting.

For example: format =

"<b>$old</b><small>$description</small><br>"
If in one day are two events than only the last event will be in regular font. Previous events will be in bold font.

Well, I changed the handling of events and now you can use two different formats. Format for whole cell and format for description of events. I created new attribute "formatDescription" to use for it. I attach the modified version of script if you want to try it or if you want to implement the changes to this plugin.

-- RichardBaar - 27 May 2003

RichardBaar's problem with items being bolded is in his format string: the <b>$old</b> is what's doing it. Here's how the format string works: When the plugin adds an item to a calendar cell it replaces it's contents with the format string. It takes what was in before and expands $old and expands the new description into $description. Here's my format string, you might give it a shot:

$old<br><small>-&amp;nbsp;$description</small>

I've no idea what the deal is with exclamations on MartinCleaver's site. Is your site public? Is there a way I can see what's going on?

-- DanBoitnott - 27 May 2003

(I switched the usernames the right way around - they had become wrongly signed). I'll send you the URL in an email Dan.

-- MartinCleaver - 27 May 2003

Well, our site is not public but I will try explain what I need and what was wrong with CalendarPlugin before I made the changes. We use the CalendarPlugin for viewing release cycles of our products. And I want to do a page with the calendar where each will see the milestones of each product. I used CalendarPlugin and it was OK till in one day where releases of two or more products. The problem was that with this format:

$old<br><small>-&amp;nbsp;$description</small>
the rendered calendar was almost unreadable. The second problem is that I want the day in bold and with font "+2". Well, I wanted to render each cell as separate table like this:

<table>
<tr><td align='center'><font size="+2"><b>Day XX</b></font></td></tr>
<tr><td align='left'><hr><small>Description for release of product 1</td></tr>
<tr><td align='left'><hr><small>Description for release of product 2</td></tr>
<tr><td align='left'><hr><small>Description for release of product 3</td></tr>
</table>

This wasn't possible with the former way of rendering events, because - as you wrote - each event was added at the end of the old cell content immediately. After my changes, at first is created array of events and then is for each day rendered at first descriptions of each event for this day and last action is rendering the whole content of appropriate day-cell.

Well, I have to say that I am newbie to Perl and maybe the changes are not in Perl-way programming conventions but it works!! :-)))

-- RichardBaar - 27 May 2003

I'd like to pick up on earlier discussion between MartinCleaver and DanBoitnott regarding merging data from multiple calendars. In surveying the desires of folks for calendar features, this ranks very high. While I'm really glad to find out a way to do this that Dan described, I think the feature is important enough to consider implementing it along the lines Martin described.

The other feature that needs to go along with this is being able to designate whether a particular event should be "rolled up" into the more general calendar. This is equivalent to the feature in many group calendaring programs of designating an event as public or private. I can image an additional event variable that designates the event as public (with the default being private).

-- LynnwoodBrown - 27 May 2003

I'm having several problems with the latest release (v1.010). I'm getting a bunch of the following in my error log:

render: Use of uninitialized value in join or string at ../lib/TWiki/Plugins/CalendarPlugin.pm line 123.

I've also got a page that appears to get into some kind of infinite loop. These are the errors:

render: Deep recursion on subroutine "TWiki::Plugins::applyHandlers" at ../lib/TWiki/Plugins.pm line 388.
render: Deep recursion on subroutine "TWiki::handleCommonTags" at ../lib/TWiki/Func.pm line 757.
render: Deep recursion on subroutine "TWiki::Plugins::commonTagsHandler" at ../lib/TWiki.pm line 1957.
render: Deep recursion on subroutine "TWiki::Plugins::applyHandlers" at ../lib/TWiki/Plugins.pm line 299.
render: Deep recursion on subroutine "TWiki::Plugins::CalendarPlugin::commonTagsHandler" at ../lib/TWiki/Plugins.pm line 171.
render: Deep recursion on subroutine "TWiki::Plugins::CalendarPlugin::handleCalendar" at ../lib/TWiki/Plugins/CalendarPlugin.pm line 113.
render: Deep recursion on subroutine "TWiki::Plugins::CalendarPlugin::handleCalendar" at ../lib/TWiki/Plugins/CalendarPlugin.pm line 113.
render: Deep recursion on subroutine "TWiki::Func::expandCommonVariables" at ../lib/TWiki/Plugins/CalendarPlugin.pm line 299.

I looked through the code a bit, but it's been far too long since I've done any Perl. smile Any assistance would be appreciated!

-- SeanTimm - 27 May 2003

Ahh. Having read the code and Richard's comment again I now understand. The ! marks were simply the default compressed 'format' string; for some reason editing CalendarPlugin page and saving it was what I needed to do.

Richard - your change sounds good. Any chance you can produce a version for 1.010? Dan - can you test it and, if you are happy, perhaps you'd like to help Dan get it released as 1.011?

-- MartinCleaver - 28 May 2003

Hi,

I attached version 1.010 with my changes. Changes are:

  • added new attribute weekstartsonmonday
  • added new attribute formatDescription
  • remade the algorithm of generating content of calendar cell as I described above

On our Wiki it works OK but some testing is needed.

-- RichardBaar - 29 May 2003

Hey Richard, I guess something needs a sensible default because I haven't changed the settings but I get the above result when applying your version. Can you either post a new version or (in the meantime) tell me what to change? Thanks! M.

-- MartinCleaver - 29 May 2003

I am sorry!! The reason why you have the output as you have => you have specified attribute format in your CALENDAR variable and you don't specify formatDescription.

In my script default values are:
format

<table width='100%'><tr><td><b>\$day</b></td></tr>\$description</table>
formatDescription
<tr><td align='left'><hr size=1>\$description</td></tr>

I forget to say that now you have to specify both attributes format and formatDescription. Or try to remove from your CALENDAR these two attributes. Than will be used default values from the script. The second thing is that I removed $old makro because now is not needed.

Example of using:

%CALENDAR{topic="aTopic"}%
%CALENDAR{topic="aTopic" format="<font size='+2'><b>$day</b></font><br>$description" formatDescription="$description<br>"}%

Of course it is possible to change the defaults in script to another values and let the script replace the makro $old with empty string for backward compatibility!! I let in attached script default values we use in our TWiki.

-- RichardBaar - 29 May 2003

Don't worry, I much appreciate your changes. It looks a lot nicer now smile

The only thing that I want different now is for calendar items ro remain Wiki-ised. I have entries such as:

  • 5 May 2003 - DinnerOnSouthBank? 7:00 pm
  • 6 May 2003 - GoKarting? 1:00 pm
  • 6 May 2003 - LiveMusicAtTheRainbow? 8:00 pm

But now, when they show in the calendar, they don't link to the associated topic. Once this functionality is restored we can get your changes released as 1.011 of CalendarPlugin!

-- MartinCleaver - 29 May 2003

I figured out the recursive lockup I was seeing. We had a calendar on a page that was referring to another topic for its tasks. However, this topic also had a calendar, and I think this caused it to go into some kind of loop. Moving the events to a completely separate topic works fine for me, but this should probably be fixed somehow since you end up with an "Internal Server Error" otherwise.

-- SeanTimm - 29 May 2003

This might be a bug: if I use one %CALENDAR{}, say to display May 2003, which is fine. However, if I want to display multiple calendars, for example:

%CALENDAR{month="5" year="2003"}
%CALENDAR{month="6" year="2003"}
%CALENDAR{month="7" year="2003"}
Preview will just hang there, no error message return whatsoever. What puzzles me is, in rare occasions, maybe one out twenties tries, I can get it through. Close examination of my system setup doesn't help. Any idea what causes this?

-- OliverWang - 29 May 2003

Hi Martin,

it is strange because I do nothing with this. The rendering of Wiki words should be the same because the only thing I did is another way of filling cells of calendar. This is also strange of this point of view - this happens only when the Wiki word is the first word in description. If there is anything before it then it is rendered correctly. The 'hot fix' is to put the Wiki word into double brackets [[Wiki word]]. I will try to look inside the TWiki code and find better solution.

RichardBaar - 30 May 2003

Hi Oliver,

I tried to put eight calendars on one page and everything is OK. What version of CalendarPlugin do you use??

RichardBaar - 30 May 2003

Hi, Richard,

I tried both 1.10 (latest) and a prior version, both failed. I was kind of frustrated, and almost ready to give up this plug-in, though I'd really like to make it work. Anyway, other system infomation include:

  • TWiki version: 01 Feb 2003
  • Perl version: 5.8.1
  • Web server & version: Apache 2.0.45 (both perl and apache are from rawhide)
  • Server OS: Red Hat Linux 9

-- OliverWang - 02 Jun 2003

Oliver,

I was having a similar problem, but with a few tweaks it's gone away..

--- CalendarPlugin.pm   2003-06-01 14:07:31.000000000 -0400
+++ CalendarPlugin.pm.tweaked   2003-06-02 13:02:27.000000000 -0400
@@ -122,9 +122,11 @@
   my $pattern = "^\\s*\\*\\s+$_[0](\\s+X\\s+{(.+)})?\\s+-\\s+(.*)\$";
   my @lines = split /\n/, ${ $_[1] };

+  no warnings; # lazy_hack
   my @res = (map  { join '|', m/$pattern/ }
             grep { m/$pattern/ }
             @lines);
+  warnings; # /lazy_hack

   # Remove the lines we handled, so that when several patterns
   # match a line, only the first pattern is really honored.
@@ -345,7 +347,7 @@
        foreach $d (@days) {
            ($dd, $mm, $yy, $xs, $xcstr, $descr) = split( /\|/, $d);
            if ($yy == $y && $months{$mm} == $m) {
-             $descs[$y][$m][$d] .= "$descr\|";
+             $descs[$y][$m][$dd] .= "$descr\|";
            }
        }
        # then collect all dates without year

-- TomHowellCintron - 02 Jun 2003

Hi, Tom,

Thanks very much for the patch. It works!!! More details are: there are some errors when applying it to v1.010 (it may not be your running version). And the second modification from $d to $dd doesn't work in my case. The only mofication needed is "no warnings; .... warnings;". Aagin, thanks a bunch.

  no warnings;
  my @res = (map  { join '|', m/$pattern/ }
             grep { m/$pattern/ }
             @lines);
  warnings;

-- OliverWang - 02 Jun 2003

In an effort to get the rendering bug resolved, I have posted the support request FirstWordIsNotLinked

-- MartinCleaver - 03 Jun 2003

Ah, hell, it bothered me enought that I fixed it. This might be considered a hack or it might be considered that there is a problem with the core, I am not sure - see below.

The symptom was that the FirstWordIsNotLinked - the resulting HTML was:

<tr><td align='left'><hr size=1>ManEcon 6 (CUB) 3:30:00 PM</td></tr>

Notice there is no space between the 1>ManEcon - TWiki took this to mean that it should not render the word as a link. Altering $formatDescription to include one did not help:

formatDescription

<tr><td align='left'><hr size=1> \$description </td></tr>

I assume this was because the code that extracts parameters trimmed the space either side. My solution or hack was to alter line 484 from:

  $format =~ s/\$description/$description/g;

To:

  $format =~ s/\$description/ $description/g;

The problem I am concerned about the core is that I believe WikiWords prefixed with a > should result in a link. This will otherwise particularly be a problem when WYSIWYG Editors such as HtmlareaEditor? become mainstream. I think addressing the request in BoldTWikiWordsAreNotHyperlinked would solve the problem but I appreciate that it would complicate the current parsing mechanism.

-- MartinCleaver - 03 Jun 2003

I looked at the Multiple calendars thing. Its line 290ish where it says:

  if ( defined $options{topic} ) { 
     ... long ramble of code.

We want something like:

  if ( defined $options{topic} ) { 
  my $topics = split ",", $_;
  for $topic (@topics) {
     ... long ramble of code.
  }

Where ... long ramble of code would be best off in a subroutine.

I need to sleep now, but that's the basic idea.

-- MartinCleaver - 03 Jun 2003

I have a fresh TWiki install, a fresh plugin from the CalendarPlugin page, and fresh installs of the CPAN modules.

I'm getting the following error on every page except the CalendarPlugin page itself, which works. This is similar to the one that SeanTimm reported above, but his was on render: instead of view:

 view: Use of uninitialized value in join at ../lib/TWiki/Plugins/CalendarPlugin.pm line 123.

On the other pages with calendars, I see the calendar, but the events aren't shown at all.

-- KarlJSmith - 18 Jun 2003

Hi everybody. I'm on haitus at the moment trying to complete several major projects at once. I did have a look at line 123 and it appears to be a comment with no joins around. Are you using the main release or a development version of the plugin?

-- DanBoitnott - 18 Jun 2003

I am using the latest main release from the CalendarPlugin topic (v1.010).

-- SeanTimm - 18 Jun 2003

I had another look and found that on that release line 123 does have a join. It is however some of the most mature code in the plugin and I couldn't find a problem just looking at the code. Is the site you're having trouble with public? Can you post a URL I could check out for debugging purposes? Also, though I don't think this is the issue, what version of Perl are you running?

-- DanBoitnott - 19 Jun 2003

I've figured it out. I'm still getting the 'join' warning, but I finally have dates in my calendars. The problem was that I used 'June' instead of 'Jun', and that made all the entries in the calendar itself vanish - I got calendars without any contents. When I checked the logs for errors, I got the join error instead of an 'unparseable date' error, so I assumed something was broken at a higher level, even though it was still working in the example page.

-- KarlJSmith - 23 Jun 2003

Hey everyone. I'm setting up an equipment booking system. There is one Calendar topic page for each piece of equipment. The users can add the date and their name after it, and this will get stuck into the Calendar. I'd like to be able to extract the number of days a user used a certain machine, for billing purposes. I'm looking at the CalendarPlugin.pm file and trying to use the event parsing function in there, and all the regexp for that. And every time I see an occurence of some person's name in the description of an event, I'll increment the number of days associated with their name in a hash table. It's not working right now, because I suck at Perl currently... I was just wondering if anyone knows any quick or easier ways to do this? Currently I'm just trying to make a Perl script which will extract info from the wiki topic's text file source.

-- DavidGrant - 07 Aug 2003

Anyone else have problems printing this? The grid lines don't come out making it really hard to read.

  • I was experiencing this also and thought it a bug. Then I realized it was because I had "print background colors" turned off in my browser print options. -- LynnwoodBrown - 22 Mar 2006

-- MartinCleaver - 13 Aug 2003

I too have the stupid join problem on line 123. It's trashing up my web server's error log. Has anyone moved forward on finding out why this occurs?

If I add:

$_[0] = "";

before the line, the problem goes away. It appears as if fetchDays is sometimes being passed an uninitialized value or something along those lines.

My error_log and disk quota would appreciate a fix for this. smile

-- TedPavlic - 16 Aug 2003

Regarding this plugin, I developed a calendar processing engine to track workhours using algorithms supplied in the implementation by Gred Hewgill at the link below. I believe this plugin could do away with requiring external packages and could generate the table internally which would provide more flexibility:

http://www.perl.com/language/ppt/src/cal

This is what I used in my QuickCalendarPlugin.

-- JonathanCline - 22 Aug 2003

I've partly tracked down the "Use of uninitialized value in join or string at" error at line 123.

The two values that are passed into fetchDays as $_[0] which trigger this message are:

  • ([0-9]?[0-9])\s+(Sep|May|Jul|Jun|Jan|Nov|Aug|Mar|Feb|Dec|Oct|Apr)\s+([12][0-9][0-9][0-9])
  • ([0-9]?[0-9])\s+(Sep|May|Jul|Jun|Jan|Nov|Aug|Mar|Feb|Dec|Oct|Apr)

I'll update here if I find a fix.

-- DeWittClinton - 22 Sep 2003

Enhancement request/proposition: allow for comments in calendar entry lines that are not rendered in the calendar itself. Thereby all essential information about an event can be kept at one place without using too much place in the calendar rendering. In my quick fix, everything after (and including) the pipe symbol is removed from the rendered entry (named $descr or $description in the perl module). For example, in

  • 09 Oct 2003 - patch CalendarPlugin | allow for comments in calendar entries
only "patch CalendarPlugin" would appear in the calendar. Here the patch against stock version 1.010:
*** CalendarPlugin.pm.orig      Mon May 26 17:44:03 2003
--- CalendarPlugin.pm   Thu Oct  9 14:58:01 2003
***************
*** 464,469 ****
--- 464,471 ----
        my ($c, $day, $description, %options) = @_;
        my $old = $c->getcontent($day);
        my $format = $options{format};
+         # NB: delete comment after | symbol
+         $description =~ s/\|.*//;
        $format =~ s/\$description/$description/g ;
        $format =~ s/\$web/$options{web}/g ;
        $format =~ s/\$topic/$options{topic}/g ;

-- NilsBluemer - 09 Oct 2003

Nils, how hard would it be to put comments in a title attribute for the table cell or content?

-- SamHasler - 09 Oct 2003

Anybody have a problem where having more than ten bullets (date inputs) on a page cause the calendar to stall. i.e. 10 bullets and the calendar pops up. 11+ bullets and it thinks a long time till I run out of patience. As it is, I've divided up my calendar into categories to keep less than 10 events per page.... any ideas why this happens?

Installed I have, according to testenv Date::Calc (5.3) Warning: 'Date::Calendar' not installed - check TWiki documentation to see if this is required. HTML::CalendarMonthSimple (1.23) Operating system: Unix (redhat linux) Perl version: 5.8.0

BenjaminFleischer - 10 Oct 2003

I'd like to suggest an enhancement for included calendars. I would like to see people maintain individual calendars (TWikiNameCalendar? ) and then include them into group and project calendars. This should be possible with 1.009 and later. What I think would enhance this ability is to be able to specify a prefix for included calendars. This could be used to prefix people's events with their TWiki name. This would allow people to maintain their vacation schedules in one place, but have them show up on all calendars that include their events.

For example, on my calendar I'd have something like `` * 20 Dec 2003 - 26 Dec 2003 Vacation''. So on my personal calendar it would show up as ``Vacation''. On the group calendars I would like to prefix it with JeffreyHonig so the event would be listed as ``Main.JeffreyHonig Vacation''.

-- JeffreyHonig - 29 Oct 2003

I get a lot of:

view: Argument "L" isn't numeric in numeric eq (==) at ../lib/TWiki/Plugins/CalendarPlugin.pm line 409.
which is from:
if ($dd == "L") {
which should be:
if ($dd eq "L") {
(the "==" changed to "eq"). This happens when you use the L for last day in a month repeating event.

-- SandyMcArthur - 29 Oct 2003

Can anybody help me with the CalendarPluginUndefinedSubroutine ?

Thanks !
-- KeithHelfrich - 29 Oct 2003

As an alternative to my previous problem (Internal Server Error/timeout when source page has >10 bullets), is there a simple modification to the source code to only pull out weekly events? I made my own calendar using recursiverender and it would be great to have a headlinesplugin-like ability to create a table with each cell having specific date information. Specifically, I'd like to have headlines for "Monday" with a link to the source page which contains more information, while using the CalendarPlugin lingo to specify which 'headlines' to pull.

Current code is

~calendar-row
~calendar-day-begin-weekly [[WeeklyCalendar#Sunday][Sun]] ~line 8pm Frisbee ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Monday][Mon]] ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Tuesday][Tue]] ~line 6pm Soccer ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Wednesday][Wed]] ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Thursday][Thu]] ~line Poker at Leo's? ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Friday][Fri]] ~line 11am Football ~calendar-day-end
~calendar-day-begin-weekly [[WeeklyCalendar#Saturday][Sat]] ~line 7pm Karate ~calendar-day-end

-- BenjaminFleischer - 06 Nov 2003

Well, I think I figured out what is causing the "Use of uninitialized value in join at 123" problem. Our calendar event file not only contains dates and events, but it also contains headers, comments and other nice things so it, too, is a TWiki page that displays nicely. All of those non-event lines are causing the errors. It is trying to parse out the date of the event. For those lines without dates, the uninitialized value results. Now that we understand it, since the events still render fine in the calendar, and since we want those headers, etc., we are just going to use the "no warnings" hack above to eliminate the log messages. Perhaps some Perl person could fix the script to ignore lines without valid dates.

-- SteveCooper - 13 Nov 2003

I have made progress but still need assistance with CalendarPluginUndefinedSubroutine -- please assist if possible. Thank you!

-- KeithHelfrich - 09 December 2003

I am having problems with 13+ events. 13 events - The calendar works. Add the 14th event - Stops working. Can someone tell me how to fix this. This plugin is great but with this restriction going to be tough to use.

-- ZrbZrajbun? - 21 Dec 2003

The following changes were made to plugin version 1.010 to get rid of the apache error log warning:

Use of uninitialized value in join or string at /twiki1/httpd/twiki-bin/b/TWiki/Plugins/CalendarPlugin.pm line 123.

Diff:

123,124c123,125
<   my @res = ( map { join '|', ( map { $_ || "" } m/$pattern/ ) }
<            grep { m/$pattern/ } @lines );
---
>   my @res = (map  { join '|', m/$pattern/ }
>            grep { m/$pattern/ }
>            @lines);

-- PaulineCheung - 24 Dec 2003

I created and uploaded a new Plugin version V1.011 that:

  • Shows now unsaved events in preview
  • Improves performance and lowers resource requirements
    • Could someone test if the limit on number of events is gone now?
  • Documentes most of HTML::CalendarMonthSimple attributes
  • Fixes a deep recursion bug
  • Fixes uninitialized value in join bug

To do:

  • The Date::Calc module is always loaded, also if there is no CALENDAR in a page. It should load only when needed (like HTML::CalendarMonthSimple)

-- PeterThoeny - 03 Jan 2004

I have a number of topics which use searches to collect events from different topics into a single one so they can be displayed in the same calendar in another topic using a topic="TopicContainingSearchForEvents" parameter. This stopped working when I upgraded from 1.010 to 1.011.

Is there a different way of collecting events from a large number of topics?

-- JensMadsen - SamHasler - 16 Jan 2004

Oh, I did not know it was used that way. What does work is a bunch of INCLUDEs of topics with events (in the calendar use HTML comments if you do not want to show the events).

The code can be fixed so that SEARCH also works. If possible there should be no performance penalty for calendars that do not use SEARCH.

-- PeterThoeny - 16 Jan 2004

Is it possible to have an yearly calender in one syntax?

-- JaiPrakash - 20 Jan 2004

I've just made changes to allow specification of multiple entries in the topic= parameter, e.g topic="Web.Cal1, Web.Cal2".

Am not sure how robust the change I have made is - perhaps someone could test it under their system and post any changes. If i hear nothing I've release this as a new version by the end of the week.

-- MartinCleaver - 18 Feb 2004

This plugin does not work with perl 5.005_03. It seems to be confused by the "our" declarations (starting on line 335). So, you may want to change the versions of perl that you claim it works with and/or fix the code to work with 5.005_03.

-- JordanShare - 19 Feb 2004

did you get it to work under perl 5.005_03? if so, could you please attach a unified diff (diff -u) patch to this topic?

-- WillNorris - 19 Feb 2004

Ah, no. I've not really put any effort into it at all (never having coded in perl before). I may take a stab at converting all the "our" to "my", but if that doesn't "just work", then I'm at the limit of my ability. smile

-- JordanShare - 19 Feb 2004

I just installed the latest version to eliminate the uninitialized value at line 123 error, but now I'm seeing the following error the httpd log:

  • Odd number of elements in hash assignment at /home/httpd/twiki/lib/TWiki/Plugins/CalendarPlugin.pm line 522.

It doesn't appear to be affecting the calendars we have instantiated on our site, but I figured I'd report it.

-- SteveRosenthal - 01 Mar 2004

  • This has been fixed in V1.015 of the plugin. -- DB - 11 Mar 2005

Thanks Steve. I thought this was my fault but I don't think so now. It is also not obvious to me what is going wrong.

A couple more comments to add to the pile:

  1. our %months = ( Jan=>1, Feb=>2, Mar=>3, Apr=>4, May=>5, Jun=>6, Jul=>7, Aug=>8, Sep=>9, Oct=>10, Nov=>11, Dec=>12);
    • This means that if the user does not abbreviate the month correctly then the entry does not go in.

  1. $text =~ s/

Warning: Can't find topic (.) /&expandIncludedEvents( $1, $options{web}, $options{topic}, () )/geo;

    • I think this could be expanded to call expandIncludedEvents for existing %CALENDAR lines - hence allowing inheritence of calendars
  1. The %CALENDAR takes month="03" but not month="Mar.*". This is confusing.

-- MartinCleaver - 06 Mar 2004

If you precede your event text by the time, then it turns out that the code benefits from the word 'sort' being inserted before the grep on line 356. This way your events are time ordered in the grid.

    # keep only bullet lines, and sort (so that event descriptions preceded by times appear in time order)
    my @bullets = sort grep { /^\s+\*/ } split( /[\n\r]+/, $text );

It'd be useful if the next person to release includes this in the code.

-- MartinCleaver - 07 Mar 2004

I ran across the hash error mentioned above and I believe this fairly ugly hack fixes it (or at least shows the problem, the %options is trying to eat all the things in @_). I don't remember the way to do this with Perl references (probably cleaner).

sub getTopicText {
    my $refText = pop @_;
    my $theWeb = pop @_;
    my $theTopic = pop @_;
    my %options = @_;
    ...
-- EricVarsanyi - 12 Mar 2004

Thanks Eric.

Incidently, anyone else seen a problem on XP/IE where each calendar entry shows only one word per line, regardless of how wide you make the window and regardless of the skin you use? See the 3 Mar 2004 for an example (sneaky midweek drink could go on one line).

Solved!

Great, thanks a lot Dan.

  • not-sized-properly.jpg:
    not-sized-properly.jpg

Dan added a width="100%" parameter (and a format="$old
-  $description") that solved this problem.

-- MartinCleaver - 13 Mar 2004

How can we change the color of an item in an individual cell? Or can we?

-- CharlieSmith - 15 Mar 2004

Has anyone given consideration to extending CalendarPlugin to:

  • Accept events defined with a time and duration?
  • Accept events defined with a time zone?

We've got the fairly typical problem of keeping people spread all over synchronized for meeting schedules.

-- BradDixon - 02 Apr 2004

CVS version has been brought up to match zip version 1.16 (which is version v1.013 of the plugin)

-- MattWilkie - 02 Apr 2004

I've attached a patch against the V1.013 version of this plugin which adds some features:

  • Support for events with time specifications.
  • Support for timezones.
  • Modifiable headers with $month, $year, and $tz variable substitution via the header option.
  • Modifiable date formats in cells with $date and $n variable substitution via the datenumberformat .
  • A new variable $time for the format option.

The event w/time parsing is done via the Date::Parse option. If Date::Parse is not present the plugin will function without it with obvious limitation. Acceptable format:

  • DD MON YEAR HH:MM (am|pm) GMT[+-]?\d?\d?

Current limitations:

  1. If you fail to specify a zone for an event or calendar you get the default TZ value or GMT.
  2. No repeating event support for date/time based events. Existing syntax for repeating events with dates only still works as before.
  3. No duration support (1pm-3pm).
  4. You can not use timezone abbreviations like PST, EDT, etc. These are all non-standard and non-unique. There are two EST's in common use, for example.
  5. I split the event string on '-' chars and then feed it to Date::Parse. Everything that comes after '|' in an event is a comment. You can not use '-' chars within your event description since it will hose the parser. I couldn't dream up a fancy enough regexp so I slacked off and used split.
  6. Makes no attempt to account for daylight saving time. If you've ever looked at those rules you would know why. The creators of calendar events and calendars must specify their GMT offset appropriately.

I am using this locally with these options set in CalendarPlugin? :

      * Set TZ = GMT-7
      * Set DATENUMBERFORMAT = $date$n
      * Set FORMAT = $old|$time|$description|$n
      * Set HEADER = <center>$month $year ($tz)</center>
This results in a calendar with tables in each cell listing events ordered by time. I then display my local calendar with:

%CALENDAR{tz="GMT-4"}%

This shifts all of the events for display in my local timezone.

I've done some quick sanity checking but would appreciate commentary.

-- BradDixon - 14 Apr 2004

Brad, useful enhancements. Could you elaborate on "No repeating event support". Is the existing functionality taken away with your patch?

-- PeterThoeny - 15 Apr 2004

Peter: No modifications to the existing parseable formats or features was made. The modification is backwards compatible with existing syntax. I just added an additional parsing function to the end of the parse chain that looks at any remaining bullets. Repeating events would be nice and maybe I'll get around to them. I've modified my earlier feature list to be more descriptive.

-- BradDixon - 15 Apr 2004

I just thought that the tz attribute is not linked to the gmtoffset attribute. This means that if you request a calendar display in your local timezone the events are mapped to that timezone but the calendar itself is not. This would be hard to notice except for circumstances where the timezone of the server puts it in a different day from the requested tz. I'll fix that in a bit.

-- BradDixon - 16 Apr 2004

New version of the patch uploaded. This version has two attributes controlling the local timezone of the calendar:

  • gmtoffset: Specified as +/- hours.
  • tz: Specified as GMT[+/-] offset.

tz takes priority over gmtoffset. Both may be specified in TWiki.CalendarPlugin or as an attribute. While two parameters are redundant I felt it was important to maintain consistency with the syntax used to specify events. I would suggest using one or the other option exclusively to avoid confusion. To test ensure that these two calendars highlight different days:

%CALENDAR%

%CALENDAR{tz="GMT+12"}%

-- BradDixon - 19 Apr 2004

I have a problem with sequence of execution with the Calendar. I am trying to put together many calendars into one. I have one way which works: a calendar generating topic with the topic= pointing to a topic which includes other (events lists) topics. Why can't I do it the other way: including the calendar at the end of the page including other topics, of course this time without specifying topic=.

It looks like this:

%INCLUDE{AlainMivilleDeChene}%
%INCLUDE{Holidays}%
%INCLUDE{OneYear}%

where the OneYear topic looks like this:

%CALENDAR{showweekdayheaders="1" month="-1" }%
%CALENDAR{showweekdayheaders="1" }%
%CALENDAR{showweekdayheaders="1" month="+1" }%
%CALENDAR{showweekdayheaders="1" month="+2" }%
%CALENDAR{showweekdayheaders="1" month="+3" }%
%CALENDAR{showweekdayheaders="1" month="+4" }%
%CALENDAR{showweekdayheaders="1" month="+5" }%
%CALENDAR{showweekdayheaders="1" month="+6" }%
%CALENDAR{showweekdayheaders="1" month="+7" }%
%CALENDAR{showweekdayheaders="1" month="+8" }%
%CALENDAR{showweekdayheaders="1" month="+9" }%
%CALENDAR{showweekdayheaders="1" month="+10" }%
%CALENDAR{showweekdayheaders="1" month="+11" }%

The first two includes transport the events lists but the last include doesn't take the events into account. Blank calendars are generated.

-- AlainMivilleDeChene - 20 Apr 2004 (previously posted 26 Oct 2003, not a comment since!)

How about a way to use a timezone that handles daylight savings time, and perhaps non-integer timezone offsets? I'm talking the TZ environment variable format here. And this is still suboptimal as the info will be based on the server, not the client, right?

On a different topic, I want to have a "group calendar" that is the union of the calendars of the people in the group.

My preference would be to have a page that contains:

  • an itemized list of the members
  • the current month
  • the next month

and the problem is this means that any time we add/remove a person it has to be done in 3 places. Is there a better way?

-- HarlanStenn - 21 Apr 2004

Alain: %CALENDAR{topic="web1.topic1, web2,topic2, web3.topic3"}% already works - does it do what you want?

Dan & I spoke about month back and forth - we think we have a workaround but I'll let him explain as he wrote it.

-- MartinCleaver - 21 Apr 2004

Yes, it works, thanks, I just have to duplicate the info 3 times for my above example. I'd rather have a single "list" that I can use multiple times.

-- HarlanStenn - 21 Apr 2004

I was having a the following error

view: Odd number of elements in hash assignment at ../lib/TWiki/Plugins/CalendarPlugin.pm line 522.
The attached patch against 1.013 fixes it.

-- NicholasSushkin - 23 Apr 2004

  • This has been fixed in V1.015 of the plugin. -- DB - 11 Mar 2005

Is it possible in addition to lists, to collect calendar entries from tables whose first column is a date?

-- NicholasSushkin - 23 Apr 2004

Could anybody help me, is there a script to convert iCal-files (.ics) to CalenderPlugin? text. Or is there an other EASY WAY to export and import iCal-files? Thanks ...

-- MarcPilloud - 28 Apr 2004

I just added a patch for the current revision 1.013 which fixes the initialization of the LANG attribute from the CalendarPlugin topic, which was broken.

-- JensKloecker - 30 Apr 2004

HarlanStenn: Sorry it took me so long to get back to you. New baby.

I really wanted to use non-integer TZ strings. The problem is that all of the popular three letter acronymns are non-standard. There are two "EST" timezones: one in the US and one in Estonia. Which is the right one? The zoneinfo you speak of gets around this by using long TZ specifications like "America/New York". I'd rather just type "GMT-4", frankly!

Daylight Saving Time is a total mess. The rules are totally local and depending where you live change every year. The OS might have correct information but since I don't know for sure I felt it better, at first, to leave it in the hands of the user. If anyone has suggestions I'm all open.

On your other issue about having an itemized list of members and duplicating it to multiple calendar topics: I would recommend installing the TopicVarPlugin? . I use that with CalendarPlugin quite sucessfully:

Everyone has a personal calendar with an EVENTS variable:

    • Set EVENTS = JoeUserCalendar? , UltimateProductGroupCalendar?
    • Set TZ = GMT-4

To display his calendar he would do a:

%CALENDAR{topic="%Home.BradDixonCalendar.EVENTS%" tz="%Home.BradDixonCalendar.TZ%"}%

Then you have a single place to define what events and timezone you prefer.

Q: Is this modification suitable for inclusion in the CVS version? If it is I would like to merge it.

-- BradDixon 11 May 2004

Trying to specify every Tuesday from 28 Sep 2004 - 16 Nov 2004 inclusive. Entered:

   * 28 Sep 2004   - 19:00 cuisine Thai
   * 05 Oct 2004   - 19:00 cuisine Thai
   * 12 Oct 2004   - 19:00 cuisine Thai
   * 19 Oct 2004   - 19:00 cuisine Thai
   * 26 Oct 2004   - 19:00 cuisine Thai
   * 02 Nov 2004   - 19:00 cuisine Thai
   * 09 Nov 2004   - 19:00 cuisine Thai
   * 16 Nov 2004   - 19:00 cuisine Thai

but would have preferred something like
E Tue 28 Sep 2004 - 16 Nov 2004 - 19:00 cuisine Thai

Is there an appropriate short formulation for this?

-- AlainMivilleDeChene - 10 Sep 2004

Facing the same problem as Alain above (trying to specify like every friday from startdate to enddate), I tried with the exception format but that didn't help either. Am I right nothing like that is supported ? Or am I overlooking something? Using version 1.013 here.

-- WimLivens - 09 Nov 2004 (actually AndreBonhote posting)

Great plugin! It needs a little bit of patching, but can work with the HtmlAreaEditor. The pertinent part of the patch is this:

     # keep only bullet lines
-    my @bullets = grep { /^\s+\*/ } split( /[\n\r]+/, $text );
+    my $parser = HTML::TokeParser->new(\$text); #tko
+    my @bullets = ();
+    my $li;
+    while ($parser->get_tag("li")) {
+        $li = "* "; 
+        $li .= $parser->get_text();
+        push @bullets, $li;
+    }

You also need to install and use HTML::TokeParser for this patch, although you could definitely handle the html in other ways.

I also removed the line from htmlarea that convereted quotes to html-entity quotes (" to "). If you wanted to keep that, you'd have to change CalendarPlugin to handle reading those in calendars, because otherwise it just prints a lot of default calendars.

-- TerriOda - 19 Sep 2004

Not sure if this is the right place for feature requests, but how 'bout a setting that would display the week number?

-- ChrisRing - 07 Oct 2004

I just installed the latest version, and noticed some 'Odd number of elements in hash assignment' errors showing up in my apache logs. The culprit is here:

sub getTopicText {
   my (%options, $theTopic, $theWeb, $refText) = @_; 
   ...

Unless the 'greed' ru