From caad454b8945d9a05b9893f6650b8eacf9a06997 Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Thu, 11 Mar 2010 05:59:51 +0000 Subject: [PATCH] NarrativeWeb: Fixed problem with AddressBook pages not being able to create a page when there is no address. Stylesheets: Fixed and cleanup of AddressBook elements. svn: r14745 --- src/data/Web_Basic-Ash.css | 27 ------ src/data/Web_Basic-Cypress.css | 27 ------ src/data/Web_Basic-Lilac.css | 27 ------ src/data/Web_Basic-Peach.css | 27 ------ src/data/Web_Basic-Spruce.css | 27 ------ src/data/Web_Nebraska.css | 24 ++++-- src/data/Web_Visually.css | 99 +++------------------ src/plugins/webreport/NarrativeWeb.py | 119 ++++++++++++++++++-------- 8 files changed, 106 insertions(+), 271 deletions(-) diff --git a/src/data/Web_Basic-Ash.css b/src/data/Web_Basic-Ash.css index 5af7c9ccc..b78a7ed3f 100644 --- a/src/data/Web_Basic-Ash.css +++ b/src/data/Web_Basic-Ash.css @@ -799,33 +799,6 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book ------------------------------------------------------- */ -div#InternetAddressBook { - margin: 0; - padding: 0; -} -div#InternetAddressBook table.addressbook { - margin: .3em 0 .3em 0; -} -div#InternetAddressBook table.addressbook tbody tr.BeginName { - border-top: solid 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td { - background-color: #FFF; - border-bottom: dashed 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { - background-color: #CCC; - width: 15%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { - width: 30%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; -} - /* Address Book ------------------------------------------------------ */ div#AddressBookList, AddressBookDetail { diff --git a/src/data/Web_Basic-Cypress.css b/src/data/Web_Basic-Cypress.css index 3a82bb2d8..4a59d2265 100644 --- a/src/data/Web_Basic-Cypress.css +++ b/src/data/Web_Basic-Cypress.css @@ -826,33 +826,6 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book ------------------------------------------------------- */ -div#InternetAddressBook { - margin: 0; - padding: 0; -} -div#InternetAddressBook table.addressbook { - margin: .3em 0 .3em 0; -} -div#InternetAddressBook table.addressbook tbody tr.BeginName { - border-top: solid 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td { - background-color: #FFF; - border-bottom: dashed 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { - background-color: #E0E6E0; - width: 15%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { - width: 30%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; -} - /* Address Book ------------------------------------------------------ */ div#AddressBookList, AddressBookDetail { diff --git a/src/data/Web_Basic-Lilac.css b/src/data/Web_Basic-Lilac.css index 92e642d7a..daf01fec4 100644 --- a/src/data/Web_Basic-Lilac.css +++ b/src/data/Web_Basic-Lilac.css @@ -776,33 +776,6 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book ------------------------------------------------------- */ -div#InternetAddressBook { - margin: 0; - padding: 0; -} -div#InternetAddressBook table.addressbook { - margin: .3em 0 .3em 0; -} -div#InternetAddressBook table.addressbook tbody tr.BeginName { - border-top: solid 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td { - background-color: #FFF; - border-bottom: dashed 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { - background-color: #E0E0E9; - width: 15%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { - width: 30%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; -} - /* Address Book ------------------------------------------------------ */ div#AddressBookList, AddressBookDetail { diff --git a/src/data/Web_Basic-Peach.css b/src/data/Web_Basic-Peach.css index 84eb713e0..d8d8a1eb6 100644 --- a/src/data/Web_Basic-Peach.css +++ b/src/data/Web_Basic-Peach.css @@ -779,33 +779,6 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book ------------------------------------------------------- */ -div#InternetAddressBook { - margin: 0; - padding: 0; -} -div#InternetAddressBook table.addressbook { - margin: .3em 0 .3em 0; -} -div#InternetAddressBook table.addressbook tbody tr.BeginName { - border-top: solid 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td { - background-color: #FFF; - border-bottom: dashed 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { - background-color: #FFFBE7; - width: 15%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { - width: 30%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; -} - /* Address Book ------------------------------------------------------ */ div#AddressBookList, AddressBookDetail { diff --git a/src/data/Web_Basic-Spruce.css b/src/data/Web_Basic-Spruce.css index f0c1969a9..770668484 100644 --- a/src/data/Web_Basic-Spruce.css +++ b/src/data/Web_Basic-Spruce.css @@ -777,33 +777,6 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book ------------------------------------------------------- */ -div#InternetAddressBook { - margin: 0; - padding: 0; -} -div#InternetAddressBook table.addressbook { - margin: .3em 0 .3em 0; -} -div#InternetAddressBook table.addressbook tbody tr.BeginName { - border-top: solid 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td { - background-color: #FFF; - border-bottom: dashed 1px #000; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { - background-color: #EAEEF4; - width: 15%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { - width: 30%; -} -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; -} - /* Address Book ------------------------------------------------------ */ div#AddressBookList, AddressBookDetail { diff --git a/src/data/Web_Nebraska.css b/src/data/Web_Nebraska.css index 3ee219918..4c47e55a4 100644 --- a/src/data/Web_Nebraska.css +++ b/src/data/Web_Nebraska.css @@ -819,31 +819,37 @@ div#RepositoryList table.repolist tbody tr td.ColumnName { background-color: #FFF; } -/* Internet Address Book +/* Address Book ------------------------------------------------------ */ -div#InternetAddressBook { +div#AddressBookList { margin: 0; padding: 0; } -div#InternetAddressBook table.addressbook { +div#AddressBookList table.addressbook { margin: .3em 0 .3em 0; } -div#InternetAddressBook table.addressbook tbody tr.BeginName { +div#AddressBookList table.addressbook tbody tr.BeginName { border-top: solid 1px #000; } -div#InternetAddressBook table.addressbook tbody tr td { +div#AddressBookList table.addressbook tbody tr td { background-color: #FFF; border-bottom: dashed 1px #000; } -div#InternetAddressBook table.addressbook tbody tr td.ColumnType { +div#AddressBookList table.addressbook tbody tr td.ColumnRowLabel { background-color: #F6F2EE; width: 15%; } -div#InternetAddressBook table.addressbook tbody tr td.ColumnName { +div#AddressBookList table.addressbook tbody tr td.ColumnName { width: 30%; } -div#InternetAddressBook table.addressbook tbody tr td.ColumnLink { - width: 70%; +div#AddressBookList table.addressbook tbody tr td.ColumnAddress { + width: 8%; +} +div#AddressBookList table.addressbook tbody tr td.ColumnResidence { + width: 8%; +} +div#AddressBookList table.addressbook tbody tr td.ColumnWebLinks { + width: 8%; } /* Subsections diff --git a/src/data/Web_Visually.css b/src/data/Web_Visually.css index db30a66e5..c3ddf7107 100644 --- a/src/data/Web_Visually.css +++ b/src/data/Web_Visually.css @@ -1,4 +1,4 @@ -./* +/* # # Gramps - a GTK+/GNOME based genealogy program # @@ -49,10 +49,15 @@ Females Web_Gender_Female.png NarrativeWeb Styles -------------------------------------------------------------------------------------------- */ -body { - font-family: Arial, sans, sans-serif, Helvetica; - color: #000; - background-color: #FFF; +div#alphabet ul li { + background-color: #6AF364; +} +div#navigation ul li.CurrentSection a { + background-color: #000; + color: #FFF; +} +div#navigation ul li.CurrentSection a:hover { + background-color: 696969; } /* General Elements @@ -268,90 +273,6 @@ div#footer p#copyright img { padding:0; } -/* Navigation ------------------------------------------------------ */ -div#navigation, div#subnavigation { - width: 100%; - margin: 0; - padding: 0; -} -div#navigation ul, div#subnavigation ul { - list-style:none; - min-width: 900px; - height: 40px; - margin:0; - padding: 0px 0px 0px 16px; - border-bottom: solid 2px #5D835F; -} -div#navigation ul li, div#subnavigation ul li { - float:left; -} -div#navigation ul li a, div#subnavigation ul li a { - display: block; - padding: 12px 16px 14px 1px; - float:left; - font: .8em bold italic small-caps verdana, serif; - color: #000; - text-decoration:none; - margin:0; -} -div#navigation ul li a:hover, div#subnavigation ul li a:hover { - background-color: #C1B398; -} -div#navigation ul li.CurrentSection a, div#subnavigation ul li.CurrentSection a { - font-weight:bold; - font-style: italic; - background-color: #453619; - color: #FFF; -} -div#navigation ul li.CurrentSection a:hover { - background-color: #000; - color: #FFF; -} -div#subnavigation ul li.CurrentSection a { - border-width: 0px 0px 2px 0px; - border-color: #5D835F; -} -i0 - -/* Alphabet Navigation ------------------------------------------------------ */ -div#alphabet { - width: 100%; - margin: 0; - background-color: #6AF364; -} -div#alphabet ul { - list-style:none; - min-width:770px; - height:24px; - margin:0; - padding: 0px 0px 0px 16px; - border-width: 1px 0px 1px 0px; - border-style: solid; - border-color: #5D835F; -} -div#alphabet ul li:after { - content:" |"; -} -div#alphabet ul li { - margin:0; - float:left; -} -div#alphabet ul li a { - display:block; - padding: 4px 8px 4px 8px; - float:left; - font: normal 16px/100% sans; - margin:0; - text-decoration:none; - color: #000; -} -div#alphabet ul li a:hover { - background-color: #000; - color: #FFF; -} - /* Main Table ----------------------------------------------------- */ table.infolist { diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 7a4cfe86c..0768c4cc5 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -7,7 +7,7 @@ # Copyright (C) 2007-2009 Stephane Charette # Copyright (C) 2008-2009 Brian G. Matherly # Copyright (C) 2008 Jason M. Simanek -# Copyright (C) 2008-2009 Rob G. Healey +# Copyright (C) 2008-2010 Rob G. Healey # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -926,9 +926,6 @@ class BasePage(object): if self.ext in [".php", ".php3", ".cgi"]: del page[0] - # add narrative specific body id - body.attr = 'id = "NarrativeWeb"' - # create additional meta tags meta = (Html("meta", attr = _META1) + Html("meta", attr = _META2, indent = False) @@ -951,11 +948,17 @@ class BasePage(object): url4 = self.report.build_url_image("favicon.ico", "images", self.up) # create stylesheet and favicon links - links = [Html("link", href = url4, type = "image/x-icon", rel = "shortcut icon"), + links = Html("link", href = url4, type = "image/x-icon", rel = "shortcut icon") + ( Html("link", href = url1, type = "text/css", media = "screen", rel = "stylesheet"), Html("link", href = url2, type = "text/css", media = "screen", rel = "stylesheet"), - Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet") - ] + Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet") + ) + + if self.report.css in ["Web_Basic-Blue.css", "Web_Visually.css"]: + # Link to Navigation Menus stylesheet + fname = "/".join(["styles", "Web_Navigation-Menus.css"]) + url = self.report.build_url_fname(fname, None, self.up) + links.extend( Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet") ) # add additional meta and link tags head += meta @@ -1003,8 +1006,8 @@ class BasePage(object): navs = [ (self.report.index_fname, _("Html|Home"), self.report.use_home), (self.report.intro_fname, _("Introduction"), self.report.use_intro), - (self.report.surname_fname, _("Surnames"), True), ('individuals', _("Individuals"), True), + (self.report.surname_fname, _("Surnames"), True), ('places', _("Places"), True), ('events', _("Events"), self.report.inc_events), ('media', _("Media"), self.create_media), @@ -2136,11 +2139,16 @@ class PlaceListPage(BasePage): thead = Html("thead") table += thead - trow = Html("tr") + ( - Html("th", _("Letter"), class_ = "ColumnLetter", inline = True), - Html("th", _("Place name | Name"), class_ = "ColumnName", inline = True) - ) + trow = Html("tr") thead += trow + trow.extend( Html("th", label, class_ = "Column" + colclass, inline = True) + for label, colclass in [ + [_("Letter"), "Letter"], + [_("Place Name | Name"), "Name"], + [_("State"), "State"], + [_("Country"), "Country"], + [_("Latitude/ Longitude"), "Coordinates"] ] + ) sort = Sort.Sort(db) handle_list = sorted(place_handles, key = sort.by_place_title_key) @@ -2153,9 +2161,7 @@ class PlaceListPage(BasePage): for handle in handle_list: place = db.get_place_from_handle(handle) place_title = ReportUtils.place_name(db, handle) - - if not place_title: - continue + ml = place.get_main_location() letter = first_letter(place_title) @@ -2176,6 +2182,14 @@ class PlaceListPage(BasePage): trow += Html("td", self.place_link(place.handle, place_title, place.gramps_id), class_ = "ColumnName") + trow.extend( Html("td", data, class_ = "Column" + colclass, inline = True) + for colclass, data in [ + ["State", ml.state], + ["Country", ml.country], + ["Coordinates", (place.lat + ", " + place.long) if place.lat and place.long else None] ] + if data or " " + ) + # add clearline for proper styling # add footer section footer = self.write_footer() @@ -4720,7 +4734,8 @@ class AddressBookListPage(BasePage): of = self.report.create_file("addressbook") # Add xml, doctype, meta and stylesheets - addressbooklistpage, body = self.write_header("%s - %s" % (title, _("Address Book")), _KEYPERSON) + addressbooklistpage, body = self.write_header("%s - %s" % (title, + _("Address Book")), _KEYPERSON) # begin AddressBookList division with Html("div", class_ = "content", id = "AddressBookList") as addressbooklist: @@ -4757,7 +4772,7 @@ class AddressBookListPage(BasePage): table += tbody # local counters for total line - index, countadd, countres, counturl = 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: person = db.get_person_from_handle(person_handle) @@ -4766,6 +4781,7 @@ class AddressBookListPage(BasePage): address = None residence = None weblinks = None + facebook = None # has address but no residence event if has_add and not has_res: @@ -4846,26 +4862,20 @@ class AddressBookPage(BasePage): # begin address book page division and section title with Html("div", class_ = "content", id = "AddressBookDetail") as addressbookdetail: body += addressbookdetail - addressbookdetail += Html("h3", self.get_name(person), inline = True) + # individual has an address + if has_add: + addressbookdetail += self.display_addr_list(has_add, None) + + # individual has a residence + if has_res: + addressbookdetail += self.dump_residence(has_res) + # individual has a url if has_url: addressbookdetail += self.display_url_list(has_url) - # individual has an address, and not a residence event - if has_add and not has_res: - addressbookdetail += self.display_addr_list(has_add, None) - - # individual has a residence event and no addresses - elif has_res and not has_add: - addressbookdetail += self.dump_residence(has_res) - - # individual has both - elif has_add and has_res: - addressbookdetail += self.display_addr_list(has_add, None) - addressbookdetail += self.dump_residence(has_res) - # add fullclear for proper styling # and footer section to page footer = self.write_footer() @@ -4915,6 +4925,7 @@ class NavWebReport(Report): self.target_path = self.options['target'] self.ext = self.options['ext'] self.css = self.options['css'] + self.navigation = self.options["navigation"] self.title = self.options['title'] self.inc_gallery = self.options['gallery'] @@ -5105,7 +5116,6 @@ class NavWebReport(Report): """ # gets the person list and applies the requested filter - ind_list = self.database.iter_person_handles() self.progress.set_pass(_('Applying Filter...'), self.database.get_number_of_people()) ind_list = self.filter.apply(self.database, ind_list, self.progress) @@ -5126,6 +5136,14 @@ class NavWebReport(Report): fname = os.path.join(const.DATA_DIR, self.css) self.copy_file(fname, _NARRATIVESCREEN, "styles") + # copy Navigation Menu Layout if Blue or Visually is being used + if self.css == "Web_Basic-Blue.css" or "Web_Visually.css": + if self.navigation == "Horizontal": + fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Horizontal.css") + else: + fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css") + self.copy_file(fname, "Web_Navigation-Menus.css", "styles") + # copy printer stylesheet fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css") self.copy_file(fname, _NARRATIVEPRINT, "styles") @@ -5380,12 +5398,12 @@ class NavWebReport(Report): has_add = None has_url = None + has_res = None if addrlist: has_add = addrlist if urllist: has_url = urllist - has_res = None for event_ref in evt_ref_list: event = db.get_event_from_handle(event_ref.ref) @@ -5405,10 +5423,11 @@ class NavWebReport(Report): # Determine if we build Address Book if has_url_address: has_url_address.sort() - AddressBookListPage(self, self.title, has_url_address) self.progress.set_pass(_("Creating address book pages ..."), len(has_url_address)) + AddressBookListPage(self, self.title, has_url_address) + for (sort_name, person_handle, has_add, has_res, has_url) in has_url_address: self.progress.step() @@ -5658,11 +5677,24 @@ class NavWebOptions(MenuReportOptions): cright.set_help( _("The copyright to be used for the web files")) menu.add_option(category_name, "cright", cright) - css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1]) + self.__css = EnumeratedListOption(_('StyleSheet'), CSS_FILES[0][1]) for style in CSS_FILES: - css.add_item(style[1], style[0]) - css.set_help( _('The stylesheet to be used for the web page')) - menu.add_option(category_name, "css", css) + self.__css.add_item(style[1], style[0]) + self.__css.set_help( _('The stylesheet to be used for the web pages')) + menu.add_option(category_name, "css", self.__css) + self.__css.connect("value-changed", self.__stylesheet_changed) + + _NAVIGATION_OPTS = [ + [_("Horizontal -- No Change"), "Horizontal"], + [_("Vertical"), "Vertical"] + ] + self.__navigation = EnumeratedListOption(_("Navigation Layout"), _NAVIGATION_OPTS[0][1]) + for layout in _NAVIGATION_OPTS: + self.__navigation.add_item(layout[1], layout[0]) + self.__navigation.set_help(_("Choose which layout for the Navigation Menus.")) + menu.add_option(category_name, "navigation", self.__navigation) + + self.__stylesheet_changed() self.__graph = BooleanOption(_("Include ancestor graph"), True) self.__graph.set_help(_('Whether to include an ancestor graph ' @@ -5913,6 +5945,17 @@ class NavWebOptions(MenuReportOptions): # The rest don't self.__pid.set_available(False) + def __stylesheet_changed(self): + """ + Handles the changing nature of the stylesheet + """ + + css_opts = self.__css.get_value() + if css_opts in ["Web_Basic-Blue.css", "Web_Visually.css"]: + self.__navigation.set_available(True) + else: + self.__navigation.set_available(False) + def __graph_changed(self): """ Handle enabling or disabling the ancestor graph