4892: Webcal link : add an index file

This commit is contained in:
SNoiraud 2016-05-06 23:58:02 +02:00
parent c0203ec342
commit 6e539f5000
2 changed files with 40 additions and 1 deletions

View File

@ -634,12 +634,17 @@ class BasePage(object):
""" """
Returns the navigation menu hyperlink Returns the navigation menu hyperlink
""" """
if url_fname == self.target_cal_uri:
uplink = False
else:
uplink = self.uplink
# check for web page file extension? # check for web page file extension?
if not _has_webpage_extension(url_fname): if not _has_webpage_extension(url_fname):
url_fname += self.ext url_fname += self.ext
# get menu item url and begin hyperlink... # 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) return Html("a", nav_text, href=url, title=nav_text, inline=True)

View File

@ -1505,6 +1505,9 @@ class WebCalReport(Report):
if self.fullyear: if self.fullyear:
self.year_glance(cal_year) self.year_glance(cal_year)
if self.home_link:
self.create_page_index()
# a single year # a single year
else: else:
cal_year = self.start_year cal_year = self.start_year
@ -1523,6 +1526,37 @@ class WebCalReport(Report):
if self.fullyear: if self.fullyear:
self.year_glance(cal_year) 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 # WebCalOptions; Creates the Menu
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------