This file is part of the GRAMPS program.
@@ -31,21 +31,21 @@ 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
GRAMPS. If not, see .
---------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
Color Palette
---------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
gray #A7A7A7
red #520
black #000
white #FFF
----------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
NarrativeWeb Styles
---------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
- General Elements
+ General Elements
----------------------------------------------------- */
body {
@@ -419,7 +419,7 @@ body#ThumbnailPreview div#references table.infolist tbody tr td.ColumnName {
width: 90%;
}
-/* Contact
+/* Contact
----------------------------------------------------- */
#researcher {
margin:16pt 0 0 0;
@@ -456,13 +456,13 @@ body#ThumbnailPreview div#references table.infolist tbody tr td.ColumnName {
clear:left;
}
-/* Subsections
+/* Subsections
----------------------------------------------------- */
#Home, #Introduction, #Download, #Contact {
padding:3em 20px;
}
-/* Subsections : Events
+/* Subsections : Events
----------------------------------------------------- */
#IndividualDetail .ColumnValue {
padding:4pt 0;
@@ -472,7 +472,7 @@ body#ThumbnailPreview div#references table.infolist tbody tr td.ColumnName {
margin:1pt 0 0 18pt;
}
-/* Subsections : Gallery
+/* Subsections : Gallery
----------------------------------------------------- */
#indivgallery h4 {
margin-bottom:1em;
@@ -532,7 +532,7 @@ table.attrlist tbody tr td.ColumnSources {
width: 10%;
}
-/* Subsections : Pedigree
+/* Subsections : Pedigree
----------------------------------------------------- */
#pedigree a {
text-decoration:none;
@@ -574,7 +574,7 @@ table.attrlist tbody tr td.ColumnSources {
font-weight:bold;
}
-/* Subsections : Ancestors Tree
+/* Subsections : Ancestors Tree
----------------------------------------------------- */
#tree {
page-break-before:always;
@@ -674,7 +674,7 @@ p#createdate {
display: none;
}
-/* Calendar Styles
+/* Calendar Styles
-------------------------------------------------------------------------------------------- */
/* Calendar : General */
body#WebCal h1#SiteTitle {
@@ -791,9 +791,9 @@ body#WebCal a {
}
/* Calendar : Previous-Next Month */
-.calendar tbody tr td.previous,
-.calendar tbody tr td.next,
-.calendar tbody tr td.previous div.date,
+.calendar tbody tr td.previous,
+.calendar tbody tr td.next,
+.calendar tbody tr td.previous div.date,
.calendar tbody tr td.next div.date {
font-weight:normal;
font-size:12pt;
diff --git a/data/css/Web_Vertical-Menus.css b/data/css/Web_Vertical-Menus.css
index ef3c2339e..c5427ae9d 100644
--- a/data/css/Web_Vertical-Menus.css
+++ b/data/css/Web_Vertical-Menus.css
@@ -10,7 +10,7 @@
# 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,
+# 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.
@@ -20,17 +20,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
-**************************************************************************************************
+*******************************************************************************
GRAMPS Cascading Style Sheet
Style Name: Web_Navigation-Vertical.css Stylesheet
-***************************************************************************************************
+*******************************************************************************
# $Id: Web_Navigation-Vertical.css 15241 2010-04-19 11:07:00Z robhealey1 $
Body Element
----------------------------------------------------- */
-body { background: -webkit-gradient
- (linear, left top, left bottom, from(#ccc), to(#fff));
+body {
+ background: -webkit-gradient (linear, left top, left bottom,
+ from(#ccc), to(#fff));
color: #000;
padding: 60px 0px 0px 146px;
}
diff --git a/data/css/Web_Visually.css b/data/css/Web_Visually.css
index 2e7bf8e0a..54e77e89a 100644
--- a/data/css/Web_Visually.css
+++ b/data/css/Web_Visually.css
@@ -10,7 +10,7 @@
# 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,
+# 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.
@@ -20,15 +20,15 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
-**************************************************************************************************
+*******************************************************************************
GRAMPS Cascading Style Sheet
Style Name: Visually Impaired Stylesheet
Style Author: Jason M. Simanek (2008)
-***************************************************************************************************
+*******************************************************************************
---------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
Color Palette
---------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
brown dark #453619, #542
brown light #C1B398
gray #696969
@@ -47,7 +47,7 @@ Females Web_Gender_Female.png
NarrativeWeb Styles
--------------------------------------------------------------------------------------------- */
+---------------------------------------------------------------------------- */
div#alphabet ul li {
background-color: #6AF364;
}
@@ -96,8 +96,6 @@ img {
background:none;
}
.content {
- overflow: auto;
- width:965px;
margin:0 auto;
padding-bottom: .2em;
}
@@ -349,7 +347,7 @@ table.infolist tbody tr td.ColumnPartner a {
table.infolist tbody tr td.ColumnParents {
font-size:.9em;
}
-table.infolist tbody tr td.ColumnParents span.father,
+table.infolist tbody tr td.ColumnParents span.father,
table.infolist tbody tr td.ColumnParents span.mother {
display:block;
}
@@ -366,7 +364,7 @@ table.infolist tbody tr td.ColumnParents span.mother:before {
#SurnameDetail p#description {
padding-top:0;
}
-table.surnamelist thead tr th.ColumnSurname,
+table.surnamelist thead tr th.ColumnSurname,
#Surnames table.surnamelist tbody tr td.ColumnSurname {
width:50%;
}
@@ -391,11 +389,11 @@ table.surnamelist tbody tr td.ColumnLetter a {
table.surnamelist tbody tr td.ColumnSurname {
background-color: #FFF;
}
-table#SortByName thead tr th.ColumnSurname,
+table#SortByName thead tr th.ColumnSurname,
table#SortByCount thead tr th.ColumnQuantity {
background-color: #C1B398;
}
-table#SortByName thead tr th.ColumnSurname a:after,
+table#SortByName thead tr th.ColumnSurname a:after,
table#SortByCount thead tr th.ColumnQuantity a:after {
content:" ↓";
}
@@ -443,7 +441,7 @@ table.surname tbody tr td.ColumnPartner a {
display:block;
padding:.6em 10px .6em 0px;
}
-table.surname thead tr th.ColumnParents,
+table.surname thead tr th.ColumnParents,
table.surname tbody tr td.ColumnParents {
width:25%;
}
@@ -465,7 +463,7 @@ div#Individuals table.IndividualList tbody tr td a {
display: block;
padding: .6em 10px;
}
-div#Individuals table.IndividualList tbody tr td.ColumnSurname a:hover,
+div#Individuals table.IndividualList tbody tr td.ColumnSurname a:hover,
div#Individuals table.IndividualList tbody tr td.ColumnSurname a:active {
cursor:default;
color: #000;
@@ -666,7 +664,7 @@ div#EventList table.alphaevent tbody tr td.ColumnDate {
div#EventList table.alphaevent tbody tr td.ColumnPerson {
width: 60%;
}
-div#EventList table.alphaevent tbody tr td.ColumnPerson span.father,
+div#EventList table.alphaevent tbody tr td.ColumnPerson span.father,
div#EventList table.alphaevent tbody tr td.ColumnPerson span.mother {
display:block;
}
@@ -696,7 +694,7 @@ div#EventDetail table.eventlist tbody tr td.ColumnDate {
div#EventDetail table.eventlist tbody tr td.ColumnPerson {
background-color: #D8F3D6;
}
-
+
/* Events
----------------------------------------------------- */
#EventList table.infolist tr.BeginType td {
@@ -709,7 +707,7 @@ div#EventDetail table.eventlist tbody tr td.ColumnPerson {
#EventDetail table.infolist tr td a {
display: inline;
}
-#EventList table.infolist tr td span.father,
+#EventList table.infolist tr td span.father,
#EventList table.infolist tr td span.mother,
#EventDetail table.infolist tr td span.father,
#EventDetail table.infolist tr td span.mother {
@@ -731,6 +729,20 @@ div#EventDetail table.eventlist tbody tr td.ColumnPerson {
#EventDetail table.infolist tr td span.mother:last-child:after {
content: "";
}
+#IndividualDetail div table.eventlist td.ColumnSources {
+ width: 5%;
+}
+#IndividualDetail div table.eventlist td.ColumnDate {
+ width: 15%;
+}
+#IndividualDetail div table.eventlist td.ColumnEvent {
+ width: 8%;
+}
+#IndividualDetail div table.eventlist td.ColumnEvent,
+#IndividualDetail div table.eventlist td.ColumnDate,
+#IndividualDetail div table.eventlist td.ColumnPlace {
+ font-weight: bold;
+}
/* Gallery
----------------------------------------------------- */
@@ -899,7 +911,7 @@ body#ThumbnailPreview div#references table.infolist tbody tr td.ColumnName {
text-decoration:none;
}
-/* Download
+/* Download
----------------------------------------------------- */
div#Download {
margin: 0;
@@ -912,7 +924,7 @@ div#Download table.download {
div#Download table.download tbody tr#Row02 {
border-bottom: solid 1px #000;
}
-div#Download table.download tbody tr td {
+div#Download table.download tbody tr td {
border: solid 1px #000;
text-align: left;
padding: 5px 0px 5px 0px;
@@ -1197,6 +1209,7 @@ div#families table.infolist tbody tr td.ColumnValue {
}
div#families table.infolist tbody tr td.ColumnValue p {
margin-top:0;
+ margin-left:0;
}
div#families table.infolist tbody tr td.ColumnValue ol {
margin:0;
@@ -1489,7 +1502,7 @@ body#WebCal {
vertical-align: top;
height: 2em;
}
-.calendar thead tr th.weekend,
+.calendar thead tr th.weekend,
.calendar thead tr th.weekday {
font-style:italic;
color: #000;
@@ -1581,9 +1594,9 @@ body#WebCal {
}
/* Calendar : Previous-Next Month */
-.calendar tbody tr td.previous,
-.calendar tbody tr td.next,
-.calendar tbody tr td.previous div.date,
+.calendar tbody tr td.previous,
+.calendar tbody tr td.next,
+.calendar tbody tr td.previous div.date,
.calendar tbody tr td.next div.date {
color: #333;
background-color: #D8F3D6;
diff --git a/data/css/ancestortree.css b/data/css/ancestortree.css
index 3a27b6b17..0fc6b27ac 100644
--- a/data/css/ancestortree.css
+++ b/data/css/ancestortree.css
@@ -33,13 +33,14 @@ Unknown #000
===== Web Graphics =====
Males Web_Gender_Male.png
Females Web_Gender_Female.png
-# -------------------------------------------------------------------------- #
+# -------------------------------------------------------------------------- */
/* Subsections : Ancestors Tree -------------------------------------------- */
#tree {
page-break-before:always;
margin:0;
padding:0;
background:none;
+ overflow-x:auto;
}
#treeContainer {
position:relative;
diff --git a/data/css/narrative-maps.css b/data/css/narrative-maps.css
index 0fb9d1007..74f12726e 100644
--- a/data/css/narrative-maps.css
+++ b/data/css/narrative-maps.css
@@ -64,13 +64,13 @@ div#FamilyMapDetail div#references table.infolist {
width: 100%;
}
div#FamilyMapDetail div#references table.infolist tbody tr td.ColumnPlace {
- width: 40%;
+ width: 70%;
}
/* Subsection: popup
------------------------------------------------------ */
-.ol-popup {
+#map_canvas .ol-popup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
@@ -82,7 +82,7 @@ div#FamilyMapDetail div#references table.infolist tbody tr td.ColumnPlace {
left: -50px;
min-width: 450px;
}
-.ol-popup:after, .ol-popup:before {
+#map_canvas .ol-popup:after, #map_canvas .ol-popup:before {
top: 100%;
border: solid transparent;
height: 0;
@@ -90,24 +90,64 @@ div#FamilyMapDetail div#references table.infolist tbody tr td.ColumnPlace {
position: absolute;
pointer-events: none;
}
-.ol-popup:after {
+#map_canvas .ol-popup:after {
border-top-color: white;
border-width: 10px;
left: 48px;
margin-left: -10px;
}
-.ol-popup:before {
+#map_canvas .ol-popup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 48px;
margin-left: -11px;
}
-.ol-popup-closer {
+#map_canvas .ol-popup-closer {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
-.ol-popup-closer:after {
+#map_canvas .ol-popup-closer:after {
content: "✖";
}
+#popup-content {
+ max-height: 250px;
+ overflow-y: auto;
+}
+#map_canvas .ol-control {
+ position: absolute;
+ background-color: rgba(255,255,255,0.1);
+ bottom: .1em;
+ left: .1em;
+ height: 4%;
+ width: 100%;
+ margin-top: 1px;
+ margin-bottom: 1px;
+ padding-left: 1px;
+}
+#map_canvas .ol-rotate {
+ display: none;
+}
+#map_canvas .ol-zoom, #map_canvas .ol-zoom-in, #map_canvas .ol-zoom-out {
+ top: .5em;
+ left: .5em;
+ border-left-width: 1px;
+ padding-left: 1px;
+ padding-right: 1px;
+}
+#map_canvas .ol-attribution ul {
+ list-style-type: none;
+ font-size:0.8em;
+ float: left;
+ margin-top: 1px;
+ margin-bottom: 1px;
+ padding-left: 5px;
+}
+#map_canvas .ol-attribution li {
+ float: left;
+ padding-left: 5px;
+}
+#map_canvas .ol-attribution button {
+ display: none;
+}
diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py
index ee950e590..eb91a1179 100644
--- a/gramps/plugins/webreport/basepage.py
+++ b/gramps/plugins/webreport/basepage.py
@@ -60,6 +60,7 @@ import logging
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.lib import (FamilyRelType, NoteType, NameType, Person,
UrlType, Name, PlaceType, EventRoleType,
+ Source, Attribute, Media, Repository, Event,
Family, Citation, Place, Date)
from gramps.gen.lib.date import Today
from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE
@@ -130,6 +131,8 @@ class BasePage: # pylint: disable=C1001
self.create_media = report.options['gallery']
self.create_unused_media = report.options['unused']
self.create_thumbs_only = report.options['create_thumbs_only']
+ self.create_images_index = report.options['create_images_index']
+ self.create_thumbs_index = report.options['create_thumbs_index']
self.inc_families = report.options['inc_families']
self.inc_events = report.options['inc_events']
self.usecms = report.options['usecms']
@@ -351,10 +354,9 @@ class BasePage: # pylint: disable=C1001
if family_events:
trow = Html("tr") + (
Html("td", " ", class_="ColumnType", inline=True),
- Html("td", " ", class_="ColumnAttribute", inline=True),
Html("td", self.format_family_events(family_events,
place_lat_long),
- class_="ColumnValue")
+ class_="ColumnValue", colspan=2)
)
table = trow
@@ -377,13 +379,13 @@ class BasePage: # pylint: disable=C1001
childlist = family.get_child_ref_list()
if childlist:
trow = Html("tr") + (
- Html("td", " ", class_="ColumnType", inline=True),
Html("td", self._("Children"), class_="ColumnAttribute",
inline=True)
)
table = table + trow if table is not None else trow
- tcell = Html("td", class_="ColumnValue", close=False)
+ tcell = Html("td", class_="ColumnValue Child", close=False,
+ colspan=2)
trow += tcell
with Html("table", class_="infolist eventlist") as table2:
@@ -517,7 +519,8 @@ class BasePage: # pylint: disable=C1001
for (data, colclass) in [
(str(attr.get_type()), "ColumnType"),
(attr.get_value(), "ColumnValue"),
- (self.dump_notes(attr.get_note_list()), "ColumnNotes"),
+ (self.dump_notes(attr.get_note_list(), Attribute),
+ "ColumnNotes"),
(self.get_citation_links(attr.get_citation_list()),
"ColumnSources")
]
@@ -610,7 +613,7 @@ class BasePage: # pylint: disable=C1001
htmllist.extend(Html('p') + linelist)
return htmllist
- def dump_notes(self, notelist):
+ def dump_notes(self, notelist, parent=None):
"""
dump out of list of notes with very little elements of its own
@@ -621,11 +624,24 @@ class BasePage: # pylint: disable=C1001
# begin unordered list
notesection = Html("div")
+ idx = 0
for notehandle in notelist:
this_note = self.r_db.get_note_from_handle(notehandle)
+ title = self._(this_note.type.xml_str())
if this_note is not None:
- notesection.extend(Html("i", self._(this_note.type.xml_str()),
- class_="NoteType"))
+ idx += 1
+ if len(notelist) > 1:
+ if self.default_note(parent, int(this_note.type)):
+ title_text = self._("Note: %s") % str(idx)
+ else:
+ title = " (" + title + ")"
+ title_text = self._("Note: %s") % str(idx) + title
+ else:
+ if self.default_note(parent, int(this_note.type)):
+ title_text = self._("Note")
+ else:
+ title_text = title
+ notesection.extend(Html("i", title_text, class_="NoteType"))
notesection.extend(self.get_note_format(this_note, True))
return notesection
@@ -682,7 +698,7 @@ class BasePage: # pylint: disable=C1001
etype,
event_gid,
uplink) if hyperlink else etype
- trow += Html("td", event_hyper, class_="ColumnEvent")
+ trow += Html("td", event_hyper, class_="ColumnEvent", rowspan=2)
# get event data
event_data = self.get_event_data(event, event_ref, uplink)
@@ -694,7 +710,6 @@ class BasePage: # pylint: disable=C1001
)
trow2 = Html("tr")
- trow2 += Html("td", "", class_="ColumnEvent")
# get event source references
srcrefs = self.get_citation_links(event.get_citation_list()) or " "
trow += Html("td", srcrefs, class_="ColumnSources", rowspan=2)
@@ -703,7 +718,7 @@ class BasePage: # pylint: disable=C1001
notelist = event.get_note_list()[:] # we don't want to modify
# cached original
notelist.extend(event_ref.get_note_list())
- htmllist = self.dump_notes(notelist)
+ htmllist = self.dump_notes(notelist, Event)
# if the event or event reference has an attribute attached to it,
# get the text and format it correctly?
@@ -720,7 +735,7 @@ class BasePage: # pylint: disable=C1001
#also output notes attached to the attributes
notelist = attr.get_note_list()
if notelist:
- htmllist.extend(self.dump_notes(notelist))
+ htmllist.extend(self.dump_notes(notelist, Event))
trow2 += Html("td", htmllist, class_="ColumnNotes", colspan=3)
@@ -1387,9 +1402,9 @@ class BasePage: # pylint: disable=C1001
del page[0]
# Header constants
- _meta1 = 'name ="viewport" content="width=device-width; '
- _meta1 += 'height=device-height; initial-scale=1.0; '
- _meta1 += 'minimum-scale=0.5; maximum-scale=10.0; user-scalable=yes"'
+ _meta1 = 'name ="viewport" content="width=device-width, '
+ _meta1 += 'height=device-height, initial-scale=1.0, '
+ _meta1 += 'minimum-scale=0.5, maximum-scale=10.0, user-scalable=yes"'
_meta2 = 'name ="apple-mobile-web-app-capable" content="yes"'
_meta3 = 'name="generator" content="%s %s %s"' % (
PROGRAM_NAME, VERSION, URL_HOMEPAGE)
@@ -1417,13 +1432,21 @@ class BasePage: # pylint: disable=C1001
# create stylesheet and favicon links
links = Html("link", type="image/x-icon",
- href=url4, rel="shortcut icon") + (
- Html("link", type="text/css", href=url3,
- media='print', rel="stylesheet", indent=False),
- Html("link", type="text/css", href=url2,
- media="screen", title=self._("Default"),
- rel="stylesheet", indent=False),
- )
+ href=url4, rel="shortcut icon")
+ # attach the ancestortree style sheet if ancestor
+ # graph is being created?
+ if self.report.options["ancestortree"]:
+ if self.usecms:
+ fname = "/".join([self.target_uri, "css", "ancestortree.css"])
+ else:
+ fname = "/".join(["css", "ancestortree.css"])
+ url5 = self.report.build_url_fname(fname, None, self.uplink)
+ links += Html("link", type="text/css", href=url5,
+ media="screen", rel="stylesheet", indent=False)
+ links += Html("link", type="text/css", href=url3,
+ media='print', rel="stylesheet", indent=False)
+ links += Html("link", type="text/css", href=url2,
+ media="screen", rel="stylesheet", indent=False)
# create all alternate stylesheets
# Cannot use it on local files (file://)
for css_f in CSS:
@@ -1435,7 +1458,7 @@ class BasePage: # pylint: disable=C1001
urlx = self.report.build_url_fname(fname, None,
self.uplink)
links += Html("link", rel="alternate stylesheet",
- title=css_f, indent=False,
+ title=self._(css_f), indent=False,
media="screen", type="text/css",
href=urlx)
@@ -1463,13 +1486,11 @@ class BasePage: # pylint: disable=C1001
body += outerwrapperdiv
# begin header section
- #headerdiv = Html("div", id='header') + (
headerdiv = Html("div", id='header') + (
- Html("≡")) + (
- Html("h1", html_escape(self.title_str),
+ Html(""))
+ headerdiv += Html("h1", html_escape(self.title_str),
id="SiteTitle", inline=True)
- )
outerwrapperdiv += headerdiv
header_note = self.report.options['headernote']
@@ -1544,12 +1565,15 @@ class BasePage: # pylint: disable=C1001
('places', self._("Places"), self.report.inc_places),
('sources', self._("Sources"), self.report.inc_sources),
('repositories', self._("Repositories"), inc_repos),
- ('media', self._("Media"), _create_media_link),
- ('thumbnails', self._("Thumbnails"), self.create_media),
+ ('media', self._("Media"), self.create_images_index and
+ self.report.inc_gallery and not self.report.create_thumbs_only),
+ ('thumbnails', self._("Thumbnails"), self.create_thumbs_index and
+ self.report.inc_gallery),
('download', self._("Download"), self.report.inc_download),
("addressbook", self._("Address Book"),
self.report.inc_addressbook),
('contact', self._("Contact"), self.report.use_contact),
+ ('updates', self._("Updates"), self.report.inc_updates),
('statistics', self._("Statistics"), self.report.inc_stats),
(self.target_cal_uri, self._("Web Calendar"), self.usecal)
]
@@ -2009,10 +2033,12 @@ class BasePage: # pylint: disable=C1001
# Begin hyperlink. Description is given only for
# the purpose of the alt tag in img element
- snapshot += self.media_link(photo_handle, newpath,
- descr,
- uplink=self.uplink,
- usedescr=False)
+ if self.create_images_index:
+ snapshot += self.media_link(photo_handle,
+ newpath,
+ descr,
+ uplink=self.uplink,
+ usedescr=False)
except (IOError, OSError) as msg:
self.r_user.warn(_("Could not add photo to page"),
@@ -2099,11 +2125,39 @@ class BasePage: # pylint: disable=C1001
# return indivgallery division to its caller
return section
- def display_note_list(self, notelist=None):
+ def default_note(self, parent, notetype):
+ """
+ return true if the notetype is the same as the parent
+
+ @param: parent -- The object (Person, Family, Media,...)
+ @param: notetype -- The type for the current note
+ """
+ if parent == Person and notetype == NoteType.PERSON:
+ return True
+ elif parent == Family and notetype == NoteType.FAMILY:
+ return True
+ elif parent == Media and notetype == NoteType.MEDIA:
+ return True
+ elif parent == Repository and notetype == NoteType.REPO:
+ return True
+ elif parent == Source and notetype == NoteType.SOURCE:
+ return True
+ elif parent == Event and notetype == NoteType.EVENT:
+ return True
+ elif parent == Place and notetype == NoteType.PLACE:
+ return True
+ elif parent == Citation and notetype == NoteType.CITATION:
+ return True
+ elif parent == Attribute and notetype == NoteType.ATTRIBUTE:
+ return True
+ return False
+
+ def display_note_list(self, notelist=None, parent=None):
"""
Display note list
@param: notelist -- The list of notes
+ @param: parent -- The parent associated to these notes
"""
if not notelist:
return None
@@ -2111,14 +2165,27 @@ class BasePage: # pylint: disable=C1001
# begin narrative division
with Html("div", class_="subsection narrative") as section:
+ idx = 0
for notehandle in notelist:
note = self.r_db.get_note_from_handle(notehandle)
+ title = self._(note.type.xml_str())
if note:
note_text = self.get_note_format(note, True)
-
+ idx += 1
+ if len(notelist) > 1:
+ if self.default_note(parent, int(note.type)):
+ title_text = self._("Note: %s") % str(idx)
+ else:
+ title = " (" + title + ")"
+ title_text = self._("Note: %s") % str(idx) + title
+ else:
+ if self.default_note(parent, int(note.type)):
+ title_text = self._("Note")
+ else:
+ title_text = title
# add section title
- section += Html("h4", self._("Narrative"), inline=True)
+ section += Html("h4", title_text, inline=True)
# attach note
section += note_text
@@ -2681,47 +2748,6 @@ class BasePage: # pylint: disable=C1001
tbody += trow
tbody += Html("tr") + Html("td", " ", colspan=2)
- # encloses
- with Html("div", class_='subsection encloses') as encloses:
- tbody += encloses
- encloses += Html("h4", self._("Place Encloses"), inline=True)
- with Html("table", class_="infolist place") as table:
- encloses += table
- visited = [place.handle]
- for link in self.r_db.find_backlink_handles(
- place.handle, include_classes=['Place']):
- if link[1] in visited:
- continue
- visited.append(link[1])
- c_place = self.r_db.get_place_from_handle(link[1])
- placeref = None
- for placeref in c_place.get_placeref_list():
- if placeref.ref == place.handle:
- gpfh = self.r_db.get_place_from_handle
- eplace = gpfh(placeref.ref)
- if not eplace:
- continue
- place_name = c_place.get_name().get_value()
- table += Html("tr") + Html("td", place_name)
-
- # enclosed by
- with Html("div", class_='subsection encloses') as encloses:
- tbody += encloses
- encloses += Html("h4", self._("Enclosed By"), inline=True)
- with Html("table", class_="infolist place") as table:
- encloses += table
- visited = [place.handle]
- placeref = None
- for placeref in place.get_placeref_list():
- if placeref.ref in visited:
- continue
- visited.append(placeref.ref)
- pplace = self.r_db.get_place_from_handle(placeref.ref)
- if not pplace:
- continue
- place_name = pplace.get_name().get_value()
- table += Html("tr") + Html("td", place_name)
-
# enclosed by
tbody += Html("tr") + Html("td", " ")
trow = Html("tr") + (
@@ -2740,7 +2766,7 @@ class BasePage: # pylint: disable=C1001
else:
place_hyper = place_name
trow = Html("tr") + (
- Html("td", place_hyper, class_="ColumnValue",
+ Html("td", place_hyper, class_="ColumnPlace",
inline=True))
tbody += trow
@@ -2766,7 +2792,7 @@ class BasePage: # pylint: disable=C1001
place_hyper = place_name
trow = Html("tr") + (
Html("td", place_hyper,
- class_="ColumnValue", inline=True))
+ class_="ColumnPlace", inline=True))
tbody += trow
# return place table to its callers
diff --git a/gramps/plugins/webreport/common.py b/gramps/plugins/webreport/common.py
index 6c99dd14c..3814cdd4c 100644
--- a/gramps/plugins/webreport/common.py
+++ b/gramps/plugins/webreport/common.py
@@ -57,14 +57,14 @@ HTTPS = "https://"
GOOGLE_MAPS = 'https://maps.googleapis.com/maps/'
# javascript code for marker path
MARKER_PATH = """
- var marker_png = '%s'
+ var marker_png = '%s';
"""
# javascript code for Google's FamilyLinks...
FAMILYLINKS = """
- var tracelife = %s
+ var tracelife = %s;
- function initialize() {
+ window.addEventListener("load", function() {
var myLatLng = new google.maps.LatLng(%s, %s);
var mapOptions = {
@@ -86,18 +86,19 @@ FAMILYLINKS = """
});
flightPath.setMap(map);
- }"""
+ });
+"""
# javascript for Google's Drop Markers...
DROPMASTERS = """
var markers = [];
var iterator = 0;
- var tracelife = %s
+ var tracelife = %s;
var map;
var myLatLng = new google.maps.LatLng(%s, %s);
- function initialize() {
+ window.addEventListener("load", function() {
var mapOptions = {
scaleControl: true,
zoomControl: true,
@@ -107,7 +108,7 @@ DROPMASTERS = """
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
- };
+ });
function drop() {
for (var i = 0; i < tracelife.length; i++) {
@@ -144,11 +145,11 @@ DROPMASTERS = """
# javascript for Google's Markers...
MARKERS = """
- var tracelife = %s
+ var tracelife = %s;
var map;
var myLatLng = new google.maps.LatLng(%s, %s);
- function initialize() {
+ window.addEventListener("load", function() {
var mapOptions = {
scaleControl: true,
panControl: true,
@@ -160,7 +161,7 @@ MARKERS = """
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
addMarkers();
- }
+ });
function addMarkers() {
var bounds = new google.maps.LatLngBounds();
@@ -189,7 +190,6 @@ MARKERS = """
infoWindow.open(map, marker);
});
}
-
"""
# javascript for OpenStreetMap's markers...
@@ -198,9 +198,9 @@ https://openlayers.org/en/latest/examples/
"""
OSM_MARKERS = """
- function initialize(){
+ window.addEventListener("load", function() {
var map;
- var tracelife = %s
+ var tracelife = %s;
var iconStyle = new ol.style.Style({
image: new ol.style.Icon(({
anchor: [0.2, 48],
@@ -241,9 +241,9 @@ OSM_MARKERS = """
"""
STAMEN_MARKERS = """
- function initialize(){
+ window.addEventListener("load", function() {
var map;
- var tracelife = %s
+ var tracelife = %s;
var layer = '%s';
var iconStyle = new ol.style.Style({
image: new ol.style.Icon(({
@@ -292,23 +292,20 @@ OPENLAYER = """
var closer = document.getElementById('popup-closer');
var tip = document.getElementById('tooltip');
var tipcontent = document.getElementById('tooltip-content');
-
var tooltip = new ol.Overlay({
element: tip,
positioning: 'bottom-center',
offset: [10, 0],
});
map.addOverlay(tooltip);
-
var popup = new ol.Overlay({
element: element,
positioning: 'bottom-center',
autoPan: true,
autoPanAnimation: { duration: 500 },
- stopEvent: false
+ stopEvent: true
});
map.addOverlay(popup);
-
/**
* Add a click handler to hide the popup.
* @return {boolean} Don't follow the href.
@@ -318,7 +315,6 @@ OPENLAYER = """
closer.blur();
return false;
};
-
map.on('pointermove', function(evt) {
evt.preventDefault()
var feature = this.forEachFeatureAtPixel(evt.pixel,
@@ -338,10 +334,9 @@ OPENLAYER = """
} else {
tooltip.setPosition(undefined);
}
-
});
map.on('singleclick', function(evt) {
- evt.preventDefault()
+ evt.preventDefault();
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
@@ -355,8 +350,7 @@ OPENLAYER = """
popup.setPosition(undefined);
}
});
-
- };
+ });
"""
# variables for alphabet_navigation()
diff --git a/gramps/plugins/webreport/event.py b/gramps/plugins/webreport/event.py
index c6fa904a9..33045f097 100644
--- a/gramps/plugins/webreport/event.py
+++ b/gramps/plugins/webreport/event.py
@@ -413,7 +413,7 @@ class EventPages(BasePage):
# Narrative subsection
notelist = event.get_note_list()
- notelist = self.display_note_list(notelist)
+ notelist = self.display_note_list(notelist, Event)
if notelist is not None:
eventdetail += notelist
diff --git a/gramps/plugins/webreport/family.py b/gramps/plugins/webreport/family.py
index 9ab917559..2c0525046 100644
--- a/gramps/plugins/webreport/family.py
+++ b/gramps/plugins/webreport/family.py
@@ -367,7 +367,7 @@ class FamilyPages(BasePage):
# Narrative subsection
notelist = family.get_note_list()
if notelist:
- relationshipdetail += self.display_note_list(notelist)
+ relationshipdetail += self.display_note_list(notelist, Family)
# display family LDS ordinance...
family_lds_ordinance_list = family.get_lds_ord_list()
diff --git a/gramps/plugins/webreport/media.py b/gramps/plugins/webreport/media.py
index 3672cfbe2..39ac72d8b 100644
--- a/gramps/plugins/webreport/media.py
+++ b/gramps/plugins/webreport/media.py
@@ -97,6 +97,7 @@ class MediaPages(BasePage):
self.media_dict = defaultdict(set)
self.unused_media_handles = []
self.cur_fname = None
+ self.create_images_index = self.report.options['create_images_index']
def display_pages(self, title):
"""
@@ -190,7 +191,8 @@ class MediaPages(BasePage):
"""
BasePage.__init__(self, report, title)
- output_file, sio = self.report.create_file("media")
+ if self.create_images_index:
+ output_file, sio = self.report.create_file("media")
# save the media file name in case we create unused media pages
self.cur_fname = self.report.cur_fname
result = self.write_header(self._('Media'))
@@ -314,7 +316,8 @@ class MediaPages(BasePage):
# send page out for processing
# and close the file
self.report.cur_fname = self.cur_fname
- self.xhtml_writer(medialistpage, output_file, sio, ldatec)
+ if self.create_images_index:
+ self.xhtml_writer(medialistpage, output_file, sio, ldatec)
def media_ref_link(self, handle, name, uplink=False):
"""
@@ -577,7 +580,7 @@ class MediaPages(BasePage):
table += trow
# get media notes
- notelist = self.display_note_list(media.get_note_list())
+ notelist = self.display_note_list(media.get_note_list(), Media)
if notelist is not None:
mediadetail += notelist
@@ -649,7 +652,9 @@ class MediaPages(BasePage):
try:
mtime = os.stat(fullpath).st_mtime
if self.report.archive:
- self.report.archive.add(fullpath, str(newpath))
+ if str(newpath) not in self.report.archive.getnames():
+ # The current file not already archived.
+ self.report.archive.add(fullpath, str(newpath))
else:
to_dir = os.path.join(self.html_dir, to_dir)
if not os.path.isdir(to_dir):
diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py
index 82bb4347a..5d4ca9e29 100644
--- a/gramps/plugins/webreport/narrativeweb.py
+++ b/gramps/plugins/webreport/narrativeweb.py
@@ -97,6 +97,7 @@ from gramps.plugins.webreport.surnamelist import SurnameListPage
from gramps.plugins.webreport.surname import SurnamePage
from gramps.plugins.webreport.thumbnail import ThumbnailPreviewPage
from gramps.plugins.webreport.statistics import StatisticsPage
+from gramps.plugins.webreport.updates import UpdatesPage
from gramps.plugins.webreport.home import HomePage
from gramps.plugins.webreport.contact import ContactPage
from gramps.plugins.webreport.download import DownloadPage
@@ -163,6 +164,8 @@ class NavWebReport(Report):
self.inc_gallery = self.options['gallery']
self.inc_unused_gallery = self.options['unused']
self.create_thumbs_only = self.options['create_thumbs_only']
+ self.create_thumbs_index = self.options['create_thumbs_index']
+ self.create_images_index = self.options['create_images_index']
self.opts = self.options
self.inc_contact = self.opts['contactnote'] or self.opts['contactimg']
@@ -202,6 +205,7 @@ class NavWebReport(Report):
self.use_home = self.options['homenote'] or self.options['homeimg']
self.use_contact = self.opts['contactnote'] or self.opts['contactimg']
self.inc_stats = self.opts['inc_stats']
+ self.inc_updates = self.opts['updates']
self.create_unused_media = self.opts['unused']
# Do we need to include this in a cms ?
@@ -218,6 +222,9 @@ class NavWebReport(Report):
self.usecal = self.options['usecal']
self.target_cal_uri = self.options['caluri']
+ # Do we need to include news and updates page ?
+ self.inc_updates = self.options['updates']
+
# either include the gender graphics or not?
self.ancestortree = self.options['ancestortree']
@@ -400,6 +407,31 @@ class NavWebReport(Report):
self._build_obj_dict()
+ #################################################
+ #
+ # Add images for home, contact and introduction pages
+ # if they are not associated to any used objects.
+ #
+ #################################################
+ if self.use_home:
+ img = self.options['homeimg']
+ if img:
+ media = self._db.get_media_from_gramps_id(img)
+ if media:
+ self._add_media(media.handle, Media, media.handle)
+ if self.inc_contact:
+ img = self.options['contactimg']
+ if img:
+ media = self._db.get_media_from_gramps_id(img)
+ if media:
+ self._add_media(media.handle, Media, media.handle)
+ if self.use_intro:
+ img = self.options['introimg']
+ if img:
+ media = self._db.get_media_from_gramps_id(img)
+ if media:
+ self._add_media(media.handle, Media, media.handle)
+
#################################################
#
# Pass 2 Generate the web pages
@@ -451,6 +483,10 @@ class NavWebReport(Report):
if self.inc_stats:
self.statistics_preview_page(self.title)
+ # build classes Updates
+ if self.inc_updates:
+ self.updates_preview_page(self.title)
+
# copy all of the neccessary files
self.copy_narrated_files()
@@ -1193,6 +1229,15 @@ class NavWebReport(Report):
1) as step:
StatisticsPage(self, title, step)
+ def updates_preview_page(self, title):
+ """
+ creates the statistics preview page
+ """
+ with self.user.progress(_("Narrated Web Site Report"),
+ _("Creating updates page..."),
+ 1):
+ UpdatesPage(self, title)
+
def addressbook_pages(self, ind_list):
"""
Create a webpage with a list of address availability for each person
@@ -1241,7 +1286,7 @@ class NavWebReport(Report):
def base_pages(self):
"""
- creates HomePage, ContactPage, DownloadPage, and IntroductionPage
+ creates HomePage, ContactPage, DownloadPage and IntroductionPage
if requested by options in plugin
"""
if self.use_home:
@@ -1454,15 +1499,17 @@ class NavWebReport(Report):
when we use rsync.
"""
if self.archive:
- output_file.flush()
- tarinfo = tarfile.TarInfo(self.cur_fname)
- tarinfo.size = len(string_io.getvalue())
- tarinfo.mtime = date if date != 0 else time.time()
- if not win():
- tarinfo.uid = os.getuid()
- tarinfo.gid = os.getgid()
- string_io.seek(0)
- self.archive.addfile(tarinfo, string_io)
+ if self.cur_fname not in self.archive.getnames():
+ # The current file not already archived.
+ output_file.flush()
+ tarinfo = tarfile.TarInfo(self.cur_fname)
+ tarinfo.size = len(string_io.getvalue())
+ tarinfo.mtime = date if date != 0 else time.time()
+ if not win():
+ tarinfo.uid = os.getuid()
+ tarinfo.gid = os.getgid()
+ string_io.seek(0)
+ self.archive.addfile(tarinfo, string_io)
output_file.close()
else:
output_file.close()
@@ -1513,7 +1560,9 @@ class NavWebReport(Report):
return tarinfo
dest = os.path.join(to_dir, to_fname)
- self.archive.add(from_fname, dest, filter=set_mtime)
+ if dest not in self.archive.getnames():
+ # The current file not already archived.
+ self.archive.add(from_fname, dest, filter=set_mtime)
else:
dest = os.path.join(self.html_dir, to_dir, to_fname)
@@ -1577,13 +1626,15 @@ class NavWebOptions(MenuReportOptions):
self.__usecal = None
self.__calendar_uri = None
self.__create_thumbs_only = None
+ self.__create_images_index = None
+ self.__create_thumbs_index = None
self.__mapservice = None
- self.__maxinitialimageheight = None
self.__maxinitialimagewidth = None
self.__citationreferents = None
self.__incdownload = None
self.__placemappages = None
self.__familymappages = None
+ self.__stamenopts = None
self.__googleopts = None
self.__googlemapkey = None
self.__ancestortree = None
@@ -1592,6 +1643,9 @@ class NavWebOptions(MenuReportOptions):
self.__dl_descr2 = None
self.__down_fname2 = None
self.__gallery = None
+ self.__updates = None
+ self.__maxdays = None
+ self.__maxupdates = None
self.__unused = None
self.__down_fname1 = None
self.__navigation = None
@@ -1885,6 +1939,14 @@ class NavWebOptions(MenuReportOptions):
addopt("gallery", self.__gallery)
self.__gallery.connect('value-changed', self.__gallery_changed)
+ self.__create_images_index = BooleanOption(
+ _("Create the images index"), False)
+ self.__create_images_index.set_help(
+ _("This option allows you to create the images index"))
+ addopt("create_images_index", self.__create_images_index)
+ self.__create_images_index.connect("value-changed",
+ self.__gallery_changed)
+
self.__unused = BooleanOption(
_("Include unused images and media objects"), True)
self.__unused.set_help(_('Whether to include unused or unreferenced'
@@ -1902,6 +1964,14 @@ class NavWebOptions(MenuReportOptions):
self.__create_thumbs_only.connect("value-changed",
self.__gallery_changed)
+ self.__create_thumbs_index = BooleanOption(
+ _("Create the thumbnail index"), False)
+ self.__create_thumbs_index.set_help(
+ _("This option allows you to create the thumbnail index"))
+ addopt("create_thumbs_index", self.__create_thumbs_index)
+ self.__create_thumbs_index.connect("value-changed",
+ self.__gallery_changed)
+
self.__maxinitialimagewidth = NumberOption(
_("Max width of initial image"), _DEFAULT_MAX_IMG_WIDTH, 0, 2000)
self.__maxinitialimagewidth.set_help(
@@ -1909,13 +1979,6 @@ class NavWebOptions(MenuReportOptions):
"of the image shown on the media page. Set to 0 for no limit."))
addopt("maxinitialimagewidth", self.__maxinitialimagewidth)
- self.__maxinitialimageheight = NumberOption(
- _("Max height of initial image"), _DEFAULT_MAX_IMG_HEIGHT, 0, 2000)
- self.__maxinitialimageheight.set_help(
- _("This allows you to set the maximum height "
- "of the image shown on the media page. Set to 0 for no limit."))
- addopt("maxinitialimageheight", self.__maxinitialimageheight)
-
self.__gallery_changed()
def __add_download_options(self, menu):
@@ -2164,6 +2227,37 @@ class NavWebOptions(MenuReportOptions):
addopt("caluri", self.__calendar_uri)
self.__calendar_uri_changed()
+ self.__graph_changed()
+
+ self.__updates = BooleanOption(_("Include the news and updates page"),
+ True)
+ self.__updates.set_help(_('Whether to include '
+ 'a page with the last updates'))
+ self.__updates.connect('value-changed', self.__updates_changed)
+ addopt("updates", self.__updates)
+
+ self.__maxdays = NumberOption(_("Max days for updates"), 1, 1, 300)
+ self.__maxdays.set_help(_("You want to see the last updates on how"
+ " many days ?"))
+ addopt("maxdays", self.__maxdays)
+
+ self.__maxupdates = NumberOption(_("Max number of updates per object"
+ " to show"), 1, 1, 100)
+ self.__maxupdates.set_help(_("How many updates do you want to see max"
+ ))
+ addopt("maxupdates", self.__maxupdates)
+
+ def __updates_changed(self):
+ """
+ Update the change of storage: archive or directory
+ """
+ _updates_option = self.__updates.get_value()
+ if _updates_option:
+ self.__maxupdates.set_available(True)
+ self.__maxdays.set_available(True)
+ else:
+ self.__maxupdates.set_available(False)
+ self.__maxdays.set_available(False)
def __cms_uri_changed(self):
"""
@@ -2257,23 +2351,25 @@ class NavWebOptions(MenuReportOptions):
if _gallery_option:
self.__create_thumbs_only.set_available(True)
self.__maxinitialimagewidth.set_available(True)
- self.__maxinitialimageheight.set_available(True)
+ self.__create_images_index.set_available(True)
+ self.__create_thumbs_index.set_available(True)
+ self.__unused.set_available(True)
# thumbnail-sized images only...
if _create_thumbs_only_option:
self.__maxinitialimagewidth.set_available(False)
- self.__maxinitialimageheight.set_available(False)
# full- sized images and Media Pages will be created...
else:
self.__maxinitialimagewidth.set_available(True)
- self.__maxinitialimageheight.set_available(True)
# no images or media objects are to be used...
else:
self.__create_thumbs_only.set_available(False)
self.__maxinitialimagewidth.set_available(False)
- self.__maxinitialimageheight.set_available(False)
+ self.__create_images_index.set_available(False)
+ self.__create_thumbs_index.set_available(False)
+ self.__unused.set_available(False)
def __download_changed(self):
"""
diff --git a/gramps/plugins/webreport/person.py b/gramps/plugins/webreport/person.py
index 6c43b818f..c4b0169fb 100644
--- a/gramps/plugins/webreport/person.py
+++ b/gramps/plugins/webreport/person.py
@@ -52,7 +52,7 @@ import logging
#------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.lib import (ChildRefType, Date, Name, Person, EventRoleType,
- Event, EventType)
+ Family, Event, EventType)
from gramps.gen.lib.date import Today
from gramps.gen.plug.report import Bibliography
from gramps.gen.plug.report import utils
@@ -469,18 +469,7 @@ class PersonPages(BasePage):
output_file, sio = self.report.create_file(person.get_handle(), "ppl")
self.uplink = True
result = self.write_header(self.sort_name)
- indivdetpage, head, dummy_body, outerwrapper = result
-
- # attach the ancestortree style sheet if ancestor
- # graph is being created?
- if self.report.options["ancestortree"]:
- if self.usecms:
- fname = "/".join([self.target_uri, "css", "ancestortree.css"])
- else:
- fname = "/".join(["css", "ancestortree.css"])
- url = self.report.build_url_fname(fname, None, self.uplink)
- head += Html("link", href=url, type="text/css", media="screen",
- rel="stylesheet")
+ indivdetpage, dummy_head, dummy_body, outerwrapper = result
# begin individualdetail division
with Html("div", class_="content",
@@ -496,7 +485,7 @@ class PersonPages(BasePage):
if self.report.options['notes']:
# display Narrative Notes
notelist = person.get_note_list()
- sect8 = self.display_note_list(notelist)
+ sect8 = self.display_note_list(notelist, Person)
if sect8 is not None:
individualdetail += sect8
@@ -564,7 +553,7 @@ class PersonPages(BasePage):
if not self.report.options['notes']:
# display Narrative Notes
notelist = person.get_note_list()
- sect8 = self.display_note_list(notelist)
+ sect8 = self.display_note_list(notelist, Person)
if sect8 is not None:
individualdetail += sect8
@@ -652,7 +641,7 @@ class PersonPages(BasePage):
else:
tracelife += """
[%f, %f, \'%s\', %s],""" % (float(longitude), float(latitude),
- placetitle.replace("'", "\\'"), links)
+ placetitle.replace("'", "\\'"), links)
return tracelife
def __create_family_map(self, person, place_lat_long):
@@ -769,9 +758,9 @@ class PersonPages(BasePage):
seq_ = 0
old_place_title = ""
- oldevent = None
links = ""
ln_str = "%s"
+ ppl_lnk = ""
for index in range(0, number_markers):
(latitude, longitude, placetitle, handle,
event) = place_lat_long[index]
@@ -783,19 +772,29 @@ class PersonPages(BasePage):
if bkref_list:
for ref in bkref_list:
(bkref_class, bkref_hdle, role) = ref
- if role == "Primary":
+ if bkref_class == Family and role == "Primary":
+ url = url_fct(bkref_hdle,
+ "fam", self.uplink)
+ fam_fct = self.r_db.get_family_from_handle
+ fam = fam_fct(bkref_hdle)
+ fam_name = self.report.get_family_name(fam)
+ ppl_lnk = ln_str % (url,
+ fam.get_gramps_id(),
+ fam_name)
+ if bkref_class == Person and role == "Primary":
url = url_fct(bkref_hdle,
"ppl", self.uplink)
ppl_fct = self.r_db.get_person_from_handle
- person = ppl_fct(bkref_hdle)
+ pers = ppl_fct(bkref_hdle)
ppl_lnk = ln_str % (url,
- person.get_gramps_id(),
- self.get_name(person))
+ pers.get_gramps_id(),
+ self.get_name(pers))
url = self.report.build_url_fname_html(event.get_handle(),
"evt", self.uplink)
evt_type = self._(str(event.get_type()))
evt_date = self.rlocale.get_date(event.get_date_object())
evt_lnk = ln_str % (url, evt_date, evt_type)
+ evt_lnk += " (" + evt_date + ")"
links += ' + "%s"' % (ppl_lnk + self._(":") + evt_lnk)
if index == number_markers - 1:
@@ -808,8 +807,8 @@ class PersonPages(BasePage):
break
continue
elif old_place_title != "" and index != 0:
- (lat, lng, plcetitle, handle_,
- event_) = place_lat_long[index-1]
+ (lat, lng, plcetitle, dummy_handle,
+ dummy_event) = place_lat_long[index-1]
tracelife = self._create_family_tracelife(tracelife,
plcetitle,
lat,
@@ -824,24 +823,33 @@ class PersonPages(BasePage):
if bkref_list:
for ref in bkref_list:
(bkref_class, bkref_hdle, role) = ref
- if role == "Primary":
+ if bkref_class == Family and role == "Primary":
+ url = url_fct(bkref_hdle,
+ "fam", self.uplink)
+ fam_fct = self.r_db.get_family_from_handle
+ fam = fam_fct(bkref_hdle)
+ fam_name = self.report.get_family_name(fam)
+ ppl_lnk = ln_str % (url,
+ fam.get_gramps_id(),
+ fam_name)
+ if bkref_class == Person and role == "Primary":
url = url_fct(bkref_hdle,
"ppl", self.uplink)
ppl_fct = self.r_db.get_person_from_handle
- person = ppl_fct(bkref_hdle)
+ pers = ppl_fct(bkref_hdle)
ppl_lnk = ln_str % (url,
- person.get_gramps_id(),
- self.get_name(person))
+ pers.get_gramps_id(),
+ self.get_name(pers))
url = self.report.build_url_fname_html(event.handle,
"evt",
self.uplink)
evt_type = self._(str(event.get_type()))
- evt_date = self.rlocale.get_date(event.get_date_object())
- evt_lnk = ln_str % (url, evt_date, evt_type)
+ date = self.rlocale.get_date(event.get_date_object())
+ evt_lnk = ln_str % (url, date, evt_type)
+ evt_lnk += " (" + date + ")"
- links = '"%s"' % (ppl_lnk + self._(":") +
- evt_lnk)
- elif index == number_markers:
+ links = '"%s"' % (ppl_lnk + self._(":") + evt_lnk)
+ elif index == number_markers-1:
tracelife = self._create_family_tracelife(tracelife,
placetitle,
latitude,
@@ -855,23 +863,45 @@ class PersonPages(BasePage):
if bkref_list:
for ref in bkref_list:
(bkref_class, bkref_hdle, role) = ref
- if role == "Primary":
+ if bkref_class == Family and role == "Primary":
+ url = url_fct(bkref_hdle,
+ "fam", self.uplink)
+ fam_fct = self.r_db.get_family_from_handle
+ fam = fam_fct(bkref_hdle)
+ fam_name = self.report.get_family_name(fam)
+ ppl_lnk = ln_str % (url,
+ fam.get_gramps_id(),
+ fam_name)
+ if bkref_class == Person and role == "Primary":
url = url_fct(bkref_hdle,
"ppl", self.uplink)
ppl_fct = self.r_db.get_person_from_handle
- person = ppl_fct(bkref_hdle)
+ pers = ppl_fct(bkref_hdle)
ppl_lnk = ln_str % (url,
- person.get_gramps_id(),
- self.get_name(person))
+ pers.get_gramps_id(),
+ self.get_name(pers))
url = self.report.build_url_fname_html(event.handle,
"evt",
self.uplink)
evt_type = self._(str(event.get_type()))
+ date = self.rlocale.get_date(event.get_date_object())
evt_lnk = ln_str % (url, evt_type, evt_type)
- links = '"%s"' % (ppl_lnk + self._(":") + evt_lnk)
+ evt_lnk += " (" + date + ")"
+ if "
" in links:
+ links += '"%s"' % (ppl_lnk+self._(":") + evt_lnk)
+ else:
+ links = '"
%s"' % (ppl_lnk + self._(":") + evt_lnk)
old_place_title = placetitle
seq_ += 1
+ (lat, lng, plcetitle, dummy_handle,
+ dummy_event) = place_lat_long[number_markers-1]
+ tracelife = self._create_family_tracelife(tracelife,
+ plcetitle,
+ lat,
+ lng,
+ seq_,
+ links)
tracelife += "];"
# begin MapDetail division...
with Html("div", class_="content", id="FamilyMapDetail") as mapdetail:
@@ -899,82 +929,6 @@ class PersonPages(BasePage):
with Html("div", id="map_canvas") as canvas:
mapdetail += canvas
- # begin javascript inline code...
- with Html("script", deter="deter",
- style='width =100%; height =100%;',
- type="text/javascript", indent=False) as jsc:
- head += jsc
-
- # Link to Gramps marker
- fname = "/".join(['images', 'marker.png'])
- marker_path = self.report.build_url_image("marker.png",
- "images",
- self.uplink)
-
- jsc += MARKER_PATH % marker_path
- # are we using Google?
- if self.mapservice == "Google":
-
- # are we creating Family Links?
- if self.googleopts == "FamilyLinks":
- if midy_ is None:
- jsc += FAMILYLINKS % (tracelife, latitude,
- longitude, int(10))
- else:
- jsc += FAMILYLINKS % (tracelife, midx_, midy_,
- zoomlevel)
-
- # are we creating Drop Markers?
- elif self.googleopts == "Drop":
- if midy_ is None:
- jsc += DROPMASTERS % (tracelife, latitude,
- longitude, int(10))
- else:
- jsc += DROPMASTERS % (tracelife, midx_, midy_,
- zoomlevel)
-
- # we are creating Markers only...
- else:
- if midy_ is None:
- jsc += MARKERS % (tracelife, latitude,
- longitude, int(10))
- else:
- jsc += MARKERS % (tracelife, midx_, midy_,
- zoomlevel)
-
- # we are using OpenStreetMap
- elif self.mapservice == "OpenStreetMap":
- if midy_ is None:
- jsc += OSM_MARKERS % (tracelife,
- longitude,
- latitude, 10)
- else:
- jsc += OSM_MARKERS % (tracelife, midy_, midx_,
- zoomlevel)
- jsc += OPENLAYER
- # we are using StamenMap
- elif self.mapservice == "StamenMap":
- if midy_ is None:
- jsc += STAMEN_MARKERS % (tracelife,
- self.stamenopts,
- longitude,
- latitude,
- 10,
- )
- else:
- jsc += STAMEN_MARKERS % (tracelife,
- self.stamenopts,
- midy_, midx_,
- zoomlevel,
- )
- jsc += OPENLAYER
-
- # if Google and Drop Markers are selected,
- # then add "Drop Markers" button?
- if self.mapservice == "Google" and self.googleopts == "Drop":
- mapdetail += Html("button", _("Drop Markers"),
- id="drop", onclick="drop()", inline=True)
-
# add div for popups.
if self.mapservice == "Google":
with Html("div", id="popup", inline=True) as popup:
@@ -1020,7 +974,7 @@ class PersonPages(BasePage):
# being sorted by date
place_lat_long = sorted(place_lat_long,
key=lambda evt:
- evt[4].get_date_object())
+ evt[4].get_date_object())
for (latitude, longitude, placetitle, handle,
event) in place_lat_long:
trow = Html("tr")
@@ -1038,8 +992,84 @@ class PersonPages(BasePage):
]
)
+ # begin javascript inline code...
+ with Html("script", deter="deter",
+ style='width =100%; height =100%;',
+ type="text/javascript", indent=False) as jsc:
+ mapdetail += jsc
+
+ # Link to Gramps marker
+ fname = "/".join(['images', 'marker.png'])
+ marker_path = self.report.build_url_image("marker.png",
+ "images",
+ self.uplink)
+
+ jsc += MARKER_PATH % marker_path
+ # are we using Google?
+ if self.mapservice == "Google":
+
+ # are we creating Family Links?
+ if self.googleopts == "FamilyLinks":
+ if midy_ is None:
+ jsc += FAMILYLINKS % (tracelife, latitude,
+ longitude, int(10))
+ else:
+ jsc += FAMILYLINKS % (tracelife, midx_, midy_,
+ zoomlevel)
+
+ # are we creating Drop Markers?
+ elif self.googleopts == "Drop":
+ if midy_ is None:
+ jsc += DROPMASTERS % (tracelife, latitude,
+ longitude, int(10))
+ else:
+ jsc += DROPMASTERS % (tracelife, midx_, midy_,
+ zoomlevel)
+
+ # we are creating Markers only...
+ else:
+ if midy_ is None:
+ jsc += MARKERS % (tracelife, latitude,
+ longitude, int(10))
+ else:
+ jsc += MARKERS % (tracelife, midx_, midy_,
+ zoomlevel)
+
+ # we are using OpenStreetMap
+ elif self.mapservice == "OpenStreetMap":
+ if midy_ is None:
+ jsc += OSM_MARKERS % (tracelife,
+ longitude,
+ latitude, 10)
+ else:
+ jsc += OSM_MARKERS % (tracelife, midy_, midx_,
+ zoomlevel)
+ jsc += OPENLAYER
+ # we are using StamenMap
+ elif self.mapservice == "StamenMap":
+ if midy_ is None:
+ jsc += STAMEN_MARKERS % (tracelife,
+ self.stamenopts,
+ longitude,
+ latitude,
+ 10,
+ )
+ else:
+ jsc += STAMEN_MARKERS % (tracelife,
+ self.stamenopts,
+ midy_, midx_,
+ zoomlevel,
+ )
+ jsc += OPENLAYER
+
+ # if Google and Drop Markers are selected,
+ # then add "Drop Markers" button?
+ if self.mapservice == "Google" and self.googleopts == "Drop":
+ mapdetail += Html("button", _("Drop Markers"),
+ id="drop", onclick="drop()", inline=True)
+
# add body id for this page...
- body.attr = 'id ="FamilyMap" onload ="initialize()"'
+ body.attr = 'id ="FamilyMap"'
# add clearline for proper styling
# add footer section
@@ -1392,7 +1422,7 @@ class PersonPages(BasePage):
for data in [
person_lnk,
person_ref.get_relation(),
- self.dump_notes(person_ref.get_note_list()),
+ self.dump_notes(person_ref.get_note_list(), Person),
self.get_citation_links(
person_ref.get_citation_list()),
]:
diff --git a/gramps/plugins/webreport/place.py b/gramps/plugins/webreport/place.py
index 1a4b726c6..b973970fd 100644
--- a/gramps/plugins/webreport/place.py
+++ b/gramps/plugins/webreport/place.py
@@ -101,6 +101,7 @@ class PlacePages(BasePage):
self.person = None
self.familymappages = None
self.googlemapkey = None
+ self.stamenopts = None
# Place needs to display coordinates?
self.display_coordinates = report.options["coordinates"]
@@ -301,7 +302,8 @@ class PlacePages(BasePage):
output_file, sio = self.report.create_file(place_handle, "plc")
self.uplink = True
self.page_title = place_name
- placepage, head, body, outerwrapper = self.write_header(_("Places"))
+ (placepage, head, dummy_body,
+ outerwrapper) = self.write_header(_("Places"))
self.placemappages = self.report.options['placemappages']
self.mapservice = self.report.options['mapservice']
@@ -341,7 +343,7 @@ class PlacePages(BasePage):
placedetail += placegallery
# place notes
- notelist = self.display_note_list(place.get_note_list())
+ notelist = self.display_note_list(place.get_note_list(), Place)
if notelist is not None:
placedetail += notelist
@@ -358,9 +360,6 @@ class PlacePages(BasePage):
if self.placemappages:
if place and (place.lat and place.long):
- latitude, longitude = conv_lat_lon(place.get_latitude(),
- place.get_longitude(),
- "D.D8")
placetitle = place_name
# add narrative-maps CSS...
@@ -406,49 +405,21 @@ class PlacePages(BasePage):
with Html("div", id="map_canvas", inline=True) as canvas:
placedetail += canvas
- # Begin inline javascript code because jsc is a
- # docstring, it does NOT have to be properly indented
- if self.mapservice == "Google":
- with Html("script", type="text/javascript",
- indent=False) as jsc:
- head += jsc
-
- # Google adds Latitude/ Longitude to its maps...
- plce = placetitle.replace("'", "\\'")
- jsc += MARKER_PATH % marker_path
- jsc += MARKERS % ([[plce,
- latitude,
- longitude,
- 1,""]],
- latitude, longitude,
- 10)
-
- elif self.mapservice == "OpenStreetMap":
- with Html("script", type="text/javascript") as jsc:
- canvas += jsc
- jsc += MARKER_PATH % marker_path
- jsc += OSM_MARKERS % ([[float(longitude),
- float(latitude),
- placetitle,""]],
- longitude, latitude, 10)
- jsc += OPENLAYER
- else: # STAMEN
- with Html("script", type="text/javascript") as jsc:
- canvas += jsc
- jsc += MARKER_PATH % marker_path
- jsc += STAMEN_MARKERS % ([[float(longitude),
- float(latitude),
- placetitle,""]],
- self.stamenopts,
- longitude, latitude, 10)
- jsc += OPENLAYER
-
- # add javascript function call to body element
- body.attr += ' onload = "initialize();" '
-
# add div for popups.
- with Html("div", id="popup", inline=True) as popup:
- placedetail += popup
+ if self.mapservice == "Google":
+ with Html("div", id="popup", inline=True) as popup:
+ placedetail += popup
+ else:
+ with Html("div", id="popup", class_="ol-popup",
+ inline=True) as popup:
+ placedetail += popup
+ popup += Html("a", href="#", id="popup-closer",
+ class_="ol-popup-closer")
+ popup += Html("div", id="popup-content")
+ with Html("div", id="tooltip", class_="ol-popup",
+ inline=True) as tooltip:
+ placedetail += tooltip
+ tooltip += Html("div", id="tooltip-content")
# source references
srcrefs = self.display_ind_sources(place)
@@ -460,6 +431,48 @@ class PlacePages(BasePage):
if ref_list is not None:
placedetail += ref_list
+ # Begin inline javascript code because jsc is a
+ # docstring, it does NOT have to be properly indented
+ if self.placemappages:
+ if place and (place.lat and place.long):
+ latitude, longitude = conv_lat_lon(place.get_latitude(),
+ place.get_longitude(),
+ "D.D8")
+ scripts = Html()
+ if self.mapservice == "Google":
+ with Html("script", type="text/javascript",
+ indent=False) as jsc:
+ scripts += jsc
+ # Google adds Latitude/ Longitude to its maps...
+ plce = placetitle.replace("'", "\\'")
+ jsc += MARKER_PATH % marker_path
+ jsc += MARKERS % ([[plce,
+ latitude,
+ longitude,
+ 1, ""]],
+ latitude, longitude,
+ 10)
+ elif self.mapservice == "OpenStreetMap":
+ with Html("script", type="text/javascript") as jsc:
+ scripts += jsc
+ jsc += MARKER_PATH % marker_path
+ jsc += OSM_MARKERS % ([[float(longitude),
+ float(latitude),
+ placetitle, ""]],
+ longitude, latitude, 10)
+ jsc += OPENLAYER
+ else: # STAMEN
+ with Html("script", type="text/javascript") as jsc:
+ scripts += jsc
+ jsc += MARKER_PATH % marker_path
+ jsc += STAMEN_MARKERS % ([[float(longitude),
+ float(latitude),
+ placetitle, ""]],
+ self.stamenopts,
+ longitude, latitude, 10)
+ jsc += OPENLAYER
+ placedetail += scripts
+
# add clearline for proper styling
# add footer section
footer = self.write_footer(ldatec)
diff --git a/gramps/plugins/webreport/repository.py b/gramps/plugins/webreport/repository.py
index 79a194ee7..7d2683530 100644
--- a/gramps/plugins/webreport/repository.py
+++ b/gramps/plugins/webreport/repository.py
@@ -271,7 +271,7 @@ class RepositoryPages(BasePage):
repositorydetail += urllist
# reposity: notelist
- notelist = self.display_note_list(repo.get_note_list())
+ notelist = self.display_note_list(repo.get_note_list(), Repository)
if notelist is not None:
repositorydetail += notelist
diff --git a/gramps/plugins/webreport/source.py b/gramps/plugins/webreport/source.py
index 13f5d504d..5b6390da8 100644
--- a/gramps/plugins/webreport/source.py
+++ b/gramps/plugins/webreport/source.py
@@ -273,7 +273,7 @@ class SourcePages(BasePage):
tbody += trow
# Source notes
- notelist = self.display_note_list(source.get_note_list())
+ notelist = self.display_note_list(source.get_note_list(), Source)
if notelist is not None:
sourcedetail += notelist
diff --git a/gramps/plugins/webreport/thumbnail.py b/gramps/plugins/webreport/thumbnail.py
index 5b5e11e00..f06f12651 100644
--- a/gramps/plugins/webreport/thumbnail.py
+++ b/gramps/plugins/webreport/thumbnail.py
@@ -76,6 +76,7 @@ class ThumbnailPreviewPage(BasePage):
"""
BasePage.__init__(self, report, title)
self.create_thumbs_only = report.options['create_thumbs_only']
+ self.create_thumbs_index = self.report.options['create_thumbs_index']
# bug 8950 : it seems it's better to sort on desc + gid.
def sort_by_desc_and_gid(obj):
"""
@@ -108,7 +109,8 @@ class ThumbnailPreviewPage(BasePage):
media_list.sort(key=lambda x: self.rlocale.sort_key(x[0]))
# Create thumbnail preview page...
- output_file, sio = self.report.create_file("thumbnails")
+ if self.create_thumbs_index:
+ output_file, sio = self.report.create_file("thumbnails")
result = self.write_header(self._("Thumbnails"))
thumbnailpage, dummy_head, body, outerwrapper = result
@@ -197,7 +199,8 @@ class ThumbnailPreviewPage(BasePage):
# send page out for processing
# and close the file
- self.xhtml_writer(thumbnailpage, output_file, sio, 0)
+ if self.create_thumbs_index:
+ self.xhtml_writer(thumbnailpage, output_file, sio, 0)
def thumbnail_link(self, name, index):
diff --git a/gramps/plugins/webreport/updates.py b/gramps/plugins/webreport/updates.py
new file mode 100644
index 000000000..8989d49b1
--- /dev/null
+++ b/gramps/plugins/webreport/updates.py
@@ -0,0 +1,241 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2000-2007 Donald N. Allingham
+# Copyright (C) 2019- Serge Noiraud
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+"""
+Narrative Web Page generator.
+
+Classe:
+ UpdatesPage
+"""
+#------------------------------------------------
+# python modules
+#------------------------------------------------
+from decimal import getcontext
+import logging
+from time import (strftime, time, localtime)
+
+#------------------------------------------------
+# Gramps module
+#------------------------------------------------
+from gramps.gen.const import GRAMPS_LOCALE as glocale
+from gramps.plugins.lib.libhtml import Html
+
+#------------------------------------------------
+# specific narrative web import
+#------------------------------------------------
+from gramps.plugins.webreport.basepage import BasePage
+from gramps.gen.display.place import displayer as _pd
+from gramps.plugins.webreport.common import (FULLCLEAR, _EVENTMAP)
+from gramps.gen.lib import (Person, Family, Event, Place, Source, Repository,
+ Media)
+from gramps.gen.lib.date import Date
+
+_ = glocale.translation.sgettext
+LOG = logging.getLogger(".NarrativeWeb")
+getcontext().prec = 8
+
+class UpdatesPage(BasePage):
+ """
+ This class is responsible for displaying information about the Home page.
+ """
+ def __init__(self, report, title):
+ """
+ @param: report -- The instance of the main report class for
+ this report
+ @param: title -- Is the title of the web page
+ """
+ BasePage.__init__(self, report, title)
+ ldatec = 0
+
+ output_file, sio = self.report.create_file("updates")
+ result = self.write_header(self._('New and updated objects'))
+ homepage, dummy_head, dummy_body, outerwrapper = result
+ self.days = self.report.options['maxdays']
+ self.nbr = self.report.options['maxupdates']
+ cur_time = int(time())
+ self.maxdays = cur_time - (86400 * self.days)
+
+ # begin updates division
+ with Html("div", class_="content", id="Updates") as section:
+ outerwrapper += section
+ description = ("This page contains the last updated objects in the"
+ " database in the last %(days)d days and for a "
+ "maximum of %(nb)d objects per object type." % {
+ 'days' : self.days,
+ 'nb' : self.nbr
+ }
+ )
+ section += Html("p", description)
+
+ header = self._("People")
+ section += Html("h4", header)
+ people = self.list_people_changed(Person)
+ if people is not None:
+ section += people
+
+ if self.report.options['inc_families']:
+ header = self._("Families")
+ section += Html("h4", header)
+ families = self.list_people_changed(Family)
+ if families is not None:
+ section += families
+
+ if self.report.options['inc_events']:
+ header = self._("Events")
+ section += Html("h4", header)
+ events = self.list_people_changed(Event)
+ if events is not None:
+ section += events
+
+ if self.report.options['inc_places']:
+ header = self._("Places")
+ section += Html("h4", header)
+ places = self.list_people_changed(Place)
+ if places is not None:
+ section += places
+
+ if self.report.options['inc_sources']:
+ header = self._("Sources")
+ section += Html("h4", header)
+ sources = self.list_people_changed(Source)
+ if sources is not None:
+ section += sources
+
+ if self.report.options['inc_repository']:
+ header = self._("Repositories")
+ section += Html("h4", header)
+ repos = self.list_people_changed(Repository)
+ if repos is not None:
+ section += repos
+
+ if (self.report.options['gallery'] and not
+ self.report.options['create_thumbs_only']):
+ header = self._("Media")
+ section += Html("h4", header)
+ media = self.list_people_changed(Media)
+ if media is not None:
+ section += media
+
+ # create clear line for proper styling
+ # create footer section
+ footer = self.write_footer(ldatec)
+ outerwrapper += (FULLCLEAR, footer)
+
+ # send page out for processing
+ # and close the file
+ self.xhtml_writer(homepage, output_file, sio, ldatec)
+
+ def list_people_changed(self, object_type):
+ """
+ List all records with last change date
+ """
+ nb_items = 0
+
+ def sort_on_change(handle):
+ """ sort records based on the last change time """
+ obj = fct(handle)
+ timestamp = obj.get_change_time()
+ return timestamp
+
+ if object_type == Person:
+ fct = self.report.database.get_person_from_handle
+ fct_link = self.new_person_link
+ elif object_type == Family:
+ fct = self.report.database.get_family_from_handle
+ fct_link = self.family_link
+ elif object_type == Event:
+ fct = self.report.database.get_event_from_handle
+ elif object_type == Place:
+ fct = self.report.database.get_place_from_handle
+ fct_link = self.place_link
+ elif object_type == Source:
+ fct = self.report.database.get_place_from_handle
+ fct_link = self.source_link
+ elif object_type == Repository:
+ fct = self.report.database.get_place_from_handle
+ fct_link = self.repository_link
+ elif object_type == Media:
+ fct = self.report.database.get_place_from_handle
+ obj_list = sorted(self.report.obj_dict[object_type],
+ key=sort_on_change, reverse=True)
+ with Html("table", class_="list", id="list") as section:
+ for handle in obj_list:
+ row = Html("tr")
+ section += row
+ date = obj = None
+ name = ""
+ obj = fct(handle)
+ if object_type == Person:
+ name = fct_link(handle)
+ elif object_type == Family:
+ name = self.report.get_family_name(obj)
+ name = fct_link(handle, name)
+ elif object_type == Event:
+ otype = obj.get_type()
+ date = obj.get_date_object()
+ if int(otype) in _EVENTMAP:
+ handle_list = set(
+ self.report.database.find_backlink_handles(
+ handle,
+ include_classes=['Family', 'Person']))
+ else:
+ handle_list = set(
+ self.report.database.find_backlink_handles(
+ handle,
+ include_classes=['Person']))
+ if handle_list:
+ name = Html("span", self._(otype.xml_str())+" ")
+ for obj_t, r_handle in handle_list:
+ if obj_t == 'Person':
+ name += self.new_person_link(r_handle)
+ else:
+ srbd = self.report.database
+ fam = srbd.get_family_from_handle(r_handle)
+ srgfn = self.report.get_family_name
+ name += self.family_link(r_handle, srgfn(fam))
+ elif object_type == Place:
+ name = _pd.display(self.report.database, obj)
+ name = fct_link(handle, name)
+ elif object_type == Source:
+ name = obj.get_title()
+ name = fct_link(handle, name)
+ elif object_type == Repository:
+ name = obj.get_name()
+ name = fct_link(handle, name)
+ elif object_type == Media:
+ name = obj.get_description()
+ url = self.report.build_url_fname_html(handle, "img")
+ name = Html("a", name, href=url, title=name)
+ if obj:
+ timestamp = obj.get_change_time()
+ if timestamp - self.maxdays > 0:
+ nb_items += 1
+ if nb_items > self.nbr:
+ break
+ tims = localtime(timestamp)
+ odat = Date(tims.tm_year, tims.tm_mon, tims.tm_mday)
+ date = self.rlocale.date_displayer.display(odat)
+ date += strftime(' %X', tims)
+ row += Html("td", date, class_="date")
+ row += Html("td", name)
+ return section