This is a MoinMoin macro for event calendar (similar to MonthCalendar macro). The development is based on the MoinMoin MonthCalendar macro but it is a little bit different from MonthCalendar. It is targeted to the one of PIM. It includes a parser which shows the event information in a well parsed format.
/CsvConverter /OlderDiscussion /RefactoringProposals |
Contents
Features
- Monthly, Weekly, Daily, List, Simple, Upcoming view of events
- Handles daily, timely, recurred events
- Uses wiki pages in a specific category for storing event data
- Customized display: background-color
Platform Support
- 0.99b Tested on
MoinMoin 1.9.6
- Linux (Arch Linux)
- Python 2.7.3
- Firefox 18.0
- 0.99a Tested on
MoinMoin 1.8.4, 1.9.4
- Linux (Fedora 10, Ubuntu 10.04)
- Python 2.6.x
- Firefox 3.5
- Folks, please add more above if you can!
- up to 0.99 Tested on/with:
Installation Guide
EventCalendar macro
Download the latest EventCalendar.py macro and place it either in your global macro directory (MoinMoin/macro) or preferably in your local macro directory (yourwiki/data/plugins/macro).
Do not forget to rename the downloaded .py file. For example, you should change the file name 'EventCalendar-080.py' to 'EventCalendar.py'.
EventCalendar stylesheet
Download the latest eventcalendar stylesheet file and insert the entries into the common.css of the appropriate theme (e.g. MoinWiki/share/moin/htdocs/modern/css/common.css).
Download
- v0.99b (patch wrapup release, supports moinmoin 1.9.6)
use eventcal-096.css for .css
- v0.99a (patch wrapup release)
use eventcal-096.css for .css
- v0.99
use eventcal-096.css for .css
- v0.98
use eventcal-096.css for .css
- v0.96
- v0.94
use eventcal-090.css for .css
- v0.93
use eventcal-090.css for .css
- v0.92
use eventcal-090.css for .css
- v0.91
use eventcal-090.css for .css
no parser
- v0.90
Macro: EventCalendar-090.py
Parser: eventcal-090.py
Stylesheet: eventcal-090.css
- v0.80
Macro: EventCalendar-080.py
Parser: eventcal-080.py
Stylesheet: eventcal-080.css
Change Log
July 17, 2009 - Version 0.99a
Add ErikMartin's Defaults patch (defaults-099-01)
Add AlanSnelson 2008-11-05 patch for Moin 1.8.0 caching methods
Add tidyup patch for 1.6.1 (EventCalendar-099.py.patch) NeoCoin
Add Weeknumber patch from KlausMariaPfeiffer 2008-01-25
Add label colour patch DavidOCallahan 2006-07-18 {see here for names: http://www.w3schools.com/html/html_colornames.asp}
Add pagelinks-099-01.patch for OrphanedPages maintenance.
- Add showpagelist, to append list of contributing pages pagelist-099-01.patch (except: default now off not on)
Add event sorting patch RuthIvimey 2007-05-17
Fix url_prefix usage DaveGore 2008-04-04
- Patches listed on this page but not in 0.99a include:
ErikMartin's Label Priority patch - too big a patch for this wrapup release.
RuthIvimey's page label colour patch - not sure of side-effects
HyungyongKim's unicode patch: described as temporary
May 22, 2006 - Version 0.99
- added some error messages
- fixed a bug on trailing spaces (Thanks to SkenderH)
May 12, 2006 - Version 0.98
- added datetime format
- display error messages for invalid event format
- show week number
- added 'label' field for custom bgcolor
- fixed a bug on duplicated recurred event, added 'last weekday' recurrence (Thanks to Chris Clark)
April 17, 2006 - Version 0.96
- added weekly, daily view
- entering only the start_time (without end_time) is allowed
- tooltip box in simple view
- fixed a bug on duplicated event id
Feb. 06, 2006 - Version 0.94
- fixed a bug on sorting events in a calendar view
- fixed a bug on displaying multiple recurred events in the upcoming view
Jan. 18, 2006 - Version 0.93
- use date/time format in user configuration at list view
- fixed a bug on formatting 'recur_until'
Jan. 17, 2006 - Version 0.92
- handling event recurrence feature is added
Jan. 13, 2006 - Version 0.91
- no need parser any more
- event data format is changed to a simpler one:
== title == start:: startdate end:: enddate bgcolor:: background_color description:: event_description ... ---- CategoryEventCalendar
- Note: it is not compatible with the event data of the old versions
event information is stored in wiki pages with specified category (CategoryEventCalendar by default)
- event caching per page
- first-day/first-weekday bug is patched.
- custom icon field is not used any more
Nov. 15, 2005 - Version 0.90
- No file I/O needed: just with wiki pages
- custom display for parsed view: none, footnote, erroronly, table
- custom display for monthly view: bgcolor, icon
- simple view is added
- a few parameters are added
Oct. 31, 2005 - Version 0.80
- The initial version is released.
Usage
To list the events in a page, just insert <<EventCalendar>>
To insert an event, insert the event information in any pages of specified category (CategoryEventCalendar by default).
Event Format
[default_description:: [page_default_description_text]] [default_bgcolor:: [page_default_background_color]] [label_def:: [label_name], [label_background_color]] == <title> == start:: <startdate> [starttime] [end:: [enddate] [endtime]] [description:: [description_text]] [bgcolor:: [custom_background_color]] [recur:: <recur_freq> <recur_type> [until <recur_until>]] [label:: <label_name>] ... ---- CategoryEventCalendar
- default_bgcolor, default_description: default values of bgcolor and description in the page if unavailable. optional
- label_def: label definition with name, bgcolor. optional
- title: event title. required
- should be enclosed with heading marker ('='), Title cannot be omitted.
- startdate: date of start. required
- should be in date format or date format
- starttime: time of start. optional
- should be in time format
- enddate: date of end. optional
should be in date format or date format. If omitted, it will be assigned equal to <startdate>.
- endtime: time of end. optional
- should be in time format. Both of start|end Time can be omitted but not either of them.
- description: description of the event. optional
- any text with no markup. should be in a line.
- bgcolor: custom background color of the event in monthly view. optional
- e.g., #abcdef
- recur: recurrence information of the event. optional
- recur_freq: how many intervals, digit or 'last' for weekday, required
- recur_type: [day|week|weekday|month|year], required
- day: every [recur_freq] days
- week: every [recur_freq] weeks
- weekday: on the same weekday of [recur_freq]-th week of the month. or 'last weekday'
- month: on the same day of [recur_freq]-th month
- year: on the same day of [recur_freq]-th year
- recur_until: recurred until when, date format, optional
- e.g., 10 day, 2 week until 2006-06-31, 3 weekday, 6 month until 2007-12-31, 1 year
- label: custom label for specific name, bgcolor. optional
- The order of the fields after an event title does not matter.
Priority of bgcolor: bgcolor > default_bgcolor > label_bgcolor
Datetime Format
- Date format:
- YYYY/MM/DD, YYYY-MM-DD, YYYY.MM.DD: 2006/05/12; 2006-05-12; 2006.05.12; 2006-5-12; 06/5/12
- B DD, YYYY: May 12, 2006; May 5th, 2006; January 1st, 2006; Jan 5, 06
- YYYYMMDD, YYMMDD: 20060512; 060512
- Year: YY = 20YY. e.g., 06-2-2 = 2006-02-02, allowed 1900 ~ 2099 only.
- Time format:
- H:M, HHMM: 12:00; 22:00; 2:00; 2 (= 2 o'clock); 2200; 12:0; 2:0
- I:M PP, IIMM PP: 12:00 PM; 3:00p; 2a (= 2 o'clock AM); 3:0pm; 0200 am; 10pm
- For example:
== Valid event #1 == start:: 2006-02-28 end:: 2006-03-01 description:: multi-day event == Valid event #2 == start:: 2006-02-28 13:00 end:: 2006-03-01 14:00 description:: multi-day event with specified time == Valid event #3 == start:: 2006-02-28 description:: single-day event. enddate will be 2006-02-28 automatically. == Valid event #4 == start:: 2006-02-28 13:00 end:: 14:00 description:: single-day event with specified time. enddate will be 2006-02-28 automatically. == Valid event #5 == start:: 2006-02-28 13:00 end:: 2006-03-01 description:: single-day event with specified time. endtime will be 13:00 automatically. == Invalid event #1 == start:: 2006-02-28 end:: 2006-03-01 13:00 description:: start time should be specified ---- CategoryEventCalendar
Event Data Example
= Personal Events = default_bgcolor:: #c0c0c0 default_description:: My personal event = Labels = label_def:: Holiday, #ff0000 label_def:: Meeting, #00ff00 === Business trip === start:: 2006-01-10 14:00 end:: 2006-01-12 17:00 description:: L.A. bgcolor:: #cfcfcf === Test event === start:: 2006-01-10 02:00p end:: 2006-01-12 17:00 description:: test event bgcolor:: #cfcfcf === Jinah's Birthday === start:: 1977-10-20 recur:: 1 year label:: Holiday === Weekly meeting === start:: Jan 17, 2006 7:00pm end:: 21:00 recur:: 1 week until 061231 label:: Meeting ---- CategoryEventCalendar
Parameters
category: the category of the event data to be used in the calendar. default: 'CategoryEventCalendar'
[[EventCalendar(category=CategoryPersonalEvents)]]
menubar: shows menubar or not (1: show, 0: no menubar). default: 1
[[EventCalendar(menubar=0)]]
monthlywidth: calendar width in pixel or percent (monthly view). default: '600' (pixel)
[[EventCalendar(monthlywidth=80%)]]
simplewidth: calendar width in pixel or percent (simpleview). default: '150' (pixel)
[[EventCalendar(simplewidth=200)]]
firstview: initial calendar view: monthly, weekly, daily, list, simple, upcoming. default: 'monthly'
[[EventCalendar(firstview=simple)]]
curdate: initial calendar date (in YYYYMM format). default: current month
[[EventCalendar(curdate=200510)]]
upcomingrange: # of days for the range of upcoming event list. default: 7 (days)
changeview: enables to change the calendar view or not (1: enabled, 0: disabled). default: 1
numcal: # of calendar in monthly, simple view. default: 1
showlastweekday: shows the event at the last weekday if the recurred weekday is not available. (1: enabled, 0: disabled). default: 0
showerror: shows error messages below the calendar if event data format is invalid. (1: enabled, 0: disabled). default: 1
showweeknumber: shows the week number of the year (1: enabled, 0: disabled). default: 0
showpagelist: shows a list of the pages used for event data below the calendar. (1: enabled, 0: disabled). default: 0
Cache-related Information
Page List: the page list of the specified category is cached at the macro page. If any data pages are added or removed into/from a category, you should do 'delete cache' in the page. Since this cache is valid for 24 hours, however, you can get refreshed page list after a day.
- Events, Cal_Events: the information about all the events and rendering monthly view calendar is cached at the macro page. If any data pages in the specified category are modified, it re-builds this information.
- Event Records: the information about the event records in a page is cached.
Sample & Screenshot
- Sample sites (If available, please add yours):
- Monthly view
- Simple view
- List view
- Upcoming view
- Weekly view
- Daily view
To do list
- Clean the ugly codes!!! (need help)
- raw html codes
Custom icon per event (experimental)
Parsing description field
Update page log at add/edit/remove event in the text data file
- Sort events by various options in list view
- Shows a part of the event list (e.g., next 100 events..)
- Show endtime in Eventcalendar
- Add exceptions to recur: "recur 1 day except (2009/09/10)"
Completed To do's
- Daily view of events
- Weekly view of events
- Date/time Format customization (e.g., 2005/10, Oct. 2005, 18:00, 06:00pm)
- Custom background color per event
- Upcoming event list
- More input parameters
- Using page cache
- Load partial events only in the specified date range
- Pre-defined configurations (e.g., color code)
Notes
MonthCalendar developed by ThomasWaldmann has inspired this macro.
- Much buggy.. : please report bugs and suggest your ideas.
If you missed to add css for EventCalendar, monthly view may not be readable.
- Insert the eventcalendar css classes into the screen.css of appropriate theme.
Confirmed Bugs & Patches
v0.99a
1.9.1 & 1.9.2 require this patch:
--- EventCalendar-0.99a.py 2010-06-10 14:57:51.683965215 +0100 +++ EventCalendar-0.99b.py 2010-06-10 15:06:14.264057020 +0100 @@ -267,10 +267,10 @@ if args: args=request.getText(args) - for item in macro.form.items(): + for item in macro.request.values.items(): if not form_vals.has_key(item[0]): try: - form_vals[item[0]]=item[1][0] + form_vals[item[0]]=item[1] except AttributeError: pass @@ -318,7 +318,7 @@ html.append( html_result ) html.append( showmenubar() ) - html.append( showpagelist() ) + html.append( show_page_list() ) if Params.showerror and Globs.errormsg: html.append(u'<p><i><font size="2" color="#aa0000"><ol>%s</ol></font></i>' % Globs.errormsg)
v0.99
1.8.0 update Patch
For 1.8.0 MoinMoin, I have modified the CacheEntry function to use Page instance caching (scope='item') as the default scope of wiki fails to render the calendar. -- AlanSnelson 2008-11-05 16:49:00
patch
EventCalendar-099-01.py.patch1 --- EventCalendar-099.py 2008-11-05 16:39:43.000000000 +0000 2 +++ EventCalendar.py 2008-11-05 16:40:27.000000000 +0000 3 @@ -156,7 +156,7 @@ 4 5 from MoinMoin import wikiutil, config, search, caching 6 from MoinMoin.Page import Page 7 -from MoinMoin.parser import wiki 8 +#from MoinMoin.parser import wiki 9 import re, calendar, time, datetime 10 import codecs, os, urllib, sha 11 12 @@ -1077,9 +1077,9 @@ 13 filteredeventkey = 'events_%s-%s' % (datefrom, dateto) 14 caleventkey = 'calevents_%s-%s' % (datefrom, dateto) 15 16 - cache_events = caching.CacheEntry(request, arena, eventkey) 17 - cache_filteredevents = caching.CacheEntry(request, arena, filteredeventkey) 18 - cache_calevents = caching.CacheEntry(request, arena, caleventkey) 19 + cache_events = caching.CacheEntry(request, arena, eventkey,scope='item') 20 + cache_filteredevents = caching.CacheEntry(request, arena, filteredeventkey,scope='item') 21 + cache_calevents = caching.CacheEntry(request, arena, caleventkey,scope='item') 22 23 dirty = 1 24 25 @@ -1396,10 +1396,10 @@ 26 pagelistkey = 'eventpages' 27 errmsglistkey = 'eventcalerrormsglist' 28 29 - cache_events = caching.CacheEntry(request, arena, eventkey) 30 - cache_labels = caching.CacheEntry(request, arena, labelkey) 31 - cache_pages = caching.CacheEntry(request, arena, pagelistkey) 32 - cache_errmsglist = caching.CacheEntry(request, arena, errmsglistkey) 33 + cache_events = caching.CacheEntry(request, arena, eventkey,scope='item') 34 + cache_labels = caching.CacheEntry(request, arena, labelkey,scope='item') 35 + cache_pages = caching.CacheEntry(request, arena, pagelistkey,scope='item') 36 + cache_errmsglist = caching.CacheEntry(request, arena, errmsglistkey,scope='item') 37 38 # page list cache 39 40 @@ -1422,10 +1422,10 @@ 41 categorypages = searchPages(request, category) 42 for page in categorypages: 43 eventpages.append(page.page_name) 44 - cache_pages.update('\n'.join(eventpages), True) 45 + cache_pages.update('\n'.join(eventpages).encode('utf-8')) 46 debug('New page list is built: %d pages' % len(eventpages)) 47 else: 48 - eventpages = cache_pages.content(True).split('\n') 49 + eventpages = cache_pages.content().decode('utf-8').split('\n') 50 debug('Cached page list is used: %d pages' % len(eventpages)) 51 52 if not Globs.page_action == 'refresh': 53 @@ -1457,9 +1457,9 @@ 54 p = Page(request, page_name) 55 e_ref = page_name 56 57 - cache_errmsg = caching.CacheEntry(request, p, errmsgkey) 58 - cache_eventrecords = caching.CacheEntry(request, p, eventrecordkey) 59 - cache_labelrecords = caching.CacheEntry(request, p, labelrecordkey) 60 + cache_errmsg = caching.CacheEntry(request, p, errmsgkey,scope='item') 61 + cache_eventrecords = caching.CacheEntry(request, p, eventrecordkey,scope='item') 62 + cache_labelrecords = caching.CacheEntry(request, p, labelrecordkey,scope='item') 63 64 if cache_eventrecords.needsUpdate(p._text_filename()) or cache_labelrecords.needsUpdate(p._text_filename()) or Globs.page_action == 'refresh': 65 page_content = p.get_raw_body()
Thankyou! --DavidGore 2008-12-16 04:01:00
1.6.1 update Patch
For 1.6.1 MoinMoin, I remove imported module that do not use, and edit two line because of argument's count. In addition, I add encode,decode code for caching based on non-alphabet character pagenames.
patch
EventCalendar-099.py.patch1 --- EventCalendar-099.py 2008-02-14 14:01:22.000000000 +0900 2 +++ EventCalendar.py 2008-02-14 14:00:16.000000000 +0900 3 @@ -156,7 +156,7 @@ 4 5 from MoinMoin import wikiutil, config, search, caching 6 from MoinMoin.Page import Page 7 -from MoinMoin.parser import wiki 8 +#from MoinMoin.parser import wiki 9 import re, calendar, time, datetime 10 import codecs, os, urllib, sha 11 12 @@ -1422,10 +1422,10 @@ 13 categorypages = searchPages(request, category) 14 for page in categorypages: 15 eventpages.append(page.page_name) 16 - cache_pages.update('\n'.join(eventpages), True) 17 + cache_pages.update('\n'.join(eventpages).encode('utf-8')) 18 debug('New page list is built: %d pages' % len(eventpages)) 19 else: 20 - eventpages = cache_pages.content(True).split('\n') 21 + eventpages = cache_pages.content().decode('utf-8').split('\n') 22 debug('Cached page list is used: %d pages' % len(eventpages)) 23 24 if not Globs.page_action == 'refresh':
example page My Journal Page --NeoCoin 2008-02-14 05:15:54
UTC Offset Messes up Upcoming event view
I set my offset to -5.0 from UTC and my upcoming view is empty. FYI, the UTC was a day ahead when I tried --JaeStutzman
Days back in Upcoming view
Would be nice if the Upcoming view would offer a second range varable beside upcomingrange - something like backrange. With this, the upcoming view would be extended to a recent and upcoming event view - this would be very helpful for example to create an What happened lately and will happen soon view ...
And here's the patch:
26d25 < * backrange: # of days for the backrange of upcoming event list. default: 0 (days) 184d182 < backrange = 0 # days 217d214 < backrange = 0 382,388d378 < # backrange: # of days for backrange in upcoming event list < # default: 0 < try: < Params.backrange = int(params.get('backrange', Globs.backrange)) < except (TypeError, ValueError): < Params.backrange = Globs.backrange < 832d821 < dayback_delta = datetime.timedelta(days=Params.backrange) 834d822 < prev_range = cur_date - dayback_delta 838c826 < datefrom = u'%04d%02d%02d' % (prev_range.year, prev_range.month, prev_range.day) --- > datefrom = u'%04d%02d%02d' % (year, month, day) 846,847c834 < datefrom = formatcfgdatetime(formatdateobject(prev_range)) < # datefrom = formatcfgdatetime(cur_date, nowtime) --- > datefrom = formatcfgdatetime(cur_date, nowtime) 857,858c844,846 < if events[eid]['enddate'] >= formatdateobject(prev_range): < html_event_rows.append( listshow_event(events[eid]) ) --- > if events[eid]['enddate'] >= formatdateobject(Globs.today): > if (not events[eid]['endtime']) or events[eid]['endtime'] >= formattimeobject(Globs.now): > html_event_rows.append( listshow_event(events[eid]) )
-- JohannesKilian 2006-09-19 13:27:48
Week Number
thanks for implementing the week numbers! but, if the first day of the week is monday, the weeknumber is wrong. I've patched it the following way:
# diff EventCalendar-099.py EventCalendar.py 176c176 < calendar.setfirstweekday(calendar.SUNDAY) --- > calendar.setfirstweekday(calendar.MONDAY) 3629c3629 < html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' %(html_text, (int(datetime.date(year, month, day).strftime('%W')) + 1)) --- > html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' %(html_text, (int(datetime.date(year, month, day).strftime('%W'))))
-- KlausMariaPfeiffer 2006-09-01 12:38:48
Week Numbers in 2008
thanks for implementing the week numbers! but, in 2008 week numbers are wrong, just use the isocalendar. I've patched it the following way:
# diff EventCalendar-099.py EventCalendar.py 176c176 < calendar.setfirstweekday(calendar.SUNDAY) --- > calendar.setfirstweekday(calendar.MONDAY) 3629c3629 < html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' % (html_text, (int(datetime.date(year, month, day).strftime('%W')) + 1)) --- > html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' % (html_text, (int(datetime.date(year, month, day).isocalendar()[1])))
-- KlausMariaPfeiffer 2008-01-25 14:40:51
Named Colours
I've patched EventCalendar v0.99 so that it allows named colours as well as hex values. This allows entries like this:
== Labels == label_def:: sick, red label_def:: conference, yellow === Meeting 1 === start:: 2006-05-30 end:: 2006-06-03 description:: First Meeting label:: conference === Moon Trip === start:: 2006-07-19 description:: Trip to the Moon bgcolor:: blue
Here's the patch:
--- EventCalendar-0.99.py.orig 2006-07-18 10:00:48.000000000 +0100 +++ EventCalendar-0.99.py 2006-07-18 10:01:38.000000000 +0100 @@ -1575,7 +1575,7 @@ regex_page_bgcolor = r""" (?P<req_field>^[ ]+default_bgcolor::[ ]+) ( - (?P<pagebgcolor>\#[0-9a-fA-F]{6}) + (?P<pagebgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+)) \s*? $ )? @@ -1616,7 +1616,7 @@ ( (?P<name>[^,^:^\s]+?) [,: ]+ - (?P<bgcolor>\#[0-9a-fA-F]{6}) + (?P<bgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+)) \s*? $ )? @@ -1888,7 +1888,7 @@ regex_bgcolor = r""" (?P<reqfield>^[ ]+bgcolor::[ ]+) ( - (?P<bgcolor>\#[0-9a-fA-F]{6})? + (?P<bgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+))? \s*? $ )?
While this patch makes it possible for users to enter invalid colour names, I think that overall it makes life easier for users. Here's a list of HTML colour names. -- DavidOcallaghan 2006-07-18 09:12:56
Stored Page Links
This patch updates the pagelinks data, so that the links generated by the macro are registerd correctly for things like OrphanedPages and linkto searches
patch:
pagelinks-099-01.patch1 Index: EventCalendar.py 2 =================================================================== 3 --- EventCalendar.py (revision 165) 4 +++ EventCalendar.py (revision 166) 5 @@ -1386,6 +1386,7 @@ 6 stored_errmsg = '' 7 8 request = Globs.request 9 + formatter = Globs.formatter 10 category = Params.category 11 12 # cache configurations 13 @@ -1421,7 +1422,8 @@ 14 if Globs.page_action == 'refresh' or cache_pages.needsUpdate(arena._text_filename()) or timedelta_days >= 1: 15 categorypages = searchPages(request, category) 16 for page in categorypages: 17 + # this is to workaround the bug in the category search returning 18 + # pages that only referance the category but are not in it 19 + # i.e. in the paramiter list for this macro 20 + if not page.page_name == request.page.page_name: 21 + formatter.pagelink(1, pagename=page.page_name) 22 eventpages.append(page.page_name) 23 cache_pages.update('\n'.join(eventpages), True) 24 debug('New page list is built: %d pages' % len(eventpages))
Show Page List
This patch adds the option to display a list of pages that were used to generate the callendar, below the callendar
patch:
pagelist-099-01.patch1 Index: EventCalendar.py 2 =================================================================== 3 --- EventCalendar.py (revision 167) 4 +++ EventCalendar.py (revision 170) 5 @@ -27,6 +27,7 @@ 6 * numcal: # of calendar. default: 1 7 * showlastweekday: shows the event at the last weekday if the recurred weekday is not available. (1: enalbed, 0: disabled). default: 0 8 * showerror: shows error messages below the calendar if event data format is invalid. (1: enalbed, 0: disabled). default: 1 9 + * showpagelist: shows a list of the pages used for event data below the calendar. (1: enalbed, 0: disabled). default: 1 10 * showweeknumber: shows the week number of the year (1: enalbed, 0: disabled). default: 0 11 12 13 @@ -216,6 +217,7 @@ 14 numcal = 1 15 showlastweekday = 0 16 showerror = 1 17 + showpagelist = 1 18 showweeknumber = 0 19 debug = 0 20 21 @@ -294,11 +296,13 @@ 22 23 if cal_action == 'weekly': 24 html_result = showweeklycalendar() 25 - 26 - 27 + 28 + 29 # format output 30 html.append( html_result ) 31 html.append( showmenubar() ) 32 + 33 + html.append( show_page_list() ) 34 35 if Params.showerror and Globs.errormsg: 36 html.append(u'<p><i><font size="2" color="#aa0000"><ol>%s</ol></font></i>' % Globs.errormsg) 37 @@ -411,6 +415,13 @@ 38 except (TypeError, ValueError): 39 Params.showweeknumber = 0 40 41 + # show definition table 42 + # default: 1 43 + try: 44 + Params.showpagelist = int(params.get('showpagelist', '1')) 45 + except (TypeError, ValueError): 46 + Params.showpagelist = 1 47 + 48 # default bgcolor 49 Params.bgcolor = '#ddffdd' 50 51 @@ -666,6 +677,43 @@ 52 return html 53 54 55 +def show_page_list(): 56 + html = "" 57 + request = Globs.request 58 + formatter = Globs.formatter 59 + 60 + if Params.showpagelist: 61 + source_pages = [] 62 + 63 + events, cal_events, labels = loadEvents() 64 + 65 + for eid in events.keys(): 66 + event = events[eid] 67 + refer = event['refer'] 68 + refer_url = '%s/%s' % (request.getScriptname(), wikiutil.quoteWikinameURL(refer)) 69 + targetlink = '<a href="%s">%s</a>' % ( refer_url, wikiutil.escape(refer)) 70 + source_pages.append( targetlink ) 71 + 72 + from sets import Set 73 + page_set = Set(source_pages) 74 + 75 + html = "\n" 76 + html += formatter.paragraph(1) 77 + html += "Constructed from events defined on these pages" 78 + html += formatter.paragraph(0) 79 + html += "\n" 80 + html += formatter.bullet_list(1) 81 + html += "\n" 82 + for p in page_set: 83 + html += formatter.listitem(1) 84 + html += p 85 + html += formatter.listitem(0) 86 + html += "\n" 87 + html += formatter.bullet_list(0) 88 + html += "\n" 89 + 90 + return html 91 + 92 def getdatefield(str_date): 93 str_year = '' 94 str_month = ''
Default Label Config Page
This patch adds looking for a defalut page for labels, (also reads events on the page) for all the calls to EventCalendar, this make it easy to have consistant set of labels without duplicating and getting the label duplication warnings, or every time there is a new calendar added needing to add it to the page with the default labels.
-- ErickMartin 2006-11-30 15:52:39
patch:
defaults-099-01.patch1 Index: EventCalendar.py 2 =================================================================== 3 --- EventCalendar.py (revision 232) 4 +++ EventCalendar.py (working copy) 5 @@ -29,6 +29,7 @@ 6 * showerror: shows error messages below the calendar if event data format is invalid. (1: enalbed, 0: disabled). default: 1 7 * showpagelist: shows a list of the pages used for event data below the calendar. (1: enalbed, 0: disabled). default: 1 8 * showweeknumber: shows the week number of the year (1: enalbed, 0: disabled). default: 0 9 + * configpage: the page that defines default config, in particular labels. default: 'EventCalendarDefaults' 10 11 12 <Event Data Format> 13 @@ -212,6 +213,7 @@ 14 curdate = '' 15 bgcolor = '' 16 category = '' 17 + defaultconfigpage = 'EventCalendarDefaults' 18 upcomingrange = 0 19 changeview = 0 20 numcal = 1 21 @@ -422,6 +424,12 @@ 22 except (TypeError, ValueError): 23 Params.showpagelist = 1 24 25 + default_cfg_page = 'EventCalendarDefaults' 26 + if hasattr(request.cfg, 'event_calendar_default_cfg_page'): 27 + default_cfg_page = request.cfg.event_calendar_default_cfg_page 28 + 29 + Params.defaultconfigpage = params.get('configpage', default_cfg_page) 30 + 31 # default bgcolor 32 Params.bgcolor = '#ddffdd' 33 34 @@ -1468,6 +1476,11 @@ 35 36 37 if Globs.page_action == 'refresh' or cache_pages.needsUpdate(arena._text_filename()) or timedelta_days >= 1: 38 + cfgpage = Page(request, Params.defaultconfigpage) 39 + if cfgpage.exists(): 40 + formatter.pagelink(1, pagename=cfgpage.page_name) 41 + eventpages.append(cfgpage.page_name) 42 + 43 categorypages = searchPages(request, category) 44 for page in categorypages: 45 # this is to workaround the bug in the category search returning
Label Priority
This patch fixes the problem where a labels color would be ignored if the page with the defaitions had a default event color
-- ErickMartin 2006-11-30 15:52:39
patch:
label_priority-099-01.patch1 Index: EventCalendar.py 2 =================================================================== 3 --- EventCalendar.py (revision 244) 4 +++ EventCalendar.py (working copy) 5 @@ -200,7 +200,7 @@ 6 page_action = '' 7 form_vals = {} 8 events = None 9 - labels = None 10 + labels = {} 11 12 13 class Params: 14 @@ -239,7 +239,7 @@ 15 16 # INITIALIZATION ---------------------------------------- 17 setglobalvalues(macro) 18 - getparams(args) 19 + getparams(request, args) 20 21 # allowed actions 22 allowed_action = ['monthly', 'list', 'simple', 'upcoming', 'daily', 'weekly'] 23 @@ -316,7 +316,7 @@ 24 25 26 27 -def getparams(args): 28 +def getparams(request, args): 29 # process arguments 30 31 params = {} 32 @@ -693,7 +693,7 @@ 33 if Params.showpagelist: 34 source_pages = [] 35 36 - events, cal_events, labels = loadEvents() 37 + events, cal_events = loadEvents() 38 39 for eid in events.keys(): 40 event = events[eid] 41 @@ -810,7 +810,7 @@ 42 html_list_header = cal_listhead() 43 44 # read all the events 45 - events, cal_events, labels = loadEvents() 46 + events, cal_events = loadEvents() 47 48 # sort events 49 sorted_eventids = events.keys() 50 @@ -883,7 +883,7 @@ 51 dateto = u'%04d%02d%02d' % (next_range.year, next_range.month, next_range.day) 52 53 # read all the events (no cache) 54 - events, cal_events, labels = loadEvents(datefrom, dateto, 1) 55 + events, cal_events = loadEvents(datefrom, dateto, 1) 56 57 nowtime = formattimeobject(Globs.now) 58 59 @@ -1118,11 +1118,10 @@ 60 debug('Loading event information.') 61 62 events = {} 63 - labels = {} 64 cal_events = {} 65 raw_events = {} 66 67 - raw_events, labels = loadEventsFromWikiPages() 68 + raw_events = loadEventsFromWikiPages() 69 70 # handling cal_events 71 if datefrom or dateto: 72 @@ -1418,26 +1417,21 @@ 73 events = raw_events 74 75 # store event list into global variables in order to sort them 76 - Globs.events = events 77 + Globs.events = raw_events 78 79 - Globs.labels = labels 80 - 81 debug(u'Total %d events are loaded finally.' % len(events)) 82 - debug(u'Total %d labels are loaded finally.' % len(labels)) 83 + debug(u'Total %d labels are loaded finally.' % len(Globs.labels)) 84 85 - return events, cal_events, labels 86 + return events, cal_events 87 88 89 90 def loadEventsFromWikiPages(): 91 92 events = {} 93 - labels = {} 94 cached_event_loaded = 0 95 dirty = 0 96 97 - eventrecord_list = [] 98 - labelrecord_list = [] 99 eventpages = [] 100 stored_errmsg = '' 101 102 @@ -1563,8 +1557,16 @@ 103 cache_labelrecords.update(pickle.dumps(labelrecords, PICKLE_PROTOCOL)) 104 cache_errmsg.update(pickle.dumps(Globs.errormsg, PICKLE_PROTOCOL)) 105 106 - eventrecord_list.append(eventrecords) 107 - labelrecord_list.append(labelrecords) 108 + for evtrecord in eventrecords: 109 + e_id = evtrecord['id'] 110 + events[e_id] = evtrecord 111 + 112 + for label in labelrecords: 113 + c_id = label['name'] 114 + if not Globs.labels.has_key(c_id): 115 + Globs.labels[c_id] = label 116 + elif label['refer'] != Globs.labels[c_id]['refer'] : 117 + stored_errmsg += u'<li>%s\n' % geterrormsg('redefined_label', label['refer'], label['name']) 118 119 stored_errmsg += Globs.errormsg 120 Globs.errormsg = '' 121 @@ -1577,7 +1579,7 @@ 122 123 try: 124 events = pickle.loads(cache_events.content()) 125 - labels = pickle.loads(cache_labels.content()) 126 + Globs.labels = pickle.loads(cache_labels.content()) 127 stored_errmsg = pickle.loads(cache_errmsglist.content()) 128 129 cached_event_loaded = 1 130 @@ -1586,7 +1588,7 @@ 131 132 except (pickle.UnpicklingError, IOError, EOFError, ValueError): 133 events = {} 134 - labels = {} 135 + Globs.labels = {} 136 stored_errmsg = '' 137 138 debug('Picke error at fetching cached events') 139 @@ -1599,22 +1601,9 @@ 140 for page_name in eventpages: 141 debug(debug_records[page_name]) 142 143 - for eventrecords in eventrecord_list: 144 - for evtrecord in eventrecords: 145 - e_id = evtrecord['id'] 146 - events[e_id] = evtrecord 147 - 148 - for labelrecords in labelrecord_list: 149 - for label in labelrecords: 150 - c_id = label['name'] 151 - if not labels.has_key(c_id): 152 - labels[c_id] = label 153 - else: 154 - stored_errmsg += u'<li>%s\n' % geterrormsg('redefined_label', label['refer'], label['name']) 155 - 156 # after generating updated events, update the cache 157 cache_events.update(pickle.dumps(events, PICKLE_PROTOCOL)) 158 - cache_labels.update(pickle.dumps(labels, PICKLE_PROTOCOL)) 159 + cache_labels.update(pickle.dumps(Globs.labels, PICKLE_PROTOCOL)) 160 cache_errmsglist.update(pickle.dumps(stored_errmsg, PICKLE_PROTOCOL)) 161 162 debug('Event information is newly built: total %d events' % len(events)) 163 @@ -1623,7 +1612,7 @@ 164 165 # end of updating events block 166 167 - return events, labels 168 + return events 169 170 171 172 @@ -2037,7 +2026,9 @@ 173 ##################### retrieve startdate 174 match = pattern_startdate.search(detail) 175 176 - if match: 177 + startdate = '' 178 + starttime = '' 179 + if match : 180 181 if match.group('startdate'): 182 passed = 1 183 @@ -2082,11 +2073,6 @@ 184 185 if passed: 186 startdate = '%d/%02d/%02d' % (int(startyear), int(startmonth), int(startday)) 187 - else: 188 - startdate = '' 189 - 190 - else: 191 - startdate = '' 192 193 if match.group('starttime'): 194 passed = 1 195 @@ -2137,11 +2123,7 @@ 196 197 if passed: 198 starttime = '%02d:%02d' % (int(starthour), int(startmin)) 199 - else: 200 - starttime = '' 201 202 - else: 203 - starttime = '' 204 205 if not startdate: 206 raise EventcalError('invalid_start') 207 @@ -2152,6 +2134,8 @@ 208 ##################### retrieve enddate 209 match = pattern_enddate.search(detail) 210 211 + enddate = '' 212 + endtime = '' 213 if match: 214 215 if match.group('enddate'): 216 @@ -2197,11 +2181,6 @@ 217 218 if passed: 219 enddate = '%d/%02d/%02d' % (int(endyear), int(endmonth), int(endday)) 220 - else: 221 - enddate = '' 222 - 223 - else: 224 - enddate = '' 225 226 if match.group('endtime'): 227 passed = 1 228 @@ -2252,57 +2231,44 @@ 229 230 if passed: 231 endtime = '%02d:%02d' % (int(endhour), int(endmin)) 232 - else: 233 - endtime = '' 234 - 235 - else: 236 - endtime = '' 237 238 if not (enddate or endtime): 239 raise EventcalError('invalid_end') 240 241 - else: 242 - enddate = '' 243 - endtime = '' 244 + ##################### retrieve label 245 + match = pattern_label.search(detail) 246 + 247 + label = '' 248 + if match: 249 + if match.group('name'): 250 + label = match.group('name') 251 + else: 252 + errormsgcode('invalid_label') 253 254 - 255 ##################### retrieve bgcolor 256 match = pattern_bgcolor.search(detail) 257 258 + bgcolor = '' 259 if match: 260 if match.group('bgcolor'): 261 bgcolor = match.group('bgcolor') 262 else: 263 errormsgcode('invalid_bgcolor') 264 - bgcolor = '' 265 - 266 - else: 267 - bgcolor = '' 268 + elif label != '' and Globs.labels: 269 + labels = Globs.labels 270 271 - ##################### retrieve label 272 - match = pattern_label.search(detail) 273 - 274 - if match: 275 - if match.group('name'): 276 - label = match.group('name') 277 - else: 278 - errormsgcode('invalid_label') 279 - label = '' 280 - 281 - else: 282 - label = '' 283 + if labels.has_key(label): 284 + bgcolor = labels[label]['bgcolor'] 285 286 ##################### retrieve description 287 match = pattern_description.search(detail) 288 289 + description = '' 290 if match: 291 if match.group('description'): 292 description = match.group('description') 293 else: 294 errormsgcode('empty_description') 295 - description = '' 296 - else: 297 - description = '' 298 299 ##################### retrieve recurrence 300 match = pattern_recur.search(detail) 301 @@ -2534,7 +2500,7 @@ 302 dateto = u'%04d%02d06' % (next_month.year, next_month.month) 303 304 # read all the events 305 - events, cal_events, labels = loadEvents(datefrom, dateto) 306 + events, cal_events = loadEvents(datefrom, dateto) 307 308 #debug(u' events: %s' % events) 309 #debug(u' cal_events: %s' % cal_events) 310 @@ -2792,7 +2758,7 @@ 311 dateto = u'%04d%02d06' % (next_month.year, next_month.month) 312 313 # read all the events 314 - events, cal_events, labels = loadEvents(datefrom, dateto) 315 + events, cal_events = loadEvents(datefrom, dateto) 316 317 #debug(u' events: %s' % events) 318 #debug(u' cal_events: %s' % cal_events) 319 @@ -3023,7 +2989,7 @@ 320 dateto = u'%04d%02d06' % (next_month.year, next_month.month) 321 322 # read all the events 323 - events, cal_events, labels = loadEvents(datefrom, dateto) 324 + events, cal_events = loadEvents(datefrom, dateto) 325 326 #debug(u' events: %s' % events) 327 #debug(u' cal_events: %s' % cal_events) 328 @@ -3361,7 +3327,7 @@ 329 dateto = u'%04d%02d06' % (next_month.year, next_month.month) 330 331 # read all the events 332 - events, cal_events, labels = loadEvents(datefrom, dateto) 333 + events, cal_events = loadEvents(datefrom, dateto) 334 335 maketip_js = [] 336 337 @@ -3736,14 +3702,6 @@ 338 description = event['description'] 339 bgcolor = event['bgcolor'] 340 341 - if not bgcolor: 342 - if Globs.labels: 343 - labels = Globs.labels 344 - # for backward compatibility 345 - if event.has_key('label'): 346 - if labels.has_key(event['label']): 347 - bgcolor = labels[event['label']]['bgcolor'] 348 - 349 year, month, day = getdatefield(cur_date) 350 351 if bgcolor: 352 @@ -3789,13 +3747,6 @@ 353 description = event['description'] 354 bgcolor = event['bgcolor'] 355 356 - if not bgcolor: 357 - labels = Globs.labels 358 - # for backward compatibility 359 - if event.has_key('label'): 360 - if labels.has_key(event['label']): 361 - bgcolor = labels[event['label']]['bgcolor'] 362 - 363 year, month, day = getdatefield(cur_date) 364 365 if bgcolor: 366 @@ -3840,13 +3791,6 @@ 367 bgcolor = event['bgcolor'] 368 time_len = event['time_len'] 369 370 - if not bgcolor: 371 - labels = Globs.labels 372 - # for backward compatibility 373 - if event.has_key('label'): 374 - if labels.has_key(event['label']): 375 - bgcolor = labels[event['label']]['bgcolor'] 376 - 377 if bgcolor: 378 bgcolor = 'background-color: %s;' % bgcolor 379 else: 380 @@ -3880,13 +3824,6 @@ 381 bgcolor = event['bgcolor'] 382 time_len = event['time_len'] 383 384 - if not bgcolor: 385 - labels = Globs.labels 386 - # for backward compatibility 387 - if event.has_key('label'): 388 - if labels.has_key(event['label']): 389 - bgcolor = labels[event['label']]['bgcolor'] 390 - 391 if bgcolor: 392 bgcolor = 'background-color: %s;' % bgcolor 393 else: 394 @@ -3933,13 +3870,6 @@ 395 396 year, month, day = getdatefield(cur_date) 397 398 - if not bgcolor: 399 - labels = Globs.labels 400 - # for backward compatibility 401 - if event.has_key('label'): 402 - if labels.has_key(event['label']): 403 - bgcolor = labels[event['label']]['bgcolor'] 404 - 405 if bgcolor: 406 bgcolor = 'background-color: %s;' % bgcolor 407 else:
The cached data of calendar events may show to the un-authorized users by acl. -- SeungikLee 2006-10-09 08:27:28
A couple problems and a question. I am using EventCalendar with MMDE (DesktopEdition), installed as a service. a) If I put two event calendar macros in the same page, changes in view on one affect both. So, if I start one with upcoming and the other with monthly, moving one month ahead changes de upcoming view to monthly also.
b) I have to stop and start the MMDE service to include newly defined pages with events. After restart I do the normal cache clean and all works. Perhaps it is a MMDE problem ...
c) question: how one gets full blocks covering several days? (as done in the monthly view example ... I have to artificially make the title long enough but seems unpractical ...)
TIA CarlosBandar
Thanks SeungikLee. It's very useful but there is a error when I use unicode event pagename (ex, Hangul pagename) because "%" character in URL encode string. It is a temporary solution for escaping error.
# diff EventCalendar.py ~/EventCalendar-099.py 2864,2870c2864 < try: < html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d%%' % width} < except TypeError: < html_cols = u'\r\n'.join(html_hour_cols[hour_index] < ).replace('%(colspan)d',u'%d'%colspan < ).replace('%(width)s', u'%d%%'%width) < --- > html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d%%' % width}
-- HyungyongKim 2006-07-03 08:04:41
also need change a similar line for weekly view.
2864,2867c2864 < try: < html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d%%' % width} < except TypeError: < html_cols = u'\r\n'.join(html_hour_cols[hour_index]).replace('%(colspan)d',u'%d'%colspan).replace('%(width)s', u'%d%%'%width) --- > html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d%%' % width} 3128,3131c3125 < try: < html_cols = u'\r\n'.join(html_hour_cols[hour_index][dayindex]) % {'colspan': colspan, 'width': u'%d%%' % width} < except TypeError: < html_cols = u'\r\n'.join(html_hour_cols[hour_index][dayindex]).replace('%(colspan)d',u'%d'%colspan).replace('%(width)s', u'%d%%'%width) --- > html_cols = u'\r\n'.join(html_hour_cols[hour_index][dayindex]) % {'colspan': colspan, 'width': u'%d%%' % width}
-- GuoYong 2006-09-23 01:03:41
RuthIvimey here with 3 issues:
There is a small error in the list view, which doesn't sort events within a day, only for different days. Apply this patch (unified diff) to fix it:
@@ -1051,8 +1080,11 @@ # sort events in the list by start date of the event def comp_list_events(xid, yid): events = Globs.events - - return cmp(events[xid]['startdate'], events[yid]['startdate']) + if events[xid]['startdate'] == events[yid]['startdate']: + return cmp(events[xid]['starttime'], events[yid]['starttime']) + else: + return cmp(events[xid]['startdate'], events[yid]['startdate']) + # load events from wiki pages def loadEvents(datefrom='', dateto='', nocache=0):
I also consider it a bug, but probably the author doesn't :-), that label background colours have a lower priority than the default background colour. If you want to change that, the following patch is what I'm using, although it might not be optimal...
@@ -1693,8 +1727,8 @@ # continue # set default values - if not e_bgcolor: - e_bgcolor = page_bgcolor + #if not e_bgcolor: + #e_bgcolor = page_bgcolor if not e_description: e_description = page_description
And finally, in week view, if you have two events that end and start at the same 1/2 hour point, the calendar puts them side-by-side as if they overlap. I can see why this happens - the granularity of rendering week view is 1 hour, so it can't render a 30 min split. It would be nice if it could though. Would it be very hard to split the day into 48 rows each of 30 mins? For that matter, would it be possible to specify a start hour and end hour for the day - e.g 08:00 to 23:00?
Thanks anyway - it's looking good (see Our Diary ) -- RuthIvimey 2007-05-17 23:36:42
Sorry for beeing anonymus, but another user has used my mail-adress. I think that I have found a bug but can't believe that I am the first. As shown in the Screenshot the Event "Business Trip" is missing in the Upcoming-List. At 20:59 that Event was there. If I change the end to 22:00h it will be listed.
-- Dirk 2007-06-12 21:50:42
The call "request.cfg.url_prefix" returns "None" in MoinMoin1.6.2 (it might also be because I'm using ProxyReverse in Apache). This causes the <SCRIPT> tag to incorrectly point to src="None/common/js/infobox.js" and tooltips are unavailable. I changed "request.cfg.url_prefix" to "request.cfg.url_prefix_static" in line 3366 to avoid this error.
-- DaveGore 2008-04-04 20:37:00
Discussion / Support / Request / Contribution
/OlderDiscussion /RefactoringProposals - HTML templates and OOP
v0.99
Four Quadrants of Time Management. If we can define more properties such as importance and urgency and have another daily/weekly/monthly will be better. Please refer to Stephen R. Covey talks about in his Four Quadrants of Time Management: 1) Important & Urgent 2) Important & Not Urgent 3) Urgent & Not Important 4) Not Urgent & Not Important
- -- RainR (2007.08.10)
It should be possible to put multiple of EventCalendar macros on a single page. I have created many CategoryCalendarEvents for various purposes. For instance I have create a different category for each user of the system. Now I would like to do the following:
Person One |
[[EventCalendar(firstview=upcoming,category=CategoryPersonOneEvents)]] |
Person Twe |
[[EventCalendar(firstview=upcoming,category=CategoryPersonTwoEvents)]] |
This would be very useful when creating an overview page for a secretary or something.
-- AllenCurtis 2007-09-17 04:20:53
Another nice extension would be the ability to specify multiple even calendar categories for the same calendar. This could be a good compromise to enabling multiple event calendar instances to exist on the same page. (I assume that is a page cache issue) -- AllenCurtis 2007-10-06 20:54:18
Hi, are there plans for 1.6? -- ReimarBauer 2007-10-26 15:37:58
Is there a way to create yearly events without specifying the year? I simply don't know or don't want to publish the year for birthday events. --AnkeHeinrich 2007-10-31 10:42:00
I like the interface of this macro. I think it would be nicer if this macro has following functions. Thanks. -- TakeoKatsuki 2010-01-19 07:19:47
Incorporating data of MonthCalendar. For example, could contents of MonthCalendar pages (file names are in year-month-day format) be recognized as the start date and end date of single-day events?
In addition to start:: and end:: syntax, time information in the heading may also be useful for specifying start time and end time of the event. For example, = 14:00-16:00 meeting =.
Creating new events directly from the calendar probably by clicking the date link, which is the case in MonthCalendar.
Faster page rendering. Currently, a category with many subpages such as MonthCalandar pages takes very long time to be rendered.
- I found this problem only on Windows. On Linux machines this macro is fast enough even with hundreds of subpages.
Specification of multiple categories for one calendar. This would be useful if one wants to obtain data from certain months from MonthCalendar.
This can be achieved by <<EventCalendar(category=(CategoryOne OR CategoryTwo))>>
Importing iCal or GoogleCalendar data. Ideally synchronization with these calendars.
- Mouseover on an event displays a box that shows detailed info from the "description" field, and URLs/WikiLinks there are clickable.
- Email notification for a specified event.
Is there an EventCalendar-RSS-Feed or is something like that planned? -- MelaEckenfels 2009-08-04 00:46:21
How can I make the calendar starts from Sunday instead of Monday? I changed the code calendar.setfirstweekday(calendar.MONDAY) to calendar.setfirstweekday(calendar.SUNDAY), and restarted the system. It works for the first view, but if I do "delete cache" action, the calendar again starts from Monday. I tested on WinXP and Linux. -- TakeoKatsuki 2010-06-03 02:18:54
Hi, I've made a quick patch (really quick, so probably there still may be bugs ) which adds a new field called 'url'. If this one is given for an event then the link in the calendar will point to the given URL instead of the page with the list of events.
497a498 > url = event['url'] 517a519,521 > if len(url) > 0: > targetlink = '<a href="%s">%s</a>' % ( url, wikiutil.escape(targettext)) > 1756c1760 < e_start_date, e_start_time, e_end_date, e_end_time, e_bgcolor, e_label, e_description, e_recur_freq, e_recur_type, e_recur_until = geteventfield(eventdetail) --- > e_start_date, e_start_time, e_end_date, e_end_time, e_bgcolor, e_label, e_description, e_recur_freq, e_recur_type, e_recur_until, e_url = geteventfield(eventdetail) 1791a1796 > eventitem['url'] = e_url 1978a1984,1993 > > regex_url = r""" > (?P<reqfield>^[ ]+url::[ ]+) > ( > (?P<url>.*?) > \s*? > $ > )? > """ > 2040a2056 > pattern_url = re.compile(regex_url, re.UNICODE + re.MULTILINE + re.IGNORECASE + re.DOTALL + re.VERBOSE) 2312a2329,2340 > ##################### retrieve URL for details > match = pattern_url.search(detail) > > if match: > if match.group('url'): > url = match.group('url') > else: > errormsgcode('empty_url') > url = '' > else: > url = '' > 2472c2500 < return startdate, starttime, enddate, endtime, bgcolor, label, description, recur_freq, recur_type, recur_until --- > return startdate, starttime, enddate, endtime, bgcolor, label, description, recur_freq, recur_type, recur_until, url
-- AlexanderAgibalov 2010-06-18 12:43:25
v0.99a
I noticed two problems here on Debian running MoinMoin v1.9.3-1+squeeze1 with Python 2.6:
the macro variable seems to lack a "form" attribute. I am not aware of the specific problematic circumstances. This exception is raised:
File "/data/moin/sites/spontanplanung/plugin/macro/EventCalendar.py", line 271, in execute for item in macro.form.items(): AttributeError: Macro instance has no attribute 'form'
the function show_page_link is referenced without underscore (showpagelink)
The following patch fixes both problems. The first part is just a quick workaround for problem (1) - I don't know if this breaks anything. The second part is simple and foolproof, I guess.
--- EventCalendar.py.orig 2009-07-16 03:35:13.000000000 +0200 +++ EventCalendar.py 2012-06-21 22:03:43.000000000 +0200 @@ -267,12 +267,13 @@ if args: args=request.getText(args) - for item in macro.form.items(): - if not form_vals.has_key(item[0]): - try: - form_vals[item[0]]=item[1][0] - except AttributeError: - pass + if hasattr(macro, "form"): + for item in macro.form.items(): + if not form_vals.has_key(item[0]): + try: + form_vals[item[0]]=item[1][0] + except AttributeError: + pass # PROCESSING ACTIONS ---------------------------------------- cal_action = form_vals.get('calaction', default_action) @@ -692,7 +693,7 @@ return html -def show_page_list(): +def showpagelist(): html = "" request = Globs.request formatter = Globs.formatter
-- Lars 2012-06-21 23:27:25