Narrated Web: bad event links on media pages (#983)
* Navweb: Don't use media regions in some case: - If we don't show families - If we don't show events Fixes #011500 * Navweb: side effect between event and media pages When a media is processed in the media display section for an event page, it's remove from the media_list, so when we try to create the media regions in the media page, the media list is empty and we can't display the regions. * Narweb: Don't show the regions for a thumbnail
This commit is contained in:
parent
34beeaad70
commit
675dfdbc70
@ -1840,7 +1840,7 @@ class BasePage: # pylint: disable=C1001
|
||||
_linkurl = self.report.build_url_fname_html(_obj.handle,
|
||||
"ppl",
|
||||
linkurl)
|
||||
elif classname == "Family":
|
||||
elif classname == "Family" and self.inc_families:
|
||||
_obj = self.r_db.get_family_from_handle(newhandle)
|
||||
partner1_handle = _obj.get_father_handle()
|
||||
partner2_handle = _obj.get_mother_handle()
|
||||
@ -1866,7 +1866,7 @@ class BasePage: # pylint: disable=C1001
|
||||
"ppl", True)
|
||||
if not _name:
|
||||
_name = self._("Unknown")
|
||||
elif classname == "Event":
|
||||
elif classname == "Event" and self.inc_events:
|
||||
_obj = self.r_db.get_event_from_handle(newhandle)
|
||||
_name = _obj.get_description()
|
||||
if not _name:
|
||||
@ -1952,57 +1952,16 @@ class BasePage: # pylint: disable=C1001
|
||||
# make a thumbnail of this region
|
||||
newpath = self.copy_thumbnail(photo_handle, photo, region)
|
||||
newpath = self.report.build_url_fname(newpath, uplink=True)
|
||||
|
||||
snapshot += self.media_link(photo_handle, newpath, descr,
|
||||
uplink=self.uplink,
|
||||
usedescr=False)
|
||||
else:
|
||||
|
||||
dummy_rpath, newpath = self.report.prepare_copy_media(photo)
|
||||
newpath = self.report.build_url_fname(newpath, uplink=True)
|
||||
|
||||
# FIXME: There doesn't seem to be any point in highlighting
|
||||
# a sub-region in the thumbnail and linking back to the
|
||||
# person or whatever. First it is confusing when the link
|
||||
# probably has nothing to do with the page on which the
|
||||
# thumbnail is displayed, and second on a thumbnail it is
|
||||
# probably too small to see, and third, on the thumbnail,
|
||||
# the link is shown above the image (which is pretty
|
||||
# useless!)
|
||||
_region_items = self.media_ref_rect_regions(photo_handle,
|
||||
linkurl=False)
|
||||
if _region_items:
|
||||
with Html("div", id="GalleryDisplay") as mediadisplay:
|
||||
snapshot += mediadisplay
|
||||
|
||||
ordered = Html("ol", class_="RegionBox")
|
||||
mediadisplay += ordered
|
||||
while _region_items:
|
||||
(name, coord_x, coord_y,
|
||||
width, height, linkurl) = _region_items.pop()
|
||||
ordered += Html("li",
|
||||
style="left:%d%%; top:%d%%; "
|
||||
"width:%d%%; height:%d%%;" % (
|
||||
coord_x, coord_y,
|
||||
width, height))
|
||||
ordered += Html("a", name, href=linkurl)
|
||||
# Need to add link to mediadisplay to get the links:
|
||||
mediadisplay += self.media_link(photo_handle,
|
||||
newpath, descr,
|
||||
self.uplink, False)
|
||||
else:
|
||||
try:
|
||||
|
||||
# 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)
|
||||
|
||||
except (IOError, OSError) as msg:
|
||||
self.r_user.warn(_("Could not add photo to page"),
|
||||
str(msg))
|
||||
else:
|
||||
# begin hyperlink
|
||||
snapshot += self.doc_link(photo_handle, descr,
|
||||
@ -2030,12 +1989,6 @@ class BasePage: # pylint: disable=C1001
|
||||
if photoref.ref in photolist_handles:
|
||||
photo = photolist_handles[photoref.ref]
|
||||
photolist_ordered.append(photo)
|
||||
try:
|
||||
if photo in photolist:
|
||||
photolist.remove(photo)
|
||||
except ValueError:
|
||||
LOG.warning("Error trying to remove '%s' from photolist",
|
||||
photo)
|
||||
# and add any that are left (should there be any?)
|
||||
photolist_ordered += photolist
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user