media gallery navigation

svn: r4953
This commit is contained in:
Don Allingham 2005-07-18 21:31:19 +00:00
parent 40afabedec
commit bb3efd78a4
7 changed files with 73 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2005-07-18 Don Allingham <don@gramps-project.org>
* src/plugins/NavWebPage.py: add media gallery navigation
* src/data/main*.css: add support for media gallery navigation
2005-07-18 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/NavWebPage.py: Optimize separation of multiple families;
Print out attributes; Print out family note

View File

@ -174,6 +174,16 @@ TABLE.infolist {
}
.img_navbar {
margin: 0;
margin-bottom: 4px;
padding: 10px;
font-size: 14px;
font-weight: bold;
text-align: center;
}
TD.category {
padding: 1px; /* Defines spacing between rows */

View File

@ -167,6 +167,14 @@ TABLE.infolist {
/*width: 100%;*/
font-size: 14px;
}
.img_navbar {
margin: 0;
margin-bottom: 4px;
padding: 10px;
font-size: 14px;
font-weight: bold;
text-align: center;
}
TD.category {
padding: 3px; /* Defines spacing between rows */
padding-right: 3em;

View File

@ -165,6 +165,14 @@ TABLE.infolist {
/*width: 100%;*/
font-size: 14px;
}
.img_navbar {
margin: 0;
margin-bottom: 4px;
padding: 10px;
font-size: 14px;
font-weight: bold;
text-align: center;
}
TD.category {
padding: 4px; /* Defines spacing between rows */
padding-right: 3em;

View File

@ -181,6 +181,14 @@ TABLE.infolist {
margin-left: 2em;
margin-top: 8px;
}
.img_navbar {
margin: 0;
margin-bottom: 4px;
padding: 10px;
font-size: 14px;
font-weight: bold;
text-align: center;
}
TD.category {
margin: 0;
padding: 4px; /* Defines spacing between rows */

View File

@ -186,6 +186,14 @@ TABLE.infolist {
margin-left: 7em;
margin-right: 7em;
}
.img_navbar {
margin: 0;
margin-bottom: 4px;
padding: 10px;
font-size: 14px;
font-weight: bold;
text-align: center;
}
TD.category {
padding: 3px; /* Defines spacing between rows */
padding-right: 3em;

View File

@ -116,7 +116,7 @@ class BasePage:
self.private = not options.handler.options_dict['NWEBincpriv']
def copy_media(self,photo):
if photo.get_handle() != self.photo_list:
if photo.get_handle() != self.photo_list and photo.get_handle() not in self.photo_list:
self.photo_list.append(photo.get_handle())
newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1]
if self.image_dir:
@ -494,7 +494,10 @@ class PlacePage(BasePage):
#------------------------------------------------------------------------
class MediaPage(BasePage):
def __init__(self, db, title, handle, src_list, options, archive, media_list):
def __init__(self, db, title, handle, src_list, options, archive, media_list,
info):
(prev, next, page_number, total_pages) = info
photo = db.get_object_from_handle(handle)
BasePage.__init__(self, title, options, archive, media_list)
of = self.create_file(handle)
@ -516,6 +519,17 @@ class MediaPage(BasePage):
of.write('<div class="summaryarea">\n')
of.write('<h3>%s</h3>\n' % title)
# gallery navigation
of.write('<div class="img_navbar">')
if prev:
of.write('<a href="%s.%s">%s</a>' % (prev,self.ext,_('Previous')))
data = _('%(page_number)d of %(total_pages)d' % {
'page_number' : page_number, 'total_pages' : total_pages })
of.write('&nbsp;&nbsp;%s&nbsp;&nbsp;' % data)
if next:
of.write('<a href="%s.%s">%s</a>' % (next,self.ext,_('Next')))
of.write('</div><br>\n')
mime_type = photo.get_mime_type()
if mime_type and mime_type.startswith("image"):
try:
@ -1551,9 +1565,19 @@ class WebReport(Report.Report):
GalleryPage(self.database, self.title, source_list, self.options_class,
archive, photo_list)
prev = None
total = len(photo_list)
index = 1
for photo_handle in photo_list:
if index == total:
next = None
else:
next = photo_list[index]
MediaPage(self.database, self.title, photo_handle, source_list,
self.options_class, archive, photo_list)
self.options_class, archive, photo_list,
(prev, next, index, total))
prev = photo_handle
index += 1
if archive:
archive.close()