Index: /waeup_product/trunk/skins/waeup_student/check_admission.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 48)
@@ -3,5 +3,4 @@
 """
 process the Admission Form
-
 return html renderer + psm
 """
@@ -13,18 +12,7 @@
 validate = REQUEST.has_key("cpsdocument_edit_button")
 
-#student = context.getContent()
-student = context
-
-#jamb = getattr(student,'my-jamb').getContent()
-jamb = getattr(student,'my-jamb')
-
-##res = jamb.validateStoreRender(request=REQUEST,
-##                               layout_mode='create',
-##                               layout_mode_ok='admitted',
-##                               layout_mode_err='create',
-##                               layout_id='admission',
-##                               )
 
 lt = context.portal_layouts
+pr = context.portal_registration
 
 res,psm,ds = lt.renderLayout(layout_id= 'admission',
@@ -37,13 +25,29 @@
 if psm == 'invalid':
     return context.check_admission_form(rendered = res,
+                                 psm = "Please correct your input",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.check_admission_form(rendered = res,
+                                 psm = None,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    s_id = "s%s" % ds.get('jamb_id')
+    if not hasattr(context,s_id):
+        return context.check_admission_form(rendered = res,
+                                 psm = "Your not admitted yet",
+                                 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,
-                                 )
-    
-elif psm == 'valid':
-    return context.student_admitted_form(rendered = res,
-                                 psm = psm,
                                  student = student,
                                  jamb = jamb,
+                                 pd = pd,
                                  )
     
Index: /waeup_product/trunk/skins/waeup_student/check_admission_form.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/check_admission_form.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/check_admission_form.pt	(revision 48)
@@ -2,4 +2,5 @@
                    portal_status_message options/psm;
                    data_storage options/ds;
+                   jamb options/jamb/getContent|nothing;
                    edition python:1;"
                    >
@@ -14,8 +15,9 @@
 
     <metal:block fill-slot="main">
-<span tal:content="structure data_storage" />
-      <h1>check your admission to the UniDemo !</h1>
+        <h1>check your admission to the UniDemo !</h1>
       <div tal:replace="structure rendered_main" />
     </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
 
 </metal:block>
Index: /waeup_product/trunk/skins/waeup_student/create_jamb.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/create_jamb.py	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/create_jamb.py	(revision 48)
@@ -1,70 +1,60 @@
-##parameters=type_name, REQUEST=None, **kw
+##parameters=REQUEST=None
 # $Id$
 """
-Create an object.
+Create an the Jamb-Record for a Student
 
-FIXME: what are the parameters?
 """
 
-from urllib import urlencode
+type_name = 'Jamb'
+ti = context.portal_types[type_name]
+pr = context.portal_registration
+pm = context.portal_membership
 
-if REQUEST is not None:
-    kw.update(REQUEST.form)
-    # Use creation without empty object.
-    # XXX should find better
-    ti = getattr(context.portal_types, type_name)
-    # For cpsdocument
-    if ti.meta_type == 'CPS Flexible Type Information':
-        args = {'type_name': type_name}
-        # XXX pass prefilled title, a bit of a hack...
-        args['widget__Title'] = kw.get('title', '')
+REQUEST.set('type_name',type_name)
 
-        # Look for the create action on the ti
-        create_action_form = ti.getActionById('create', 'cpsdocument_create_form')
+validate = REQUEST.has_key("cpsdocument_edit_button")
 
-        return REQUEST.RESPONSE.redirect('%s/%s?%s'
-                                         % (context.absolute_url(),
-                                            create_action_form,
-                                            urlencode(args)))
+lt = context.portal_layouts
 
-if REQUEST and not kw.get('title'):
-    # Need a title before creating folders
-    if type_name in ('Section', 'Workspace'):
-        args = {'type_name': type_name}
-        return REQUEST.RESPONSE.redirect('%s/folder_edit_form?%s' %
-                                (context.absolute_url(), urlencode(args)))
+res,psm,ds = lt.renderLayout(layout_id= 'jambcreate',
+                      schema_id= 'jamb',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      )
+if psm == 'invalid' or psm == '':
+    return context.create_jamb_form(rendered = res,
+                                 psm = psm,
+                                 ds = ds,
+                                 )
+    
+elif psm == 'valid':
+    s_id = "s%s" % ds.get('reg_nr')
+    name = ds.get('name')
+    skw = {'title': name}
+    context.invokeFactory('Student',s_id) 
+    student = getattr(context,s_id)    
+    student.edit(mapping=skw)
+    context.notifyCPSDocumentCreation(ob=student)
+    jamb_id = 'JAMB'
+    student.invokeFactory('Jamb',jamb_id) 
+    jamb = getattr(student,jamb_id)    
+    ds.set('title', name)
+    jamb.edit(mapping=ds)
+    context.notifyCPSDocumentCreation(ob=jamb)
+    psm = 'Student created'
+    pr.addMember(s_id, 'UnSeT')
+    groups = context.portal_directories.groups
+    gm = list(groups.getEntry('Students')['members'])
+    gm.extend((s_id,))
+    groups.editEntry({'group': 'Students', 
+                      'members': gm})  
+    return context.student_folder_view(psm=psm)
+##    return context.create_jamb_form(rendered = res,
+##                                 psm = psm,
+##                                 ds = ds,
+##                                 )
+    
+return res,psm,ds
 
-id = kw.get('title', 'my_' + type_name)
-id = context.computeId(compute_from=id)
-
-context.invokeFactory(type_name, id)
-ob = getattr(context, id)
-
-try:
-    doc = ob.getEditableContent()
-except AttributeError:
-    # not a proxy
-    doc = ob
-else:
-    try:
-        doc.edit(proxy=ob, **kw)
-    except:
-        # CMF Compatibility.
-        # type_name not necessarly and edit method
-        # for CMF types is not aware about that.
-        if kw.has_key('type_name'):
-            del kw['type_name']
-        doc.edit(**kw)
-
-context.portal_eventservice.notifyEvent('modify_object', context, {})
-context.portal_eventservice.notifyEvent('modify_object', ob, {})
-
-
-if REQUEST is not None:
-    psm = 'psm_content_created'
-    action_path = doc.getTypeInfo().immediate_view # getActionById('metadata')
-    REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' %
-                              (ob.absolute_url(), action_path,
-                               psm))
-
-return id
Index: /waeup_product/trunk/skins/waeup_student/create_jamb_form.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/create_jamb_form.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/create_jamb_form.pt	(revision 48)
@@ -1,26 +1,22 @@
-<html metal:use-macro="here/content_lib_master/macros/master">
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;"
+                   >
+<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 python:1;
+                metadata metadata|nothing"
+                >
+    </metal:block>
 
-  <metal:block fill-slot="head_slot">
-    <tal:block tal:define="student here/getContent">
-    </tal:block>
+    <metal:block fill-slot="main">
+      <h1>Enter the JAMB Data for a Student </h1>
+      <div tal:replace="structure rendered_main" />
+    </metal:block>
+  <metal:block fill-slot="sub">
   </metal:block>
 
-  <metal:block fill-slot="css_slot">
-    <link rel="Stylesheet" type="text/css" href=""
-          tal:attributes="href string:${base_url}student.css" />
-  </metal:block>
-
-  <metal:block fill-slot="main"
-               tal:define="items here/contentValues"
-               >
-    <form action="content_create" tal:attributes="action string:${here_url}/content_create"
-          method="post" class="group">
-      <dt>
-        <input type="hidden" name="type_name" value="Jamb" /> 
-      <p>
-        <input id="objectTitle" type="text" name="title" value="JAMB" class="focus" size="40" />
-        <input type="submit" class="standalone searchButton" value="create" />
-      </p>
-    </form>
-  </metal:block>
-</html>
+</metal:block>
+</metal:block>
+</tal:block>
Index: /waeup_product/trunk/skins/waeup_student/create_personal_form.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/create_personal_form.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/create_personal_form.pt	(revision 48)
@@ -17,5 +17,5 @@
           method="post" class="group">
       <dt>
-        <input type="hidden" name="type_name" value="Jamb" /> 
+        <input type="hidden" name="type_name" value="StudentPersonal" /> 
       <p>
         <input id="objectTitle" type="text" name="Title" value="personal" class="focus" size="40" />
Index: /waeup_product/trunk/skins/waeup_student/process_waeup_login.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 48)
+++ /waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 48)
@@ -0,0 +1,33 @@
+##parameters=member=None,sc_pin=None
+# $Id$
+"""
+Process a student after login
+
+"""
+request = context.REQUEST
+response=request.response
+
+if request.form.get('submit') == 'Log in':
+    if "Students" in member.getGroups():
+        ca = context.portal_catalog(id = str(member))
+    elif "StudentManager" in member.getGroups():
+        ca = context.portal_catalog(id = 'students')
+    ma = ca[0].getObject()
+    return response.redirect(ma.absolute_url())
+        
+member_id = str(member)
+ma = getattr(context,member_id)
+jkw = {'admission_sc_pin': sc_pin}
+jamb = getattr(ma,'JAMB')
+jamb.edit(mapping=jkw)
+#pdid = 'personal%s' % member_id
+pdid = 'PERSONAL'
+ma.invokeFactory('StudentPersonal', pdid)
+pd = getattr(ma,pdid)    
+pkw = {}
+pkw['sex'] = getattr(jamb,'sex')
+pkw['lastname'] = getattr(jamb,'name')
+pd.edit(mapping=pkw)
+context.notifyCPSDocumentCreation(ob=pd)
+return response.redirect(ma.absolute_url())
+
Index: /waeup_product/trunk/skins/waeup_student/student_admitted_form.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_admitted_form.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/student_admitted_form.pt	(revision 48)
@@ -5,10 +5,7 @@
                    edition python:1;"
                    >
