Fixed SurnamePage, other minor fixes. Some cleanup of the stylesheet.

svn: r12656
This commit is contained in:
Rob G. Healey 2009-06-12 06:04:30 +00:00
parent 140c565a28
commit 94dba1433d
2 changed files with 131 additions and 111 deletions

View File

@ -435,11 +435,21 @@ table.infolist tbody tr td.ColumnType {
} }
table.infolist tbody tr td.ColumnPartner { table.infolist tbody tr td.ColumnPartner {
font-size:.9em; font-size:.9em;
background-color:#FFF;
}
table.infolist tbody tr td.ColumnPartner a {
display:block;
padding:.6em 10px;
vertical-align:middle;
}
table.infolist tbody tr td.ColumnPartner a:hover {
background-color:#C1B398;
} }
table.infolist tbody tr td.ColumnParents { table.infolist tbody tr td.ColumnParents {
font-size:.9em; font-size:.9em;
} }
table.infolist tbody tr td.ColumnParents span.father, table.infolist tbody tr td.ColumnParents span.mother { table.infolist tbody tr td.ColumnParents span.father,
table.infolist tbody tr td.ColumnParents span.mother {
display:block; display:block;
} }
table.infolist tbody tr td.ColumnParents span.mother:before { table.infolist tbody tr td.ColumnParents span.mother:before {
@ -569,7 +579,7 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
/* IndividualDetail /* IndividualDetail
------------------------------------------------------ */ ------------------------------------------------------ */
#IndividualDetail { #IndividualDetail {
background-color:#C1B398; background-color:#FFF;
} }
#IndividualDetail div table.infolist tr td { #IndividualDetail div table.infolist tr td {
font:normal .9em/1.2em sans-serif; font:normal .9em/1.2em sans-serif;
@ -846,7 +856,7 @@ div.subsection table.infolist {
----------------------------------------------------- */ ----------------------------------------------------- */
div#events { div#events {
padding-bottom:0; padding-bottom:0;
height:3.5cm; height:2.8cm;
overflow:auto; overflow:auto;
} }
div#events h4 { div#events h4 {

View File

