summaryrefslogtreecommitdiff
path: root/src/meetingtools/apps/room/forms.py
blob: a211b2d2f95b23b990b225644bbf69bd9cf1c608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'''
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.forms import Form
from form_utils.forms import BetterModelForm
from django.contrib.auth.models import Group
        
PUBLIC = 0
PROTECTED = 1
PRIVATE = 2
        
class ModifyRoomForm(BetterModelForm):
    class Meta:
        model = Room
        fields = ['name','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.'}),
                    ]
        widgets = {'source_sco_id': Select(),
                   'urlpath': TextInput(attrs={'size': '40'}),
                   'name': TextInput(attrs={'size': '40'})}
        
        
class CreateRoomForm(BetterModelForm):
    
    participants = ModelChoiceField(Group,required=False)
    presenters = ModelChoiceField(Group,required=False)
    hosts = ModelChoiceField(Group,required=False)
    
    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. If you leave the <em>Participants</em> field empty that implies that anyone who knows the URL may enter the room.'})               
                    ]
        widgets = {'source_sco_id': Select(),
                   'urlpath': TextInput(attrs={'size': '40'}),
                   'name': TextInput(attrs={'size': '40'})}
        
class DeleteRoomForm(Form):
    confirm = BooleanField(label="Confirm remove room")