NarrativeWeb is now complete unless there are bugs. Style sheet has been updated to match current changes.

svn: r13123
This commit is contained in:
Rob G. Healey 2009-08-27 13:21:55 +00:00
parent 483e745903
commit 0ac7dc7a96
2 changed files with 145 additions and 137 deletions

View File

@ -36,7 +36,7 @@ brown darkest #453619
brown dark #542
brown light #C1B398
gray #696969
green #6AF364
green #6AF364, #5D835F
green lighter #D8F3D6
===== Ancestor Graph Color Scheme =====
@ -87,6 +87,7 @@ img {
background:none;
}
.content {
overflow: auto;
width:965px;
margin:0 auto;
padding-bottom:.5em;
@ -191,19 +192,28 @@ span.preposition {
color:#000;
}
/* NarrativeWeb
------------------------------------------------------ */
body#NarrativeWeb {
font-family: Arial, sans, sans-serif, Helvetica;
}
/* Header
----------------------------------------------------- */
#header {
overflow: auto;
width:100%;
height: 2cm;
margin:0;
height:1.5cm;
padding:0 0 .9em 0;
background-color:#453619;
border-bottom:solid 2px #6AF364;
background-color: #542;
border-bottom:solid 8px #5D835F;
}
#SiteTitle {
color:#FFF;
margin:0;
padding:.5em 0 0 20px;
font-size: 36px;
color:#FFF;
font-style:italic;
}
p#user_header {
@ -217,16 +227,16 @@ p#user_header {
/* Footer
----------------------------------------------------- */
#footer {
overflow: auto;
width: 100%;
height: 1.5cm;
clear:both;
height:1.5cm;
width:100%;
font-size:12px;
line-height:130%;
font-family:sans-serif;
margin:0;
color:#FFF;
margin:0 auto;
padding:0;
background-color:#453619;
border-top:solid 2px #6AF364;
background-color: #542;
border-top:solid 8px #5D835F;
}
#footer a, #footer a:visited {
text-decoration:none;
@ -246,16 +256,16 @@ p#user_header {
width:60%;
text-align:left;
margin-left:10px;
color:#FFF;
}
#footer p#copyright {
float:right;
text-align:right;
color:#FFF;
margin-top:10px;
margin: 10px 10px 0px 0px;
}
#footer p#copyright img {
float:right;
margin-right: 10px;
}
#user_footer {
width:70%;
@ -601,42 +611,51 @@ table.individuallist tbody tr td.ColumnPartner a:hover {
/* Events
----------------------------------------------------- */
div#eventlist ( )
table.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: 100%;
width: 965px;
}
table.eventlist tbody tr {
div#EventList table.eventlist thead tr th {
font-weight:bold;
text-transform:uppercase;
border:solid 1px #5D835F;
}
div#EventList table.eventlist tbody tr {
border-bottom:solid 1px #000;
}
table.eventlist tbody tr td {
div#EventList table.eventlist tbody tr td {
background-color:#D8F3D6;
}
table.eventlist tbody tr td.ColumnEventType {
display:block;
padding:4px 20px 4px 20px;
background-color:#FFF;
width:15%;
}
table.eventlist tbody tr td.ColumnDate {
width:15%;0
}
table.eventlist tbody tr td.ColumnPlace {
display:block;
padding: 4px 10px 4px 10px;
background-color:#FFF;
width:60%;
}
table.eventlist tbody tr td.ColumnDescription {
width:10^;
}
table.eventlist tbody tr td.ColumnPerson {
div#EventList table.eventlist tbody tr td.ColumnType {
display:block;
padding:10px 20px 10px 20px;
background-color:#FFF;
width:70%;
width: 35%;
}
div#EventList table.eventlist tbody tr td.ColumnDate {
width: 22%;
}
div#EventList table.eventlist tbody tr td.ColumnDescription {
width: 20%;
}
div#EventList table.eventlist tbody tr td.ColumnName {
display:block;
padding:10px 20px 10px 20px;
background-color:#FFF;
width: 75%;
}
div#EventDetail {
font-size:10px;
color:#000;
font-family:Arial, sans, sans-serif, Helvetica;
}
div#EventDetail h3 {
font-size: 40px;
}
/* Gallery

View File

@ -124,7 +124,7 @@ from libhtmlbackend import HtmlBackend
AHEAD = _('Attributes')
DHEAD = _('Date')
DESCRHEAD = _('Description')
EHEAD = _('EventType')
EHEAD = _('Type')
NHEAD = _('Notes')
PHEAD = _('Place')
SHEAD = _('Sources')
@ -1882,14 +1882,10 @@ class PlacePage(BasePage):
class EventListPage(BasePage):
def __init__(self, report, title, event_list, event_types):
def __init__(self, report, title, event_dict):
BasePage.__init__(self, report, title)
db = report.database
BasePage.__init__(self, report, event_list[0][0], event_list[0][1])
# get down to just the types and remove its occurences
keys = sorted(event_types, key=locale.strxfrm)
of = self.report.create_file("events")
eventslistpage, body = self.write_header(_('Events'))
@ -1918,17 +1914,15 @@ class EventListPage(BasePage):
thead += trow
for (label, colclass) in [
(EHEAD, 'EventType'),
(EHEAD, 'Type'),
(DHEAD, 'Date'),
(PHEAD, 'Place'),
(DESCRHEAD, 'Description'),
(_('Person'), 'Person') ]:
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
# send the entire events list
# table body is started in here
table += self.write_event_row(event_list)
# send entire events dictionary
table += self.write_event_rows(event_dict)
# and clearline for proper styling
# and footer section
@ -1939,62 +1933,57 @@ class EventListPage(BasePage):
# and close the file
self.mywriter(eventslistpage, of)
def write_event_row(self, event_data_list):
def write_event_rows(self, event_dict):
"""
display the event row
display the event row for class EventListPage()
"""
db = self.report.database
# begin table body
tbody = Html('tbody')
# unwrap event list
for sort_name, evt_type, sort_date, event, evt_ref, person in event_data_list:
for (sort_name, person, event_list) in event_dict:
# 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()
event_hyper = self.event_link(eventtype, evt_ref.ref, event.gramps_id)
# get place hyperlink
place_handle = event.get_place_handle()
place = db.get_place_from_handle(place_handle)
place_hyper = None
if place:
place_name = ReportUtils.place_name(db, place_handle)
place_hyper = self.place_link(place_handle, place_name,
place.gramps_id, False)
# get person's hyperlink
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
person_hyper = self.person_link(url, person, True, person.gramps_id)
# begin table row
trow = Html('tr')
tbody += trow
first = True
for (evt_type, sort_date, event, evt_ref) in event_list:
for (colclass, data) in [
['EventType', event_hyper],
['Date', _dd.display(event.get_date_object() )],
['Place', place_hyper],
['Description', event.get_description()],
['Person', person_hyper] ]:
# event hyperlink
event_hyper = self.event_link(evt_type, evt_ref.ref, event.gramps_id)
data = data or ' '
trow += Html('td', data, class_='Column%s' % colclass, inline=True)
# begin table row
trow = Html('tr')
tbody += trow
# return events table body to its callers
if first:
trow.attr = 'class="BeginName"'
for (colclass, data) in [
['Type', event_hyper],
['Date', _dd.display(event.get_date_object() )],
['Description', event.get_description()] ]:
data = data or ' '
# conditional statement for inline=True or False
samerow = True if (data == ' ' or colclass == 'Date') else False
trow += Html('td', data, class_='Column%s' % colclass, inline=samerow)
if first:
trow += Html('td', person_hyper, class_='ColumnName')
else:
trow += Html('td', ' ', class_='ColumnName', inline=True)
first = False
# return events table body to its caller
return tbody
class EventPage(BasePage):
def __init__(self, report, evt_type, event, evt_ref, person):
BasePage.__init__(self, report, evt_type, event.gramps_id)
def __init__(self, report, title, evt_type, event, evt_ref, person):
BasePage.__init__(self, report, '%s - %s' % (title, evt_type))
db = report.database
of = self.report.create_file(evt_ref.ref, 'evt')
@ -2009,7 +1998,7 @@ class EventPage(BasePage):
eventdetail += Html('h3', '%s of %s' % (evt_type, self.get_name(person)), inline=True)
# begin event detail table
with Html('table', class_='infolist eventdetail') as table:
with Html('table', class_='infolist eventlist') as table:
eventdetail += table
# get event data
@ -2028,11 +2017,11 @@ class EventPage(BasePage):
table += trow
url = self.report.build_url_fname_html(person.handle, 'ppl', self.up)
hyper = self.person_link(url, person, True, person.gramps_id)
person_hyper = self.person_link(url, person, True, person.gramps_id)
trow = Html('tr') + (
Html('td', _('Person'), class_='ColumnAttribute', inline=True),
Html('td', hyper, class_='ColumnValue', inline=True)
Html('td', person_hyper, class_='ColumnValue', inline=True)
)
table += trow
@ -2691,7 +2680,7 @@ class SourceListPage(BasePage):
thead += trow
for (label, colclass) in [
(None, 'RowLabel'),
(None, 'RowLabel'),
(_('Name'), 'Name') ]:
label = label or ' '
@ -4270,12 +4259,12 @@ class IndividualPage(BasePage):
trow = Html('tr')
for (label, colclass) in [
(EHEAD, 'EventType'),
(EHEAD, 'Type'),
(DHEAD, 'Date'),
(PHEAD, 'Place'),
(DESCRHEAD, 'Description'),
(SHEAD, 'Sources'),
(NHEAD, 'Note') ]:
(NHEAD, 'Notes') ]:
trow += Html('th', label, class_ = 'Column%s' % colclass, inline = True)
@ -4850,16 +4839,20 @@ class NavWebReport(Report):
def event_pages(self, ind_list):
"""
a dump of all the events sorted by EventType, gramps_id,
and a description if one?
a dump of all the events sorted by person's surname, and event type,
then by date if needed...
"""
db = self.database
# a dictionary for event information
event_dict = []
event_list = []
event_types = {}
for person_handle in ind_list:
person = db.get_person_from_handle(person_handle)
# begin events list for each person
event_list = []
# get sort name for sorting later
last_name = person.get_primary_name().get_surname()
first_name = person.get_primary_name().get_first_name()
@ -4874,21 +4867,15 @@ class NavWebReport(Report):
# get event type
evt_type = self.get_event_type(event, evt_ref)
# get sot date as year/month/day or 0/0/0
# get sot date as year/month/day or 0000/00/00
event_date = event.get_date_object()
year = str(event_date.get_year() ) or str(0)
month = str(event_date.get_month() ) or str(0)
day = str(event_date.get_day() ) or str(0)
sort_date = '/'.join([year, month, day])
info = [sort_name, evt_type, sort_date, event, evt_ref, person]
event_list.append(info)
year = event_date.get_year() or 0
month = event_date.get_month() or 0
day = event_date.get_day() or 0
sort_date = '%04d/%02d/%02d' % (year, month, day)
# get a list of the different event type in this database
if evt_type in event_types:
event_types[evt_type] += 1
else:
event_types[evt_type] = 1
# add event data
event_list.append([evt_type, sort_date, event, evt_ref])
for evt_ref in person.get_primary_event_ref_list():
event = db.get_event_from_handle(evt_ref.ref)
@ -4896,36 +4883,38 @@ class NavWebReport(Report):
# get event type
evt_type = self.get_event_type(event, evt_ref)
# get sot date as year/month/day or 0/0/0
# get sot date as year/month/day or 0000/00/00
event_date = event.get_date_object()
year = str(event_date.get_year() ) or str(0)
month = str(event_date.get_month() ) or str(0)
day = str(event_date.get_day() ) or str(0)
sort_date = '/'.join([year, month, day])
info = [sort_name, evt_type, sort_date, event, evt_ref, person]
event_list.append(info)
year = event_date.get_year() or 0
month = event_date.get_month() or 0
day = event_date.get_day() or 0
sort_date = '%04d/%02d/%02d' % (year, month, day)
# get a list of the different event type in this database
if evt_type in event_types:
event_types[evt_type] += 1
else:
event_types[evt_type] = 1
# add event data
event_list.append([evt_type, sort_date, event, evt_ref])
# 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])
# sort the events dictionary
event_dict.sort()
# set progress meter pass
self.progress.set_pass(_('Creating event pages'), len(event_list))
# sort the events by type
event_list.sort()
self.progress.set_pass(_('Creating event pages'), len(event_dict))
# send all data to the events list page
EventListPage(self, self.title, event_list, event_types)
EventListPage(self, self.title, event_dict)
for sort_name, evt_type, sort_date, event, evt_ref, person in event_list:
self.progress.step()
for (sort_name, person, event_list) in event_dict:
# create individual event page
EventPage(self, evt_type, event, evt_ref, person)
for evt_type, sort_date, event, evt_ref in event_list:
self.progress.step()
# create individual event page
EventPage(self, self.title, evt_type, event, evt_ref, person)
def gallery_pages(self, source_list):
import gc