2013-11-14 01:16:14 +01:00
|
|
|
from django.utils.translation import ugettext_lazy
|
|
|
|
|
|
|
|
from openslides.utils.widgets import Widget
|
|
|
|
from openslides.projector.api import get_active_slide
|
|
|
|
|
|
|
|
from .models import Mediafile
|
|
|
|
|
|
|
|
|
|
|
|
class PDFPresentationWidget(Widget):
|
|
|
|
"""
|
|
|
|
Widget for presentable PDF files.
|
|
|
|
"""
|
|
|
|
name = 'presentations'
|
|
|
|
verbose_name = ugettext_lazy('Presentations')
|
2014-05-15 20:07:09 +02:00
|
|
|
required_permission = 'core.can_manage_projector'
|
2013-11-14 01:16:14 +01:00
|
|
|
default_column = 1
|
|
|
|
default_weight = 75
|
2015-03-26 05:36:10 +01:00
|
|
|
template_name = 'mediafiles/widget_pdfpresentation.html'
|
2014-05-15 14:08:44 +02:00
|
|
|
icon_css_class = 'icon-align-left'
|
2013-11-14 01:16:14 +01:00
|
|
|
more_link_pattern_name = 'mediafile_list'
|
2014-04-08 20:50:44 +02:00
|
|
|
# javascript_files = None # TODO: Add pdf.js stuff here.
|
2013-11-14 01:16:14 +01:00
|
|
|
|
|
|
|
def get_context_data(self, **context):
|
|
|
|
pdfs = Mediafile.objects.filter(
|
|
|
|
filetype__in=Mediafile.PRESENTABLE_FILE_TYPES,
|
|
|
|
is_presentable=True)
|
|
|
|
current_page = get_active_slide().get('page_num', 1)
|
|
|
|
return super(PDFPresentationWidget, self).get_context_data(
|
|
|
|
pdfs=pdfs,
|
|
|
|
current_page=current_page,
|
|
|
|
**context)
|