diff options
Diffstat (limited to 'src/meetingtools/apps/room/forms.py')
-rw-r--r-- | src/meetingtools/apps/room/forms.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/meetingtools/apps/room/forms.py b/src/meetingtools/apps/room/forms.py index a211b2d..1906922 100644 --- a/src/meetingtools/apps/room/forms.py +++ b/src/meetingtools/apps/room/forms.py @@ -3,18 +3,26 @@ Created on Feb 1, 2011 @author: leifj ''' -from django.forms.models import ModelChoiceField + from meetingtools.apps.room.models import Room -from django.forms.widgets import Select, TextInput -from django.forms.fields import BooleanField +from django.forms.widgets import Select, TextInput, RadioSelect +from django.forms.fields import BooleanField, ChoiceField from django.forms.forms import Form from form_utils.forms import BetterModelForm -from django.contrib.auth.models import Group +from django.utils.safestring import mark_safe PUBLIC = 0 PROTECTED = 1 PRIVATE = 2 +class PrefixTextInput(TextInput): + def __init__(self, attrs=None, prefix=None): + super(PrefixTextInput, self).__init__(attrs) + self.prefix = prefix + + def render(self, name, value, attrs=None): + return mark_safe("<b>"+self.prefix+"</b> "+super(PrefixTextInput, self).render(name, value, attrs)) + class ModifyRoomForm(BetterModelForm): class Meta: model = Room @@ -30,35 +38,28 @@ class ModifyRoomForm(BetterModelForm): '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.'}), ] widgets = {'source_sco_id': Select(), - 'urlpath': TextInput(attrs={'size': '40'}), + 'urlpath': PrefixTextInput(attrs={'size': '15'}), 'name': TextInput(attrs={'size': '40'})} class CreateRoomForm(BetterModelForm): - - participants = ModelChoiceField(Group,required=False) - presenters = ModelChoiceField(Group,required=False) - hosts = ModelChoiceField(Group,required=False) - + + access = ChoiceField(choices=(('public','Public'),('private','Private'))) class Meta: model = Room - fields = ['name','urlpath','participants','presenters','hosts','source_sco_id','self_cleaning'] + fields = ['name','urlpath','access','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'], + ('properties',{'fields': ['self_cleaning','urlpath','access'], '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. If you leave the <em>Participants</em> field empty that implies that anyone who knows the URL may enter the room.'}) + 'description': 'These are basic properties for your room. If you set your room to clean-up after use it will be reset every time the last participant leaves the room. If you create a public room it will be open to anyone who has the room URL. If you create a private room then guests will have to be approved by an active meeting host before being able to join the room.'}), ] - widgets = {'source_sco_id': Select(), - 'urlpath': TextInput(attrs={'size': '40'}), + widgets = {'access': RadioSelect(), + 'urlpath': PrefixTextInput(attrs={'size': '15'}), 'name': TextInput(attrs={'size': '40'})} class DeleteRoomForm(Form): |