Fixed class EventList and EventPage. With it, display_attr_list(). Changed, added, and removed elements to match current work.

svn: r13160
This commit is contained in:
Rob G. Healey 2009-09-05 11:45:56 +00:00
parent 06458ae1d7
commit fa38bf99f8
2 changed files with 313 additions and 340 deletions

View File

@ -59,15 +59,10 @@ Females Web_Gender_Female.png
body { body {
color: #000; color: #000;
margin: 0; margin: 0;
padding: 94px 0px 0px 0px;
background-color: #FFF; background-color: #FFF;
font-family: Arial, sans, sans-serif, Helvetica; font-family: Arial, sans, sans-serif, Helvetica;
} }
body.location {
padding: 94px 0px 60px 0px;
}
body.nolocation {
padding: 94px 0px 0px 0px;
}
div { div {
margin:0; margin:0;
padding:0; padding:0;
@ -172,17 +167,19 @@ ol {
padding-top:.5em; padding-top:.5em;
padding-bottom:0; padding-bottom:0;
} }
a { ol li a {
color: #000;
text-decoration:none; text-decoration:none;
} }
ol li a:hover {
text-decoration:underline;
}
a {
color:#542;
}
a:visited { a:visited {
color: #000; color:#542;
text-decoration: none;
} }
a:hover { a:hover {
padding: 2px 10px 2px 0;
display: block;
color:#000; color:#000;
background-color:#C1B398; background-color:#C1B398;
text-decoration:underline; text-decoration:underline;
@ -228,6 +225,7 @@ p#user_header {
#footer { #footer {
width: 100%; width: 100%;
height: 60px; height: 60px;
overflow: auto;
clear: both; clear: both;
font-size: 12px; font-size: 12px;
color: #FFF; color: #FFF;
@ -235,13 +233,6 @@ p#user_header {
margin: 0; margin: 0;
border-top: solid 8px #5D835F; border-top: solid 8px #5D835F;
} }
.nolocation {
}
.location {
position: fixed;
bottom: 0;
overflow: auto;
}
#footer a, #footer a:visited { #footer a, #footer a:visited {
text-decoration:none; text-decoration:none;
color:#FFF; color:#FFF;
@ -389,15 +380,27 @@ table.infolist thead tr th {
margin:0; margin:0;
padding:.2em 10px; padding:.2em 10px;
background-color:#6AF364; background-color:#6AF364;
border: solid 2px #5D835F; border: solid 1px #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 { table.infolist tr td {
font:normal 1.1em/1.4em serif; font:normal 1.1em/1.4em serif;
vertical-align:middle; vertical-align:middle;
padding:.1em 10px; 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 { table.infolist tr.BeginLetter td, table.infolist tr.BeginSurname td {
border-top:solid 1px #5D835F; border-top:solid 1px #453619;
} }
table.infolist tr td.ColumnLetter { table.infolist tr td.ColumnLetter {
width:3%; width:3%;
@ -423,6 +426,13 @@ table.infolist tbody tr td.ColumnPartner {
font-size:.9em; font-size:.9em;
background-color:#FFF; 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 { table.infolist tbody tr td.ColumnParents {
font-size:.9em; font-size:.9em;
} }
@ -601,16 +611,26 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
/* Events /* Events
----------------------------------------------------- */ ----------------------------------------------------- */
div#EventList { div#EventList, div#EventDetail (
font-size:10px; font-size:10px;
color: #000; )
div#EventList a:hover, div#EventDetail a:hover {
padding: 2px 0 2px 0;
display: block;
}
div#EventList table.eventlist {
width: 965px;
}
div#EventList table.eventlist thead tr th {
font-weight:bold;
border:solid 1px #5D835F;
} }
div#EventList table.eventlist tbody tr { div#EventList table.eventlist tbody tr {
border-bottom: dashed 1px #5D835F; border-bottom:solid 1px #5D835F;
} }
div#EventList table.eventlist tbody tr td { div#EventList table.eventlist tbody tr td {
background-color:#D8F3D6; background-color:#D8F3D6;
padding: 4px 0 4px 0; padding: 4px 0px 4px 0px;
} }
div#EventList table.eventlist tbody tr td.ColumnType { div#EventList table.eventlist tbody tr td.ColumnType {
background-color:#FFF; background-color:#FFF;
@ -621,25 +641,22 @@ div#EventList table.eventlist tbody tr td.ColumnDate {
} }
div#EventList table.eventlist tbody tr td.ColumnName { div#EventList table.eventlist tbody tr td.ColumnName {
background-color:#FFF; background-color:#FFF;
width: 40%; width: 35%;
} }
div#EventList table.eventlist tbody tr td.ColumnPartner { div#EventList table.eventlist tbody tr td.ColumnPartner {
background-color: #FFF; background-color: #FFF;
width: 30%; width: 35%;
}
div#EventDetail {
font-size:10px;
color: #000;
} }
div#EventDetail h3 { div#EventDetail h3 {
font-size: 40px; font-size: 40px;
} }
div#EventDetail table.eventlist {
margin: .5cm 0.5cm 0;
width:965px;
}
div#EventDetail table.eventlist tbody tr td { div#EventDetail table.eventlist tbody tr td {
border-bottom:dashed 1px #5D835F; border-bottom:dashed 1px #5D835F;
} padding: 4px 0 4px 0;
div#EventDetail table.eventlist tbody tr td.ColumnValue a:hover {
padding: 2px 5px 2px 0px;
display:block;
} }
/* Gallery /* Gallery
@ -908,20 +925,18 @@ div#events h4 {
#IndividualDetail { #IndividualDetail {
background-color:#FFF; background-color:#FFF;
} }
#IndividualDetail div#events table.infolist thead tr th {
font-weight:bold;
font-size:12px;
line-height:12px;
font-family:sans-serif;
text-transform:uppercase;
color: #542;
padding-top:6px;
padding-bottom:4px;
background-color: #6AF364;
}
#IndividualDetail div#events table.eventtable { #IndividualDetail div#events table.eventtable {
width:100%; width:100%;
padding-bottom:15px; padding-top:15px;
}
#IndividualDetail div#events table.infolist thead tr th {
font-weight:bold;
font-size:10px;
line-height:12px;
text-transform:uppercase;
color:#542;
padding-top:6px 0 4px 0;
background-color:#6AF364;
} }
#IndividualDetail div#events table.infolist thead tr th:first-child { #IndividualDetail div#events table.infolist thead tr th:first-child {
padding-left:20px; padding-left:20px;
@ -941,15 +956,8 @@ table.infolist tbody tr td.ColumnValue p {
color:#696969; color:#696969;
margin:.2em 0 0 2em; margin:.2em 0 0 2em;
} }
table.eventtable thead tr th {
color: #000;
}
table.eventtable tbody tr td {
border-bottom:solid 1px #000;
}
div#events table.attrlist { div#events table.attrlist {
margin-top:.3cm; margin: .3cm 0 0 .78cm;
margin-left:.78cm;
width:880px; width:880px;
} }
table.attrlist thead tr th { table.attrlist thead tr th {
@ -967,9 +975,6 @@ div#events table.attrlist tbody tr td.ColumnType {
div#events table.attrlist tbody tr td.ColumnValue { div#events table.attrlist tbody tr td.ColumnValue {
width:200px; width:200px;
} }
div#events table.attrlist tbody tr td.ColumnSources {
width:50px;
}
div#events table.attrlist tbody tr td.ColumnNotes { div#events table.attrlist tbody tr td.ColumnNotes {
width:350px; width:350px;
} }

View File

@ -368,11 +368,34 @@ class BasePage(object):
# return unordered note list to its callers # return unordered note list to its callers
return unordered return unordered
def get_event_data(self, event, evt_ref): 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)
evt_hyper = Html('a', eventtype, href=url, title=eventtype)
if not self.noid and gid:
evt_hyper += Html('span', ' [%s] ' % gid, class_='grampsid',
inline=True)
# return event hyper link to its callers
return evt_hyper
def get_event_data(self, event, evt_ref, showdescr=False, showsources=True):
"""
retrieve event data from event and evt_ref
@param: event = event from database
@param: evt_ref = eent reference
@param: showdescr = to show the event description or not
@param: showsources = to show the event source references or not
"""
db = self.report.database db = self.report.database
# get event type # get event type
eventtype = get_event_type(event, evt_ref) eventtype = get_event_type(event, evt_ref)
evt_hyper = self.event_link(eventtype, evt_ref.ref, event.gramps_id, True)
# get place name # get place name
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
@ -390,29 +413,25 @@ class BasePage(object):
# wrap it all up and return to its callers # wrap it all up and return to its callers
info = [ info = [
['Type', eventtype], [THEAD, evt_hyper],
['Date', _dd.display(event.get_date_object() )], [DHEAD, _dd.display(event.get_date_object() )],
['Place', place_hyper], [PHEAD, place_hyper],
['Description', event.get_description()], [NHEAD, notelist],
['Notes', notelist], [AHEAD, event.get_attribute_list()] ]
['Attributes', event.get_attribute_list()]
] if showdescr:
descr_row = [DESCRHEAD, event.get_description()]
info.insert(3, descr_row)
if showsources:
position = 3
if showdescr:
position = 4
source_row = [SHEAD, self.get_citation_links(event.get_source_references() ) ]
info.insert(position, source_row)
return info 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'): def dump_ordinance(self, db, ldsobj, LDSType='Person'):
""" """
will dump the LDS Ordinance information for either will dump the LDS Ordinance information for either
@ -671,11 +690,13 @@ class BasePage(object):
name.set_display_as(name_format) name.set_display_as(name_format)
return _nd.display_name(name) return _nd.display_name(name)
def display_attr_list(self, attrobj): def display_attr_list(self, attrobj, showsources=True):
""" """
will display an object's attributes will display an object's attributes
@param: attrobj -- object to display it's attributes @param: attrobj -- object to display it's attributes
@param: showsources = True for class IndividualPage
= False for class EventPage
""" """
attrlist = attrobj.get_attribute_list() attrlist = attrobj.get_attribute_list()
if not attrlist: if not attrlist:
@ -696,13 +717,15 @@ class BasePage(object):
trow = Html('tr') trow = Html('tr')
thead += trow thead += trow
attr_header_row = [ attr_header_row = [
(THEAD, 'Type'), [THEAD, 'Type'],
(VHEAD, 'Value'), [VHEAD, 'Value'],
(SHEAD, 'Source'), [NHEAD, 'Notes'] ]
(NHEAD, 'Notes') ]
if showsources:
sourcerow = [SHEAD, 'Sources']
attr_header_row.insert(2, sourcerow)
for (label, colclass) in attr_header_row: for (label, colclass) in attr_header_row:
trow += Html('th', label, class_='Column%s' % colclass, inline=True) trow += Html('th', label, class_='Column%s' % colclass, inline=True)
# begin table body # begin table body
@ -713,18 +736,30 @@ class BasePage(object):
trow = Html('tr') trow = Html('tr')
tbody += trow tbody += trow
for (colclass, value) in [ attr_data_row = [
['Type', attr.get_type().xml_str()], [attr.get_type().xml_str()],
['Value', attr.get_value()], [attr.get_value()],
['Sources', self.get_citation_links(attr.get_source_references() )], [self.dump_notes(attr.get_note_list() )] ]
['Notes', self.dump_notes(attr.get_note_list() )] ]:
trow += Html('td', value, class_='Column%s' % colclass, inline=True) if showsources:
sourcerefs = [attr.get_source_references()]
attr_data_row.insert(2, sourcerefs)
index = 0
for value in attr_data_row:
value = value or ' '
# get column class from attr_header_row
colclass = attr_header_row[index][1]
trow += Html('td', value, class_='Column%s' % colclass,
inline=True if colclass == 'Type' else False)
index += 1
# return section to its caller # return section to its caller
return section return section
def write_footer(self, location): def write_footer(self):
""" """
Will create and display the footer section of each page... Will create and display the footer section of each page...
@ -735,9 +770,6 @@ class BasePage(object):
# begin footer division # begin footer division
with Html('div', id='footer') as footer: with Html('div', id='footer') as footer:
# specify footer location or not?
footer.attr += ' class="location"' if location else ' class="nolocation"'
footer_note = self.report.options['footernote'] footer_note = self.report.options['footernote']
if footer_note: if footer_note:
note = db.get_note_from_gramps_id(footer_note) note = db.get_note_from_gramps_id(footer_note)
@ -791,7 +823,7 @@ class BasePage(object):
# return footer to its callers # return footer to its callers
return footer return footer
def write_header(self, title, location): def write_header(self, title):
""" """
Note. 'title' is used as currentsection in the navigation links and Note. 'title' is used as currentsection in the navigation links and
as part of the header title. as part of the header title.
@ -811,10 +843,6 @@ class BasePage(object):
self.report.encoding, xmllang self.report.encoding, xmllang
) )
# if we have set a location for footer, then we must also set
# the class here too to not have the footer padding
body.attr = ' class="location"' if location else ' class="nolocation"'
# create additional meta tags # create additional meta tags
meta = (Html('meta', attr = _META1) + meta = (Html('meta', attr = _META1) +
Html('meta', attr = _META2, indent=False) Html('meta', attr = _META2, indent=False)
@ -1174,6 +1202,7 @@ class BasePage(object):
[_('Page'), sref.page], [_('Page'), sref.page],
[_('Confidence'), confidence] [_('Confidence'), confidence]
] ]
for (label, data) in source_data: for (label, data) in source_data:
if data: if data:
tmp.append("%s: %s" % (label, data)) tmp.append("%s: %s" % (label, data))
@ -1371,13 +1400,8 @@ class IndividualListPage(BasePage):
showpartner = report.options['showpartner'] showpartner = report.options['showpartner']
showparents = report.options['showparents'] showparents = report.options['showparents']
# determine if we specify the location of footer or not?
location = True
if len(person_handle_list) > 6:
location = False
of = self.report.create_file("individuals") of = self.report.create_file("individuals")
indlistpage, body = self.write_header(_('Individuals'), location) indlistpage, body = self.write_header(_('Individuals'))
# begin Individuals division # begin Individuals division
with Html('div', class_='content', id='Individuals') as section: with Html('div', class_='content', id='Individuals') as section:
@ -1550,7 +1574,7 @@ class IndividualListPage(BasePage):
# create clear line for proper styling # create clear line for proper styling
# create footer section # create footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -1569,14 +1593,9 @@ class SurnamePage(BasePage):
showpartner = report.options['showpartner'] showpartner = report.options['showpartner']
showparents = report.options['showparents'] showparents = report.options['showparents']
# determine location of footer or not?
location = True
if len(person_handle_list) > 6:
location = False
of = self.report.create_file(name_to_md5(surname), 'srn') of = self.report.create_file(name_to_md5(surname), 'srn')
self.up = True self.up = True
surnamepage, body = self.write_header("%s - %s" % (_('Surname'), surname), location) surnamepage, body = self.write_header("%s - %s" % (_('Surname'), surname))
# begin SurnameDetail division # begin SurnameDetail division
with Html('div', id='SurnameDetail', class_='contente') as surnamedetail: with Html('div', id='SurnameDetail', class_='contente') as surnamedetail:
@ -1711,7 +1730,7 @@ class SurnamePage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -1725,13 +1744,8 @@ class PlaceListPage(BasePage):
self.src_list = src_list # TODO verify that this is correct self.src_list = src_list # TODO verify that this is correct
db = report.database db = report.database
# determine the location of footer or not?
location = True
if len(place_handles) > 6:
location = False
of = self.report.create_file("places") of = self.report.create_file("places")
placelistpage, body = self.write_header(_('Places'), location) placelistpage, body = self.write_header(_('Places'))
# begin places division # begin places division
with Html('div', class_='content', id='Places') as section: with Html('div', class_='content', id='Places') as section:
@ -1801,7 +1815,7 @@ class PlaceListPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -1817,11 +1831,10 @@ class PlacePage(BasePage):
BasePage.__init__(self, report, title, place.gramps_id) BasePage.__init__(self, report, title, place.gramps_id)
self.src_list = src_list # TODO verify that this is correct self.src_list = src_list # TODO verify that this is correct
# we are specifying the location of footer
of = self.report.create_file(place.get_handle(), 'plc') of = self.report.create_file(place.get_handle(), 'plc')
self.up = True self.up = True
self.page_title = ReportUtils.place_name(db, place_handle) self.page_title = ReportUtils.place_name(db, place_handle)
placepage, body = self.write_header(_('Places'), True) placepage, body = self.write_header(_('Places'))
# begin PlaceDetail Division # begin PlaceDetail Division
with Html('div', class_='content', id='PlaceDetail') as placedetail: with Html('div', class_='content', id='PlaceDetail') as placedetail:
@ -1898,8 +1911,7 @@ class PlacePage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
# we are not specifying the location of footer as there is too much info footer = self.write_footer()
footer = self.write_footer(True)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -1912,13 +1924,8 @@ class EventListPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# determine if we specify location of footer or not?
location = True
if len(event_dict) > 6:
location = False
of = self.report.create_file("events") of = self.report.create_file("events")
eventslistpage, body = self.write_header(_('Events'), location) eventslistpage, body = self.write_header(_('Events'))
# begin events list division # begin events list division
with Html('div', class_='content', id='EventList') as eventlist: with Html('div', class_='content', id='EventList') as eventlist:
@ -1933,7 +1940,7 @@ class EventListPage(BasePage):
eventlist += Html('p', msg, id='description') eventlist += Html('p', msg, id='description')
# begin event list table # begin event list table
with Html('table', class_='eventlist') as table: with Html('table', class_='infolist eventlist') as table:
eventlist += table eventlist += table
# begin table head # begin table head
@ -1959,18 +1966,18 @@ class EventListPage(BasePage):
for (person, event_list) in event_dict: for (person, event_list) in event_dict:
first = True first = True
for (evt_type, sort_name, sort_date, event, evt_ref, for (evt_type, sort_date, sort_name, evt, evt_ref,
partner) in event_list: partner) in event_list:
# write eent row data # write eent row data
trow = self.write_event_row(person, evt_type, event, trow = self.write_event_row(person, evt_type, evt,
evt_ref, partner, first) evt_ref, partner, first)
tbody += trow tbody += trow
first = False first = False
# and clearline for proper styling # and clearline for proper styling
# and footer section # and footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page ut for processing # send page ut for processing
@ -1980,10 +1987,17 @@ class EventListPage(BasePage):
def write_event_row(self, person, evt_type, evt, evt_ref, partner, first): def write_event_row(self, person, evt_type, evt, evt_ref, partner, first):
""" """
display the event row for class EventListPage() display the event row for class EventListPage()
@param: person = person that the event is referenced to
@param: evt_type = the type of event
@param: evt = event
@param: evt_ref = event reference
@param: partner = only used when the event is either a Marriage or Divorce
@param: first = used for only showing the person once for list of events
""" """
# get person's hyperlink # get person's hyperlink
url = self.report.build_url_fname_html(person.handle, 'ppl', True) url = self.report.build_url_fname_html(person.handle, 'ppl', False)
person_hyper = self.person_link(url, person, True, person.gramps_id) person_hyper = self.person_link(url, person, True, person.gramps_id)
# event hyperlink # event hyperlink
@ -2010,15 +2024,15 @@ class EventListPage(BasePage):
# display partner if event is either a Marriage or Divorce? # display partner if event is either a Marriage or Divorce?
# partner will not be None # partner will not be None
tcell = Html('td', class_='ColumnPartner') tcell = Html('td', class_='ColumnPartner')
trow += tcell trow += tcell
# get partner hyperlink # get partner hyperlink
if partner is not None: if partner is not None:
url = self.report.build_url_fname_html(partner.handle, 'ppl', True)
partner_hyper = self.person_link(url, partner, False, # get partner hyperlink
partner.gramps_id) url = self.report.build_url_fname_html(partner.handle, 'ppl', False)
partner_hyper = self.person_link(url, partner, False, partner.gramps_id)
tcell += partner_hyper tcell += partner_hyper
else: else:
tcell += ' ' tcell += ' '
@ -2027,13 +2041,14 @@ class EventListPage(BasePage):
return trow return trow
class EventPage(BasePage): class EventPage(BasePage):
def __init__(self, report, title, evt_type, event, evt_ref, person, partner):
BasePage.__init__(self, report, '%s - %s' % (title, evt_type)) def __init__(self, report, title, person, partner, evt_type, event, evt_ref):
BasePage.__init__(self, report, title, event.gramps_id)
self.up = True
db = report.database db = report.database
of = self.report.create_file(evt_ref.ref, 'evt') of = self.report.create_file(evt_ref.ref, 'evt')
self.up = True eventpage, body = self.write_header(_('Events'))
eventpage, body = self.write_header(_('Events'), True)
# start event page division # start event page division
with Html('div', class_='content', id='EventDetail') as eventdetail: with Html('div', class_='content', id='EventDetail') as eventdetail:
@ -2054,9 +2069,9 @@ class EventPage(BasePage):
table += tbody table += tbody
# get event data # get event data
event_row = self.get_event_data(event, evt_ref) event_row = self.get_event_data(event, evt_ref, True, False)
# the first four in the list is to be used here, the rest are below # the first four are listed here, the other two are way below
for index in xrange(4): for index in xrange(4):
label = event_row[index][0] label = event_row[index][0]
data = event_row[index][1] or None data = event_row[index][1] or None
@ -2064,7 +2079,7 @@ class EventPage(BasePage):
if data is not None: if data is not None:
trow = Html('tr') + ( trow = Html('tr') + (
Html('td', label, class_= 'ColumnAttribute', inline=True), Html('td', label, class_= 'ColumnAttribute', inline=True),
Html('td', data, class_='ColumnValue', inline=True) Html('td', data, class_='ColumnValue')
) )
tbody += trow tbody += trow
@ -2095,12 +2110,11 @@ class EventPage(BasePage):
# get attribute list # get attribute list
attrib = event_row[5][1] attrib = event_row[5][1]
if attrib: if attrib:
eventdetail += self.display_attr_list(event) eventdetail += self.display_attr_list(event, False)
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
# specified location of footer footer = self.write_footer()
footer = self.write_footer(True)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2198,8 +2212,7 @@ class MediaPage(BasePage):
self.copy_thumbnail(handle, photo) self.copy_thumbnail(handle, photo)
self.page_title = photo.get_description() self.page_title = photo.get_description()
# there is usually too much information on these pages? mediapage, body = self.write_header("%s - %s" % (_('Media'), self.page_title))
mediapage, body = self.write_header("%s - %s" % (_('Media'), self.page_title), False)
# begin GalleryDetail division # begin GalleryDetail division
mediadetail = Html('div', class_='content', id='GalleryDetail') mediadetail = Html('div', class_='content', id='GalleryDetail')
@ -2410,7 +2423,7 @@ class MediaPage(BasePage):
mediadetail += notes mediadetail += notes
# get media attributes # get media attributes
attrib = self.display_attr_list(photo) attrib = self.display_attr_list(photo, False)
if attrib is not None: if attrib is not None:
mediadetail += attrib mediadetail += attrib
@ -2426,9 +2439,7 @@ class MediaPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
# not specifying the location of footer because there is usually footer = self.write_footer()
# a lot of information on the media pages
footer = self.write_footer(False)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2503,17 +2514,12 @@ class SurnameListPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# determine if we specify location of footer or not?
location = True
if len(person_handle_list) > 6:
location = False
if order_by == self.ORDER_BY_NAME: if order_by == self.ORDER_BY_NAME:
of = self.report.create_file(filename) of = self.report.create_file(filename)
surnamelistpage, body = self.write_header(_('Surnames'), location) surnamelistpage, body = self.write_header(_('Surnames'))
else: else:
of = self.report.create_file("surnames_count") of = self.report.create_file("surnames_count")
surnamelistpage, body = self.write_header(_('Surnames by person count'), location) surnamelistpage, body = self.write_header(_('Surnames by person count'))
# begin surnames division # begin surnames division
with Html('div', class_='content', id='surnames') as surnamelist: with Html('div', class_='content', id='surnames') as surnamelist:
@ -2621,7 +2627,7 @@ class SurnameListPage(BasePage):
# create footer section # create footer section
# add clearline for proper styling # add clearline for proper styling
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2646,21 +2652,14 @@ class IntroductionPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# determine if we specify the location of the footer or not on image?
location = True
introimg = report.add_image('introimg')
if introimg:
location = False
of = self.report.create_file(report.intro_fname) of = self.report.create_file(report.intro_fname)
# Note. In old NarrativeWeb.py the content_divid depended on filename. intropage, body = self.write_header(_('Introduction'))
intropage, body = self.write_header(_('Introduction'), location)
# begin Introduction division # begin Introduction division
with Html('div', class_='content', id='Introduction') as section: with Html('div', class_='content', id='Introduction') as section:
body += section body += section
# introduction image is identified earlier introimg = report.add_image('introimg')
if introimg is not None: if introimg is not None:
section += introimg section += introimg
@ -2674,7 +2673,7 @@ class IntroductionPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# create footer section # create footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2690,20 +2689,14 @@ class HomePage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# determine the location of footer or not by image?
homeimg = report.add_image('homeimg')
location = True
if homeimg:
location = False
of = self.report.create_file("index") of = self.report.create_file("index")
homepage, body = self.write_header(_('Home'), location) homepage, body = self.write_header(_('Home'))
# begin home division # begin home division
with Html('div', class_='content', id='Home') as section: with Html('div', class_='content', id='Home') as section:
body += section body += section
# home page image is specified earlier... homeimg = report.add_image('homeimg')
if homeimg is not None: if homeimg is not None:
section += homeimg section += homeimg
@ -2717,7 +2710,7 @@ class HomePage(BasePage):
# create clear line for proper styling # create clear line for proper styling
# create footer section # create footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2733,13 +2726,8 @@ class SourceListPage(BasePage):
handle_list = list(handle_set) handle_list = list(handle_set)
source_dict = {} source_dict = {}
# determine if we specify location of footer or not?
location = True
if len(handle_list) > 6:
location = False
of = self.report.create_file("sources") of = self.report.create_file("sources")
sourcelistpage, body = self.write_header(_('Sources'), location) sourcelistpage, body = self.write_header(_('Sources'))
# begin source list division # begin source list division
with Html('div', class_='content', id='sources') as section: with Html('div', class_='content', id='sources') as section:
@ -2790,7 +2778,7 @@ class SourceListPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2805,10 +2793,9 @@ class SourcePage(BasePage):
source = db.get_source_from_handle(handle) source = db.get_source_from_handle(handle)
BasePage.__init__(self, report, title, source.gramps_id) BasePage.__init__(self, report, title, source.gramps_id)
# possibility of too much information, so no specified footer
of = self.report.create_file(source.get_handle(), 'src') of = self.report.create_file(source.get_handle(), 'src')
self.up = True self.up = True
sourcepage, body = self.write_header(_('Sources'),False) sourcepage, body = self.write_header(_('Sources'))
# begin source detail division # begin source detail division
with Html('div', class_='content', id='SourceDetail') as section: with Html('div', class_='content', id='SourceDetail') as section:
@ -2858,8 +2845,7 @@ class SourcePage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
# possibility of too much information, so no specified footer footer = self.write_footer()
footer = self.write_footer(False)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2872,9 +2858,8 @@ class MediaListPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# no specified footer location
of = self.report.create_file("media") of = self.report.create_file("media")
medialistpage, body = self.write_header(_('Media'), False) medialistpage, body = self.write_header(_('Media'))
# begin gallery division # begin gallery division
with Html('div', class_='content', id='Gallery') as section: with Html('div', class_='content', id='Gallery') as section:
@ -2929,8 +2914,7 @@ class MediaListPage(BasePage):
# add footer section # add footer section
# add clearline for proper styling # add clearline for proper styling
# no specified footer location footer = self.write_footer()
footer = self.write_footer(False)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -2984,9 +2968,8 @@ class DownloadPage(BasePage):
if not dlfname1 and not dlfname2: if not dlfname1 and not dlfname2:
return return
# has to be False for some problem with stylesheet
of = self.report.create_file("download") of = self.report.create_file("download")
downloadpage, body = self.write_header(_('Download'), False) downloadpage, body = self.write_header(_('Download'))
# begin download page and table # begin download page and table
with Html('div', class_='content', id='Download') as download: with Html('div', class_='content', id='Download') as download:
@ -3102,8 +3085,7 @@ class DownloadPage(BasePage):
# clear line for proper styling # clear line for proper styling
# create footer section # create footer section
# a specified footer location footer = self.write_footer()
footer = self.write_footer(False)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -3117,7 +3099,7 @@ class ContactPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("contact") of = self.report.create_file("contact")
contactpage, body = self.write_header(_('Contact'), False) contactpage, body = self.write_header(_('Contact'))
# begin contact division # begin contact division
with Html('div', class_='content', id='Contact') as section: with Html('div', class_='content', id='Contact') as section:
@ -3127,7 +3109,6 @@ class ContactPage(BasePage):
with Html('div', id='summaryarea') as summaryarea: with Html('div', id='summaryarea') as summaryarea:
section += summaryarea section += summaryarea
# contact image is specified earlier
contactimg = report.add_image('contactimg', 200) contactimg = report.add_image('contactimg', 200)
if contactimg is not None: if contactimg is not None:
summaryarea += contactimg summaryarea += contactimg
@ -3169,7 +3150,7 @@ class ContactPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer(False) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for porcessing # send page out for porcessing
@ -3194,14 +3175,13 @@ class IndividualPage(BasePage):
self.src_list = src_list # Used by get_citation_links() self.src_list = src_list # Used by get_citation_links()
self.bibli = Bibliography() self.bibli = Bibliography()
self.place_list = place_list self.place_list = place_list
self.sort_name = self.get_name(self.person) self.sort_name = self.get_name(person)
self.name = self.get_name(self.person) self.name = self.get_name(person)
db = report.database db = report.database
of = self.report.create_file(person.handle, 'ppl') of = self.report.create_file(person.handle, 'ppl')
self.up = True self.up = True
# there is way too much information on this page, so False indivdetpage, body = self.write_header(self.sort_name)
indivdetpage, body = self.write_header(self.get_name(person), False)
# begin individualdetail division # begin individualdetail division
with Html('div', class_='content', id='IndividualDetail') as individualdetail: with Html('div', class_='content', id='IndividualDetail') as individualdetail:
@ -3212,8 +3192,7 @@ class IndividualPage(BasePage):
# if there is a thumbnail, add it also? # if there is a thumbnail, add it also?
if thumbnail is not None: if thumbnail is not None:
individualdetail += (thumbnail, name, summary) individualdetail += thumbnail
else:
individualdetail += (name, summary) individualdetail += (name, summary)
# display a person's events # display a person's events
@ -3222,7 +3201,7 @@ class IndividualPage(BasePage):
individualdetail += sect2 individualdetail += sect2
# display attributes # display attributes
sect3 = self.display_attr_list(self.person) sect3 = self.display_attr_list(person)
if sect3 is not None: if sect3 is not None:
individualdetail += sect3 individualdetail += sect3
@ -3237,7 +3216,7 @@ class IndividualPage(BasePage):
individualdetail += sect5 individualdetail += sect5
# display LDS ordinance # display LDS ordinance
sect6 = self.display_lds_ordinance(self.person) sect6 = self.display_lds_ordinance(person)
if sect6 is not None: if sect6 is not None:
individualdetail += sect6 individualdetail += sect6
@ -3299,8 +3278,7 @@ class IndividualPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# create footer section # create footer section
# there is way too much information here to gie footer a location... footer = self.write_footer()
footer = self.write_footer(False)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -4353,7 +4331,6 @@ class IndividualPage(BasePage):
(THEAD, 'Type'), (THEAD, 'Type'),
(DHEAD, 'Date'), (DHEAD, 'Date'),
(PHEAD, 'Place'), (PHEAD, 'Place'),
(DESCRHEAD, 'Description'),
(SHEAD, 'Sources'), (SHEAD, 'Sources'),
(NHEAD, 'Notes') ]: (NHEAD, 'Notes') ]:
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True) trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
@ -4368,7 +4345,6 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
lnk = (self.report.cur_fname, self.page_title, self.gid) lnk = (self.report.cur_fname, self.page_title, self.gid)
descr = event.get_description()
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
if place_handle in self.place_list: if place_handle in self.place_list:
@ -4414,8 +4390,7 @@ class IndividualPage(BasePage):
['Type', evt_hyper], ['Type', evt_hyper],
['Date', _dd.display(event.get_date_object() )], ['Date', _dd.display(event.get_date_object() )],
['Place', place], ['Place', place],
['Description', event.get_description()], ['Sources', self.get_citation_links(event.get_source_references() )],
['Source', self.get_citation_links(event.get_source_references() )],
['Notes', self.dump_notes(notelist)] ]: ['Notes', self.dump_notes(notelist)] ]:
data = data or ' ' data = data or ' '
@ -4472,13 +4447,8 @@ class RepositoryListPage(BasePage):
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
# determine if we specify the location of footer or not?
location = True
if len(repos_dict) > 6:
location = False
of = self.report.create_file('repositories') of = self.report.create_file('repositories')
repolistpage, body = self.write_header(_('Repositories'), location) repolistpage, body = self.write_header(_('Repositories'))
# begin RepositoryList division # begin RepositoryList division
with Html('div', class_='content', id='RepositoryList') as repositorylist: with Html('div', class_='content', id='RepositoryList') as repositorylist:
@ -4537,7 +4507,7 @@ class RepositoryListPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer(location) footer = self.write_footer()
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -4555,7 +4525,7 @@ class RepositoryPage(BasePage):
of = self.report.create_file(handle, 'repo') of = self.report.create_file(handle, 'repo')
self.up = True self.up = True
repositorypage, body = self.write_header(_('Repositories'), True) repositorypage, body = self.write_header(_('Repositories'))
# begin RepositoryDetail division and page title # begin RepositoryDetail division and page title
with Html('div', class_='content', id='RepositoryDetail') as repositorydetail: with Html('div', class_='content', id='RepositoryDetail') as repositorydetail:
@ -4600,8 +4570,7 @@ class RepositoryPage(BasePage):
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
# a specified location of footer footer = self.write_footer()
footer = self.write_footer(True)
body += (fullclear, footer) body += (fullclear, footer)
# send page out for processing # send page out for processing
@ -4943,6 +4912,7 @@ class NavWebReport(Report):
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
family = db.get_family_from_handle(family_handle) family = db.get_family_from_handle(family_handle)
# get partner handle
partner_handle = ReportUtils.find_spouse(person, family) partner_handle = ReportUtils.find_spouse(person, family)
if partner_handle: if partner_handle:
partner = db.get_person_from_handle(partner_handle) partner = db.get_person_from_handle(partner_handle)
@ -4961,9 +4931,10 @@ class NavWebReport(Report):
sort_date = '%04d/%02d/%02d' % (year, month, day) sort_date = '%04d/%02d/%02d' % (year, month, day)
# add event data # add event data
event_list.append([evt_type, sort_name, sort_date, event, evt_ref, event_list.append([evt_type, sort_date, sort_name, event,
partner]) evt_ref, partner])
partner = None
for evt_ref in person.get_primary_event_ref_list(): for evt_ref in person.get_primary_event_ref_list():
event = db.get_event_from_handle(evt_ref.ref) event = db.get_event_from_handle(evt_ref.ref)
@ -4978,18 +4949,15 @@ class NavWebReport(Report):
sort_date = '%04d/%02d/%02d' % (year, month, day) sort_date = '%04d/%02d/%02d' % (year, month, day)
# add event data # add event data
event_list.append([evt_type, sort_name, sort_date, event, evt_ref, event_list.append([evt_type, sort_date, sort_name, event,
partner]) evt_ref, partner])
# sort the list of an individual's events # sort the event_list
event_list.sort() event_list.sort()
# combine person and their events together # combine person and their events together
event_dict.append([person, event_list]) event_dict.append([person, event_list])
# sort the events dictionary
event_dict.sort()
# set progress meter pass # set progress meter pass
self.progress.set_pass(_('Creating event pages'), len(event_dict)) self.progress.set_pass(_('Creating event pages'), len(event_dict))
@ -4999,10 +4967,10 @@ class NavWebReport(Report):
for (person, event_list) in event_dict: for (person, event_list) in event_dict:
self.progress.step() self.progress.step()
for (evt_type, sort_name, sort_date, event, evt_ref, partner) in event_list: for (evt_type, sort_date, sort_name, event, evt_ref, partner) in event_list:
# create individual event page # create individual event page
EventPage(self, self.title, evt_type, event, evt_ref, person, partner) EventPage(self, self.title, person, partner, evt_type, event, evt_ref)
def gallery_pages(self, source_list): def gallery_pages(self, source_list):
import gc import gc