Added Vertical and Horizontal Navigation Menus back into NarrativeWeb. Added State, Country, and Lat & Long to the PlacesListPage.

svn: r14490
This commit is contained in:
Rob G. Healey 2010-02-25 22:28:03 +00:00
parent 5d2c817048
commit d3a1cae6ae
4 changed files with 1654 additions and 133 deletions

View File

@ -62,6 +62,7 @@ book_categories = {
CSS_FILES = [
# First is used as default selection.
[_("Basic-Ash"), 'Web_Basic-Ash.css'],
[_("Basic-Blue"), 'Web_Basic-Blue.css'],
[_("Basic-Cypress"), 'Web_Basic-Cypress.css'],
[_("Basic-Lilac"), 'Web_Basic-Lilac.css'],
[_("Basic-Peach"), 'Web_Basic-Peach.css'],

View File

@ -30,16 +30,7 @@ see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------------------------
# $Id: $
Body Element
----------------------------------------------------- */
body {
font-family: Arial, sans, sans-serif, Helvetica;
color: #000;
background-color: #FFF;
padding: 60px 0px 0px 108px;
}
/* Header
Header
----------------------------------------------------- */
#header {
position: fixed;
@ -49,24 +40,24 @@ body {
width: 100%;
}
/* Navigation/ SubNavigation
/* Alphabet Navigation
----------------------------------------------------- */
div#navigation, div#subnavigation {
div#alphabet {
position: fixed;
left: 0px;
width: 108px;
height: 500px;
left: 4px;
width: 40px;
height: 326px;
overflow-x: auto;
border-width: 2px 4px 2px 4px;
border-style: solid;
}
div#navigation ul, div#subnavigation ul {
div#alphabet ul {
display: inline;
list-style: none;
padding: 0px 9px 0px 9px;
margin: 0;
}
div#navigation ul li, div#subnavigation ul li {
div#alphabet ul li {
font: bold 14px/100% sans;
padding: 10px 10px 10px 0px;
margin:0;
@ -74,101 +65,17 @@ div#navigation ul li, div#subnavigation ul li {
border-width: 0px 0px 2px 0px;
border-style: solid;
}
div#navigation ul li:first-child, div#subnavigation ul li:first-child {
div#alphabet ul li:first-child {
border-top: 0;
}
div#navigation ul li:last-child, div#subnavigation ul li:last-child {
div#alphabet ul li:last-child {
border-bottom: 0;
}
div#navigation ul li a, div#subnavigation ul li a {
div#alphabet ul li a {
text-decoration: none;
display: block;
padding: 10px 0px 6px 10px;
}
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;
}
/* Alphabet Navigation
----------------------------------------------------- */
div#alphabet {
width: 100%;
margin: 0;
padding: 0;
}
div#alphabet ul {
list-style:none;
min-width: 900px;
height: 40px;
margin:0;
padding: 0px 0px 0px 16px;
border-bottom: solid 2px #5D835F;
}
div#alphabet ul li {
float:left;
}
div#alphabet 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#alphabet ul li a:hover {
background-color: #C1B398;
}
/* 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;
}

1581
src/data/Web_Basic-Blue.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -942,8 +942,8 @@ class BasePage(object):
fname = "/".join(["styles", _NARRATIVESCREEN])
url2 = self.report.build_url_fname(fname, None, self.up)
# link to Navigation stylesheet
fname = "/".join(["styles", "Web_Alphabet-Vertical.css"])
# Link to Navigation stylesheet
fname = "/".join(["styles", "Web_Navigation-Menus.css"])
url5 = self.report.build_url_fname(fname, None, self.up)
# Link to _NARRATIVEPRINT stylesheet
@ -957,9 +957,12 @@ class BasePage(object):
# create stylesheet and favicon links
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 = url2, type = "text/css", media = "screen", rel = "stylesheet") ]
if self.report.css in ["Web_Basic-Blue.css", "Web_Visually.css"]:
links += Html("link", href= url5, type= "text/css", media="screen", rel="stylesheet")
links += Html("link", href = url3, type = "text/css", media = 'print', rel = "stylesheet")
# add additional meta and link tags
head += meta
@ -2140,14 +2143,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),
Html("th", _("State"), class_ = "ColumnState", inline = True),
Html("th", _("Country"), class_ = "ColumnCtry", inline = True),
Html("th", _("Latitude/ Longitude"), class_ = "ColumnCoordinates", 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)
@ -2160,12 +2165,9 @@ 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)
ml = place.get_main_location()
trow = Html("tr")
tbody += trow
@ -2184,12 +2186,13 @@ 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 data or "&nbsp;" )
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 data or "&nbsp;"
)
# add clearline for proper styling
# add footer section
@ -4918,6 +4921,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']
@ -5129,9 +5133,13 @@ class NavWebReport(Report):
fname = os.path.join(const.DATA_DIR, self.css)
self.copy_file(fname, _NARRATIVESCREEN, "styles")
# copy Navigation stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css")
self.copy_file(fname, "Web_Alphabet-Vertical.css", "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")
@ -5665,11 +5673,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", _("Horizontal -- No Change")],
["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 '
@ -5919,6 +5940,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