-<metal:html use-macro="here/main_template/macros/master">
-  <metal:block fill-slot="header" />
+  <metal:html use-macro="here/main_template/macros/master">
     <metal:main fill-slot="main">
-      <span tal:condition="python: 1" tal:content="jamb/reg_nr" />
-      <span tal:condition="python: 1" tal:content="jamb/admission_sc_pin" />
-      <span tal:content="student/title_or_id" />
+      <a href="edits" tal:attributes="href string:${context/pd/absolute_url}/cpsdocument_edit_form"></a>
     </metal:main>
   </metal:html>
Index: /waeup_product/trunk/skins/waeup_student/student_folder_view.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_folder_view.py	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/student_folder_view.py	(revision 48)
@@ -1,3 +1,3 @@
-##parameters=REQUEST=None
+##parameters=REQUEST=None,psm=None,groups=None
 
 # $Id$
@@ -8,3 +8,3 @@
 admin = "SectionManager" in context.portal_membership.getAuthenticatedMember().getRolesInContext(context)
 
-return context.student_folder_view_main(admin = admin)
+return context.student_folder_view_main(admin = admin,psm=psm,groups=groups)
Index: /waeup_product/trunk/skins/waeup_student/student_folder_view_main.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_folder_view_main.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/student_folder_view_main.pt	(revision 48)
@@ -10,4 +10,6 @@
           tal:attributes="href string:${base_url}student.css" />
   </metal:block>
