"""
open/dulcinea/lib/ui/gallery.qpy
"""
from dulcinea.gallery import get_gallery
from dulcinea.ui.attachment import AttachmentUI, format_attachments
from qp.pub.common import get_user, header, footer
def _decorate:xml(gallery, body, title=None):
title = 'Gallery'
header(title)
'
'
footer(title)
class GalleryDirectory(AttachmentUI):
def __init__(self, decorate=None):
"""
Delay calling AttachmentUI constructor until it is needed.
This allows a GalleryDirectory to be constructed before the
database is open.
"""
self.decorate = decorate
def get_exports(self):
AttachmentUI.__init__(self, get_gallery(), decorate=self.decorate)
return AttachmentUI.get_exports(self)
def render_attachments:xml(self):
is_admin = get_user().is_admin()
format_attachments(self.attachable, '',
thumbnail_size=200,
show_details=False,
show_action_links=is_admin)