Webcal: link problems in some cases (#661)

* Webcal: link problems in some cases

Year 2016 is highlighted by default instead of current year.

Fixes #10801

* Webcal: Missing links when muliyear unselected
This commit is contained in:
Serge Noiraud 2018-09-30 10:20:09 +02:00 committed by GitHub
parent 1b60193f77
commit 896b77a165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@
# Copyright (C) 2008-2011 Rob G. Healey <robhealey1@gmail.com> # Copyright (C) 2008-2011 Rob G. Healey <robhealey1@gmail.com>
# Copyright (C) 2008 Jason Simanek # Copyright (C) 2008 Jason Simanek
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2015-2016 Serge Noiraud # Copyright (C) 2015- Serge Noiraud
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -34,6 +34,7 @@ Web Calendar generator.
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os, shutil import os, shutil
import datetime import datetime
import time
import calendar # Python module import calendar # Python module
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -146,6 +147,10 @@ class WebCalReport(Report):
self.multiyear = mgobn('multiyear') self.multiyear = mgobn('multiyear')
self.start_year = mgobn('start_year') self.start_year = mgobn('start_year')
self.end_year = mgobn('end_year') self.end_year = mgobn('end_year')
if not self.multiyear:
self.end_year = self.start_year
if self.end_year < self.start_year:
self.end_year = self.start_year
self.maiden_name = mgobn('maiden_name') self.maiden_name = mgobn('maiden_name')
@ -512,6 +517,7 @@ class WebCalReport(Report):
# limit number of years to eighteen (18) years and only one row of years # limit number of years to eighteen (18) years and only one row of years
nyears = ((self.end_year - self.start_year) + 1) nyears = ((self.end_year - self.start_year) + 1)
num_years = nyears if 0 < nyears < 19 else 18 num_years = nyears if 0 < nyears < 19 else 18
self.end_year = (self.start_year + 17) if nyears > 18 else self.end_year
# begin year division and begin unordered list # begin year division and begin unordered list
with Html("div", id="subnavigation", with Html("div", id="subnavigation",
@ -1563,8 +1569,8 @@ class WebCalReport(Report):
index, body = self.write_header(nr_up, title, "index", False) index, body = self.write_header(nr_up, title, "index", False)
# create Year Navigation menu # create Year Navigation menu
if self.multiyear and ((self.end_year - self.start_year) > 0): current_year = time.strftime("%Y", time.gmtime())
body += self.year_navigation(nr_up, str(2016)) body += self.year_navigation(nr_up, str(current_year))
# create blank line for stylesheets # create blank line for stylesheets
# write footer section # write footer section