Index: WAeUP_SRP/trunk/skins/waeup_student/create_level.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/create_level.py	(revision 1492)
+++ WAeUP_SRP/trunk/skins/waeup_student/create_level.py	(revision 1492)
@@ -0,0 +1,70 @@
+##parameters=
+# $Id$
+"""
+process the Application Form
+return html renderer + psm
+"""
+request = context.REQUEST
+import DateTime,logging
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+current = DateTime.DateTime()
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+redirect = response.redirect
+logger = logging.getLogger('Student.create_level')
+students = context.portal_directories.students
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+lt = context.portal_layouts
+wt = context.waeup_tool
+student = context.students_catalog(id=context.getStudentId())[0]
+cert_id = student.course
+in_progress =  session.get('in_progress','finished')
+if in_progress == 'finished':
+    session.set('in_progress','started')
+    view = context.in_progress_view(refresh=3,page='study_level_view')
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.setHeader('Content-length','%d' % (len(view)))
+    response.setStatus('OK')
+    response.write(view)
+    response.write('')
+elif in_progress == 'started':
+    return
+context.invokeFactory('StudentStudyLevel',"%s" % current_level)
+level = getattr(context,"%s" % current_level)
+session = context.getSessionString()
+level.getContent().edit(mapping={'session': session})
+context.portal_workflow.doActionFor(level,'open')
+context.portal_workflow.doActionFor(level,'close_for_edit')
+results = context.results_import(matric_no = student.matric_no)
+carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
+l = []
+for co in carry_overs:
+    d = context.getCourseInfo(co.CosCode)
+    d['grade'] = co.GRADE
+    d['carry_level'] = co.CarryLevel
+    cr_id = context.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
+    getattr(context,cr_id).getContent().edit(mapping=d)
+res = context.portal_catalog(portal_type="Certificate", id = cert_id)
+l = []
+if res:
+    cert = res[0]
+    path = cert.getPath()
+    query = Eq("path",path) &\
+            Eq('portal_type','CertificateCourse') &\
+            Eq('SearchableText', "%s" % student.level)
+    courses = evalAdvancedQuery(query)
+    for c in courses:
+        d = context.getCourseInfo(c.getId)
+        cr_id = context.invokeFactory('StudentCourseResult',c.getId)
+        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
+        getattr(context,cr_id).getContent().edit(mapping=d)
+session.set('in_progress','finished')
+return "finished"
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py	(revision 1491)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py	(revision 1492)
@@ -43,26 +43,21 @@
     info['course'] = None
 items = []
-#current_level = sbrain.level
-#levels = context.objectIds()
-#review_state = wftool.getInfoFor(context,'review_state',None)
-#if review_state != 'content_addable':
-#    wftool.doActionFor(context,'close_for_edit')
+current_level = sbrain.level
+levels = context.objectIds()
+review_state = wftool.getInfoFor(context,'review_state',None)
+if review_state != 'content_addable':
+    wftool.doActionFor(context,'close_for_edit')
 student_review_state = context.getStudentReviewState()
-may_register = student_review_state in ('shool_fee_payed',)
-#levels.sort()
-#if not levels and may_register:
-#    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
-#    level = getattr(context,"%s" % current_level)
-#    session = context.getSessionString()
-#    level.getContent().edit(mapping={'session': session})
-#    context.portal_workflow.doActionFor(level,'open')
-#    context.portal_workflow.doActionFor(level,'close_for_edit')
-#    levels.append(current_level)
-#for l in levels:
-#    row = {}
-#    row['id'] = l
-#    row['title'] = "Level %s" % l
-#    row['url'] = "%s/%s" % (context.absolute_url(),l)
-#    items.append(row)
+may_register = 1 or student_review_state in ('shool_fee_payed',)
+levels.sort()
+info['create_level'] = None
+if may_register:
+    info['create_level'] = current_level
+for l in levels:
+    row = {}
+    row['id'] = l
+    row['title'] = "Level %s" % l
+    row['url'] = "%s/%s" % (context.absolute_url(),l)
+    items.append(row)
 
 info['items'] = items
Index: WAeUP_SRP/trunk/skins/waeup_student/student_index.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 1491)
+++ WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 1492)
@@ -43,45 +43,5 @@
         return context.payment_receipt()
     elif context.portal_type == 'StudentStudyLevel':
-        if context.objectIds():
-            return context.study_level_view()
-        student = context.students_catalog(id=context.getStudentId())[0]
-        cert_id = student.course
-        in_progress =  session.get('in_progress','finished')
-        if in_progress == 'finished':
-            session.set('in_progress','started')
-            view = context.in_progress_view(refresh=3,page='study_level_view')
-            response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-            response.setHeader('Content-length','%d' % (len(view)))
-            response.setStatus('OK')
-            response.write(view)
-            response.write('')
-        elif in_progress == 'started':
-            return
-        #from Products.zdb import set_trace;set_trace()
-        results = context.results_import(matric_no = student.matric_no)
-        carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
-        l = []
-        for co in carry_overs:
-            d = context.getCourseInfo(co.CosCode)
-            d['grade'] = co.GRADE
-            d['carry_level'] = co.CarryLevel
-            cr_id = context.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
-            getattr(context,cr_id).getContent().edit(mapping=d)
-        res = context.portal_catalog(portal_type="Certificate", id = cert_id)
-        l = []
-        if res:
-            cert = res[0]
-            path = cert.getPath()
-            query = Eq("path",path) &\
-                    Eq('portal_type','CertificateCourse') &\
-                    Eq('SearchableText', "%s" % student.level)
-            courses = evalAdvancedQuery(query)
-            for c in courses:
-                d = context.getCourseInfo(c.getId)
-                cr_id = context.invokeFactory('StudentCourseResult',c.getId)
-                d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
-                getattr(context,cr_id).getContent().edit(mapping=d)
-        session.set('in_progress','finished')
-        return "finished"
+        return context.study_level_view()
     students_url = "%s/campus/students" % (context.portal_url())
     id = str(member)
Index: WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1491)
+++ WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1492)
@@ -3,4 +3,5 @@
     <metal:block fill-slot="header"  
                  tal:define="global info context/getStudyCourseInfo;
+                 global create_level info/create_level|nothing;
                  global is_so info/is_so;
                  "
@@ -94,4 +95,23 @@
         </table>
       </form>
+      <form action="" method="post" class="group"
+            tal:attributes="action string:${context/absolute_url}/create_level"
+            tal:define="rows python: info['items'];"
+            >
+        <table width="100%" cellspacing="0" cellpadding="2"
+               summary="contents of the folder"
+               class="folderButtons">
+          <tr>
+            <td align="left" valign="top" rowspan="3"></td>
+            <td align="left" valign="top">
+              <input type="submit" name="create_level" tal:condition="create_level"
+                       class="destructive" 
+                       tal:attributes="onclick python:'return window.confirm(\'really create Level %s\')' % create_level;
+                       value string: create Level ${create_level}" 
+                       />
+            </td>
+          </tr>
+        </table>
+      </form>          
     </metal:main>
  
