diff options
author | Leif Johansson <leifj@sunet.se> | 2011-04-04 21:04:33 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-04-04 21:04:33 +0200 |
commit | 5e6d967b1bf14b715b306d8bc7637f94a813757b (patch) | |
tree | 7f016fd0d1dad33f98eef835ed60cee88645f7b7 /src/meetingtools | |
parent | bf9d7779e715e3f876d3843f3dac4c08af242fa0 (diff) |
cleanup and turn form into wizard
Diffstat (limited to 'src/meetingtools')
-rw-r--r-- | src/meetingtools/ac/api.py | 2 | ||||
-rw-r--r-- | src/meetingtools/apps/room/forms.py | 17 | ||||
-rw-r--r-- | src/meetingtools/apps/room/views.py | 4 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/meetingtools/ac/api.py b/src/meetingtools/ac/api.py index 7397453..679b1ac 100644 --- a/src/meetingtools/ac/api.py +++ b/src/meetingtools/ac/api.py @@ -4,13 +4,13 @@ Created on Jan 31, 2011 @author: leifj ''' -from lxml import etree import httplib2 from urllib import quote import logging from pprint import pformat import os import tempfile +from lxml import etree class ACPException(Exception): def __init__(self, value): diff --git a/src/meetingtools/apps/room/forms.py b/src/meetingtools/apps/room/forms.py index 3b89297..aef7d8d 100644 --- a/src/meetingtools/apps/room/forms.py +++ b/src/meetingtools/apps/room/forms.py @@ -8,12 +8,13 @@ from meetingtools.apps.room.models import Room from django.forms.widgets import Select, TextInput from django.forms.fields import ChoiceField, BooleanField from django.forms.forms import Form +from form_utils.forms import BetterModelForm PUBLIC = 0 PROTECTED = 1 PRIVATE = 2 -class UpdateRoomForm(ModelForm): +class UpdateRoomForm(BetterModelForm): #protection = ChoiceField(choices=((PUBLIC,'Anyone can enter the room.'), # (PROTECTED,'Only group members and accepted guests can enter the room.'), # (PRIVATE,'Only group members can enter.'))) @@ -21,6 +22,20 @@ class UpdateRoomForm(ModelForm): class Meta: model = Room fields = ['name','urlpath','participants','presenters','hosts','source_sco_id','self_cleaning'] + fieldsets = [('name',{'fields': ['name'], + 'classes': ['step'], + 'legend': 'Step 1: Room name', + 'description': 'The room name should be short and descriptive.' + }), + ('properties',{'fields': ['self_cleaning','urlpath','source_sco_id'], + 'classes': ['step'], + 'legend': 'Step 2: Room properties', + 'description': 'These are basic properties for your room. If you set your room to be self-cleaning it will be reset every time the last participant leaves the room.'}), + ('rights',{'fields': ['participants','presenters','hosts'], + 'classes': ['step','submit_step'], + 'legend': 'Step 3: Room rights (optional)', + 'description': 'Define the groups that are to have access to your room.'}) + ] widgets = {'participants': Select(), 'presenters': Select(), 'hosts': Select(), diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index b423d42..65e085b 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -146,12 +146,14 @@ def update(request,id=None): acc = room.acc what = "Update" title = "Modify %s" % room.name + formname = "update" update = True else: acc = _acc_for_user(request.user) my_meetings_sco_id = _user_meeting_folder(request,acc) room = Room(creator=request.user,acc=acc,folder_sco_id=my_meetings_sco_id) what = "Create" + formname = "create" title = "Create a new room" update = False @@ -168,7 +170,7 @@ def update(request,id=None): if update: form.fields['urlpath'].widget.attrs['readonly'] = True - return respond_to(request,{'text/html':'edit.html'},{'form':form,'formtitle': title,'submitname':'%s Room' % what}) + return respond_to(request,{'text/html':'apps/room/%s.html' % formname},{'form':form,'formtitle': title,'submitname':'%s Room' % what}) def _import_room(request,acc,sco_id,source_sco_id,folder_sco_id,name,urlpath): modified = False |