Ticket #562: WikiCalendar_inc_dec_month_and_year.patch
| File WikiCalendar_inc_dec_month_and_year.patch, 2.2 kB (added by taa, 2 years ago) |
|---|
-
WikiCalendar.py
old new 10 10 # 11 11 # Author: Matthew Good <trac@matt-good.net> 12 12 # Month/Year navigation by: Jan Finell <finell@cenix-bioscience.com> 13 # Month/Year increment/decrement parameters by: Tony Abou-Assaleh <taa@acm.org> 13 14 14 15 import time 15 16 import calendar … … 51 52 # find out whether use http param, current or macro param year/month 52 53 53 54 if http_param_year == "": 54 # not clicked on a prev or next button 55 if len(args) >= 1 and args[0] <> "*": 56 # year given in macro parameters 57 year = int(args[0]) 58 else: 59 # use current year 60 year = today.tm_year 55 # use current year 56 year = today.tm_year 61 57 else: 62 58 # year in http params (clicked by user) overrides everything 63 59 year = int(http_param_year) 64 60 61 # not clicked on a prev or next button 62 if len(args) >= 1: 63 if args[0][0] == "*": 64 pass 65 elif args[0][0] in ("-", "+"): 66 year += int(args[0]) 67 else: 68 # year given in macro parameters 69 year = int(args[0]) 70 65 71 if http_param_month == "": 66 # not clicked on a prev or next button 67 if len(args) >= 2 and args[1] <> "*": 68 # month given in macro parameters 69 month = int(args[1]) 70 else: 71 # use current month 72 month = today.tm_mon 72 # use current month 73 month = today.tm_mon 73 74 else: 74 75 # month in http params (clicked by user) overrides everything 75 76 month = int(http_param_month) 76 77 78 # not clicked on a prev or next button 79 if len(args) >= 2: 80 if args[1][1] == "*": 81 pass 82 elif args[1][1] in ("-", "+"): 83 month += int(args[1]) 84 else: 85 # month given in macro parameters 86 month = int(args[1]) 87 88 # handle month > 12 and month < 1, must shift to month 89 # range from [1,12] to [0,11] and back 90 year += (month-1) / 12 91 month = (month+11) % 12 + 1 92 77 93 showbuttons = 1 78 94 if len(args) >= 3: 79 95 showbuttons = bool(args[2]=="True" or args[2]=="true" or args[2]=="no" or args[2]=="0")
