Ejemplo n.º 1
0
def workshop_view(workshop, request):
    """
    Workshop view_only view

        workshop

            the context returned by the traversal tree
    """
    if has_permission('manage', workshop, request):
        url = request.route_path(
            'workshop',
            id=workshop.id,
            _query=dict(action='edit'),
        )
        return HTTPFound(url)
    populate_actionmenu(request)

    timeslots_datas = []

    for timeslot in workshop.timeslots:
        if timeslot.start_time.day == timeslot.end_time.day:
            time_str = u"le {0} de {1} à {2}".format(
                format_date(timeslot.start_time),
                format_datetime(timeslot.start_time, timeonly=True),
                format_datetime(timeslot.end_time, timeonly=True))
        else:
            time_str = u"du {0} au {1}".format(
                format_datetime(timeslot.start_time),
                format_datetime(timeslot.end_time))

        status = timeslot.user_status(request.user.id)
        timeslots_datas.append((timeslot.name, time_str, status))

    return dict(title=workshop.title, timeslots_datas=timeslots_datas)
Ejemplo n.º 2
0
def workshop_view(workshop, request):
    """
    Workshop view_only view

        workshop

            the context returned by the traversal tree
    """
    if has_permission('manage', workshop, request):
        url = request.route_path(
            'workshop',
            id=workshop.id,
            _query=dict(action='edit'),
        )
        return HTTPFound(url)
    populate_actionmenu(request)

    timeslots_datas = []

    for timeslot in workshop.timeslots:
        if timeslot.start_time.day == timeslot.end_time.day:
            time_str = u"le {0} de {1} à {2}".format(
                format_date(timeslot.start_time),
                format_datetime(timeslot.start_time, timeonly=True),
                format_datetime(timeslot.end_time, timeonly=True)
                )
        else:
            time_str = u"du {0} au {1}".format(
                format_datetime(timeslot.start_time),
                format_datetime(timeslot.end_time)
                )

        status = timeslot.user_status(request.user.id)
        timeslots_datas.append((timeslot.name, time_str, status))

    return dict(title=workshop.title, timeslots_datas=timeslots_datas)
Ejemplo n.º 3
0
def activity_view_only_view(context, request):
    """
    Single Activity view-only view
    """
    if request.has_permission('admin_activity'):
        url = request.route_path(
            'activity',
            id=context.id,
            _query=dict(action='edit'),
        )
        return HTTPFound(url)
    else:
        title = u"Rendez-vous du %s" % (render_api.format_datetime(
            request.context.datetime), )
        populate_actionmenu(request)
        return dict(title=title, activity=request.context)
Ejemplo n.º 4
0
def activity_view_only_view(context, request):
    """
    Single Activity view-only view
    """
    if has_permission('manage', context, request):
        url = request.route_path(
                'activity',
                id=context.id,
                _query=dict(action='edit'),
                )
        return HTTPFound(url)
    title = u"Rendez-vous du %s" % (
            render_api.format_datetime(request.context.datetime),
            )
    populate_actionmenu(request)
    return dict(title=title, activity=request.context)