Changed names of Navigation Alphabet stylesheets. Cleanup code and stylesheets.

svn: r14988
This commit is contained in:
Rob G. Healey 2010-04-01 15:11:33 +00:00
parent 3e345733eb
commit ec6ccdc58f
4 changed files with 87 additions and 61 deletions

View File

@ -870,8 +870,7 @@ div#RepositoryList table.repolist tbody tr td.ColumnName {
------------------------------------------------------ */ ------------------------------------------------------ */
div#AddressBookList, AddressBookDetail { div#AddressBookList, AddressBookDetail {
margin: 0; margin: 0;
padding: 0 14px 0 14px; padding: 0;
width: 965px;
} }
div#AddressBookList table.addressbook { div#AddressBookList table.addressbook {
@ -1105,7 +1104,7 @@ div#Addresses {
padding: 0; padding: 0;
} }
div#Addresses table.infolist { div#Addresses table.infolist {
font-size: 12px; font-size: 10px;
background-color: #70B1ED; background-color: #70B1ED;
} }
div#Addresses table.infolist tbody tr td { div#Addresses table.infolist tbody tr td {
@ -1124,7 +1123,7 @@ div#Addresses table.infolist tbody tr td.ColumnCounty {
width: 8%; width: 8%;
} }
div#Addresses table.infolist tbody tr td.ColumnState { div#Addresses table.infolist tbody tr td.ColumnState {
width: 12%; width: 8%;
} }
div#Addresses table.infolist tbody tr td.ColumnCntry { div#Addresses table.infolist tbody tr td.ColumnCntry {
width: 5%; width: 5%;
@ -1133,7 +1132,7 @@ div#Addresses table.infolist tbody tr td.ColumnPostalcode {
width: 10%; width: 10%;
} }
div#Addresses table.infolist tbody tr td.ColumnPhone { div#Addresses table.infolist tbody tr td.ColumnPhone {
width: 15%; width: 12%;
} }
/* Subsections : Gallery /* Subsections : Gallery

View File

@ -1,4 +1,5 @@
/* /*
# encoding: utf-8
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
@ -21,7 +22,7 @@
************************************************************************************************** **************************************************************************************************
GRAMPS Cascading Style Sheet GRAMPS Cascading Style Sheet
Style Name: Web_Alphabet-Horizontal Stylesheet Style Name: Web_Navigation-Horizontal Stylesheet
*************************************************************************************************** ***************************************************************************************************
# $Id: Web_Alphabet-Horizontal.css 14559 2010-03-02 01:16:46Z robhealey1 $ # $Id: Web_Alphabet-Horizontal.css 14559 2010-03-02 01:16:46Z robhealey1 $
@ -40,9 +41,9 @@ div#header {
body { body {
color: #000; color: #000;
background-color: #FFF; background-color: #FFF;
padding: 0;
margin: 0; margin: 0;
width: 100%; padding: 0px 14px 0px 14px;
width: 965px;
} }
/* Alphabet Navigation /* Alphabet Navigation

View File

@ -1,4 +1,5 @@
/* /*
# encoding: utf-8
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
@ -21,7 +22,7 @@
************************************************************************************************** **************************************************************************************************
GRAMPS Cascading Style Sheet GRAMPS Cascading Style Sheet
Style Name: Web_Alphabet-Vertical Stylesheet Style Name: Web_Navigation-Vertical Stylesheet
*************************************************************************************************** ***************************************************************************************************
# $Id: Web_Alphabet-Vertical.css 14559 2010-03-02 01:16:46Z robhealey1 $ # $Id: Web_Alphabet-Vertical.css 14559 2010-03-02 01:16:46Z robhealey1 $

View File

@ -98,6 +98,9 @@ from libhtmlbackend import HtmlBackend
from libgedcom import make_gedcom_date from libgedcom import make_gedcom_date
# import library to access SQL database
from libaccess import *
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# constants # constants
@ -326,6 +329,12 @@ class BasePage(object):
return trow return trow
def get_citation_links(self, source_ref_list): def get_citation_links(self, source_ref_list):
"""
get citation link from the source reference list
@param: source_ref_list = list of source references
"""
gid_list = [] gid_list = []
lnk = (self.report.cur_fname, self.page_title, self.gid) lnk = (self.report.cur_fname, self.page_title, self.gid)
@ -743,18 +752,23 @@ class BasePage(object):
# return summaryarea division to its callers # return summaryarea division to its callers
return summaryarea return summaryarea
def addressbook_link(self, handle, up = False): def addressbook_link(self, person_handle, up = False):
""" createsa hyperlink for an address book link based on person's handle """ """
db = self.report.database createsa hyperlink for an address book link based on person's handle
url = self.report.build_url_fname_html(handle, "addr", up) @param: person_handle = person's handle from the database
person = db.get_person_from_handle(handle) #param: up = rather to add subdirs or not?
"""
url = self.report.build_url_fname_html(person_handle, "addr", up)
person = self.report.database.get_person_from_handle(person_handle)
if person.gender == gen.lib.Person.FEMALE:
person_name = self.get_name(person, person.get_primary_name().get_surname() )
else:
person_name = self.get_name(person) person_name = self.get_name(person)
addr_hyper = Html("a", person_name, href = url, title = html_escape(person_name))
# return addressbook hyperlink to its caller # return addressbook hyperlink to its caller
return addr_hyper return Html("a", person_name, href = url, title = html_escape(person_name))
def get_copyright_license(self, copyright, up = False): def get_copyright_license(self, copyright, up = False):
""" """
@ -781,6 +795,9 @@ class BasePage(object):
""" """
Return person's name, unless maiden_name given, unless married_name Return person's name, unless maiden_name given, unless married_name
listed. listed.
@param: person = person object from database
@param: maiden_name = Female's family surname
""" """
# name_format is the name format that you set in options # name_format is the name format that you set in options
@ -794,6 +811,7 @@ class BasePage(object):
if int(name.get_type()) == gen.lib.NameType.MARRIED: if int(name.get_type()) == gen.lib.NameType.MARRIED:
married_name = name married_name = name
break # use first break # use first
# Now, decide which to use: # Now, decide which to use:
if maiden_name is not None: if maiden_name is not None:
if married_name is not None: if married_name is not None:
@ -1027,7 +1045,7 @@ class BasePage(object):
('contact', _("Contact"), self.report.use_contact), ('contact', _("Contact"), self.report.use_contact),
('sources', SHEAD, True), ('sources', SHEAD, True),
('repositories', _("Repositories"), inc_repos), ('repositories', _("Repositories"), inc_repos),
("addressbook", _("Address Book"), self.report.addressbook) ("addressbook", _("Address Book"), self.report.inc_addressbook)
] ]
navigation = Html("div", id = 'navigation') navigation = Html("div", id = 'navigation')
@ -4731,7 +4749,6 @@ class AddressBookListPage(BasePage):
address/ Residence events address/ Residence events
@param: has_url_address -- a list of (sort_name, person_handle, has_add, has_rtes, and has_url @param: has_url_address -- a list of (sort_name, person_handle, has_add, has_rtes, and has_url
""" """
BasePage.__init__(self, report, title) BasePage.__init__(self, report, title)
db = report.database db = report.database
@ -4740,8 +4757,7 @@ class AddressBookListPage(BasePage):
of = self.report.create_file("addressbook") of = self.report.create_file("addressbook")
# Add xml, doctype, meta and stylesheets # Add xml, doctype, meta and stylesheets
addressbooklistpage, body = self.write_header("%s - %s" % (title, addressbooklistpage, body = self.write_header("%s - %s" % (title, _("Address Book")), _KEYPERSON)
_("Address Book")), _KEYPERSON)
# begin AddressBookList division # begin AddressBookList division
with Html("div", class_ = "content", id = "AddressBookList") as addressbooklist: with Html("div", class_ = "content", id = "AddressBookList") as addressbooklist:
@ -4782,13 +4798,10 @@ class AddressBookListPage(BasePage):
index, countadd, countres, counturl, countfb = 0, 0, 0, 0, 0 index, countadd, countres, counturl, countfb = 0, 0, 0, 0, 0
for (sort_name, person_handle, has_add, has_res, has_url) in has_url_address: for (sort_name, person_handle, has_add, has_res, has_url) in has_url_address:
person = db.get_person_from_handle(person_handle)
index += 1
address = None address = None
residence = None residence = None
weblinks = None weblinks = None
facebook = None
# has address but no residence event # has address but no residence event
if has_add and not has_res: if has_add and not has_res:
@ -4815,22 +4828,21 @@ class AddressBookListPage(BasePage):
trow = Html("tr") trow = Html("tr")
tbody += trow tbody += trow
header_row = [ trow.extend(
["RowLabel", index], Html("td", data or " ", class_="Column" + colclass, inline = True)
for (colclass, data) in [
["RowLabel", index + 1],
["Name", self.addressbook_link(person_handle)], ["Name", self.addressbook_link(person_handle)],
["Address", address], ["Address", address],
["Residence", residence], ["Residence", residence],
["WebLinks", weblinks] ] ["WebLinks", weblinks] ]
)
trow.extend( index += 1
Html("td", data or " ",
class_="Column" + colclass, inline=True)
for (colclass, data) in header_row)
# create totals row for table # create totals row for table
trow = Html("tr", class_ = "Totals") + ( trow = Html("tr", class_ = "Totals") + (
Html("td", _("Total"), classs_ = "ColumnRowlabel", inline = True), Html("td", _("Total"), classs_ = "ColumnRowlabel", inline = True),
Html("td", index, class_ = "ColumnName", inline = True), Html("td", " ", class_ = "ColumnName", inline = True),
Html("td", countadd, class_ = "ColumnAddress", inline = True), Html("td", countadd, class_ = "ColumnAddress", inline = True),
Html("td", countres, class_ = "ColumnResidence", inline = True), Html("td", countres, class_ = "ColumnResidence", inline = True),
Html("td", counturl, class_ = "ColumnWebLinks", inline = True) Html("td", counturl, class_ = "ColumnWebLinks", inline = True)
@ -4977,7 +4989,7 @@ class NavWebReport(Report):
self.birthorder = self.options['birthorder'] self.birthorder = self.options['birthorder']
# get option for Internet Address Book # get option for Internet Address Book
self.addressbook = self.options["addressbook"] self.inc_addressbook = self.options["inc_addressbook"]
if self.use_home: if self.use_home:
self.index_fname = "index" self.index_fname = "index"
@ -5057,6 +5069,9 @@ class NavWebReport(Report):
self.progress = ProgressMeter(_("Narrated Web Site Report"), '') self.progress = ProgressMeter(_("Narrated Web Site Report"), '')
# initialize database for use with libaccess library
init(self.database)
# Build the person list # Build the person list
ind_list = self.build_person_list() ind_list = self.build_person_list()
@ -5075,7 +5090,7 @@ class NavWebReport(Report):
# build classes SurnameListPage and SurnamePage # build classes SurnameListPage and SurnamePage
self.surname_pages(ind_list) self.surname_pages(ind_list)
# build PlaceListPage and PlacePage # build classes PlaceListPage and PlacePage
self.place_pages(place_list, source_list) self.place_pages(place_list, source_list)
# build classes EventListPage and EventPage # build classes EventListPage and EventPage
@ -5085,23 +5100,24 @@ class NavWebReport(Report):
# build classes SourceListPage and SourcePage # build classes SourceListPage and SourcePage
self.source_pages(source_list) self.source_pages(source_list)
# build MediaListPage and MediaPage # build classes MediaListPage and MediaPage
if self.inc_gallery: if self.inc_gallery:
self.gallery_pages(source_list) self.gallery_pages(source_list)
# Build source pages a second time to pick up sources referenced # Build classes source pages a second time to pick up sources referenced
# by galleries # by galleries
self.source_pages(source_list) self.source_pages(source_list)
# build classes RepositoryListPage and RepositoryPage # build classes RepositoryListPage and RepositoryPage
if self.inc_repository:
repolist = self.database.get_repository_handles() repolist = self.database.get_repository_handles()
if len(repolist): if len(repolist):
self.repository_pages(repolist) self.repository_pages(repolist)
# build class InternetAddressBook # build classes ddressBookList and AddressBookPage
if self.addressbook: if self.inc_addressbook:
self.address_book_page(ind_list) self.addressbook_pages(ind_list)
# if an archive is being used, close it? # if an archive is being used, close it?
if self.archive: if self.archive:
@ -5363,42 +5379,45 @@ class NavWebReport(Report):
will create RepositoryPage() and RepositoryListPage() will create RepositoryPage() and RepositoryListPage()
""" """
db = self.database
repos_dict = {} repos_dict = {}
# Sort the repositories # Sort the repositories
for handle in repolist: for handle in repolist:
repo = db.get_repository_from_handle(handle) repo = self.database.get_repository_from_handle(handle)
key = repo.name + str(repo.get_gramps_id()) key = repo.name + str(repo.get_gramps_id())
repos_dict[key] = (repo, handle) repos_dict[key] = (repo, handle)
keys = sorted(repos_dict, key = locale.strxfrm) keys = sorted(repos_dict, key = locale.strxfrm)
# set progress bar pass for Repositories # set progress bar pass for Repositories
self.progress.set_pass(_('Creating repository pages'), len(repos_dict)) repo_size = len(repos_dict)
self.progress.set_pass(_('Creating repository pages'), repo_size)
# RepositoryListPage Class # RepositoryListPage Class
RepositoryListPage(self, self.title, repos_dict, keys) RepositoryListPage(self, self.title, repos_dict, keys)
count = 1
for index, key in enumerate(keys): for index, key in enumerate(keys):
self.progress.set_header(_("Creating repository page %d of %d" % (count, repo_size)))
(repo, handle) = repos_dict[key] (repo, handle) = repos_dict[key]
# RepositoryPage Class # RepositoryPage Class
RepositoryPage(self, self.title, repo, handle, repo.gramps_id) RepositoryPage(self, self.title, repo, handle, repo.gramps_id)
# increment progress bar
self.progress.step() self.progress.step()
count += 1
def address_book_page(self, ind_list): def addressbook_pages(self, ind_list):
""" """
Creates classes AddressBookListPage and AddressBookPage Creates classes AddressBookListPage and AddressBookPage
""" """
db = self.database
has_url_address = [] has_url_address = []
for person_handle in ind_list: for person_handle in ind_list:
person = db.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
addrlist = person.get_address_list() addrlist = person.get_address_list()
evt_ref_list = person.get_event_ref_list() evt_ref_list = person.get_event_ref_list()
urllist = person.get_url_list() urllist = person.get_url_list()
@ -5406,13 +5425,14 @@ class NavWebReport(Report):
has_add = None has_add = None
has_url = None has_url = None
has_res = None has_res = None
if addrlist: if addrlist:
has_add = addrlist has_add = addrlist
if urllist: if urllist:
has_url = urllist has_url = urllist
for event_ref in evt_ref_list: for event_ref in evt_ref_list:
event = db.get_event_from_handle(event_ref.ref) event = self.database.get_event_from_handle(event_ref.ref)
# get event type # get event type
evt_type = str(event.get_type() ) evt_type = str(event.get_type() )
@ -5431,15 +5451,21 @@ class NavWebReport(Report):
if has_url_address: if has_url_address:
has_url_address.sort() has_url_address.sort()
self.progress.set_pass(_("Creating address book pages ..."), len(has_url_address)) addr_size = len( has_url_address )
self.progress.set_pass(_("Creating address book pages ..."), addr_size)
AddressBookListPage(self, self.title, has_url_address) AddressBookListPage(self, self.title, has_url_address)
count = 1
for (sort_name, person_handle, has_add, has_res, has_url) in has_url_address: for (sort_name, person_handle, has_add, has_res, has_url) in has_url_address:
self.progress.step() self.progress.set_header(_("Creating address book page %d of %d" % (count, addr_size)))
AddressBookPage(self, self.title, person_handle, has_add, has_res, has_url) AddressBookPage(self, self.title, person_handle, has_add, has_res, has_url)
# increment progress bar
self.progress.step()
count += 1
def build_subdirs(self, subdir, fname, up = False): def build_subdirs(self, subdir, fname, up = False):
""" """
If subdir is given, then two extra levels of subdirectory are inserted If subdir is given, then two extra levels of subdirectory are inserted
@ -5899,8 +5925,7 @@ class NavWebOptions(MenuReportOptions):
#menu.add_option(category_name, 'showhalfsiblings', showallsiblings) #menu.add_option(category_name, 'showhalfsiblings', showallsiblings)
birthorder = BooleanOption(_('Sort all children in birth order'), False) birthorder = BooleanOption(_('Sort all children in birth order'), False)
birthorder.set_help(_('Whether to display children in birth order' birthorder.set_help(_('Whether to display children in birth order or in entry order?'))
' or in entry order?'))
menu.add_option(category_name, 'birthorder', birthorder) menu.add_option(category_name, 'birthorder', birthorder)
inc_events = BooleanOption(_('Include event pages'), False) inc_events = BooleanOption(_('Include event pages'), False)
@ -5915,10 +5940,10 @@ class NavWebOptions(MenuReportOptions):
inc_gendex.set_help(_('Whether to include a GENDEX file or not')) inc_gendex.set_help(_('Whether to include a GENDEX file or not'))
menu.add_option(category_name, 'inc_gendex', inc_gendex) menu.add_option(category_name, 'inc_gendex', inc_gendex)
addressbook = BooleanOption(_("Include address book pages"), False) inc_addressbook = BooleanOption(_("Include address book pages"), False)
addressbook.set_help(_("Whether to add Address Book pages or not which can include" inc_addressbook.set_help(_("Whether to add Address Book pages or not which can include"
" e-mail and website addresses and personal address/ residence events?")) " e-mail and website addresses and personal address/ residence events?"))
menu.add_option(category_name, "addressbook", addressbook) menu.add_option(category_name, "inc_addressbook", inc_addressbook)
def __archive_changed(self): def __archive_changed(self):
""" """