예제 #1
0
파일: views.py 프로젝트: SUNET/meetingtools
def _room2dict(request, room):
    return {'name': room.name,
            'description': room.description,
            'user_count': room.nusers(),
            'host_count': room.nhosts(),
            'updated': rfc3339_date(room.lastupdated),
            'self_cleaning': room.self_cleaning,
            'url': base_url(request, room.go_url())}
예제 #2
0
파일: views.py 프로젝트: SUNET/meetingtools
def _init_update_form(request, form, acc, folder_sco):
    if form.fields.has_key('urlpath'):
        url = base_url(request)
        form.fields['urlpath'].widget.prefix = url
    if form.fields.has_key('source_sco'):
        form.fields['source_sco'].widget.choices = [('', '-- select template --')] + [r for r in
                                                                                      _user_templates(request, acc,
                                                                                                      folder_sco)]
예제 #3
0
파일: views.py 프로젝트: SUNET/meetingtools
def view(request, id):
    room = get_object_or_404(Room, pk=id)
    return respond_to(request,
                      {'text/html': 'apps/room/list.html'},
                      {'user': request.user,
                       'rooms': [room],
                       'title': room.name,
                       'baseurl': base_url(request),
                       'active': True,
                      })
예제 #4
0
파일: views.py 프로젝트: SUNET/meetingtools
def go_by_path(request, path):
    rooms = Room.objects.filter(urlpath=path)
    if len(rooms) == 1:
        return goto(request, rooms[0])

    if len(rooms) == 0:
        return HttpResponseNotFound()

    return respond_to(request,
                      {'text/html': 'apps/room/choose.html',
                       'application/json': json_response([base_url(request, room.go_url()) for room in rooms])},
                      {'rooms': rooms})
예제 #5
0
파일: views.py 프로젝트: SUNET/meetingtools
def list_by_tag(request, tn):
    tags = tn.split('+')
    rooms = TaggedItem.objects.get_by_model(Room, tags).order_by('name').all().prefetch_related("creator", "sco",
                                                                                                "folder_sco",
                                                                                                "source_sco",
                                                                                                "deleted_sco")
    title = 'Rooms tagged with %s' % " and ".join(tags)
    return respond_to(request,
                      {'text/html': 'apps/room/list.html',
                       'application/json': json_response([_room2dict(request, room) for room in rooms], request)},
                      {'title': title,
                       'description': title,
                       'edit': False,
                       'active': len(rooms) == 1,
                       'baseurl': base_url(request),
                       'tagstring': tn,
                       'rooms': rooms})