@ -1023,141 +1023,151 @@ class SurnamePage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
of = self.report.create_file(name_to_md5(surname), 'srn') # module variables
self.up = True
surname, body = self.write_header("%s - %s" % (_('Surname'), surname))
# plugin variables
showbirth = report.options['showbirth'] showbirth = report.options['showbirth']
showdeath = report.options['showdeath'] showdeath = report.options['showdeath']
showpartner = report.options['showpartner'] showpartner = report.options['showpartner']
showparents = report.options['showparents'] showparents = report.options['showparents']
of = self.report.create_file(name_to_md5(surname), 'srn')
self.up = True
surnamepage, body = self.write_header("%s - %s" % (_('Surname'), surname))
# begin SurnameDetail division # begin SurnameDetail division
with Html('div', class_='content', id='SurnameDetail') as section: with Html('div', id='SurnameDetail', class_='contente') as surnamedetail:
body += section body += surnamedetail
# section title # section title
title = Html('h3', html_escape(surname), inline=True) surnamedetail += Html('h3', html_escape(surname), inline=True)
section += title
msg = _("This page contains an index of all the individuals in the " msg = _("This page contains an index of all the individuals in the "
"database with the surname of %s. Selecting the person’s name " "database with the surname of %s. Selecting the person’s name "
"will take you to that person’s individual page.") % surname "will take you to that person’s individual page.") % surname
descr = Html('p', msg, id='description') surnamedetail += Html('p', msg, id='description')
section += descr
# begin surname table # begin surname table and thead
with Html('table', class_='infolist surname') as table: with Html('table', class_='infolist surname') as surname_table:
section += table surnamedetail += surname_table
with Html('thead') as thead: with Html('thead') as thead:
table += thead surname_table += thead
tabhead = []
tabhead.append('Name')
if report.options['showbirth']:
tabhead.append('Birth')
if report.options['showdeath']:
tabhead.append('Death')
if report.options['showpartner']:
tabhead.append('Partner')
if report.options['showparents']:
tabhead.append('Parents')
with Html('tr') as trow: with Html('tr') as trow:
thead += trow thead += trow
trow += Html('th', _('Name'), class_='ColumnName', inline=True)
if report.options['showbirth']: # now spit out whatever is in table head
trow += Html('th', _('Birth'), class_='ColumnBirth', inline=True) for column in tabhead:
if report.options['showdeath']: trow += Html('th', _(column), class_='Column%s' % column,
trow += Html('th', _('Death'), class_='ColumnDeath', inline=True) inline=True)
if report.options['showpartner']:
trow += Html('th', _('Partner'), class_='ColumnPartner', inline=True)
if report.options['showparents']:
trow += Html('th', _('Parents'), class_='ColumnParents', inline=True)
# begin table body # begin table body
with Html('tbody') as tbody: with Html('tbody') as tbody:
table += tbody surname_table += tbody
for person_handle in person_handle_list: for person_handle in person_handle_list:
# firstname column # firstname column
person = db.get_person_from_handle(person_handle) person = db.get_person_from_handle(person_handle)
with Html('tr') as trow: trow = Html('tr')
tbody += trow tcell = Html('td', class_='ColumnName')
with Html('td', class_='ColumnName') as tcell: url = self.report.build_url_fname_html(person.handle, 'ppl', True)
trow += tcell first_suffix = _get_short_name(person.gender, person.primary_name)
url = self.report.build_url_fname_html(person.handle, 'ppl', True) tcell += self.person_link(url, first_suffix, person.gramps_id)
first_suffix = _get_short_name(person.gender, person.primary_name) trow += tcell
tcell += self.person_link(url, first_suffix, person.gramps_id)
# birth column # birth column
if showbirth: if showbirth:
with Html('td', class_='ColumnBirth', inline=True) as tcell: tcell = Html('td', class_='ColumnBirth', inline=True)
trow += tcell birth = ReportUtils.get_birth_or_fallback(db, person)
birth = ReportUtils.get_birth_or_fallback(db, person) if birth:
if birth: birth_date = _dd.display(birth.get_date_object())
birth_date = _dd.display(birth.get_date_object()) if birth.get_type() == EventType.BIRTH:
if birth.get_type() == EventType.BIRTH: tcell += birth_date
tcell += birth_date else:
else: tcell += Html('em', birth_date)
tcell += Html('em', birth_date) else:
else: tcell += ' '
tcell += ' ' trow += tcell
# death column # death column
if report.options['showdeath']: if showdeath:
with Html('td', class_='ColumnDeath', inline=True) as tcell: tcell = Html('td', class_='ColumnDeath', inline=True)
trow += tcell death = ReportUtils.get_death_or_fallback(db, person)
death = ReportUtils.get_death_or_fallback(report.database, person) if death:
if death: death_date = _dd.display(death.get_date_object())
death_date = _dd.display(death.get_date_object()) if death.get_type() == EventType.DEATH:
if death.get_type() == EventType.DEATH: tcell += death_date
tcell += death_date else:
tcell += Html('em', death_date)
else:
tcell += ' '
trow += tcell
# partner column
if showpartner:
tcell = Html('td', class_='ColumnPartner')
family_list = person.get_family_handle_list()
first_family = True
if family_list:
for family_handle in family_list:
family = db.get_family_from_handle(family_handle)
partner_handle = ReportUtils.find_spouse(person, family)
if partner_handle:
partner = db.get_person_from_handle(partner_handle)
partner_name = self.get_name(partner)
if not first_family:
tcell += ','
if partner_handle in report_handle_list:
url = self.report.build_url_fname_html(
partner_handle,
'ppl', True)
tcell += self.person_link(url, partner_name)
else: else:
tcell += Html('em', death_date) tcell += partner_name
else: else:
tcell += ' ' tcell += ' '
else:
tcell += ' '
trow += tcell
# partner column # parents column
if report.options['showpartner']: if report.options['showparents']:
with Html('td', class_='ColumnParter') as tcell: tcell = Html('td', class_='ColumnParents')
trow += tcell parent_handle_list = person.get_parent_family_handle_list()
family_list = person.get_family_handle_list() if parent_handle_list:
first_family = True parent_handle = parent_handle_list[0]
partner_name = None family = db.get_family_from_handle(parent_handle)
if family_list: father_id = family.get_father_handle()
for family_handle in family_list: mother_id = family.get_mother_handle()
family = report.database.get_family_from_handle(family_handle) father = db.get_person_from_handle(father_id)
partner_handle = ReportUtils.find_spouse(person, family) mother = db.get_person_from_handle(mother_id)
if partner_handle: if father:
partner = report.database.get_person_from_handle(partner_handle) father_name = self.get_name(father)
partner_name = self.get_name(partner) if mother:
if not first_family: mother_name = self.get_name(mother)
tcell += ',' if mother and father:
if partner_handle in report_handle_list: tcell += Html('span', father_name,
url = self.report.build_url_fname_html(partner_handle, 'ppl', True) class_='father fatherNmother') + (
tcell += self.person_link(url, partner_name) Html('span', mother_name, class_='mother')
else: )
tcell += partner_name elif mother:
else: tcell += Html('span', mother_name, class_='mother')
tcell += ' ' elif father:
tcell += Html('span', father_name, class_='father')
# parents column else:
if report.options['showparents']: tcell += ' '
with Html('td', class_='ColumnParents') as tcell: trow += tcell
trow += tcell tbody += trow
parent_handle_list = person.get_parent_family_handle_list()
if parent_handle_list:
parent_handle = parent_handle_list[0]
family = report.database.get_family_from_handle(parent_handle)
father_name = ''
mother_name = ''
father_id = family.get_father_handle()
mother_id = family.get_mother_handle()
father = report.database.get_person_from_handle(father_id)
mother = report.database.get_person_from_handle(mother_id)
if father:
father_name = self.get_name(father)
if mother:
mother_name = self.get_name(mother)
if mother and father:
tcell += Html('span', father_name, class_='father fatherNmother') + \
Html('span', mother, class_='mother')
elif mother:
tcell += Html('span', mother_name, class_='mother')
elif father:
tcell += Html('span', father_name, class_='father')
# add surnames table
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer() footer = self.write_footer()
@ -1165,7 +1175,7 @@ class SurnamePage(BasePage):
# send page out for processing # send page out for processing
# and close the file # and close the file
self.mywriter(surname, of) self.mywriter(surnamepage, of)
class IndividualListPage(BasePage): class IndividualListPage(BasePage):