Ejemplo n.º 1
0
def inject_meeting_body(event, **kwargs):
    event.preload_all_acl_entries()
    event_tz = event.display_tzinfo
    show_date = request.args.get('showDate') or 'all'
    show_session = request.args.get('showSession') or 'all'
    detail_level = request.args.get('detailLevel') or 'contribution'
    view = request.args.get('view')

    children_strategy = joinedload('children')
    children_strategy.joinedload('session_block').joinedload('person_links')
    children_strategy.joinedload('break_')

    children_contrib_strategy = children_strategy.subqueryload('contribution')
    children_contrib_strategy.joinedload('person_links')
    children_contrib_strategy.joinedload('subcontributions')
    children_contrib_strategy.joinedload('references')
    children_contrib_strategy.joinedload('own_room')
    children_contrib_strategy.joinedload('note')

    children_subcontrib_strategy = children_contrib_strategy.joinedload('subcontributions')
    children_subcontrib_strategy.joinedload('person_links')
    children_subcontrib_strategy.joinedload('references')

    contrib_strategy = joinedload('contribution')
    contrib_strategy.joinedload('person_links')
    contrib_strategy.joinedload('references')
    contrib_strategy.joinedload('note')

    subcontrib_strategy = contrib_strategy.joinedload('subcontributions')
    subcontrib_strategy.joinedload('person_links')
    subcontrib_strategy.joinedload('references')
    subcontrib_strategy.joinedload('note')

    # try to minimize the number of DB queries
    options = [contrib_strategy,
               children_strategy,
               joinedload('session_block').joinedload('person_links'),
               joinedload('session_block').joinedload('own_room'),
               joinedload('break_')]

    entries = []
    show_siblings_location = False
    show_children_location = {}
    for entry in event.timetable_entries.filter_by(parent=None).options(*options):
        if show_date != 'all' and entry.start_dt.astimezone(event_tz).date().isoformat() != show_date:
            continue
        if (entry.type == TimetableEntryType.CONTRIBUTION and
                (detail_level not in ('contribution', 'all') or show_session != 'all')):
            continue
        elif (entry.type == TimetableEntryType.SESSION_BLOCK and show_session != 'all' and
                str(entry.object.session.friendly_id) != show_session):
            continue

        if entry.type == TimetableEntryType.BREAK:
            entries.append(entry)
        elif entry.object.can_access(session.user):
            entries.append(entry)
        if not entry.object.inherit_location:
            show_siblings_location = True
        show_children_location[entry.id] = not all(child.object.inherit_location for child in entry.children)

    entries.sort(key=attrgetter('end_dt'), reverse=True)
    entries.sort(key=lambda entry: (entry.start_dt, _entry_title_key(entry)))

    days = [(day, list(e)) for day, e in groupby(entries, lambda e: e.start_dt.astimezone(event_tz).date())]
    theme = theme_settings.themes[get_theme(event, view)[0]]
    plugin = theme.get('plugin')
    tpl_name = theme.get('tt_template', theme['template'])
    tt_tpl = ((plugin.name + tpl_name)
              if (plugin and tpl_name[0] == ':')
              else posixpath.join('events/timetable/display', tpl_name))
    multiple_days = event.start_dt.astimezone(event_tz).date() != event.end_dt.astimezone(event_tz).date()
    return render_template(tt_tpl, event=event, entries=entries, days=days,
                           timezone=event_tz.zone, tz_object=event_tz, hide_contribs=(detail_level == 'session'),
                           theme_settings=theme.get('settings', {}), show_siblings_location=show_siblings_location,
                           show_children_location=show_children_location, multiple_days=multiple_days, **kwargs)
Ejemplo n.º 2
0
 def _checkParams(self, params):
     RHConferenceBaseDisplay._checkParams(self, params)
     self.force_overview = request.view_args.get('force_overview', False)
     self.theme_id, self.theme_override = get_theme(
         self.event_new, request.args.get('view'))
Ejemplo n.º 3
0
 def _process_args(self):
     RHTimetableProtectionBase._process_args(self)
     self.timetable_layout = request.args.get('layout') or request.args.get(
         'ttLyt')
     self.theme, self.theme_override = get_theme(self.event,
                                                 request.args.get('view'))
Ejemplo n.º 4
0
 def _checkParams(self, params):
     RHConferenceBaseDisplay._checkParams(self, params)
     self.timetable_layout = request.args.get('layout') or request.args.get(
         'ttLyt')
     self.theme, self.theme_override = get_theme(self.event_new,
                                                 request.args.get('view'))
