Changeset 88
- Timestamp:
- 07/28/05 15:27:06 (3 years ago)
- Files:
-
- wikicalendarmacro/stable/WikiCalendar.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wikicalendarmacro/stable/WikiCalendar.py
r53 r88 1 # Copyright (C) 2005 Matthew Good <matt@matt-good.net> 1 # Copyright (C) 2005 Matthew Good <trac@matt-good.net> 2 # Copyright (C) 2005 Jan Finell <finell@cenix-bioscience.com> 2 3 # 3 4 # "THE BEER-WARE LICENSE" (Revision 42): 4 # < matt@matt-good.net> wrote this file. As long as you retain this notice you5 # <trac@matt-good.net> wrote this file. As long as you retain this notice you 5 6 # can do whatever you want with this stuff. If we meet some day, and you think 6 7 # this stuff is worth it, you can buy me a beer in return. Matthew Good … … 8 9 # http://people.freebsd.org/~phk/) 9 10 # 10 # Author: Matthew Good <matt@matt-good.net> 11 # Author: Matthew Good <trac@matt-good.net> 12 # Month/Year navigation by: Jan Finell <finell@cenix-bioscience.com> 11 13 12 14 import time … … 29 31 cal = calendar.monthcalendar(year, month) 30 32 31 buff = StringIO()32 33 33 34 date = [year, month] + [1] * 7 34 35 36 # url to the current page (used in the navigation links) 37 thispageURL = env.href.wiki(hdf.getValue('wiki.page_name', '')) 38 # for the prev/next navigation links 39 prevMonth = month-1 40 prevYear = year 41 nextMonth = month+1 42 nextYear = year 43 # check for year change (KISS version) 44 if prevMonth == 0: 45 prevMonth = 12 46 prevYear -= 1 47 if nextMonth == 13: 48 nextMonth = 1 49 nextYear += 1 50 51 # building the output 52 buff = StringIO() 35 53 buff.write('<table><caption>') 54 55 # prev month link 56 prevMonthURL = thispageURL+'?month=%d&year=%d' % (prevMonth, prevYear) 57 buff.write('<a href="%s">< </a>' % prevMonthURL) 58 # the caption 36 59 buff.write(time.strftime('%B %Y', tuple(date))) 60 # next month link 61 nextMonthURL = thispageURL+'?month=%d&year=%d' % (nextMonth, nextYear) 62 buff.write('<a href="%s"> ></a>' % nextMonthURL) 37 63 buff.write('</caption>\n<thead><tr align="center">') 64 38 65 for day in calendar.weekheader(2).split(): 39 66 buff.write('<th scope="col">%s</th>' % day) … … 66 93 buff.close() 67 94 return table 95
