示例#1
0
def overview(request):
    """
    Shows an overview of all items.
    """
    if request.method == 'POST':
        for item in Item.objects.all():
            form = ElementOrderForm(request.POST, prefix="i%d" % item.id)
            if form.is_valid():
                try:
                    item.parent = Item.objects.get( \
                                       id=form.cleaned_data['parent'])
                except Item.DoesNotExist:
                    item.parent = None
                item.weight = form.cleaned_data['weight']
                item.save()

    items = children_list(Item.objects.filter(parent=None).exclude(hidden=True).order_by('weight'))
    items_hidden = children_list(Item.objects.filter(parent=None).exclude(hidden=False).order_by('weight'))
    try:
        overview = is_summary() and not get_active_item()
    except Item.DoesNotExist:
        overview = True
    return {
        'items': items,
        'items_hidden': items_hidden,
        'overview': overview,
        'summary': is_summary(),
        'countdown_visible': config_get('countdown_visible'),
        'countdown_time': config_get('agenda_countdown_time'),
        }
示例#2
0
def beamerhome(request):
    """
    Shows a active Slide.
    """
    data = {'ajax': 'on'}
    template = ''
    try:
        item = get_active_item()
        votes = assignment_votes(item)
        polls = assignment_polls(item)
        if is_summary():
            items = item.children.filter(hidden=False)
            data['items'] = items
            data['title'] = item.title
            template = 'beamer/overview.html'
        else:
            data['item'] = item.cast()
            data['title'] = item.title
            data['votes'] = votes
            data['polls'] = polls
            template = 'beamer/%shome.html' % (item.type)
    except Item.DoesNotExist:
        items = Item.objects.filter(parent=None).filter(hidden=False)\
        .order_by('weight')
        data['items'] = items
        data['title'] = _("Agenda")
        template = 'beamer/overview.html'

    if request.is_ajax():
        content = render_block_to_string(template, 'content', data)
        jsondata = {'content': content,
                    'title': data['title'],
                    'time': datetime.now().strftime('%H:%M'),
                    'bigger': config_get('bigger'),
                    'up': config_get('up'),
                    'countdown_visible': config_get('countdown_visible'),
                    'countdown_time': config_get('agenda_countdown_time'),
                    'countdown_control': config_get('countdown_control'),
                    }
        return ajax_request(jsondata)
    else:
        return render_to_response(template,
            data,
            context_instance=RequestContext(request))