From 29682503159fae23e335feff6d811ccd0ae0d65c Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Tue, 3 Feb 2009 08:01:31 +0000 Subject: [PATCH] Moved revision numbering tag to a better visual area; cleanup of calendar_build(), calendar_common(), get_day_list() in WebCal, removed alphabet_navigation from NarrativeWeb.py. svn: r11814 --- src/data/Web_Basic-Ash.css | 18 +- src/data/Web_Basic-Cypress.css | 7 +- src/data/Web_Basic-Lilac.css | 9 +- src/data/Web_Basic-Peach.css | 8 +- src/data/Web_Basic-Spruce.css | 8 +- src/data/Web_Mainz.css | 8 +- src/data/Web_Nebraska.css | 8 +- src/data/Web_Print-Default.css | 8 +- src/data/Web_Visually.css | 7 +- src/plugins/lib/libholiday.py | 32 ++-- src/plugins/webreport/NarrativeWeb.py | 253 ++++++++++++++------------ src/plugins/webreport/WebCal.py | 203 +++++++++++---------- 12 files changed, 322 insertions(+), 247 deletions(-) diff --git a/src/data/Web_Basic-Ash.css b/src/data/Web_Basic-Ash.css index bcd7184c4..ea6a03fbf 100644 --- a/src/data/Web_Basic-Ash.css +++ b/src/data/Web_Basic-Ash.css @@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet Style Name: Basic-Ash Stylesheet Style Author: Jason M. Simanek (2008) Note: Adapted from GRAMPS original Modern Style stylesheet -$Id$ ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -20,7 +19,7 @@ Go to to learn more! Copyright 2008 Jason M. Simanek This file is part of the GRAMPS program. - +/* GRAMPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. @@ -41,13 +40,16 @@ gray #999 gray light #CCC gray very light #EEE white #FFF + + NarrativeWeb Styles +------------------------------------------------------------------------------------------------ + + General Elements +----------------------------------------------------- + +# $Id$ + */ - -/* NarrativeWeb Styles --------------------------------------------------------------------------------------------- */ - -/* General Elements ------------------------------------------------------ */ body { font-family:sans-serif; color:#000; diff --git a/src/data/Web_Basic-Cypress.css b/src/data/Web_Basic-Cypress.css index baa07d17f..25fc71697 100644 --- a/src/data/Web_Basic-Cypress.css +++ b/src/data/Web_Basic-Cypress.css @@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet Style Name: Basic - Cypress Style Author: Jason Simanek (2008) Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Tranquil' stylesheet -$Id$ ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -44,7 +43,11 @@ white #FFF */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { font-family:sans-serif; color:#000; diff --git a/src/data/Web_Basic-Lilac.css b/src/data/Web_Basic-Lilac.css index 1c479dad0..5f456ca59 100644 --- a/src/data/Web_Basic-Lilac.css +++ b/src/data/Web_Basic-Lilac.css @@ -6,7 +6,6 @@ GRAMPS Cascading Style Sheet Style Name: Basic - Lilac Style Author: Jason M. Simanek (2008) Note: Adapted from GRAMPS original Modern Style stylesheet with colors from the original 'Business' stylesheet -$Id$ ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -20,7 +19,7 @@ Go to to learn more! Copyright 2008 Jason M. Simanek This file is part of the GRAMPS program. - +/* GRAMPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. @@ -47,7 +46,11 @@ white #FAFAFF -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { font-family:sans-serif; color:#000; diff --git a/src/data/Web_Basic-Peach.css b/src/data/Web_Basic-Peach.css index 8d79bf162..ace35036e 100644 --- a/src/data/Web_Basic-Peach.css +++ b/src/data/Web_Basic-Peach.css @@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet Style Name: Basic-Peach Stylesheet Style Author: Jason M. Simanek (2008) Note: Adapted from GRAMPS original Modern Style stylesheet with a new orange color scheme. -$Id$ + ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -47,7 +47,11 @@ yellow light #FFFBE7 -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { font-family:sans-serif; color:#36220B; diff --git a/src/data/Web_Basic-Spruce.css b/src/data/Web_Basic-Spruce.css index ae9647432..686b0ab5d 100644 --- a/src/data/Web_Basic-Spruce.css +++ b/src/data/Web_Basic-Spruce.css @@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet Style Name: Basic-Spruce Stylesheet Style Author: Jason M. Simanek (2008) Note: Adapted from GRAMPS original Modern Style stylesheet with a new blue color scheme. -$Id$ + ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -47,7 +47,11 @@ white #FFF -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { font-family:sans-serif; color:#000; diff --git a/src/data/Web_Mainz.css b/src/data/Web_Mainz.css index b57705ed9..bbcf0b8de 100644 --- a/src/data/Web_Mainz.css +++ b/src/data/Web_Mainz.css @@ -3,7 +3,7 @@ GRAMPS Cascading Style Sheet Style Name: Mainz Style Author: Jason Simanek (2008) -$Id$ + ---------------------------------------------------------------------------- This website was created with GRAMPS ---------------------------------------------------------------------------- @@ -55,7 +55,11 @@ Middle Light images/Web_Mainz_MidLight.png -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { font-family:Georgia, serif; color:#7D5925; diff --git a/src/data/Web_Nebraska.css b/src/data/Web_Nebraska.css index 1da3bd289..ede7e69ca 100644 --- a/src/data/Web_Nebraska.css +++ b/src/data/Web_Nebraska.css @@ -5,7 +5,7 @@ Copyright Holder and License GRAMPS Cascading Style Sheet Style Name: Nebraska Default Stylesheet Style Author: Jason M. Simanek (2008) -$Id$ + ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -47,7 +47,11 @@ green #5D835F -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { color:#000; margin:0; diff --git a/src/data/Web_Print-Default.css b/src/data/Web_Print-Default.css index 2768c9858..2e61c8664 100644 --- a/src/data/Web_Print-Default.css +++ b/src/data/Web_Print-Default.css @@ -6,7 +6,7 @@ GRAMPS Cascading Style Sheet Style Name: Print Style Sheet Style Author: Jason M. Simanek (2008) Modified by Rob G. Healey, July 2008 -$Id$ + ************************************************************************************************** This website was created with GRAMPS -------------------------------------------------------------------------------------------------- @@ -45,7 +45,11 @@ white #FFF -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { color:#000; margin:0; diff --git a/src/data/Web_Visually.css b/src/data/Web_Visually.css index 67ecb9937..e8fee970a 100644 --- a/src/data/Web_Visually.css +++ b/src/data/Web_Visually.css @@ -5,7 +5,6 @@ Copyright Holder and License GRAMPS Cascading Style Sheet Style Name: Visually Impaired Stylesheet Style Author: Jason M. Simanek (2008) -Modified by Rob G. Healey (C) 2008-2009 ************************************************************************************************** This website was created with GRAMPS http://www.gramps-project.org @@ -52,7 +51,11 @@ Females Web_Gender_Female.png -------------------------------------------------------------------------------------------- */ /* General Elements ------------------------------------------------------ */ +----------------------------------------------------- + +# $Id$ + +*/ body { color:#000; margin:0; diff --git a/src/plugins/lib/libholiday.py b/src/plugins/lib/libholiday.py index 014568925..434c8eeba 100644 --- a/src/plugins/lib/libholiday.py +++ b/src/plugins/lib/libholiday.py @@ -1,7 +1,8 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2007 Donald N. Allingham -# Copyright (C) 2008-2009 Brian G. Matherly +# Copyright (C) 2008-2009 Brian G. Matherly +# Copyright (C) 2009 Rob G. Healey # # 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 @@ -114,9 +115,24 @@ class HolidayTable: self.__init_table() def __find_holiday_files(self): - """ Looks in multiple places for holidays.xml files """ + """ Looks in multiple places for holidays.xml files + It will search for the file in user;s plugin directories first, + then it will search in program's plugins directories. """ + holiday_file = 'holidays.xml' + # Look for holiday files in the user plugins directory and all + # subdirectories. + holiday_full_path = os.path.join(const.USER_PLUGINS, holiday_file) + if os.path.exists(holiday_full_path): + HolidayTable.__holiday_files.append(holiday_full_path) + + for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS): + for directory in dirnames: + holiday_full_path = os.path.join(directory, holiday_file) + if os.path.exists(holiday_full_path): + HolidayTable.__holiday_files.append(holiday_full_path) + # Look for holiday files in the installation plugins directory and all # subdirectories. holiday_full_path = os.path.join(const.PLUGINS_DIR, holiday_file) @@ -129,18 +145,6 @@ class HolidayTable: if os.path.exists(holiday_full_path): HolidayTable.__holiday_files.append(holiday_full_path) - # Look for holiday files in the user plugins directory and all - # subdirectories. - holiday_full_path = os.path.join(const.USER_PLUGINS, holiday_file) - if os.path.exists(holiday_full_path): - HolidayTable.__holiday_files.append(holiday_full_path) - - for (dirpath, dirnames, filenames) in os.walk(const.USER_PLUGINS): - for directory in dirnames: - holiday_full_path = os.path.join(directory, holiday_file) - if os.path.exists(holiday_full_path): - HolidayTable.__holiday_files.append(holiday_full_path) - def __build_country_list(self): """ Generate the list of countries that have holiday information. """ for holiday_file_path in HolidayTable.__holiday_files: diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index c2ba7f5b0..db30afcee 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -78,6 +78,7 @@ import gen.lib import const from GrampsCfg import get_researcher import Sort +import GrampsLocale from gen.plug import PluginManager from gen.plug.menu import PersonOption, NumberOption, StringOption, \ BooleanOption, EnumeratedListOption, FilterOption, \ @@ -101,6 +102,8 @@ from gen.lib.eventroletype import EventRoleType # constants # #------------------------------------------------------------------------ +_PERSON = 0 +_PLACE = 1 _INCLUDE_LIVING_VALUE = 99 # Arbitrary number _NAME_COL = 3 @@ -236,7 +239,6 @@ def html_escape(text): return text - def name_to_md5(text): """This creates an MD5 hex string to be used as filename.""" return md5(text).hexdigest() @@ -245,7 +247,7 @@ class BasePage: """ This is the base class to write certain HTML pages. """ - + def __init__(self, report, title, gid=None): """ report - instance of NavWebReport @@ -275,38 +277,6 @@ class BasePage: self.linkhome = options['linkhome'] self.use_gallery = options['gallery'] - def alphabet_navigation(self, of, ind_list): - """ - Will create the alphabetical navigation bar... - """ - - def get_alpha_list(ind_list): - """ Will produce the active letters in the alphabet """ - - firstletter_list = [] - for person_handle in ind_list: - person = self.report.database.get_person_from_handle(person_handle) - primary_name = person.get_primary_name() - - alpha_name = primary_name.get_surname() - - if alpha_name: - alpha_ltr = alpha_name[0] - if alpha_ltr not in firstletter_list: - firstletter_list.append(alpha_ltr) - - firstletter_list.sort() - return firstletter_list - - namedict = get_alpha_list(ind_list) - - of.write('\t\n') - def write_footer(self, of): of.write('\n') # Terminate div_content @@ -355,7 +325,7 @@ class BasePage: of.write('\n') of.write('') - def write_header(self, of, title, content_divid=None): + def write_header(self, of, title): """ Note. 'title' is used as currentsection in the navigation links. """ @@ -405,72 +375,82 @@ class BasePage: of.write('\n') # Begin Navigation Menu - of.write('\n') # End Navigation Menu - - divid = '' - if content_divid: - divid = ' id="%s"' % content_divid - of.write('\n' % divid) - def display_nav_links(self, of, currentsection): + """ + Creates the navigation menu + """ + + # Determine if there will be a link to WebCal or not??? + use_webcal = False + webcal_link = self.report.webcal_link + if webcal_link.strip() != '': + if not webcal_link.endswith(self.ext): + webcal_link += self.ext + if os.path.isfile(webcal_link): + use_webcal = True + navs = [ - (self.report.index_fname, _('Home'), self.report.use_home), - (self.report.intro_fname, _('Introduction'), self.report.use_intro), - (self.report.surname_fname, _('Surnames'), True), - ('individuals', _('Individuals'), True), - ('places', _('Places'), True), - ('gallery', _('Gallery'), self.use_gallery), - ('download', _('Download'), self.report.inc_download), - ('contact', _('Contact'), self.report.use_contact), - ('sources', _('Sources'), True), + (self.report.index_fname, _('Home'), self.report.use_home), + (self.report.intro_fname, _('Introduction'), self.report.use_intro), + (self.report.surname_fname, _('Surnames'), True), + ('individuals', _('Individuals'), True), + ('places', _('Places'), True), + ('gallery', _('Gallery'), self.use_gallery), + ('download', _('Download'), self.report.inc_download), + ('contact', _('Contact'), self.report.use_contact), + ('sources', _('Sources'), True), + (webcal_link, _('Web Calendar'), use_webcal), ] + of.write('\t\n') # End Navigation Menu def display_first_image_as_thumbnail( self, of, photolist=None): if not photolist or not self.use_gallery: @@ -750,7 +730,9 @@ class IndividualListPage(BasePage): db = report.database of = self.report.create_file("individuals") - self.write_header(of, _('Individuals'), content_divid='Individuals') + self.write_header(of, _('Individuals')) + + of.write('
\n') msg = _("This page contains an index of all the individuals in the " "database, sorted by their last names. Selecting the person’s " @@ -761,9 +743,6 @@ class IndividualListPage(BasePage): showspouse = report.options['showspouse'] showparents = report.options['showparents'] - # begin alphabetical navigation - self.alphabet_navigation(of, person_handle_list) - of.write('\t

%s

\n' % _('Individuals')) of.write('\t

%s

\n' % msg) of.write('\t\n') @@ -799,11 +778,10 @@ class IndividualListPage(BasePage): if first: of.write('\t\t\n') if surname: - of.write('\t\t\t\n') of.write('\t\t\t\n') - of.write('\t\t\t\n' % (last_letter, last_letter)) + of.write('\t\t\t\n') @@ -1466,7 +1450,9 @@ class IntroductionPage(BasePage): db = report.database of = self.report.create_file(report.intro_fname) # Note. In old NarrativeWeb.py the content_divid depended on filename. - self.write_header(of, _('Introduction'), content_divid='Introduction') + self.write_header(of, _('Introduction')) + + of.write('
\n') of.write('\t

%s

\n' % _('Introduction')) @@ -1491,7 +1477,9 @@ class HomePage(BasePage): db = report.database of = self.report.create_file("index") - self.write_header(of, _('Home'), content_divid='Home') + self.write_header(of, _('Home')) + + of.write('
\n') of.write('\t

%s

\n' % _('Home')) @@ -1516,7 +1504,9 @@ class SourcesPage(BasePage): db = report.database of = self.report.create_file("sources") - self.write_header(of, _('Sources'), content_divid='Sources') + self.write_header(of, _('Sources')) + + of.write('
\n') handle_list = list(handle_set) source_dict = {} @@ -1572,7 +1562,9 @@ class SourcePage(BasePage): of = self.report.create_file(source.get_handle(), 'src') self.up = True self.page_title = source.get_title() - self.write_header(of, "%s - %s" % (_('Sources'), self.page_title), content_divid='SourceDetail') + self.write_header(of, "%s - %s" % (_('Sources'), self.page_title)) + + of.write('
\n') media_list = source.get_media_list() self.display_first_image_as_thumbnail(of, media_list) @@ -1613,7 +1605,9 @@ class GalleryPage(BasePage): db = report.database of = self.report.create_file("gallery") - self.write_header(of, _('Gallery'), content_divid='Gallery') + self.write_header(of, _('Gallery')) + + of.write('
\n' % (dayclass, get_name_for_daycol(day_col))) - of.write('\t\t\t\n' % (dayclass, dayname, dayname[0])) + of.write('\t\t\t\n' % dayname[0]) of.write('\t\t\n') of.write('\t\n') # begin table body of.write('\t\n') - # Compute the first day to display for this month. - # It can also be a day in the previous month. - current_date = datetime.date(year, month, 1) # first day of the month - current_ord = current_date.toordinal() - monthinfo[0].count(0) - - # get last month's last week for previous days in the month - if month == 1: - prevmonth = calendar.monthcalendar(year - 1, 12) - else: - prevmonth = calendar.monthcalendar(year, month-1) - num_weeks = len(prevmonth) - lastweek_prevmonth = prevmonth[num_weeks - 1] - - # get next month's first week for next days in the month - if month == 12: - nextmonth = calendar.monthcalendar(year + 1, 1) - else: - nextmonth = calendar.monthcalendar(year, month + 1) - firstweek_nextmonth = nextmonth[0] + current_date, current_ord, monthinfo = get_first_day(year, month) nweeks = len(monthinfo) for week_row in range(0, nweeks): @@ -598,10 +599,10 @@ class WebCalReport(Report): day = week[day_col] if day == 0: # a day in the previous or next month if week_row == 0: # a day in the previous month - specday = lastweek_prevmonth[day_col] + specday = get_previous_day(year, month, day_col) specclass = "previous " + dayclass elif week_row == nweeks-1: # a day in the next month - specday = firstweek_nextmonth[day_col] + specday = get_next_day(year, month, day_col) specclass = "next " + dayclass of.write('\t\t\t
%s' - % (surname[0].upper(), surname)) - else: - of.write('\t\t\t%s' + of.write('\t\t\t%s\n' % (name_to_md5(surname), surname)) + else: + of.write('\t\t\t \n') else: of.write('\t\t
 ') @@ -904,7 +882,9 @@ class SurnamePage(BasePage): db = report.database of = self.report.create_file(name_to_md5(surname), 'srn') self.up = True - self.write_header(of, "%s - %s" % (_('Surname'), surname), content_divid='SurnameDetail') + self.write_header(of, "%s - %s" % (_('Surname'), surname)) + + of.write('
\n') msg = _("This page contains an index of all the individuals in the " "database with the surname of %s. Selecting the person’s name " @@ -1031,7 +1011,9 @@ class PlaceListPage(BasePage): db = report.database of = self.report.create_file("places") - self.write_header(of, _('Places'), content_divid='Places') + self.write_header(of, _('Places')) + + of.write('
\n') msg = _("This page contains an index of all the places in the " "database, sorted by their title. Clicking on a place’s " @@ -1096,7 +1078,9 @@ class PlacePage(BasePage): of = self.report.create_file(place.get_handle(), 'plc') self.up = True self.page_title = ReportUtils.place_name(db, place_handle) - self.write_header(of, "%s - %s" % (_('Places'), self.page_title), content_divid='PlaceDetail') + self.write_header(of, "%s - %s" % (_('Places'), self.page_title)) + + of.write('
\n') media_list = place.get_media_list() self.display_first_image_as_thumbnail(of, media_list) @@ -1178,7 +1162,9 @@ class MediaPage(BasePage): self.copy_thumbnail(handle, photo) self.page_title = photo.get_description() - self.write_header(of, "%s - %s" % (_('Gallery'), self.page_title), content_divid='GalleryDetail') + self.write_header(of, "%s - %s" % (_('Gallery'), self.page_title)) + + of.write('
\n') of.write('\t

%s:

\n' % _('Gallery')) @@ -1370,16 +1356,15 @@ class SurnameListPage(BasePage): db = report.database if order_by == self.ORDER_BY_NAME: of = self.report.create_file(filename) - self.write_header(of, _('Surnames'), content_divid='Surnames') + self.write_header(of, _('Surnames')) + of.write('
\n') of.write('\t

%s

\n' % _('Surnames')) else: of = self.report.create_file("surnames_count") - self.write_header(of, _('Surnames by person count'), content_divid='Surnames') + self.write_header(of, _('Surnames by person count')) + of.write('
\n') of.write('\t

%s

\n' % _('Surnames by person count')) - # beginning of Alphabetical Navigation - self.alphabet_navigation(of, person_handle_list) - of.write('\t

%s

\n' % _( 'This page contains an index of all the ' 'surnames in the database. Selecting a link ' @@ -1430,8 +1415,7 @@ class SurnameListPage(BasePage): if letter is not last_letter: last_letter = letter of.write('\t\t
') - of.write('%s%s') self.surname_link(of, name_to_md5(surname), surname) of.write('%s%s\n' % (dayclass, dayname)) + of.write('\t\t\t\t%s
\n' % specclass) @@ -621,31 +622,34 @@ class WebCalReport(Report): # specify day class for this day of.write('class="%s">\n' % hilightday) - # Year at a Glance - if cal == "yg": - # create yyyymmdd date string for - # "One Day" calendar pages filename - two_digit_month = '%02d' % month - two_digit_day = '%02d' % day - fname_date = str(year) + str(two_digit_month) + str(two_digit_day) - - # create web link to corresponding "One Day" page... - # The HREF is relative to the year path. - fname_date = '/'.join([lng_month, fname_date]) - fname_date += self.ext - of.write('\t\t\t\t\n' - % (fname_date, shrt_month, day)) - of.write('\t\t\t\t\t
%d
\n' % day) - of.write('\t\t\t\t
\n') - one_day_cal = "OneDay" - - # WebCal - else: - one_day_cal = "WebCal" - of.write('\t\t\t\t
%d
\n' % day) - evt_dte = _make_date(thisday.year, thisday.month, thisday.day) - self.one_day(of, evt_dte, one_day_cal, holiday_list, bday_anniv_list) + day_list = get_day_list(evt_dte, holiday_list, bday_anniv_list) + + if day_list: + # Year at a Glance + if cal == "yg": + # create yyyymmdd date string for + # "One Day" calendar page filename + two_digit_month = '%02d' % month + two_digit_day = '%02d' % day + fname_date = str(year) + str(two_digit_month) + str(two_digit_day) + + # create web link to corresponding "One Day" page... + # The HREF is relative to the year path. + fname_date = '/'.join([lng_month, fname_date]) + fname_date += self.ext + of.write('\t\t\t\t\n' + % (fname_date, shrt_month, day)) + of.write('\t\t\t\t\t
%d
\n' % day) + one_day_cal = "OneDay" + + # WebCal + else: + one_day_cal = "WebCal" + of.write('\t\t\t\t
%d
\n' % day) + + # both WebCal and Year_Glance needs day_list displayed + self.one_day(of, evt_dte, one_day_cal, day_list) # no holiday/ bday/ anniversary this day else: @@ -684,7 +688,7 @@ class WebCalReport(Report): """ of.write('\n') + of.write('\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n') xmllang = Utils.xml_lang() of.write('\n' % (xmllang, xmllang)) @@ -698,18 +702,21 @@ class WebCalReport(Report): subdirs = ['..'] * nr_up - # link to stylesheet + # link to screen stylesheet fname = '/'.join(subdirs + ['styles'] + [self.css]) - of.write('\t\n' % fname) + of.write('\t\n') - # link to _CALENDARPRINT stylesheet + # link to print stylesheet if add_print: fname = '/'.join(subdirs + ['styles'] + ["Web_Print-Default.css"]) - of.write('\t\n' % fname) + of.write('\t\n') # link to GRAMPS favicon fname = '/'.join(subdirs + ['images'] + ['favicon.ico']) - of.write('\t\n' % fname) + of.write('\t\n') of.write('\n\n') @@ -772,24 +779,15 @@ class WebCalReport(Report): def close_file(self, of): of.close() - def one_day(self, of, evt_dte, one_day_cal, holiday_list, bday_anniv_list): + def one_day(self, of, evt_dte, one_day_cal, day_list): """ This method creates the One Day page for "Year At A Glance" - 'holiday_list' - list of holidays to display on this day - 'bday_anniv_list' - list of birthdays and anniversaries to display on this day - 'day_list' - a combination of both dictionaries to be able to create one day nyears, date, text, event --- are necessary for figuring the age or years married for each year being created... """ - # initialize day_list - day_list = [] - - # call day_list to fill - day_list = fill_day_list(evt_dte, holiday_list, bday_anniv_list) - # This is one_day in the year-at-a-glance calendar if one_day_cal == "OneDay": @@ -816,7 +814,15 @@ class WebCalReport(Report): # set date display as in user prevferences pg_date = _dd.display(evt_dte) - self.calendar_common(of, nr_up, year, lng_month, _('One Day Within A Year'), pg_date) + # page title + title = _('One Day Within A Year') + + # Add Header + self.write_header(of, nr_up, title, False) + + of.write('\n' % pg_date) + + self.calendar_common(of, nr_up, year, lng_month, title) of.write('\t

%s

\n' % pg_date) @@ -845,7 +851,12 @@ class WebCalReport(Report): # page title title = _("%(year)d, At A Glance") % {'year' : year} - self.calendar_common(of, nr_up, year, 'fullyear', title, 'fullyearlinked') + # Add Header + self.write_header(of, nr_up, title, False) + + of.write('\n') + + self.calendar_common(of, nr_up, year, 'fullyear', title) # page description of.write('
\n') @@ -993,7 +1004,12 @@ class WebCalReport(Report): cal_fname = _get_long_month_name(month) of = self.create_file(cal_fname, str(year)) - self.calendar_common(of, nr_up, year, cal_fname, self.title_text, 'WebCal', use_home=True) + # Add Header + self.write_header(of, nr_up, self.title_text, True) + + of.write('\n') + + self.calendar_common(of, nr_up, year, cal_fname, self.title_text, True) # build the calendar self.calendar_build(of, "wc", year, month) @@ -1454,9 +1470,9 @@ def _get_long_month_name(month): def _get_short_month_name(month): return _shrt_month[month] -def fill_day_list(evt_dte, holiday_list, bday_anniv_list): +def get_day_list(evt_dte, holiday_list, bday_anniv_list): """ - Will fill day_list and return it to its caller one_day() + Will fill day_list and return it to its caller: calendar_build() holiday_list, or bday_anniv_list -- will always have something in it... @@ -1464,7 +1480,7 @@ def fill_day_list(evt_dte, holiday_list, bday_anniv_list): 'day_list' - a combination of both dictionaries to be able to create one day nyears, date, text, event --- are necessary for figuring the age or years married - for each year being created... + for each day being created... """ # initialize day_list @@ -1521,12 +1537,10 @@ def fill_day_list(evt_dte, holiday_list, bday_anniv_list): if txt_str is not None: day_list.append((nyears, date, txt_str, event)) - # if there is more than one event on any given date, sort them based on years - # for birthdays and anniversaries. - # holidays will always appear first in the list. - if len(day_list) > 1: - day_list.sort() - + # sort them based on number of years + # holidays will always be on top of day + day_list.sort() + return day_list def get_marrital_status(family, db): @@ -1548,6 +1562,9 @@ def get_marrital_status(family, db): are_married = None return are_married +def gen_key(event): + return ((event.get_year(), event.get_month(), event.get_day())) + #------------------------------------------------------------------------- # #