Ejemplo n.º 5
0
def inject_meeting_body(event, **kwargs):
    event.preload_all_acl_entries()
    event_tz = event.display_tzinfo
    show_date = request.args.get('showDate') or 'all'
    show_session = request.args.get('showSession') or 'all'
    detail_level = request.args.get('detailLevel') or 'contribution'
    view = request.args.get('view')

    children_strategy = joinedload('children')
    children_strategy.joinedload('session_block').joinedload('person_links')
    children_strategy.joinedload('break_')

    children_contrib_strategy = children_strategy.subqueryload('contribution')
    children_contrib_strategy.joinedload('person_links')
    children_contrib_strategy.joinedload('subcontributions')
    children_contrib_strategy.joinedload('references')
    children_contrib_strategy.joinedload('own_room')
    children_contrib_strategy.joinedload('note')

    children_subcontrib_strategy = children_contrib_strategy.joinedload('subcontributions')
    children_subcontrib_strategy.joinedload('person_links')
    children_subcontrib_strategy.joinedload('references')

    contrib_strategy = joinedload('contribution')
    contrib_strategy.joinedload('person_links')
    contrib_strategy.joinedload('references')
    contrib_strategy.joinedload('note')

    subcontrib_strategy = contrib_strategy.joinedload('subcontributions')
    subcontrib_strategy.joinedload('person_links')
    subcontrib_strategy.joinedload('references')
    subcontrib_strategy.joinedload('note')

    # try to minimize the number of DB queries
    options = [contrib_strategy,
               children_strategy,
               joinedload('session_block').joinedload('person_links'),
               joinedload('session_block').joinedload('own_room'),
               joinedload('break_')]

    entries = []
    show_siblings_location = False
    show_children_location = {}
    for entry in event.timetable_entries.filter_by(parent=None).options(*options):
        if show_date != 'all' and entry.start_dt.astimezone(event_tz).date().isoformat() != show_date:
            continue
        if (entry.type == TimetableEntryType.CONTRIBUTION and
                (detail_level not in ('contribution', 'all') or show_session != 'all')):
            continue
        elif (entry.type == TimetableEntryType.SESSION_BLOCK and show_session != 'all' and
                unicode(entry.object.session.friendly_id) != show_session):
            continue

        if entry.type == TimetableEntryType.BREAK:
            entries.append(entry)
        elif entry.object.can_access(session.user):
            entries.append(entry)
        if not entry.object.inherit_location:
            show_siblings_location = True
        show_children_location[entry.id] = not all(child.object.inherit_location for child in entry.children)

    entries.sort(key=attrgetter('end_dt'), reverse=True)
    entries.sort(key=lambda entry: (entry.start_dt, _entry_title_key(entry)))

    days = [(day, list(e)) for day, e in groupby(entries, lambda e: e.start_dt.astimezone(event_tz).date())]
    theme = theme_settings.themes[get_theme(event, view)[0]]
    plugin = theme.get('plugin')
    tpl_name = theme.get('tt_template', theme['template'])
    tt_tpl = ((plugin.name + tpl_name)
              if (plugin and tpl_name[0] == ':')
              else posixpath.join('events/timetable/display', tpl_name))
    multiple_days = event.start_dt.astimezone(event_tz).date() != event.end_dt.astimezone(event_tz).date()
    return render_template(tt_tpl, event=event, entries=entries, days=days,
                           timezone=event_tz.zone, tz_object=event_tz, hide_contribs=(detail_level == 'session'),
                           theme_settings=theme.get('settings', {}), show_siblings_location=show_siblings_location,
                           show_children_location=show_children_location, multiple_days=multiple_days, **kwargs)
Ejemplo n.º 6
0
 def _process_args(self):
     RHConferenceBaseDisplay._process_args(self)
     self.force_overview = request.view_args.get('force_overview', False)
     self.theme_id, self.theme_override = get_theme(
         self.event, request.args.get('view'))
Ejemplo n.º 7
0
 def _process_args(self):
     RHDisplayEventBase._process_args(self)
     self.force_overview = request.view_args.get('force_overview', False)
     self.theme_id, self.theme_override = get_theme(self.event, request.args.get('view'))
Ejemplo n.º 8
0
 def _process_args(self):
     RHDisplayEventBase._process_args(self)
     self.timetable_layout = request.args.get('layout') or request.args.get('ttLyt')
     self.theme, self.theme_override = get_theme(self.event, request.args.get('view'))
Ejemplo n.º 9
0
 def _process_args(self):
     RHConferenceBaseDisplay._process_args(self)
     self.timetable_layout = request.args.get('layout') or request.args.get(
         'ttLyt')
     self.theme, self.theme_override = get_theme(self.event,
                                                 request.args.get('view'))