Index: waeup_product/trunk/skins/waeup_student/add_course_ticket.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/add_course_ticket.py	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/add_course_ticket.py	(revision 164)
@@ -0,0 +1,67 @@
+##parameters=REQUEST
+# $Id$
+"""
+book an accomodation
+"""
+type_name = 'CourseTicket'
+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= 'study_level',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      create_action = 'add_course_ticket',
+                      )
+if True or 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')
+    if hasattr(context,oid):
+        return context.common_edit_form(rendered = res,
+                                 create = 1,
+                                 type_name = type_name,
+                                 psm = 'You already registered for that level',
+                                 )
+    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)
Index: waeup_product/trunk/skins/waeup_student/admission_slip_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/admission_slip_form.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/admission_slip_form.pt	(revision 164)
@@ -0,0 +1,22 @@
+<html metal:use-macro="here/content_lib_master/macros/master">
+
+  <metal:block fill-slot="head_slot">
+  </metal:block>
+
+  <metal:block fill-slot="css_slot">
+    <link rel="Stylesheet" type="text/css" href=""
+      tal:attributes="href string:${base_url}document.css" />
+  </metal:block>
+  <metal:block fill-slot="header">
+  </metal:block>
+
+  <metal:block fill-slot="main">
+    <h1> Your Admission Slip</h1>      
+    <p>you used a <span  tal:content="options/dict/sc_value" /> Scratchcard with PIN 
+    <span tal:content="options/dict/sc_pin" />
+    </p>
+      <tal:block  tal:content="structure options/rendered" />
+  </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
+</html>
Index: waeup_product/trunk/skins/waeup_student/book_accommodation.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/book_accommodation.py	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/book_accommodation.py	(revision 164)
@@ -21,12 +21,13 @@
                       ob={},
                       layout_mode='create',
+                      create_action = 'book_accommodation',
                       )
 if psm == 'invalid':
