Index: /waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py
===================================================================
--- /waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py	(revision 141)
+++ /waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py	(revision 142)
@@ -920,5 +920,5 @@
         'ncols': 1,
         'rows': [
-            [{'widget_id': 'heading', 'ncols': 1},],
+            #[{'widget_id': 'heading', 'ncols': 1},],
             [{'widget_id': 'title', 'ncols': 1},],
             [{'widget_id': 'text', 'ncols': 1},],
@@ -994,10 +994,10 @@
 study_level = { ###(
     'widgets': {
-        'title': {
+        'Title': {
             'type': 'Select Widget',
             'data': {
                 'title': '',
                 'fields': ('Title',),
-                'is_required': True,
+                'is_required': False,
                 'label': 'Study Level',
                 'label_edit': 'Study Level',
@@ -1023,5 +1023,5 @@
         'ncols': 1,
         'rows': [
-            [{'widget_id': 'title', 'ncols': 1},],
+            [{'widget_id': 'Title', 'ncols': 1},],
         ]
     },
@@ -1045,5 +1045,5 @@
             },
         },
-        'title': Title,
+        'Title': Title,
         'text': Text,
         'which_sex': {
@@ -1137,6 +1137,6 @@
         'ncols': 1,
         'rows': [
-            [{'widget_id': 'heading', 'ncols': 1},],
-            [{'widget_id': 'title', 'ncols': 1},],
+            #[{'widget_id': 'heading', 'ncols': 1},],
+            [{'widget_id': 'Title', 'ncols': 1},],
             [{'widget_id': 'text', 'ncols': 1},],
             [{'widget_id': 'which_sex', 'ncols': 1},],
Index: /waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py
===================================================================
--- /waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py	(revision 141)
+++ /waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py	(revision 142)
@@ -321,8 +321,15 @@
 
 course_schema = { ###(
+    'Title': {
+        'type': 'CPS String Field',
+        'data': {
+            'default_expr': '',
+            'is_searchabletext': True,
+        },
+    },
     'heading': {
         'type': 'CPS String Field',
         'data': {
-            'default_expr': 'string:',
+            'default_expr': '',
             'is_searchabletext': True,
         },
@@ -374,4 +381,10 @@
 accommodation = { ###(
     'heading': {
+        'type': 'CPS String Field',
+        'data': {
+            'is_searchabletext': True,
+        },
+    },
+    'Title': {
         'type': 'CPS String Field',
         'data': {
Index: /waeup_product/trunk/skins/waeup_faculty/create_course.py
===================================================================
--- /waeup_product/trunk/skins/waeup_faculty/create_course.py	(revision 141)
+++ /waeup_product/trunk/skins/waeup_faculty/create_course.py	(revision 142)
@@ -24,8 +24,9 @@
                       create_action = 'create_course',
                       )
-if psm == 'invalid':
+if  psm == 'invalid':
     return context.common_edit_form(rendered = res,
                                  create = 1,
                                  type_name = type_name,
+                                 #psm = str(ds),
                                  psm = 'Please correct your errors',
                                  )
Index: /waeup_product/trunk/skins/waeup_student/register_level.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/register_level.py	(revision 142)
+++ /waeup_product/trunk/skins/waeup_student/register_level.py	(revision 142)
@@ -0,0 +1,80 @@
+##parameters=REQUEST
+# $Id$
+"""
+book an accomodation
+"""
+type_name = 'StudyLevel'
+ti = context.portal_types[type_name]
+pm = context.portal_membership
+REQUEST.set('type_name',type_name)
+
+validate = REQUEST.has_key("cpsdocument_create_button")
+
+
+lt = context.portal_layouts
+pv = context.portal_vocabularies
+#pr = context.portal_registration
+
+res,psm,ds = lt.renderLayout(layout_id= 'study_level',
+                      schema_id= 'metadata',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      create_action = 'register_level',
+                      )
+if psm == 'invalid':
+    return context.common_edit_form(rendered = res,
+                                 create = 1,
+                                 type_name = type_name,
+                                 psm = 'Not yet active',
+                                 #psm = 'Please correct your errors',
+                                 )
+elif psm == '':
+    return context.common_edit_form(rendered = res,
+                                 create = 1,
+                                 type_name = type_name,
+                                 psm = psm,
+                                 #psm = str(ds),
+                                 )
+    
+elif psm == 'valid':
+    psm = (ds)
+    oid = ds.get('Title')
+    return context.common_edit_form(rendered = res,
+                                 create = 1,
+                                 type_name = type_name,
+                                 psm = 'Not yet active',
+                                 #psm = 'Please correct your errors',
+                                 )
+    
+    halls = getattr(context,'accommodation').contentValues()
+    beds = []
+    student = context.PERSONAL.getContent()
+    sf = context.getContent()
+    for hall in halls:
+        h = hall.getContent()
+        ba = int(getattr(h,'beds_assigned',0))
+        bal = getattr(h,'beds_assigned_list',[])
+        nr_of_beds = int(h.nr_of_blocks) * int(h.nr_of_floors) * int(h.rooms_per_floor) * int(h.beds_per_room)
+        if h.which_sex == student.sex and nr_of_beds > len(bal):
+            break
+    dict = {'heading': h.heading,
+            'text': h.text,
+            'which_sex': h.which_sex,
+            'nr_of_blocks': h.nr_of_blocks,
+            'nr_of_floors': h.nr_of_floors,
+            'rooms_per_floor': h.rooms_per_floor,
+            'beds_per_room': h.beds_per_room,
+            'nr_of_free': nr_of_beds,
+            'beds_assigned': ba,
+             }
+    ba += 1
+    dict['beds_assigned'] = ba
+    bal.append(('%s:%d' % (pm.getAuthenticatedMember(),ba)))
+    dict['beds_assigned_list'] = bal
+    psm = "h:%(heading)s free:%(nr_of_free)s %(beds_assigned)s" % dict
+    sf.edit(mapping = ds)
+    h.edit(mapping = dict)
+    #psm = "Your not admitted"
+    return context.booked_accommodation(v=dict)
