1.1 --- a/EventAggregatorSupport.py Thu Mar 26 01:04:02 2009 +0100
1.2 +++ b/EventAggregatorSupport.py Thu Mar 26 01:40:33 2009 +0100
1.3 @@ -120,6 +120,13 @@
1.4 today = datetime.date.today()
1.5 return (today.year, today.month)
1.6
1.7 +def getCurrentYear():
1.8 +
1.9 + "Return the current year."
1.10 +
1.11 + today = datetime.date.today()
1.12 + return today.year
1.13 +
1.14 def monthupdate(date, n):
1.15
1.16 "Return 'date' updated by 'n' months."
1.17 @@ -263,6 +270,7 @@
1.18 events = []
1.19 shown_events = {}
1.20 all_shown_events = []
1.21 + processed_pages = set()
1.22
1.23 earliest = None
1.24 latest = None
1.25 @@ -278,6 +286,13 @@
1.26 for page_in_category in pages_in_category:
1.27 pagename = page_in_category.page_name
1.28
1.29 + # Only process each page once.
1.30 +
1.31 + if pagename in processed_pages:
1.32 + continue
1.33 + else:
1.34 + processed_pages.add(pagename)
1.35 +
1.36 # Get a real page, not a result page.
1.37
1.38 real_page_in_category = Page(request, pagename)
2.1 --- a/macros/EventAggregator.py Thu Mar 26 01:04:02 2009 +0100
2.2 +++ b/macros/EventAggregator.py Thu Mar 26 01:40:33 2009 +0100
2.3 @@ -45,13 +45,29 @@
2.4 # Macro functions.
2.5
2.6 def getMonth(arg):
2.7 + n = None
2.8 +
2.9 if arg.startswith("current"):
2.10 date = EventAggregatorSupport.getCurrentMonth()
2.11 if len(arg) > 8:
2.12 n = int(arg[7:])
2.13 - date = EventAggregatorSupport.monthupdate(date, n)
2.14 +
2.15 + elif arg.startswith("yearstart"):
2.16 + date = (EventAggregatorSupport.getCurrentYear(), 1)
2.17 + if len(arg) > 10:
2.18 + n = int(arg[9:])
2.19 +
2.20 + elif arg.startswith("yearend"):
2.21 + date = (EventAggregatorSupport.getCurrentYear(), 12)
2.22 + if len(arg) > 8:
2.23 + n = int(arg[7:])
2.24 +
2.25 else:
2.26 date = EventAggregatorSupport.getMonth(arg)
2.27 +
2.28 + if n is not None:
2.29 + date = EventAggregatorSupport.monthupdate(date, n)
2.30 +
2.31 return date
2.32
2.33 def getFormMonth(request, calendar_name, argname):
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/pages/CategoryEvents Thu Mar 26 01:40:33 2009 +0100
3.3 @@ -0,0 +1,17 @@
3.4 +##master-page:CategoryTemplate
3.5 +##master-date:Unknown-Date
3.6 +#format wiki
3.7 +#language en
3.8 +
3.9 +The events category. Here are the current month's events:
3.10 +
3.11 +<<EventAggregator(CategoryEvents,start=current,end=current,calendar=mc)>>
3.12 +
3.13 +To add a page to this category, add a link to this page on the last line of the page. You can add multiple categories to a page.
3.14 +
3.15 +'''List of pages in this category:'''
3.16 +
3.17 +<<FullSearchCached(category:CategoryEvents)>>
3.18 +
3.19 +----
3.20 +CategoryCategory