Fixed error in display_year_navs() which also affects the Visually Impaired stylesheet.

svn: r12159
This commit is contained in:
Rob G. Healey 2009-02-28 11:49:43 +00:00
parent 7b809aefda
commit 76f536e571

View File

@ -414,12 +414,19 @@ class WebCalReport(Report):
num_years = (self.end_year - self.start_year) num_years = (self.end_year - self.start_year)
cal_year = self.start_year cal_year = self.start_year
nrows = (num_years / 16) # stylesheets other than "Web_Visually.css" will hold 22 years in a row
for rows in range(0, (nrows + 1)): # otherwise, 18 years in a row
_stylesheet = 'Web_Visually.css'
years_in_row = 22 if self.css is not _stylesheet else 18
# simple mathematics was not working, so I did it for python
nrows = get_num_of_rows(num_years, years_in_row)
for rows in range(0, nrows):
of.write('<div id="navigation">\n') of.write('<div id="navigation">\n')
of.write('\t<ul>\n') of.write('\t<ul>\n')
cols = 0 cols = 1
while (cols <= 15 and cal_year <= self.end_year): while (cols <= years_in_row and cal_year <= self.end_year):
url = '' url = ''
# begin subdir level # begin subdir level
@ -1540,6 +1547,30 @@ def _has_webpage_extension(url):
return True return True
return False return False
def get_num_of_rows(num_years, years_in_row):
"""
This will return the number of weeks to be display in
display_year_navs()
"""
if num_years > years_in_row:
rows = 1
num_years -= years_in_row
elif 1 <= num_years <= years_in_row:
return 1
if num_years > years_in_row:
rows += 1
num_years -= years_in_row
elif 1 <= num_years <= years_in_row:
rows += 1
return rows
if num_years > years_in_row:
rows += 1
num_years -= years_in_row
elif 1 <= num_years <= years_in_row:
rows += 1
return rows
return rows
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Register Plugin # Register Plugin