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 = [ CSS_FILES = [
# First is used as default selection. # First is used as default selection.
[_("Basic-Ash"), 'Web_Basic-Ash.css'], [_("Basic-Ash"), 'Web_Basic-Ash.css'],
[_("Basic-Blue"), 'Web_Basic-Blue.css'],
[_("Basic-Cypress"), 'Web_Basic-Cypress.css'], [_("Basic-Cypress"), 'Web_Basic-Cypress.css'],
[_("Basic-Lilac"), 'Web_Basic-Lilac.css'], [_("Basic-Lilac"), 'Web_Basic-Lilac.css'],
[_("Basic-Peach"), 'Web_Basic-Peach.css'], [_("Basic-Peach"), 'Web_Basic-Peach.css'],

View File

@ -30,16 +30,7 @@ see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
# $Id: $ # $Id: $
Body Element Header
----------------------------------------------------- */
body {
font-family: Arial, sans, sans-serif, Helvetica;
color: #000;
background-color: #FFF;
padding: 60px 0px 0px 108px;
}
/* Header
----------------------------------------------------- */ ----------------------------------------------------- */
#header { #header {
position: fixed; position: fixed;
@ -49,24 +40,24 @@ body {
width: 100%; width: 100%;
} }
/* Navigation/ SubNavigation /* Alphabet Navigation
----------------------------------------------------- */ ----------------------------------------------------- */
div#navigation, div#subnavigation { div#alphabet {
position: fixed; position: fixed;
left: 0px; left: 4px;
width: 108px; width: 40px;
height: 500px; height: 326px;
overflow-x: auto; overflow-x: auto;
border-width: 2px 4px 2px 4px; border-width: 2px 4px 2px 4px;
border-style: solid; border-style: solid;
} }
div#navigation ul, div#subnavigation ul { div#alphabet ul {
display: inline; display: inline;
list-style: none; list-style: none;
padding: 0px 9px 0px 9px; padding: 0px 9px 0px 9px;
margin: 0; margin: 0;
} }
div#navigation ul li, div#subnavigation ul li { div#alphabet ul li {
font: bold 14px/100% sans; font: bold 14px/100% sans;
padding: 10px 10px 10px 0px; padding: 10px 10px 10px 0px;
margin:0; margin:0;
@ -74,101 +65,17 @@ div#navigation ul li, div#subnavigation ul li {
border-width: 0px 0px 2px 0px; border-width: 0px 0px 2px 0px;
border-style: solid; border-style: solid;
} }
div#navigation ul li:first-child, div#subnavigation ul li:first-child { div#alphabet ul li:first-child {
border-top: 0; border-top: 0;
} }
div#navigation ul li:last-child, div#subnavigation ul li:last-child { div#alphabet ul li:last-child {
border-bottom: 0; border-bottom: 0;
} }
div#navigation ul li a, div#subnavigation ul li a { div#alphabet ul li a {
text-decoration: none; text-decoration: none;
display: block; display: block;
padding: 10px 0px 6px 10px; 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 { div#alphabet ul li a:hover {
background-color: #C1B398; 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]) fname = "/".join(["styles", _NARRATIVESCREEN])
url2 = self.report.build_url_fname(fname, None, self.up) url2 = self.report.build_url_fname(fname, None, self.up)
# link to Navigation stylesheet # Link to Navigation stylesheet
fname = "/".join(["styles", "Web_Alphabet-Vertical.css"]) fname = "/".join(["styles", "Web_Navigation-Menus.css"])
url5 = self.report.build_url_fname(fname, None, self.up) url5 = self.report.build_url_fname(fname, None, self.up)
# Link to _NARRATIVEPRINT stylesheet # Link to _NARRATIVEPRINT stylesheet
@ -957,9 +957,12 @@ class BasePage(object):
# create stylesheet and favicon links # 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 = url1, type = "text/css", media = "screen", rel = "stylesheet"),
Html("link", href = url2, 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")
] 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 # add additional meta and link tags
head += meta head += meta
@ -2140,14 +2143,16 @@ class PlaceListPage(BasePage):
thead = Html("thead") thead = Html("thead")
table += thead table += thead
trow = Html("tr") + ( 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)
)
thead += trow 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) sort = Sort.Sort(db)
handle_list = sorted(place_handles, key = sort.by_place_title_key) handle_list = sorted(place_handles, key = sort.by_place_title_key)
@ -2160,12 +2165,9 @@ class PlaceListPage(BasePage):
for handle in handle_list: for handle in handle_list:
place = db.get_place_from_handle(handle) place = db.get_place_from_handle(handle)
place_title = ReportUtils.place_name(db, handle) place_title = ReportUtils.place_name(db, handle)
ml = place.get_main_location()
if not place_title:
continue
letter = first_letter(place_title) letter = first_letter(place_title)
ml = place.get_main_location()
trow = Html("tr") trow = Html("tr")
tbody += trow tbody += trow
@ -2185,11 +2187,12 @@ class PlaceListPage(BasePage):
class_ = "ColumnName") class_ = "ColumnName")
trow.extend( Html("td", data, class_ = "Column" + colclass, inline = True) trow.extend( Html("td", data, class_ = "Column" + colclass, inline = True)
for (colclass, data) in [ for colclass, data in [
["State", ml.state], ["State", ml.state],
["Country", ml.country], ["Country", ml.country],
["Coordinates", place.lat + "," + place.long] ] ["Coordinates", (place.lat + ", " + place.long)] ]
if data or "&nbsp;" ) if data or "&nbsp;"
)
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
@ -4918,6 +4921,7 @@ class NavWebReport(Report):
self.target_path = self.options['target'] self.target_path = self.options['target']
self.ext = self.options['ext'] self.ext = self.options['ext']
self.css = self.options['css'] self.css = self.options['css']
self.navigation = self.options["navigation"]
self.title = self.options['title'] self.title = self.options['title']
self.inc_gallery = self.options['gallery'] self.inc_gallery = self.options['gallery']
@ -5129,9 +5133,13 @@ class NavWebReport(Report):
fname = os.path.join(const.DATA_DIR, self.css) fname = os.path.join(const.DATA_DIR, self.css)
self.copy_file(fname, _NARRATIVESCREEN, "styles") self.copy_file(fname, _NARRATIVESCREEN, "styles")
# copy Navigation stylesheet # 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") fname = os.path.join(const.DATA_DIR, "Web_Alphabet-Vertical.css")
self.copy_file(fname, "Web_Alphabet-Vertical.css", "styles") self.copy_file(fname, "Web_Navigation-Menus.css", "styles")
# copy printer stylesheet # copy printer stylesheet
fname = os.path.join(const.DATA_DIR, "Web_Print-Default.css") 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")) cright.set_help( _("The copyright to be used for the web files"))
menu.add_option(category_name, "cright", cright) 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: for style in CSS_FILES:
css.add_item(style[1], style[0]) self.__css.add_item(style[1], style[0])
css.set_help( _('The stylesheet to be used for the web page')) self.__css.set_help( _('The stylesheet to be used for the web pages'))
menu.add_option(category_name, "css", css) 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 = BooleanOption(_("Include ancestor graph"), True)
self.__graph.set_help(_('Whether to include an ancestor graph ' self.__graph.set_help(_('Whether to include an ancestor graph '
@ -5919,6 +5940,17 @@ class NavWebOptions(MenuReportOptions):
# The rest don't # The rest don't
self.__pid.set_available(False) 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): def __graph_changed(self):
""" """
Handle enabling or disabling the ancestor graph Handle enabling or disabling the ancestor graph