Added option to choose which layout the user wants for the Source Page Citation Referents section as either Outline or Drop Down.

svn: r18997
This commit is contained in:
Rob G. Healey 2012-03-03 08:25:12 +00:00
parent 26bbb654d0
commit f76a460b28
13 changed files with 148 additions and 185 deletions

View File

@ -1611,8 +1611,10 @@ class BasePage(object):
user_header += note
# Begin Navigation Menu--
# is the style sheet either Blue or Visually, and menu layout is Drop Down?
if (self.report.css == "Blue" or self.report.css == "Visually"):
# is the style sheet either Basic-Blue or Visually Impaired,
# and menu layout is Drop Down?
if (self.report.css == _("Basic-Blue") or
self.report.css == _("Visually Impaired")):
if self.report.navigation == "dropdown":
body += self.display_drop_menu()
else:
@ -1673,7 +1675,7 @@ class BasePage(object):
index = 0
for rows in range(num_rows):
unordered = Html("ul", class_ = "menu")
unordered = Html("ul", class_ = "menu", id = "dropmenu")
cols = 0
while (cols <= num_cols and index < number_items):
@ -4443,6 +4445,7 @@ class SourcePage(BasePage):
inc_repositories = self.report.options["inc_repository"]
self.navigation = self.report.options['navigation']
self.citationreferents = self.report.options['citationreferents']
# for use in determining if an object is in the report database or not?
(db_family_handles, db_event_handles, db_place_handles, db_repository_handles,
@ -4518,25 +4521,21 @@ class SourcePage(BasePage):
(citation_list, citation_referents_list) = the_lists
if citation_referents_list:
# Drop Down is being used, add Style sheet and javascript file...
if (report.css == "Blue" or report.css == "Visually"):
if self.navigation == "dropdown":
# link- in Animated Drop Down style sheet
fname = "/".join(["css", "narrative-citations.css"])
url = self.report.build_url_fname(fname, None, self.up)
head += Html("link", type = "text/css", href = url, media = "screen",
rel = "stylesheet", inline = True)
# link- in Animated Drop Down style sheet
fname = "/".join(["css", "narrative-dropdown.css"])
url = self.report.build_url_fname(fname, None, self.up)
head += Html("link", type = "text/css", href = url, media = "screen",
rel = "stylesheet", inline = True)
# javascript if the user's browser is IE6?
fname = "/".join(["scripts", "jquery-1.7.1.min.js"])
url = self.report.build_url_fname(fname, None, self.up)
head += Html("script", type = "text/javascript", href = url,
language ="javascript", inline = True)
if self.citationreferents == "DropDown":
fname = "/".join(["scripts", "jquery-1.7.1.min.js"])
url = self.report.build_url_fname(fname, None, self.up)
head += Html("script", type = "text/javascript", href = url,
language ="javascript", inline = True)
# create inline javascript style...
with Html("script", type = "text/javascript", language = "javascript") as jsc:
head += jsc
jsc += """
if ($.browser.msie && $.browser.version.substr(0,1)< 7)
{
@ -6881,6 +6880,7 @@ class NavWebReport(Report):
self.ext = self.options['ext']
self.css = self.options['css']
self.navigation = self.options["navigation"]
self.citationreferents = self.options['citationreferents']
self.title = self.options['title']
@ -7018,6 +7018,9 @@ class NavWebReport(Report):
str(value))
return
# copy all of the neccessary files for NarrativeWeb report...
self.copy_narrated_files()
# Build the person list
ind_list = self.build_person_list()
@ -7027,9 +7030,6 @@ class NavWebReport(Report):
place_list = {}
source_list = {}
# copy all of the neccessary files for NarrativeWeb report...
self.copy_narrated_files()
self.base_pages()
# for use with discovering biological, half, and step siblings for use in display_ind_parents()...
@ -7146,23 +7146,28 @@ class NavWebReport(Report):
elif self.navigation == "Fade":
fname = CSS["Fade-Menus"]["filename"]
elif self.navigation == "dropdown":
fname = CSS["dropdown-Menus"]["filename"]
fname = CSS["DropDown-Menus"]["filename"]
self.copy_file(fname, "narrative-menus.css", "css")
# copy Animated Citations Drop Down Layout if being used, copy its style sheet
# and its associated javascript file?
if (self.css == _("Basic-Blue") or self.css == _("Visually Impaired")):
if self.citationreferents == "DropDown":
fname = CSS["Animated DropDown"]["javascript"]
self.copy_file(fname, "jquery-1.7.1.min.js", "scripts")
if self.citationreferents == "DropDown":
fname = CSS["Animated DropDown"]["filename"]
else:
fname = CSS["Outline"]["filename"]
self.copy_file(fname, "narrative-citations.css", "css")
# copy narrative-maps Style Sheet if Place or Family Map pages are being created?
if (self.placemappages or self.familymappages):
fname = CSS["NarrativeMaps"]["filename"]
self.copy_file(fname, "narrative-maps.css", "css")
# if Drop Down Navigation is being used, copy its style sheet and its javascript file...
if (self.css == "Blue" or self.css == "Visually"):
if self.navigation == "dropdown":
fname = CSS["Animated Dropdown"]["filename"]
self.copy_file(fname, "narrative-dropdown.css", "css")
fname = CSS["Animated Dropdown"]["javascript"]
self.copy_file(fname, "jquery-1.7.1.min.js", "scripts")
# Copy the Creative Commons icon if the Creative Commons
# license is requested
if 0 < self.copyright <= len(_CC):
@ -7818,6 +7823,17 @@ class NavWebOptions(MenuReportOptions):
self.__stylesheet_changed()
_cit_opts = [
(_("Normal Outline Style"), "Outline"),
(_("Drop-Down -- WebKit Browsers Only"), "DropDown")
]
self.__citationreferents = EnumeratedListOption(_("Citation Referents Layout"), _cit_opts[0][1])
for layout in _cit_opts:
self.__citationreferents.add_item(layout[1], layout[0])
self.__citationreferents.set_help(_("Determine the default layout for the "
"Source Page's Citation Referents section"))
addopt("citationreferents", self.__citationreferents)
self.__ancestortree = BooleanOption(_("Include ancestor's tree"), True)
self.__ancestortree.set_help(_('Whether to include an ancestor graph on each individual page'))
addopt( "ancestortree", self.__ancestortree )

View File

@ -9,13 +9,14 @@ DATAFILES = \
ancestortree.css \
behaviour.css \
narrative-maps.css \
Web_Animated-Dropdown.css \
Web_Basic-Ash.css \
Web_Basic-Blue.css \
Web_Basic-Cypress.css \
Web_Basic-Lilac.css \
Web_Basic-Peach.css \
Web_Basic-Spruce.css \
Web_Citations-Animated.css \
Web_Citations-Outline.css \
Web_DropDown-Menus.css \
Web_Fade-Menus.css \
Web_Horizontal-Menus.css \

View File

@ -367,21 +367,6 @@ table.IndividualList td.ColumnSurname {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: lower-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
----------------------------------------------------- */

View File

@ -405,21 +405,6 @@ table.IndividualList td.ColumnSurname {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
----------------------------------------------------- */

View File

@ -406,21 +406,6 @@ table.IndividualList td.ColumnSurname {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
----------------------------------------------------- */

View File

@ -406,21 +406,6 @@ table.IndividualList td.ColumnSurname {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
----------------------------------------------------- */

View File

@ -406,21 +406,6 @@ table.IndividualList td.ColumnSurname {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
----------------------------------------------------- */

View File

@ -0,0 +1,46 @@
/*
# encoding: utf-8
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright 2012 Rob G. Healey <robhealey1@gmail.com>
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
******************************************************
GRAMPS Cascading Style Sheet
Style Name: Web_Citations-Outline.css
******************************************************
# $Id$
Source Citations Outline styles
------------------------------------------------------ */
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}

View File

@ -41,7 +41,7 @@ div#header {
/* Drop Down Navigation Menu
------------------------------------------------------ */
#dropmenu {
ul#dropmenu {
width: 100%;
margin: 0 auto;
padding: 10px 0 0 0;
@ -59,12 +59,12 @@ div#header {
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 2px 1px #9c9c9c;
}
#dropmenu li {
ul#dropmenu li {
float: left;
padding: 0 0 10px 0;
position: relative;
}
#dropmenu a {
ul#dropmenu a {
float: left;
height: 25px;
padding: 0 25px;
@ -74,21 +74,21 @@ div#header {
text-decoration: none;
text-shadow: 0 1px 0 #000;
}
#dropmenu li:hover > a {
ul#dropmenu li:hover > a {
color: #fafafa
}
*html #dropmenu li a:hover /* IE6 */
*html ul#dropmenu li a:hover /* IE6 */
{
color: #fafafa
}
#dropmenu li:hover > ul {
ul#dropmenu li:hover > ul {
display: block
}
/* Sub-menu
------------------------------------------------------ */
#dropmenu ul {
ul#dropmenu ul {
list-style: none;
margin: 0;
padding: 0;
@ -107,7 +107,7 @@ div#header {
-moz-border-radius: 5px;
border-radius: 5px;
}
#dropmenu ul li {
ul#dropmenu ul li {
float: none;
margin: 0;
padding: 0;
@ -116,12 +116,12 @@ div#header {
-webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
}
#dropmenu ul li:last-child {
ul#dropmenu ul li:last-child {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
#dropmenu ul a {
ul#dropmenu ul a {
padding: 10px;
height: auto;
line-height: 1;
@ -130,17 +130,17 @@ div#header {
float: none;
text-transform: none;
}
*html #dropmenu ul a /* IE6 */
*html ul#dropmenu ul a /* IE6 */
{
height: 10px;
width: 150px;
}
*:first-child+html #dropmenu ul a /* IE7 */
*:first-child+html ul#dropmenu ul a /* IE7 */
{
height: 10px;
width: 150px;
}
#dropmenu ul a:hover {
ul#dropmenu ul a:hover {
background: #0186ba;
background: -moz-linear-gradient(#04acec, #0186ba);
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
@ -149,11 +149,11 @@ div#header {
background: -ms-linear-gradient(#04acec, #0186ba);
background: linear-gradient(#04acec, #0186ba);
}
#dropmenu ul li:first-child a {
ul#dropmenu ul li:first-child a {
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
#dropmenu ul li:first-child a:after {
ul#dropmenu ul li:first-child a:after {
content: '';
position: absolute;
left: 30px;
@ -164,17 +164,17 @@ div#header {
border-right: 5px solid transparent;
border-bottom: 8px solid #444;
}
#dropmenu ul li:first-child a:hover:after {
ul#dropmenu ul li:first-child a:hover:after {
border-bottom-color: #04acec
}
#dropmenu ul li:last-child a {
ul#dropmenu ul li:last-child a {
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
/* Clear floated elements
------------------------------------------------------ */
#dropmenu:after {
ul#dropmenu:after {
visibility: hidden;
display: block;
font-size: 0;
@ -183,8 +183,8 @@ div#header {
height: 0;
}
* html #dropmenu { zoom: 1; } /* IE6 */
*:first-child+html #dropmenu { zoom: 1; } /* IE7 */
* html ul#dropmenu { zoom: 1; } /* IE6 */
*:first-child+html ul#dropmenu { zoom: 1; } /* IE7 */
/* Alphabet Navigation and Year Menu
------------------------------------------------------ */

View File

@ -358,21 +358,6 @@ table#SortByCount thead th.ColumnQuantity a:after {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Contact
-----------------------------------------------------------------*/

View File

@ -508,21 +508,6 @@ table.attrlist tbody tr td.ColumnSources {
div#SourceDetail {
margin: 0 auto;
}
div#SourceCitationReferents ul.Col1 {
list-style-type: decimal
}
div#SourceCitationReferents ul.Col2 {
list-style-type: upper-alpha
}
div#SourceCitationReferents ul.Col3 {
list-style-type: lower-alpha
}
div#SourceCitationReferents ul.Col4 {
list-style-type: upper-roman
}
div#SourceCitationReferents ul.Col5 {
list-style-type: disc
}
/* Relationships
================================================= */

View File

@ -34,12 +34,12 @@ def make_css_dict(tup):
"""
return {
"id": tup[0],
"user": tup[1],
"translation": tup[2],
"filename": tup[3],
"navigation": tup[4],
"images": tup[5],
"javascript": tup[6],
"user" : tup[1],
"translation" : tup[2],
"filename" : tup[3],
"navigation" : tup[4],
"images" : tup[5],
"javascript" : tup[6],
}
def load_on_reg(dbstate, uistate, plugin):
@ -53,7 +53,8 @@ def load_on_reg(dbstate, uistate, plugin):
path_js = partial(os.path.join, dir, "js")
CSS_FILES = [
# id, user selectable?, translated_name, fullpath, navigation target name, images, javascript
# id, user selectable?, translated_name, option name, fullpath,
# navigation target name, images, javascript
# "default" is used as default
# Basic Ash style sheet
@ -131,10 +132,14 @@ def load_on_reg(dbstate, uistate, plugin):
path_css('Web_Fade-Menus.css'), None, [], [] ],
# WebKit/ Html5/ CSS3 Animated Drop Down Style Sheet
["Animated Dropdown", 0, "Animated Dropdown",
path_css("Web_Animated-Dropdown.css"), None, [],
["Animated DropDown", 0, "Animated DropDown",
path_css("Web_Citations-Animated.css"), None, [],
path_js("jquery-1.7.1.min.js") ],
# Source Page Citations Referents Outline Style sheet...
["Outline", 0, "Outline Citations",
path_css("Web_Citations-Outline.css"), None, [], [] ],
# WebKit/ Html5/ CSS3 Drop Down Navigation Menus Style Sheet
["DropDown-Menus", 0, "Drop Down Menus",
path_css("Web_DropDown-Menus.css"), None, [], [] ],
@ -178,7 +183,7 @@ def process_list(data):
if file:
path, filename = os.path.split(file)
# is there a override file in the VERSION_DIR/webstuff?
# eg, ~/.gramps/gramps33/webstuff/Web_Nebraska.css
# eg, ~/.gramps/gramps34/webstuff/Web_Nebraska.css
# if so, replace this one:
override = os.path.join(const.VERSION_DIR, "webstuff", filename)
if os.path.exists(override):