From 6e539f5000fd94779753709aa6d2cbcaa44eaadd Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Fri, 6 May 2016 23:58:02 +0200 Subject: [PATCH] 4892: Webcal link : add an index file --- gramps/plugins/webreport/narrativeweb.py | 7 ++++- gramps/plugins/webreport/webcal.py | 34 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index f3c13dc41..72f67b2de 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -634,12 +634,17 @@ class BasePage(object): """ Returns the navigation menu hyperlink """ + if url_fname == self.target_cal_uri: + uplink = False + else: + uplink = self.uplink + # check for web page file extension? if not _has_webpage_extension(url_fname): url_fname += self.ext # get menu item url and begin hyperlink... - url = self.report.build_url_fname(url_fname, None, self.uplink) + url = self.report.build_url_fname(url_fname, None, uplink) return Html("a", nav_text, href=url, title=nav_text, inline=True) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 9d2b384ee..2e255326a 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -1505,6 +1505,9 @@ class WebCalReport(Report): if self.fullyear: self.year_glance(cal_year) + if self.home_link: + self.create_page_index() + # a single year else: cal_year = self.start_year @@ -1523,6 +1526,37 @@ class WebCalReport(Report): if self.fullyear: self.year_glance(cal_year) + if self.home_link: + self.create_page_index() + + def create_page_index(self): + """ + Create the page index called by the narrativeweb. + """ + output_file = self.create_file('index', "") + + # page title + title = _("My Family Calendar") + + nr_up = 0 + + # Create page header + # body has already been added to yearglance already once + index, body = self.write_header(nr_up, title, "index", False) + + # create Year Navigation menu + if self.multiyear and ((self.end_year - self.start_year) > 0): + body += self.year_navigation(nr_up, str(2016)) + + # create blank line for stylesheets + # write footer section + footer = self.write_footer(nr_up) + body += (FULLCLEAR, footer) + + # send calendar page to web output + # and close the file + self.XHTMLWriter(index, output_file) + # ----------------------------------------------------------------------------- # WebCalOptions; Creates the Menu #------------------------------------------------------------------------------