Add extra page to narrativeweb. (#465)

Fixes #02630
This commit is contained in:
Serge Noiraud 2017-11-23 09:36:13 +01:00 committed by GitHub
parent be776d6a31
commit d677a1a785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 0 deletions

View File

@ -226,6 +226,8 @@ register('paths.report-directory', USER_HOME)
register('paths.website-directory', USER_HOME)
register('paths.website-cms-uri', '')
register('paths.website-cal-uri', '')
register('paths.website-extra-page-uri', '')
register('paths.website-extra-page-name', '')
register('paths.quick-backup-directory', USER_HOME)
register('paths.quick-backup-filename',
"%(filename)s_%(year)d-%(month)02d-%(day)02d.%(extension)s")

View File

@ -133,6 +133,8 @@ class BasePage: # pylint: disable=C1001
self.target_uri = report.options['cmsuri']
self.usecal = report.options['usecal']
self.target_cal_uri = report.options['caluri']
self.extrapage = report.options['extrapage']
self.extrapagename = report.options['extrapagename']
self.familymappages = None
lang = report.options['trans']
self.rlocale = report.set_locale(lang)
@ -1472,6 +1474,7 @@ class BasePage: # pylint: disable=C1001
self.report.use_home),
(self.report.intro_fname, self._("Introduction"),
self.report.use_intro),
(self.report.extrapage, self.extrapagename, (self.extrapage != "")),
('individuals', self._("Individuals"), True),
(self.report.surname_fname, self._("Surnames"), True),
('families', self._("Families"), self.report.inc_families),

View File

@ -199,6 +199,12 @@ class NavWebReport(Report):
self.usecms = self.options['usecms']
self.target_uri = self.options['cmsuri']
# Do we add an extra page ?
# extrapage is the URI
# extrapagename is the visible name in the navigation bar.
self.extrapage = self.options['extrapage']
self.extrapagename = self.options['extrapagename']
# Do we need to include web calendar ?
self.usecal = self.options['usecal']
self.target_cal_uri = self.options['caluri']
@ -1532,6 +1538,8 @@ class NavWebOptions(MenuReportOptions):
self.__navigation = None
self.__target_cal_uri = None
self.__securesite = False
self.__extra_page_name = None
self.__extra_page = None
db_options = name + ' ' + dbase.get_dbname()
MenuReportOptions.__init__(self, db_options, dbase)
@ -1545,6 +1553,7 @@ class NavWebOptions(MenuReportOptions):
self.__add_report_html(menu)
self.__add_report_display(menu)
self.__add_page_generation_options(menu)
self.__add_more_pages(menu)
self.__add_images_generation_options(menu)
self.__add_download_options(menu)
self.__add_advanced_options(menu)
@ -1675,6 +1684,28 @@ class NavWebOptions(MenuReportOptions):
self.__securesite.set_help(_('Whether to use http:// or https://'))
addopt("securesite", self.__securesite)
def __add_more_pages(self, menu):
"""
Add more extra pages to the report
"""
category_name = _("Extra pages")
addopt = partial( menu.add_option, category_name )
default_path_name = config.get('paths.website-extra-page-name')
self.__extra_page_name = StringOption(_("Extra page name"),
default_path_name)
self.__extra_page_name.set_help(
_("Your extra page name like it is shown in the menubar"))
self.__extra_page_name.connect('value-changed',
self.__extra_page_name_changed)
addopt("extrapagename", self.__extra_page_name)
default_path = config.get('paths.website-extra-page-uri')
self.__extra_page = DestinationOption(_("Your extra page path"),
default_path)
self.__extra_page.set_help(
_("Your extra page path without extension"))
self.__extra_page.connect('value-changed', self.__extra_page_changed)
addopt("extrapage", self.__extra_page)
def __add_report_display(self, menu):
"""
How to display names, datyes, ...
@ -2027,6 +2058,22 @@ class NavWebOptions(MenuReportOptions):
"""
self.__target_cal_uri = self.__calendar_uri.get_value()
def __extra_page_name_changed(self):
"""
Update the change of the extra page name
"""
self._extra_page_name = self.__extra_page_name.get_value()
if self._extra_page_name != "":
config.set('paths.website-extra-page-name', self._extra_page_name)
def __extra_page_changed(self):
"""
Update the change of the extra page without extension
"""
self._extra_page = self.__extra_page.get_value()
if self._extra_page != "":
config.set('paths.website-extra-page-uri', self._extra_page)
def __archive_changed(self):
"""
Update the change of storage: archive or directory