-    return context.check_admission_form(rendered = res,
+    return context.book_accommodation_form(rendered = res,
                                  psm = "Please correct your input",
                                  ds = ds,
                                  )
 elif psm == '':
-    return context.check_admission_form(rendered = res,
+    return context.book_accommodation_form(rendered = res,
                                  psm = None,
                                  ds = ds,
@@ -36,5 +37,5 @@
     halls = getattr(context,'accommodation').contentValues()
     beds = []
-    student = context.getContent()
+    student = context.PERSONAL.getContent()
     sf = context.getContent()
     for hall in halls:
Index: waeup_product/trunk/skins/waeup_student/book_accommodation_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/book_accommodation_form.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/book_accommodation_form.pt	(revision 164)
@@ -0,0 +1,25 @@
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;
+                   data_storage options/ds;
+                   jamb options/jamb/getContent|nothing;
+                   edition python:1;"
+                   >
+<metal:block define-macro="edit_form">
+<metal:block use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="header"
+    tal:define="creation creation|nothing;
+                edition edition|nothing;
+                metadata metadata|nothing"
+                >
+    </metal:block>
+
+    <metal:block fill-slot="main">
+        <h1>Book Your Accommodation!</h1>
+      <div tal:replace="structure rendered_main" />
+    </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
+
+</metal:block>
+</metal:block>
+</tal:block>
Index: waeup_product/trunk/skins/waeup_student/check_admission.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 164)
@@ -17,5 +17,5 @@
 
 res,psm,ds = lt.renderLayout(layout_id= 'admission',
-                      schema_id= 'jamb',
+                      schema_id= 'student_admission',
                       context=context,
                       mapping=validate and REQUEST,
@@ -37,29 +37,19 @@
     catalog = context.portal_catalog
     search = catalog(SearchableText = "%s*" % s_id)
-    if len(search) < 1:
-        psm = "Your not admitted"
+    student = getattr(context,s_id,None)
+    if student is None:
+    #if len(search) < 1:
+        psm = "Your are not admitted"
         return context.check_admission_form(rendered = res,
-                                 psm = psm + str(search),
+                                 psm = psm, 
                                  ds = ds,
                                  )
-    sf = getattr(context,s_id,None)
-    if sf and getattr(sf,'PERSONAL',None):
-        psm = "Your already admitted, please login"
-        return context.check_admission_form(rendered = res,
-                                 psm = psm,
-                                 ds = ds,
-                                 )
-    rset = REQUEST.set
-    sc_pin =  ds.get('sc_pin')
-    return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s" 
-                                    % (context.absolute_url(),s_id,sc_pin))
-##    return context.student_admitted_form(rendered = res,
-##                                 psm = psm,
-##                                 ds = ds,
-##                                 student = student,
-##                                 jamb = jamb,
-##                                 pd = pd,
-##                                 )
-##    
-##return res,psm,ds
+student.getContent().setScratchCardData('adm_check',ds)
 
+jamb = getattr(student,'JAMB')
+res = jamb.getContent().render(layout_id = 'admission_slip', 
+                               layout_mode = 'view',
+                               schema_id = 'jamb')
+
+return jamb.admission_slip_form(rendered = res, dict = ds)
+
Index: waeup_product/trunk/skins/waeup_student/check_admission_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/check_admission_form.pt	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/check_admission_form.pt	(revision 164)
@@ -13,13 +13,19 @@
                 >
     </metal:block>
-
-    <metal:block fill-slot="main">
-        <h1>Check your admission status!</h1>
-      <div tal:replace="structure rendered_main" />
+      <metal:block fill-slot="main">
+        <h1> Check Your Admission Status! </h1>
+        <div tal:replace="structure rendered_main" />
+          Instructions :<br />
+          <ul>
+            <li>Enter the scratch card PIN for admission check </li> 
+            <li>Print the Admission Slip which is displayed if you are admitted by the School </li>
+            <li>Buy a Clearance card </li> 
+            <li>Proceed to the Clearance Eligibility Online Form and fill your O/L details </li> 
+            <li>Proceed to the School with all original documents for Clearance to finalize the clearance process </li>
+          </ul>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
     </metal:block>
-  <metal:block fill-slot="sub">
   </metal:block>
-
-</metal:block>
-</metal:block>
 </tal:block>
Index: waeup_product/trunk/skins/waeup_student/clearence.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/clearence.py	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/clearence.py	(revision 164)
@@ -0,0 +1,57 @@
+##parameters=REQUEST
+# $Id$
+"""
+process the Admission Form
+return html renderer + psm
+"""
+type_name = 'Jamb'
+ti = context.portal_types[type_name]
+
+REQUEST.set('type_name',type_name)
+
+validate = REQUEST.has_key("cpsdocument_edit_button")
+
+
+lt = context.portal_layouts
+pr = context.portal_registration
+
+res,psm,ds = lt.renderLayout(layout_id= 'clearence',
+                      schema_id= 'student_clearence',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      )
+if psm == 'invalid':
+    return context.clearence_form(rendered = res,
+                                 psm = "Please correct your input",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.clearence_form(rendered = res,
+                                 psm = None,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    s_id = "s%s" % ds.get('jamb_id')
+    catalog = context.portal_catalog
+    search = catalog(SearchableText = "%s*" % s_id)
+    if len(search) < 1:
+        psm = "Your not admitted"
+        return context.clearence_form(rendered = res,
+                                 psm = psm,
+                                 ds = ds,
+                                 )
+    sf = getattr(context,s_id,None)
+    if sf and getattr(sf,'PERSONAL',None):
+        psm = "Your already admitted, please login"
+        return context.clearence_form(rendered = res,
+                                 psm = psm,
+                                 ds = ds,
+                                 )
+    rset = REQUEST.set
+    student = getattr(context,s_id)
+    student.getContent().setScratchCardData('clearence',ds)
+    sc_pin =  ds.get('sc_pin')
+    return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s" 
+                                    % (context.absolute_url(),s_id,sc_pin))
Index: waeup_product/trunk/skins/waeup_student/clearence_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/clearence_form.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/clearence_form.pt	(revision 164)
@@ -0,0 +1,30 @@
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;
+                   data_storage options/ds;
+                   jamb options/jamb/getContent|nothing;
+                   edition python:1;"
+                   >
+<metal:block define-macro="edit_form">
+<metal:block use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="header"
+    tal:define="creation creation|nothing;
+                edition edition|nothing;
+                metadata metadata|nothing"
+                >
+    </metal:block>
+      <metal:block fill-slot="main">
+        <h1>Clearence and Eligibility Processing </h1>
+        <div tal:replace="structure rendered_main" />
+          Instructions :<br />
+          <ul>
+            <li>Buy a Clearance card </li> 
+            <li>Enter the PIN here </li> 
+            <li>Proceed to the Clearance Eligibility Online Form and fill your O/L details </li> 
+            <li>Proceed to the School with all original documents for Clearance to finalize the clearance process</li>
+          </ul>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: waeup_product/trunk/skins/waeup_student/eligibility.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/eligibility.py	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/eligibility.py	(revision 164)
@@ -0,0 +1,51 @@
+##parameters=REQUEST
+# $Id$
+"""
+process the Admission Form
+return html renderer + psm
+"""
+type_name = 'Jamb'
+ti = context.portal_types[type_name]
+
+REQUEST.set('type_name',type_name)
+
+validate = REQUEST.has_key("cpsdocument_edit_button")
+
+
+lt = context.portal_layouts
+pr = context.portal_registration
+pm = context.portal_membership
+
+jamb = getattr(context,'JAMB')
+jamb_rendered = jamb.getContent().render(layout_id = 'admission_slip', 
+                               layout_mode = 'view',
+                               schema_id = 'jamb')
+
+res,psm,ds = lt.renderLayout(layout_id= 'student_eligibility',
+                      schema_id= 'student_eligibility',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      )
+res = jamb_rendered + res
+if psm == 'invalid':
+    return context.eligibility_form(rendered = res,
+                                 #psm = str(ds),
+                                 psm = "Please correct your input",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.eligibility_form(rendered = res,
+                                 psm = None,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    s_personal = context.PERSONAL.getContent()
+    s_personal.edit(mapping={'email': ds.get('email')})
+    pm.setPassword(REQUEST.get("widget__pw"))
+    
+return context.eligibility_form(rendered = res,
+                                 psm = 'Password and Email have been successfully set',
+                                 ds = ds,
+                                 )
Index: waeup_product/trunk/skins/waeup_student/eligibility_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/eligibility_form.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/eligibility_form.pt	(revision 164)
@@ -0,0 +1,23 @@
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;
+                   data_storage options/ds;
+                   jamb options/jamb/getContent|nothing;
+                   edition python:1;"
+                   >
+<metal:block define-macro="edit_form">
+<metal:block use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="header"
+    tal:define="creation creation|nothing;
+                edition edition|nothing;
+                metadata metadata|nothing"
+                >
+    </metal:block>
+      <metal:block fill-slot="main">
+        <h1> Fill in your Email and give a new Password </h1>
+        <div tal:replace="structure rendered_main" />
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: waeup_product/trunk/skins/waeup_student/layout_accobook_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_accobook_create.pt	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/layout_accobook_create.pt	(revision 164)
@@ -10,5 +10,4 @@
              edit_form     python:ti and ti.getActionById('edit',   'cpsdocument_edit_form') or  'cpsdocument_edit_form';
              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
-             formaction string:check_admission_form;
              first_layout options/first_layout|python:0;
              last_layout options/last_layout|python:0;
@@ -17,5 +16,5 @@
              "
              >
-  <form action='book_accommodation' method='post'
+  <form action='' method='post' tal:attributes="action string:${options/create_action}"
         enctype='multipart/form-data' class='workflow'>
     <div class='group'>
@@ -81,3 +80,2 @@
   </form>
 </metal:block>
-  
Index: waeup_product/trunk/skins/waeup_student/layout_clearence_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_clearence_create.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/layout_clearence_create.pt	(revision 164)
@@ -0,0 +1,83 @@
+<tal:block define="global creation python:1" />
+<metal:block define-macro="default_edit"
+             tal:define="layout options/layout;
+             ds options/datastructure;
+             creation creation|nothing;
+             metadata metadata|nothing;
+             type_name request/type_name|nothing;
+             ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
+             creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ;
+             edit_form     python:ti and ti.getActionById('edit',   'cpsdocument_edit_form') or  'cpsdocument_edit_form';
+             metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
+             formaction string:check_admission_form;
+             first_layout options/first_layout|python:0;
+             last_layout options/last_layout|python:0;
+             is_flexible options/is_flexible;
+             cpsmcat nocall:here/translation_service;
+             "
+             >
+  <form action='clearence' method='post'
+        enctype='multipart/form-data' class='workflow'>
+    <div class='group'>
+      <div class='documentFields'>
+        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
+          <tr tal:repeat="row layout/rows" valign="top">
+            <td tal:repeat="cell row"
+                tal:attributes="colspan cell/ncols">
+              <tal:block define="widget cell/widget;
+              wid widget/getWidgetId;
+              dm options/datastructure/getDataModel;
+              err python:ds.getError(wid);
+              err_mapping python:ds.getErrorMapping(wid);
+              is_required widget/is_required|nothing;
+              tooltip_id python:wid + '_help';
+              widget_css_class cell/widget_css_class|nothing;
+              widget_css_class python:test(is_flexible, 'group', widget_css_class);
+              css_class python:test(err, 'row error',
+              test(is_flexible, 'group', 'row'))"
+              >
+                <div tal:attributes="class widget_css_class;
+                id python:widget.getHtmlWidgetId()+'_widget';"
+                >
+                  <div class="label" tal:condition="widget/label_edit"
+                       tal:attributes="class python:test(is_required, 'label required','label')">
+                    <label i18n:translate="" tal:condition="widget/is_i18n"
+                           tal:content="widget/label_edit"
+                           tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
+                    <label tal:condition="not:widget/is_i18n"
+                           tal:content="widget/label_edit"
+                           tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
+                  </div>
+                  <button type="button" class="tooltipControl"
+                          tal:condition="widget/help"
+                          tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
+                  <div class="field">
+                    <div tal:replace="structure cell/widget_rendered"/>
+                  </div>
+                  <div class="tooltipArea" style="visibility: hidden;"
+                       tal:condition="widget/help"
+                       tal:attributes="id tooltip_id;
+                       onclick python:'showElement(false, \'%s\')' % tooltip_id;"
+                       >
+                    <tal:block i18n:translate="" tal:condition="widget/is_i18n"
+                               tal:content="widget/help">i18_key-help_for_this_field</tal:block>
+                    <tal:block tal:condition="not:widget/is_i18n"
+                               tal:content="widget/help">This is the help for this field</tal:block>
+                  </div>
+                  <tal:block condition="err">
+                    <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
+                      <br /><em style="color: red"
+                                tal:content="msg">err</em>
+                    </tal:block>
+                  </tal:block>
+                </div>
+              </tal:block>
+            </td>
+          </tr>
+        </table>
+        <input type="submit" class="standalone" name="cpsdocument_edit_button" value="check" />
+      </div>        
+    </div>
+  </form>
+</metal:block>
+  
Index: waeup_product/trunk/skins/waeup_student/layout_slregister_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_slregister_create.pt	(revision 164)
+++ waeup_product/trunk/skins/waeup_student/layout_slregister_create.pt	(revision 164)
@@ -0,0 +1,2 @@
+<tal:block define="global creation python:1" />
+<metal:block use-macro="here/waeup_layout_lib/macros/common_edit" />
Index: waeup_product/trunk/skins/waeup_student/process_waeup_login.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 164)
@@ -37,4 +37,6 @@
 pd.getContent().edit(mapping=pkw)
 context.notifyCPSDocumentCreation(ob=pd)
-return response.redirect(ma.absolute_url())
 
+return response.redirect("%s/eligibility" % ma.absolute_url())
+return ma.eligibility(REQUEST=context.REQUEST)
+
Index: waeup_product/trunk/skins/waeup_student/register_level.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/register_level.py	(revision 163)
+++ waeup_product/trunk/skins/waeup_student/register_level.py	(revision 164)
@@ -2,5 +2,5 @@
 # $Id$
 """
-book an accomodation
+register for next level
 """
 type_name = 'StudyLevel'
@@ -17,5 +17,5 @@
 
 res,psm,ds = lt.renderLayout(layout_id= 'study_level',
-                      schema_id= 'metadata',
+                      schema_id= 'study_level',
                       context=context,
                       mapping=validate and REQUEST,
@@ -28,6 +28,6 @@
                                  create = 1,
                                  type_name = type_name,
-                                 #psm = 'Not yet active',
-                                 psm = 'Please correct your errors',
+                                 psm = str(ds),
+                                 #psm = 'Please correct your errors',
                                  )
 elif psm == '':
@@ -40,24 +40,25 @@
     
 elif psm == 'valid':
-    psm = (ds)
-    oid = ds.get('Title')
-    if hasattr(context,oid):
+    voc = pv.courselevel
+    level_id = voc.items()[0][0]
+    level = getattr(context,level_id,None)
+    if level:
         return context.common_edit_form(rendered = res,
                                  create = 1,
                                  type_name = type_name,
-                                 psm = 'You already registered for that level',
+                                 psm = "You have already registered for Level %s" % voc.get(level_id)
                                  )
-    context.invokeFactory(type_name,oid) 
-    object = getattr(context,oid)
-    voc = pv.courselevel
-    ds.set('Title',voc.get(oid))
+    
+    context.invokeFactory(type_name,level_id) 
+    object = getattr(context,level_id)
+    ds.set('Title',voc.get(level_id))
     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())
+    psm = 'new %s created' % level_id
+    semester_id = 'Semester_1_%s_%s' % (level_id,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())
+    semester_id = 'Semester_2_%s_%s' % (level_id,context.getId())
     object.invokeFactory('Semester',semester_id)
     semester = getattr(object,semester_id)
Index: waeup_product/trunk/skins/waeup_student/register_study_level.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/register_study_level.py	(revision 163)
+++ 	(revision )
@@ -1,67 +1,0 @@
-##parameters=REQUEST
-# $Id$
-"""
-book an accomodation
-"""
-type_name = 'CourseTicket'
-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= 'study_level',
-                      context=context,
-                      mapping=validate and REQUEST,
-                      ob={},
-                      layout_mode='create',
-                      create_action = 'register_study_level',
-                      )
-if True or 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')
-    if hasattr(context,oid):
-        return context.common_edit_form(rendered = res,
-                                 create = 1,
-                                 type_name = type_name,
-                                 psm = 'You already registered for that level',
-                                 )
-    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)
