More work on classes EventList and EventPage. Changing elements to match current work.
svn: r13155
This commit is contained in:
parent
2234f82e1a
commit
8e65bbe9c0
@ -172,19 +172,17 @@ ol {
|
||||
padding-top:.5em;
|
||||
padding-bottom:0;
|
||||
}
|
||||
ol li a {
|
||||
a {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
ol li a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
a {
|
||||
color:#542;
|
||||
}
|
||||
a:visited {
|
||||
color:#542;
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
padding: 2px 10px 2px 0;
|
||||
display: block;
|
||||
color: #000;
|
||||
background-color: #C1B398;
|
||||
text-decoration:underline;
|
||||
@ -382,7 +380,7 @@ div#alphabet ul li.letters a:hover {
|
||||
----------------------------------------------------- */
|
||||
table.infolist {
|
||||
width:100%;
|
||||
margin:0;
|
||||
margin: .5cm 0 .5cm 0;
|
||||
padding:0;
|
||||
}
|
||||
table.infolist thead tr th {
|
||||
@ -393,25 +391,13 @@ table.infolist thead tr th {
|
||||
background-color: #6AF364;
|
||||
border: solid 2px #5D835F;
|
||||
}
|
||||
table.infolist thead tr th a {
|
||||
background-color:#6AF364;
|
||||
color:#000;
|
||||
}
|
||||
table.infolist thead tr th a:hover {
|
||||
background-color:#C1B398;
|
||||
}
|
||||
table.infolist tr td {
|
||||
font:normal 1.1em/1.4em serif;
|
||||
vertical-align:middle;
|
||||
padding:.1em 10px;
|
||||
}
|
||||
table.infolist tr td a {
|
||||
display:block;
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td {
|
||||
border-top:solid 1px #453619;
|
||||
border-top:solid 1px #5D835F;
|
||||
}
|
||||
table.infolist tr td.ColumnLetter {
|
||||
width:3%;
|
||||
@ -437,13 +423,6 @@ table.infolist tbody tr td.ColumnPartner {
|
||||
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 { }
|
||||
|
||||
table.infolist tbody tr td.ColumnParents {
|
||||
font-size:.9em;
|
||||
}
|
||||
@ -622,52 +601,35 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
|
||||
|
||||
/* Events
|
||||
----------------------------------------------------- */
|
||||
div#EventList (
|
||||
div#EventList {
|
||||
font-size:10px;
|
||||
color: #000;
|
||||
font-family:Arial, sans, sans-serif, Helvetica;
|
||||
)
|
||||
div#EventList table.eventlist {
|
||||
margin: .5cm 0 .5cm 0;
|
||||
width: 965px;
|
||||
}
|
||||
div#EventList table.eventlist thead tr th {
|
||||
font-weight:bold;
|
||||
border:solid 1px #5D835F;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr {
|
||||
border-bottom:solid 1px #000;
|
||||
border-bottom: dashed 1px #5D835F;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td {
|
||||
background-color: #D8F3D6;
|
||||
padding: 10px 0px 10px 0px;
|
||||
padding: 4px 0 4px 0;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnType {
|
||||
background-color: #FFF;
|
||||
width: 25%;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnType a:hover {
|
||||
padding: 10px 10px 10px 0px;
|
||||
display:block;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnDate {
|
||||
width: 18%;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnDescription {
|
||||
width: 20%;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnName {
|
||||
background-color: #FFF;
|
||||
width: 75%;
|
||||
width: 40%;
|
||||
}
|
||||
div#EventList table.eventlist tbody tr td.ColumnName a:hover {
|
||||
padding: 10px 10px 10px 0px;
|
||||
display:block;
|
||||
div#EventList table.eventlist tbody tr td.ColumnPartner {
|
||||
background-color: #FFF;
|
||||
width: 30%;
|
||||
}
|
||||
div#EventDetail {
|
||||
font-size:10px;
|
||||
color: #000;
|
||||
font-family:Arial, sans, sans-serif, Helvetica;
|
||||
}
|
||||
div#EventDetail h3 {
|
||||
font-size: 40px;
|
||||
@ -676,7 +638,7 @@ div#EventDetail table.eventlist tbody tr td {
|
||||
border-bottom:dashed 1px #5D835F;
|
||||
}
|
||||
div#EventDetail table.eventlist tbody tr td.ColumnValue a:hover {
|
||||
padding: 5px 50px 5px 0px;
|
||||
padding: 2px 5px 2px 0px;
|
||||
display:block;
|
||||
}
|
||||
|
||||
|
@ -371,14 +371,8 @@ class BasePage(object):
|
||||
def get_event_data(self, event, evt_ref):
|
||||
db = self.report.database
|
||||
|
||||
# Event/ Type
|
||||
evt_name = str(event.get_type())
|
||||
|
||||
if evt_ref.get_role() == EventRoleType.PRIMARY:
|
||||
eventtype = u"%(evt_name)s" % locals()
|
||||
else:
|
||||
evt_role = evt_ref.get_role()
|
||||
eventtype = u"%(evt_name)s (%(evt_role)s)" % locals()
|
||||
# get event type
|
||||
eventtype = get_event_type(event, evt_ref)
|
||||
|
||||
# get place name
|
||||
place_handle = event.get_place_handle()
|
||||
@ -400,12 +394,25 @@ class BasePage(object):
|
||||
['Date', _dd.display(event.get_date_object() )],
|
||||
['Place', place_hyper],
|
||||
['Description', event.get_description()],
|
||||
['Sources', self.get_citation_links(event.get_source_references() )],
|
||||
['Notes', notelist],
|
||||
['Attributes', event.get_attribute_list()]
|
||||
]
|
||||
return info
|
||||
|
||||
def event_link(self, eventtype, handle, gid=None, up=False):
|
||||
""" createsa hyperlink for an event based on its type """
|
||||
|
||||
url = self.report.build_url_fname_html(handle, 'evt', up)
|
||||
|
||||
|
||||
event_hyper = Html('a', eventtype, href=url, title=eventtype)
|
||||
if not self.noid and gid:
|
||||
event_hyper += Html('span', ' [%s] ' % gid, class_='grampsid',
|
||||
inline=True)
|
||||
|
||||
# return event hyper link to its callers
|
||||
return event_hyper
|
||||
|
||||
def dump_ordinance(self, db, ldsobj, LDSType='Person'):
|
||||
"""
|
||||
will dump the LDS Ordinance information for either
|
||||
@ -1329,18 +1336,6 @@ class BasePage(object):
|
||||
# return hyperlink to its callers
|
||||
return hyper
|
||||
|
||||
def event_link(self, eventtype, handle, gid, up=False):
|
||||
""" createsa hyperlink for an event based on its type """
|
||||
|
||||
url = self.report.build_url_fname_html(handle, 'evt', up)
|
||||
|
||||
hyper = Html('a', html_escape(eventtype), href=url, title=eventtype)
|
||||
if not self.noid and gid:
|
||||
hyper += Html('span', ' [%s] ' % gid, class_='grampsid', inline=True)
|
||||
|
||||
# return hyperlink back to its caller
|
||||
return hyper
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
#
|
||||
# # Web Page Fortmatter and writer
|
||||
@ -1938,7 +1933,7 @@ class EventListPage(BasePage):
|
||||
eventlist += Html('p', msg, id='description')
|
||||
|
||||
# begin event list table
|
||||
with Html('table', class_='infolist eventlist') as table:
|
||||
with Html('table', class_='eventlist') as table:
|
||||
eventlist += table
|
||||
|
||||
# begin table head
|
||||
@ -1952,13 +1947,26 @@ class EventListPage(BasePage):
|
||||
for (label, colclass) in [
|
||||
(THEAD, 'Type'),
|
||||
(DHEAD, 'Date'),
|
||||
(DESCRHEAD, 'Description'),
|
||||
(_('Person'), 'Person') ]:
|
||||
(_('Person'), 'Name'),
|
||||
(_('Partner'), 'Partner') ]:
|
||||
trow += Html('th', label, class_ = 'Column%s' % colclass,
|
||||
inline = True)
|
||||
|
||||
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
|
||||
# begin table body
|
||||
tbody = Html('tbody')
|
||||
table += tbody
|
||||
|
||||
# send entire events dictionary
|
||||
table += self.write_event_rows(event_dict)
|
||||
for (person, event_list) in event_dict:
|
||||
|
||||
first = True
|
||||
for (evt_type, sort_name, sort_date, event, evt_ref,
|
||||
partner) in event_list:
|
||||
|
||||
# write eent row data
|
||||
trow = self.write_event_row(person, evt_type, event,
|
||||
evt_ref, partner, first)
|
||||
tbody += trow
|
||||
first = False
|
||||
|
||||
# and clearline for proper styling
|
||||
# and footer section
|
||||
@ -1969,56 +1977,57 @@ class EventListPage(BasePage):
|
||||
# and close the file
|
||||
self.mywriter(eventslistpage, of)
|
||||
|
||||
def write_event_rows(self, event_dict):
|
||||
def write_event_row(self, person, evt_type, evt, evt_ref, partner, first):
|
||||
"""
|
||||
display the event row for class EventListPage()
|
||||
"""
|
||||
db = self.report.database
|
||||
|
||||
# begin table body
|
||||
tbody = Html('tbody')
|
||||
|
||||
for (sort_name, person, event_list) in event_dict:
|
||||
|
||||
# get person's hyperlink
|
||||
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
|
||||
url = self.report.build_url_fname_html(person.handle, 'ppl', True)
|
||||
person_hyper = self.person_link(url, person, True, person.gramps_id)
|
||||
|
||||
first = True
|
||||
for (evt_type, sort_date, event, evt_ref) in event_list:
|
||||
|
||||
# event hyperlink
|
||||
event_hyper = self.event_link(evt_type, evt_ref.ref, event.gramps_id)
|
||||
event_hyper = self.event_link(evt_type, evt_ref.ref, evt.gramps_id)
|
||||
|
||||
# begin table row
|
||||
trow = Html('tr')
|
||||
tbody += trow
|
||||
|
||||
for (colclass, data) in [
|
||||
['Type', event_hyper],
|
||||
['Date', _dd.display(event.get_date_object() )],
|
||||
['Description', event.get_description()] ]:
|
||||
['Date', _dd.display(evt.get_date_object() )] ]:
|
||||
data = data or ' '
|
||||
|
||||
# conditional statement for inline=True or False
|
||||
samerow = True if (data == ' ' or (colclass == 'Date' or 'Type'))\
|
||||
else False
|
||||
trow += Html('td', data, class_='Column%s' % colclass, inline=samerow)
|
||||
trow += Html('td', data, class_='Column%s' % colclass, inline=True)
|
||||
|
||||
# display person hyperlink or non-breaking space
|
||||
# display person hyperlink or ' '
|
||||
tcell = Html('td', class_='ColumnName')
|
||||
trow += tcell
|
||||
|
||||
if first:
|
||||
tcell += person_hyper
|
||||
else:
|
||||
tcell += ' '
|
||||
first = False
|
||||
|
||||
# return events table body to its caller
|
||||
return tbody
|
||||
# display partner if event is either a Marriage or Divorce?
|
||||
# partner will not be None
|
||||
|
||||
tcell = Html('td', class_='ColumnPartner')
|
||||
trow += tcell
|
||||
|
||||
# get partner hyperlink
|
||||
if partner is not None:
|
||||
url = self.report.build_url_fname_html(partner.handle, 'ppl', True)
|
||||
partner_hyper = self.person_link(url, partner, False,
|
||||
partner.gramps_id)
|
||||
tcell += partner_hyper
|
||||
else:
|
||||
tcell += ' '
|
||||
|
||||
# return EventList row to its caller
|
||||
return trow
|
||||
|
||||
class EventPage(BasePage):
|
||||
def __init__(self, report, title, evt_type, event, evt_ref, person):
|
||||
def __init__(self, report, title, evt_type, event, evt_ref, person, partner):
|
||||
BasePage.__init__(self, report, '%s - %s' % (title, evt_type))
|
||||
db = report.database
|
||||
|
||||
@ -2048,7 +2057,7 @@ class EventPage(BasePage):
|
||||
event_row = self.get_event_data(event, evt_ref)
|
||||
|
||||
# the first four in the list is to be used here, the rest are below
|
||||
for index in xrange(5):
|
||||
for index in xrange(4):
|
||||
label = event_row[index][0]
|
||||
data = event_row[index][1] or None
|
||||
|
||||
@ -2059,21 +2068,32 @@ class EventPage(BasePage):
|
||||
)
|
||||
tbody += trow
|
||||
|
||||
# get person hyperlink
|
||||
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
|
||||
person_hyper = self.person_link(url, person, True, person.gramps_id)
|
||||
trow = Html('tr') + (
|
||||
Html('td', _('Person'), class_='ColumnAttribute', inline=True),
|
||||
Html('td', person_hyper, class_='ColumnValue', inline=True)
|
||||
Html('td', person_hyper, class_='ColumnValue')
|
||||
)
|
||||
tbody += trow
|
||||
|
||||
# get notes section
|
||||
notelist = event_row[5][1]
|
||||
# display partner if type is either Marriage or Divorce
|
||||
if partner is not None:
|
||||
url = self.report.build_url_fname_html(partner.handle, 'ppl', self.up)
|
||||
partner_hyper = self.person_link(url, partner, True, partner.gramps_id)
|
||||
trow = Html('tr') + (
|
||||
Html('td', _('Partner'), class_='ColumnAttribute', inline=True),
|
||||
Html('td', partner_hyper, class_='ColumnValue')
|
||||
)
|
||||
tbody += trow
|
||||
|
||||
# Narrative subsection
|
||||
notelist = event_row[4][1]
|
||||
if notelist:
|
||||
eventdetail += self.display_note_list(notelist)
|
||||
|
||||
# get attribute list
|
||||
attrib = event_row[6][1]
|
||||
attrib = event_row[5][1]
|
||||
if attrib:
|
||||
eventdetail += self.display_attr_list(event)
|
||||
|
||||
@ -4358,18 +4378,14 @@ class IndividualPage(BasePage):
|
||||
self.place_list[place_handle] = [lnk]
|
||||
|
||||
place = self.place_link(place_handle,
|
||||
ReportUtils.place_name(db, place_handle), up=True)
|
||||
ReportUtils.place_name(db,
|
||||
place_handle), up=True)
|
||||
else:
|
||||
place = ''
|
||||
|
||||
# Event/ Type
|
||||
evt_name = str(event.get_type())
|
||||
|
||||
if event_ref.get_role() == EventRoleType.PRIMARY:
|
||||
eventtype = u"%(evt_name)s" % locals()
|
||||
else:
|
||||
evt_role = event_ref.get_role()
|
||||
eventtype = u"%(evt_name)s (%(evt_role)s)" % locals()
|
||||
# Get event type and hyperlink
|
||||
eventtype = get_event_type(event, event_ref)
|
||||
evt_hyper = self.event_link(eventtype, event_ref.ref, event.gramps_id, True)
|
||||
|
||||
# Place
|
||||
place_handle = event.get_place_handle()
|
||||
@ -4395,7 +4411,7 @@ class IndividualPage(BasePage):
|
||||
trow = Html('tr')
|
||||
|
||||
for (colclass, data) in [
|
||||
['Type', eventtype],
|
||||
['Type', evt_hyper],
|
||||
['Date', _dd.display(event.get_date_object() )],
|
||||
['Place', place],
|
||||
['Description', event.get_description()],
|
||||
@ -4434,7 +4450,6 @@ class IndividualPage(BasePage):
|
||||
for event_ref in eventlist:
|
||||
|
||||
event = db.get_event_from_handle(event_ref.ref)
|
||||
evtType = str(event.get_type() )
|
||||
|
||||
# add event body row
|
||||
ordered += self.display_event_row(event, event_ref)
|
||||
@ -4893,22 +4908,6 @@ class NavWebReport(Report):
|
||||
SourcePage(self, self.title, key, source_list)
|
||||
self.progress.step()
|
||||
|
||||
def get_event_type(self, event, event_ref):
|
||||
""" return the type of an event """
|
||||
|
||||
# Event/ Type
|
||||
evt_name = str(event.get_type())
|
||||
|
||||
if event_ref.get_role() == EventRoleType.PRIMARY:
|
||||
evt_type = u"%(evt_name)s" % locals()
|
||||
else:
|
||||
evt_role = event_ref.get_role()
|
||||
evt_type = u"%(evt_name)s (%(evt_role)s)" % locals()
|
||||
evt_type = evt_type or ' '
|
||||
|
||||
# return event type to its callers
|
||||
return evt_type
|
||||
|
||||
def place_pages(self, place_list, source_list):
|
||||
|
||||
self.progress.set_pass(_("Creating place pages"), len(place_list))
|
||||
@ -4921,7 +4920,7 @@ class NavWebReport(Report):
|
||||
|
||||
def event_pages(self, ind_list):
|
||||
"""
|
||||
a dump of all the events sorted by person's surname, and event type,
|
||||
a dump of all the events sorted by event type, surname, and
|
||||
then by date if needed...
|
||||
"""
|
||||
db = self.database
|
||||
@ -4940,14 +4939,19 @@ class NavWebReport(Report):
|
||||
first_name = person.get_primary_name().get_first_name()
|
||||
sort_name = ', '.join([last_name, first_name])
|
||||
|
||||
partner = None
|
||||
for family_handle in person.get_family_handle_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)
|
||||
|
||||
for evt_ref in family.get_event_ref_list():
|
||||
event = db.get_event_from_handle(evt_ref.ref)
|
||||
|
||||
# get event type
|
||||
evt_type = self.get_event_type(event, evt_ref)
|
||||
evt_type = get_event_type(event, evt_ref)
|
||||
|
||||
# get sot date as year/month/day or 0000/00/00
|
||||
event_date = event.get_date_object()
|
||||
@ -4957,13 +4961,14 @@ class NavWebReport(Report):
|
||||
sort_date = '%04d/%02d/%02d' % (year, month, day)
|
||||
|
||||
# add event data
|
||||
event_list.append([evt_type, sort_date, event, evt_ref])
|
||||
event_list.append([evt_type, sort_name, sort_date, event, evt_ref,
|
||||
partner])
|
||||
|
||||
for evt_ref in person.get_primary_event_ref_list():
|
||||
event = db.get_event_from_handle(evt_ref.ref)
|
||||
|
||||
# get event type
|
||||
evt_type = self.get_event_type(event, evt_ref)
|
||||
evt_type = get_event_type(event, evt_ref)
|
||||
|
||||
# get sot date as year/month/day or 0000/00/00
|
||||
event_date = event.get_date_object()
|
||||
@ -4973,13 +4978,14 @@ class NavWebReport(Report):
|
||||
sort_date = '%04d/%02d/%02d' % (year, month, day)
|
||||
|
||||
# add event data
|
||||
event_list.append([evt_type, sort_date, event, evt_ref])
|
||||
event_list.append([evt_type, sort_name, sort_date, event, evt_ref,
|
||||
partner])
|
||||
|
||||
# sort the list of an individual's events
|
||||
event_list.sort()
|
||||
|
||||
# combine person and their events together
|
||||
event_dict.append([sort_name, person, event_list])
|
||||
event_dict.append([person, event_list])
|
||||
|
||||
# sort the events dictionary
|
||||
event_dict.sort()
|
||||
@ -4990,13 +4996,13 @@ class NavWebReport(Report):
|
||||
# send all data to the events list page
|
||||
EventListPage(self, self.title, event_dict)
|
||||
|
||||
for (sort_name, person, event_list) in event_dict:
|
||||
for (person, event_list) in event_dict:
|
||||
self.progress.step()
|
||||
|
||||
for evt_type, sort_date, event, evt_ref in event_list:
|
||||
for (evt_type, sort_name, sort_date, event, evt_ref, partner) in event_list:
|
||||
|
||||
# create individual event page
|
||||
EventPage(self, self.title, evt_type, event, evt_ref, person)
|
||||
EventPage(self, self.title, evt_type, event, evt_ref, person, partner)
|
||||
|
||||
def gallery_pages(self, source_list):
|
||||
import gc
|
||||
@ -5824,6 +5830,20 @@ def add_birthdate(db, childlist):
|
||||
# return the list of child handles and their birthdates
|
||||
return sorted_children
|
||||
|
||||
def get_event_type(event, event_ref):
|
||||
""" return the type of an event """
|
||||
|
||||
evt_name = str(event.get_type())
|
||||
|
||||
if event_ref.get_role() == EventRoleType.PRIMARY:
|
||||
evt_type = u"%(evt_name)s" % locals()
|
||||
else:
|
||||
evt_role = event_ref.get_role()
|
||||
evt_type = u"%(evt_name)s (%(evt_role)s)" % locals()
|
||||
|
||||
# return event type to its callers
|
||||
return evt_type
|
||||
|
||||
# -------------------------------------------
|
||||
#
|
||||
# Register Plugin
|
||||
|
Loading…
Reference in New Issue
Block a user