+  <metal:block fill-slot="header">
+  </metal:block>
 
   <metal:block fill-slot="main"
@@ -16,8 +18,7 @@
                >
     <span tal:condition="python: mtool.isAnonymousUser()"> 
-      Please login or check you Jambadmission.
+      Please login or <a href="" tal:attributes="href string:${context/absolute_url}/check_admission">check you Jambadmission</a>.
     </span>
-    <span tal:condition="python: 0" tal:content="python:member.getRolesInContext(here)" />
-    <span tal:condition="python: 'SectionManager' in member.getRolesInContext(here)"> 
+    <span tal:condition="python: member and 'StudentManager' in member.getGroups()"> 
       <table cellspacing="0" cellpadding="0">
         <tal:block condition="python: len(items)">
@@ -36,3 +37,5 @@
     </span>
   </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
 </html>
Index: /waeup_product/trunk/skins/waeup_student/student_index_html.py
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_index_html.py	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/student_index_html.py	(revision 48)
@@ -4,4 +4,9 @@
 
 """Default view for the Student."""
+member = context.portal_membership.getAuthenticatedMember()
 
-return context.student_view_main()
+#return context.student_view_manager()
+if 'StudentManager' in member.getGroups():
+    return context.student_view_manager()
+elif 'Students' in member.getGroups():
+    return context.student_view_student()
Index: /waeup_product/trunk/skins/waeup_student/student_view_manager.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_view_manager.pt	(revision 47)
+++ /waeup_product/trunk/skins/waeup_student/student_view_manager.pt	(revision 48)
@@ -6,15 +6,15 @@
 </metal:block>
 
-<metal:block fill-slot="css_slot">
-  <link rel="Stylesheet" type="text/css" href=""
-    tal:attributes="href string:${base_url}student.css" />
-</metal:block>
+  <metal:block fill-slot="css_slot">
+    <link rel="Stylesheet" type="text/css" href=""
+          tal:attributes="href string:${base_url}student.css" />
+  </metal:block>
+  <metal:block fill-slot="header">
+  </metal:block>
 
 <metal:block fill-slot="main"
-             tal:define="student here/getContent;
-             items here/contentValues"
+             tal:define="items here/contentValues"
              >
-    <span tal:condition="python: 0" tal:content="items" />
-    <tal:block tal:content="structure student/jamb_where_admitted" />
+    <h2>Data for Student <span tal:content="context/id" /></h2>
     <table cellspacing="0" cellpadding="0">
       <tal:block condition="python: len(items)">
@@ -34,3 +34,5 @@
     </table>
   </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
 </html>
Index: /waeup_product/trunk/skins/waeup_student/student_view_student.pt
===================================================================
--- /waeup_product/trunk/skins/waeup_student/student_view_student.pt	(revision 48)
+++ /waeup_product/trunk/skins/waeup_student/student_view_student.pt	(revision 48)
@@ -0,0 +1,37 @@
+<html metal:use-macro="here/content_lib_master/macros/master">
+
+<metal:block fill-slot="head_slot">
+  <tal:block tal:define="student here/getContent">
+  </tal:block>
+</metal:block>
+
+<metal:block fill-slot="css_slot">
+  <link rel="Stylesheet" type="text/css" href=""
+    tal:attributes="href string:${base_url}student.css" />
+</metal:block>
+  <metal:block fill-slot="header">
+  </metal:block>
+  <metal:block fill-slot="main"
+               tal:define="student here/getContent;
+               items here/contentValues"
+               >
+    <table cellspacing="0" cellpadding="0">
+      <tal:block condition="python: len(items)">
+        <tr tal:repeat="item items">
+          <td colspan="1"> 
+            <a href="jamb" 
+               tal:attributes="href item/absolute_url"
+               tal:content="item/title_or_id"></a>
+          </td>
+        </tr>
+      </tal:block>
+      <tr tal:condition="python:not len(items)">
+        <td>
+          no Items yet !
+        </td>
+      </tr>
+    </table>
+  </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
+</html>
