Index: waeup_product/trunk/skins/waeup_student/create_jamb.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/create_jamb.py	(revision 150)
+++ waeup_product/trunk/skins/waeup_student/create_jamb.py	(revision 152)
@@ -37,6 +37,5 @@
 elif psm == 'valid':
     s_id = "s%s" % ds.get('reg_nr')
-    name = ds.get('name')
-    skw = {'title': name}
+    skw = {'title': "%(firstname)s %(lastname)s" % ds}
     context.invokeFactory('Student',s_id) 
     student = getattr(context,s_id)    
@@ -46,5 +45,5 @@
     student.invokeFactory('Jamb',jamb_id) 
     jamb = getattr(student,jamb_id)    
-    ds.set('title', name)
+    ds.set('title', "%(reg_nr)s (%(lastname)s)" % ds)
     jamb.getContent().edit(mapping=ds)
     context.notifyCPSDocumentCreation(ob=jamb)
@@ -57,4 +56,8 @@
     if noCPSMember:
         pr.addMember(s_id, 'UnSeT',roles=('Member','Student','Contributor'))
+    student.manage_setLocalRoles(s_id, ['Owner'])
+    jamb.manage_setLocalRoles(s_id, ['Owner'])
+##    student.getContent().setOwnership(s_id)
+##    jamb.getContent().setOwnership(s_id)
 ##    groups = context.portal_directories.groups
 ##    gm = list(groups.getEntry('Students')['members'])
@@ -63,9 +66,3 @@
 ##                      'members': gm})  
     return context.students_folder_view_manager(psm=psm)
-##    return context.create_jamb_form(rendered = res,
-##                                 psm = psm,
-##                                 ds = ds,
-##                                 )
-    
-return res,psm,ds
 
Index: waeup_product/trunk/skins/waeup_student/process_waeup_login.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 150)
+++ waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 152)
@@ -25,14 +25,15 @@
 pd = getattr(ma,pdid)
 pkw = {}
-pkw['sex'] = getattr(jamb,'sex')
-pkw['firstname'] = getattr(jamb,'firstname')
-pkw['middlename'] = getattr(jamb,'middlename')
-pkw['lastname'] = getattr(jamb,'lastname')
-pkw['aggregate'] = getattr(jamb,'aggregate')
-pkw['faculty'] = getattr(jamb,'faculty')
-pkw['age'] = getattr(jamb,'age')
-pkw['state'] = getattr(jamb,'state')
+jc = jamb.getContent()
+pkw['sex'] = getattr(jc,'sex')
+pkw['firstname'] = getattr(jc,'firstname')
+pkw['middlename'] = getattr(jc,'middlename')
+pkw['lastname'] = getattr(jc,'lastname')
+pkw['aggregate'] = getattr(jc,'aggregate')
+pkw['faculty'] = getattr(jc,'faculty')
+pkw['age'] = getattr(jc,'age')
+pkw['state'] = getattr(jc,'state')
 
-pd.edit(mapping=pkw)
+pd.getContent().edit(mapping=pkw)
 context.notifyCPSDocumentCreation(ob=pd)
 return response.redirect(ma.absolute_url())
Index: waeup_product/trunk/skins/waeup_student/register_level.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/register_level.py	(revision 150)
+++ waeup_product/trunk/skins/waeup_student/register_level.py	(revision 152)
@@ -28,6 +28,6 @@
                                  create = 1,
                                  type_name = type_name,
-                                 psm = 'Not yet active',
-                                 #psm = 'Please correct your errors',
+                                 #psm = 'Not yet active',
+                                 psm = 'Please correct your errors',
                                  )
 elif psm == '':
@@ -42,39 +42,26 @@
     psm = (ds)
     oid = ds.get('Title')
-    return context.common_edit_form(rendered = res,
+    if hasattr(context,oid):
+        return context.common_edit_form(rendered = res,
                                  create = 1,
                                  type_name = type_name,
-                                 psm = 'Not yet active',
-                                 #psm = 'Please correct your errors',
+                                 psm = 'You already registered for that level',
                                  )
-    
-    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)
+    context.invokeFactory(type_name,oid) 
+    object = getattr(context,oid)
+    voc = pv.courselevel
+    ds.set('Title',voc.get(oid))
+    object.getContent().edit(mapping=ds,proxy=object)
+    context.notifyCPSDocumentCreation(ob=object)
+    psm = 'new %s created' % oid
+    semester_id = 'Semester_1_%s_%s' % (oid,context.getId())
+    object.invokeFactory('Semester',semester_id)
+    semester = getattr(object,semester_id)
+    semester.getContent().edit(mapping={'Title': 'First Semester'})
+    semester_id = 'Semester_2_%s_%s' % (oid,context.getId())
+    object.invokeFactory('Semester',semester_id)
+    semester = getattr(object,semester_id)
+    semester.getContent().edit(mapping={'Title': 'Second Semester'})
+    context_ti = context.portal_types[context.portal_type] 
+    index = context_ti.getActionById('view','university_view')
+    return getattr(context,index)(psm=psm)
