Index: WAeUP_SRP/trunk/skins/waeup_student/add_course_result.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/add_course_result.py	(revision 1479)
+++ WAeUP_SRP/trunk/skins/waeup_student/add_course_result.py	(revision 1482)
@@ -10,7 +10,49 @@
 # $Id$
 """
-FIXME: add docstring.
+add a course_result object.
 """
+from urllib import urlencode
+request = context.REQUEST
+course_cat = context.courses_catalog
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_portal = context.portal_catalog.evalAdvancedQuery
+course_id = request.get('course_id')
+d = context.getCourseInfo(course_id)
+args = {}
+err = ''
+while True:
+    if d['title'] == 'unknown':
+        err = "no such course"
+        break
+    if context.hasObject(course_id):
+        err = "course already exists"
+        break
+    if context.hasObject("%s_co" % course_id):
+        err = "course already exists as carryover"
+        break
+    break
 
-return context.REQUEST.RESPONSE.redirect("%s/content_create?type_name=StudentCourseResult"
-                                          % (context.absolute_url()))
+if err:
+    args['course_id'] = course_id
+    args['error'] = err
+    url = "%s?%s" % (context.absolute_url(),urlencode(args))
+    return request.RESPONSE.redirect(url)
+##cert_id = context.aq_parent.getContent().study_course    
+##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) &\
+##            Eq('id',course_id)
+##course = aq_portal(query)[0]
+cr_id = context.invokeFactory('StudentCourseResult',course_id)
+##d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
+##getattr(context,cr_id).getContent().edit(mapping=d)
+args['course_id'] = course_id
+from urllib import urlencode
+url = "%s?%s" % (context.absolute_url(),urlencode(args))
+return request.RESPONSE.redirect(url)
+
Index: WAeUP_SRP/trunk/skins/waeup_student/course_result_delete.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/course_result_delete.py	(revision 1482)
+++ WAeUP_SRP/trunk/skins/waeup_student/course_result_delete.py	(revision 1482)
@@ -0,0 +1,27 @@
+## Script (Python) "folder_delete"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=ids=[], REQUEST=None
+##title=
+##
+# $Id$
+"""
+FIXME: add docstring.
+"""
+
+from Products.CMFCore.utils import getToolByName
+here = context
+
+ret_url = here.absolute_url()
+
+if ids:
+    here.manage_delObjects(ids)
+    message = 'portal_status_message=psm_item(s)_deleted'
+else:
+    message = 'portal_status_message=psm_select_at_least_one_document'
+
+if REQUEST is not None:
+    return REQUEST.RESPONSE.redirect(ret_url + '?' + message)
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py	(revision 1479)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py	(revision 1482)
@@ -45,21 +45,23 @@
 current_level = sbrain.level
 levels = context.objectIds()
-#context.portal_workflow.doActionFor(context,'close_for_edit')
+review_state = wftool.getInfoFor(context,'review_state',None)
+if review_state != 'content_addable':
+    context.portal_workflow.doActionFor(context,'close_for_edit')
 
-#levels.sort()
-#if int(current_level) > int(levels[-1]):
-#if not levels:
-#    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
-#    level = getattr(context,"%s" % current_level)
-#    level.getContent().edit(mapping={'session': "2006/2007"})
-#    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)
+levels.sort()
+if not levels:
+    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)
 
 info['items'] = items
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py	(revision 1479)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py	(revision 1482)
@@ -57,5 +57,11 @@
 normal = []
 carry_overs = []
+credits_total = 0
 for id,obj in context.objectItems():
+    try:
+        credit = int(obj.getContent().credits)
+    except ValueError:
+        credit = 3
+    credits_total += credit
     if id.endswith('_co'):
         d = context.getCourseInfo(id[:-3])
@@ -69,5 +75,5 @@
             d['coe'] = 'Elective'
         normal.append(d)
-
+info['credits_total'] = credits_total
 carry_overs.sort(cmp_semester)
 info['carry_overs'] = carry_overs
Index: WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1479)
+++ WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1482)
@@ -64,6 +64,9 @@
                      />
             </td>
-            <td><a href="view" tal:attributes="href string:${row/url}">
-              <strong tal:content="row/title" /></a> </td>
+            <td><a href="view" tal:condition="python: 0"
+                   tal:attributes="href string:${row/url}">
+              <strong tal:content="row/title" /></a> 
+              <strong tal:condition="python: 1" tal:content="row/title" />
+            </td>
           </tr>
         </table>
Index: WAeUP_SRP/trunk/skins/waeup_student/study_level_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/study_level_view.pt	(revision 1479)
+++ WAeUP_SRP/trunk/skins/waeup_student/study_level_view.pt	(revision 1482)
@@ -19,4 +19,24 @@
     </metal:block>
     <metal:main fill-slot="main" tal:condition="python:1">
+      <form action="add_course_result" method="post" class="group">
+        <h3>Add a course</h3>
+        <table>
+          <tr>
+            <th>Course Id</th>
+            <td><input type="text" name="course_id" 
+                       tal:attributes="value request/course_id|nothing"/></td>
+            <td tal:condition="request/error|nothing" 
+                tal:content="request/error" />
+          </tr>
+          <tr>
+            <th></th>
+            <td colspan="2">
+              <input type="submit" name="add"
+                     class="context" value="Add Course" 
+                     />
+            </td>
+          </tr>
+        </table>
+      </form>    
       <form action="." method="post" class="group">
         <h3>Carryover Courses</h3>
@@ -36,5 +56,5 @@
             <td width="2%" tal:content="row/semester"></td>
             <td width="2%" tal:content="row/credits"></td>
-            <td width="8%" tal:content="row/grade|nothing"></td>
+            <td width="8%" tal:content="row/grade|string:"></td>
           </tr>
         </table>
@@ -57,4 +77,9 @@
             <td width="8%" tal:content="row/coe|nothing"></td>
           </tr>
+          <tr>
+            <td colspan="1"></td>
+            <th colspan="3">Total credits</th>
+            <td width="8%" tal:content="info/credits_total"></td>
+          </tr>
         </table>
         <table width="100%" cellspacing="0" cellpadding="2"
@@ -70,9 +95,9 @@
                        % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
                        />
-                <input tal:condition="python:1" type="submit" name="register_checked:method"
+                <input tal:condition="python:0" type="submit" name="register_checked:method"
                        class="context" value="Register" />
                 <input tal:condition="python:0" type="submit" name="retract_checked:method"
                        class="context" value="Retract" />
-                <input type="submit" name="folder_delete:method" value="button_delete"
+                <input type="submit" name="course_result_delete:method" value="button_delete"
                        class="destructive" i18n:attributes="value"
                        tal:attributes="onclick python:'return window.confirm(\'%s\')' %
@@ -89,6 +114,5 @@
       </form>
     </metal:main>
-    
-    <metal:sub fill-slot="sub"/>
   </metal:body>
 </metal:html>
+  
