Index: /WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py	(revision 6855)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py	(revision 6855)
@@ -0,0 +1,54 @@
+##parameters=key=None
+# $Id$
+"""
+Return the levels as an vocabulary
+"""
+student_id = context.getStudentId()
+end_level = 800
+if student_id:
+    end_level = context.students_catalog(id = student_id)[0].end_level
+    if end_level and end_level.isdigit():
+        end_level = int(end_level)
+    else:
+        end_level = 700
+
+if key is None:
+    levels = [l for l in range(0,end_level+200,10)
+               if l % 100 < 30 and l < end_level + 120]
+    voc = [('','')]
+    for l in levels:
+        level_nr,repeat = divmod(l, 100)
+        if level_nr > end_level/100 and repeat:
+            voc += ("%s" % l,"%s (2nd spillover)" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))),
+        elif level_nr > end_level/100:
+            voc += ("%s" % l,"%s (spillover)" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))),
+        elif repeat > 0:
+            voc += ("%s" % l,"%s (on %d. probation)" %
+                    (context.portal_vocabularies.levels.get("%d00" % (level_nr)),
+                                                            (repeat // 10))),
+        else:
+            voc += ("%03d" % l,"%s" %
+                    (context.portal_vocabularies.levels.get("%d00" % (level_nr)))),
+    return voc
+
+if key and key.isdigit():
+    ikey = int(key)
+else:
+    raise KeyError
+level_nr,repeat = divmod(ikey, 100)
+l = []
+
+level = context.portal_vocabularies.levels.get("%d00" % level_nr,None)
+if level is None:
+    raise KeyError
+    
+if level_nr > end_level/100 and repeat:    
+    return "%s 2nd Spillover" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))
+elif level_nr > end_level/100:
+    return "%s Spillover" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))
+
+if repeat > 0:
+    level += " on %d. Probation" % (repeat // 10)
+
+return level
+
Index: /WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py	(revision 6855)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py	(revision 6855)
@@ -0,0 +1,123 @@
+## Script (Python) "getStudyLevelInfo"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=student=None
+##title=
+##
+# $Id$
+"""
+return Info about the Studylevel
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+"""
+
+info = context.waeup_tool.getAccessInfo(context)
+student_id = info['student_id']
+if student_id is None:
+    return None
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+
+course_results = context.course_results
+request = context.REQUEST
+response = request.RESPONSE
+import logging
+logger = logging.getLogger('Skins.getStudyLevelInfo')
+
+level_id  =  context.getId()
+level_doc = info['doc'] = context.getContent()
+
+info['is_so'] = is_so = info['is_sectionofficer']
+#info['is_student'] = is_student = context.isStudent()
+info['is_ca'] = is_ca = context.isCourseAdviser()
+#info['student'] = student = context.students_catalog(id=student_id)[0]
+info['student'] = student = context.students_catalog.getRecordByKey(student_id)
+info['review_state'] = review_state = student.review_state
+is_current_level = level_id == student.level
+school_fee_paid =  review_state == 'school_fee_paid'
+info['is_current_level'] = is_current_level
+info['has_verdict'] = has_verdict = level_doc.verdict
+
+info['submission_allowed']= school_fee_paid and is_current_level and not has_verdict
+info['validation_allowed']= review_state == 'courses_registered' and is_current_level
+info['rejection_allowed']= review_state in ('courses_registered', 'courses_validated','returning',) and is_current_level
+info['validated'] = level_doc.validated_by and not (is_current_level and review_state in ('courses_registered',))
+info['show_check_boxes'] =  (is_ca and school_fee_paid and is_current_level and not has_verdict) or\
+                            (info['is_student'] and school_fee_paid and is_current_level and not has_verdict) or\
+                            (is_so) # and is_current_level and not has_verdict)
+
+info['verdict'] = context.portal_vocabularies.verdicts.get(level_doc.verdict).upper()
+info['session'] = context.portal_vocabularies.sessions.get(level_doc.session)
+info['level_str'] = context.portal_vocabularies.student_levels.get(level_id)
+
+info['choosen_ids'] = request.get('ids',[])
+
+#info['status_info'] = ""
+#if is_student:
+#    if review_state == 'courses_registered':
+#        info['status_info'] = "Request for course validation pending"
+#    elif review_state == 'courses_validated':
+#        info['status_info'] = "Courses validated"
+#elif is_ca:
+#    if review_state == 'courses_registered':
+#        info['status_info'] = "Please validate these courses"
+#    elif review_state == 'courses_validated':
+#        info['status_info'] = "Courses validated"
+
+cert_id = student.course
+info['cert_id'] = cert_id
+total_credits,gpa,carry_overs,normal1,normal2,normal3 = course_results.getCourses(student_id,level_id)
+info['total_credits'] = total_credits
+
+#start customization
+
+if context.objectIds():
+    course_results.moveResultsHere(context,student_id)
+    logger.info("%s initiated moveResultsHere for %s in level %s" % (member_id,student_id,level_id))
+
+max_credits = 50
+try:
+    if int(context.getId()) >=  int(student.end_level):
+        max_credits = 51
+except:
+    logger.info("%s has strange level id %s" % (student_id,level_id))
+info['without_score'] = without_score = True
+if without_score:
+    for rows in (normal1,normal2,normal3):
+        for row in rows:
+            row['score'] = 0
+info['without_cascore'] = True
+#end customization
+
+info['max_credits'] = max_credits
+info['credits_exceeded'] = total_credits > max_credits
+current_session = student.session
+
+info['gpa'] = gpa
+if gpa and total_credits:
+    info['gpa'] = "%4.2f" % (float(gpa)/int(total_credits))
+
+# carry_overs.sort(cmp_semester_id)
+info['carry_overs'] = carry_overs
+# normal.sort(cmp_semester_id)
+
+info['normal1'] = normal1
+info['normal2'] = normal2
+info['normal3'] = normal3
+
+info['data_missing'] = not info['normal1'] and not info['normal2'] and not info['normal3']
+info['spillover'] = student.level > student.end_level
+
+students_object = context.portal_url.getPortalObject().campus.students
+student = getattr(students_object, student_id)
+info['app'] = student.application
+info['app_doc'] = student.application.getContent()
+return info
Index: /WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt	(revision 6855)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt	(revision 6855)
@@ -0,0 +1,341 @@
+<metal:body use-macro="here/main_template/macros/master">
+  <metal:main fill-slot="main"
+          tal:define="info context/getStudyLevelInfo;
+                      contact_student_form string:contact_student_form;
+                      study_level_view string:study_level_view;">
+  <metal:block define-macro="edit_form">   
+              
+    <span tal:condition="not: info">
+      <span tal:content="here/illegal_view" />
+    </span>
+    <span tal:condition="info">
+    <span tal:define= "is_so context/isSectionOfficer;
+    is_ca info/is_ca;
+    show_check_boxes info/show_check_boxes;
+    has_verdict info/has_verdict;
+    submission_allowed info/submission_allowed;
+    rejection_allowed info/rejection_allowed;
+    is_current_level info/is_current_level;
+    is_student info/is_student;
+    with_score not: info/without_score|nothing;
+    with_cascore not: info/without_cascore|nothing;
+    ">       
+
+    <a href=""
+       tal:attributes="href string:${here/academicsParent}">
+      <img tal:attributes="src string:${here/portal_url}/arrow_up.gif"/>
+      Up one level
+    </a>
+
+    <div style="text-align: right" 
+         tal:condition="rejection_allowed">
+    <a href="" target="slip" tal:attributes="href string:course_registration_slip"
+        onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
+        <img tal:attributes="src string:${here/portal_url}/actionicon_print.png" />
+        Course Registration Slip
+    </a>
+    </div>
+    
+    <div style="text-align: right" 
+         tal:condition="info/gpa">
+    <a href="" target="slip" tal:attributes="href string:new_session_results_slip"
+        onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
+        <img tal:attributes="src string:${here/portal_url}/actionicon_print.png" />
+        Session Results Slip
+    </a>
+    </div>    
+         
+    <h3> 
+      <span tal:condition="python: is_so or is_ca">
+        <span tal:content="info/student/name" />:
+      </span>
+      <span tal:condition="is_student">My </span>
+      
+      Course Registration Form for <span tal:content="info/level_str" />
+    </h3>
+    
+        <br />
+        <table>
+          <tr>
+            <th  width="220px">Session:</th> 
+            <td><span tal:content="info/session" /></td>
+          </tr>
+          <tr>
+            <th>Total Credits:</th>
+            <td tal:content="info/total_credits" />
+          </tr>
+          <tr tal:condition="has_verdict">
+            <th>Verdict:</th> 
+            <td><span tal:content="info/verdict" /></td>
+          </tr>      
+          <tr tal:condition="info/gpa">
+            <th>GPA:</th> 
+            <td><span tal:content="info/gpa" /></td>
+          </tr>
+        </table>           
+   
+             
+    <form action="." method="post" class="group" onsubmit="return submit_once()">
+      <span tal:condition="info/carry_overs" tal:omit-tag="">
+      <h3>Carryover Courses</h3>
+      <br />
+      <table tal:condition="python: 1" class="contentListing" width="100%" summary="content layout" id="folder_content">
+
+        <tr>
+        <th tal:attributes="colspan python: test(show_check_boxes,'2','1')">Both Semesters</th>
+        <th style='text-align:center'></th> 
+        <th style='text-align:center'>sm</th>
+        <th style='text-align:center'>cr</th>
+        <th tal:condition="with_score" style='text-align:center'>sc</th>
+        <th tal:condition="with_cascore" style='text-align:center'>ca</th>
+        <th style='text-align:center'>gr</th>
+        <th style='text-align:center'>wt</th>
+        <th style='text-align:center'></th>
+        <th tal:condition="submission_allowed" style='text-align:center'></th>   
+            
+        </tr>          
+        <tr tal:repeat="row info/carry_overs"
+            tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
+      
+          <td align="left" valign="middle" style="width: 5%;"
+              tal:condition="show_check_boxes">
+            <input type="checkbox" name="ids:list" value="" id="" class="noborder"
+                   tal:define="id row/id"
+                   tal:attributes="value id;
+                   id python:'cb_' + id;
+                   checked python:id in info['choosen_ids'];" 
+                   />
+          </td>
+
+          <td width="58%" tal:content="row/title"></td>
+          <td style='text-align:center' width="10%" tal:content="row/code"></td>
+          <td style='text-align:center' width="2%"><span tal:content="row/semester" /></td>
+          <td style='text-align:center' width="2%" tal:content="row/credits"></td>
+          <td tal:condition="with_score" style='text-align:center' width="4%" tal:content="row/score"></td>
+          <td tal:condition="with_cascore" style='text-align:center' width="4%" tal:content="row/ca1"></td>
+          <td style='text-align:center' width="2%" tal:content="row/grade"></td>
+          <td style='text-align:center' width="2%" tal:content="row/weight"></td>
+          <td style='text-align:center' width="10%" tal:content="row/coe|nothing"></td>
+          
+          <td tal:condition="submission_allowed" style='text-align:center' width="5%">&nbsp;</td>
+       
+        </tr>
+      </table>
+      </span> 
+
+      <div class="" tal:condition="python: False and info['data_missing'] and not info['spillover']">
+        <font color="red">Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!</font>
+        <br /><br />
+      </div>
+       
+      <span tal:condition="not:info/data_missing" tal:omit-tag=""> 
+      <h3>Session Courses</h3>
+      <br />
+
+      <table class="contentListing" width="100%" id="folder_content">
+        
+        <span tal:repeat="sem python:(('1','First Semester Courses','normal1'),('2','Second Semester Courses','normal2'),('3','Level Courses','normal3'))">       
+                    
+        <tr tal:condition="python:info[sem[2]]">
+        <th tal:attributes="colspan python: test(show_check_boxes,'2','1')" 
+            tal:content="python:sem[1]" />
+        <th style='text-align:center'></th> 
+        <th style='text-align:center'>sm</th>
+        <th style='text-align:center'>cr</th>
+        <th tal:condition="with_score" style='text-align:center'>sc</th>
+        <th tal:condition="with_cascore" style='text-align:center'>ca</th>
+        <th style='text-align:center'>gr</th>
+        <th style='text-align:center'>wt</th>
+        <th style='text-align:center'></th>
+        <th tal:condition="submission_allowed" style='text-align:center'></th>   
+            
+        </tr>                
+        <tr tal:repeat="row python:info[sem[2]]"
+            
+            tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
+          <td align="left" valign="middle" style="width: 5%;"
+             tal:condition="show_check_boxes">
+            <input type="checkbox" name="ids:list" value="" id="" class="noborder"
+                   tal:define="id row/id"
+                   tal:attributes="value id;
+                   id python:'cb_' + id;
+                   checked python:id in info['choosen_ids'];" 
+                   />
+          </td>
+          <td width="58%" tal:content="row/title"></td>
+          <td style='text-align:center' width="10%" tal:content="row/code"></td>
+          <td style='text-align:center' width="2%"><span tal:content="row/semester" /></td>
+          <td style='text-align:center' width="2%" tal:content="row/credits"></td>
+          <td tal:condition="with_score" style='text-align:center' width="4%" tal:content="row/score"></td>
+          <td tal:condition="with_cascore" style='text-align:center' width="4%" tal:content="row/ca1"></td>
+          <td style='text-align:center' width="2%" tal:content="row/grade"></td>
+          <td style='text-align:center' width="2%" tal:content="row/weight"></td>
+          <td style='text-align:center' width="10%" tal:content="row/coe|nothing"></td>
+          
+          <td tal:condition="submission_allowed" width="5%" style='text-align:center'>
+            <a href="edit" tal:attributes="href string:course_edit/${row/code}"
+            target="edit_course_result"
+            onclick="javascript:window.open('','edit_course_result','width=600, height=350, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
+            [edit]
+            </a> 
+          </td>          
+        </tr>
+        <tr><td>&nbsp;</td></tr>
+        </span>        
+        
+      </table>
+      </span>
+      
+      <br />
+      <table>
+      <tr><th>sm:</th> <td>Semester</td></tr>
+      <tr><th>cr:</th> <td>Credits</td></tr>
+      <tr tal:condition="with_score"><th>sc:</th> <td>Score</td></tr>
+      <tr tal:condition="with_cascore"><th>ca:</th> <td>CA Score</td></tr>
+      <tr><th>gr: </th> <td>Grade</td></tr>
+      <tr><th>wt: </th> <td>Weight</td></tr>
+      </table>      
+          
+      <br />
+      
+      <table tal:condition="python: is_student and show_check_boxes" width="100%" cellspacing="0" cellpadding="2"
+             class="folderButtons">
+        <tr>
+          <td align="left" valign="top" rowspan="3"></td>
+          <td align="left" valign="top">
+              <input type="submit" name="delete_course_result:method" value="Delete selected"
+                     class="destructive" i18n:attributes="value"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     ('Do you really want to delete selected courses?', )" 
+                     />
+              <input tal:condition="python: 1" type="submit" name="refresh_level:method"
+                     class="context" value="Update" 
+                     />
+                    
+                     
+              <br /><br />
+              <input tal:condition="not: info/credits_exceeded" 
+                     type="submit" name="register_courses:method"
+                     class="context" value="Submit to Course Adviser" 
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     ('Do you really want to submit the course list? You will not be able to edit your data after submission.', )" />
+              <span tal:condition="info/credits_exceeded">
+                  <font color="red"> <strong>Your total credits exceed <span tal:replace="info/max_credits" />!</strong></font>
+              </span>
+                     
+              <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                     tal:attributes="value study_level_view"/>  
+                     
+              <br /><br />
+              
+              <span tal:condition="python: 1">
+              <strong>Note:</strong> 'Update' checks for all courses in your certificate and will add them to your course list irrespective of
+              prior deletion, i.e. already deleted courses will show up again. 
+              Please use this function only if you are sure that your faculty has added courses which are not yet on your course list.                                
+              </span>
+              <span tal:condition="python: 0">
+              <strong>Note:</strong> The 'Update' function has been temporarily disabled.                                 
+              </span>              
+                     
+          </td>
+        </tr>
+      </table>
+      <table tal:condition="python: is_so and show_check_boxes" width="100%" cellspacing="0" cellpadding="2"
+             class="folderButtons">
+        <tr>
+          <td align="left" valign="top" rowspan="3"></td>
+          <td align="left" valign="top">
+              <input type="button" value="Select all" class="context"
+                     onclick="someJavaScriptFunctionThatWillBeReplaced"
+                     i18n:attributes="value"
+                     tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')'
+                     % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
+                     />
+              <input type="submit" name="delete_course_result:method" value="Delete selected"
+                     class="destructive" i18n:attributes="value"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     ('Do you really want to delete the courses selected?', )" 
+                     />
+              <input 
+                     type="submit" name="refresh_level:method"
+                     class="context" value="Update" 
+                     />
+              <input tal:condition="submission_allowed" type="submit" name="register_courses:method"
+                     class="context" value="Submit" />  
+              <input tal:condition="info/validation_allowed" type="submit" name="validate_courses:method"
+                     class="context" value="Validate" />
+              <input tal:condition="info/rejection_allowed" type="submit" name="reject_courses:method"
+                     class="context" value="Reject" />
+                     
+              <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                     tal:attributes="value study_level_view"/>                         
+              <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
+                     tal:attributes="value contact_student_form"/>                         
+
+          </td>
+        </tr>
+      </table>
+      <table tal:condition="python:is_ca and is_current_level and not has_verdict" width="100%" cellspacing="0" cellpadding="2"
+             class="folderButtons">
+        <tr>
+          <td align="left" valign="top" rowspan="3"></td>
+          <td align="left" valign="top">
+              <input tal:condition="show_check_boxes"
+                     type="button" value="Select all" class="context"
+                     onclick="someJavaScriptFunctionThatWillBeReplaced"
+                     i18n:attributes="value"
+                     tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')'
+                     % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
+                     />
+              <input tal:condition="show_check_boxes"
+                     type="submit" name="delete_course_result:method" value="Delete selected"
+                     class="destructive" i18n:attributes="value"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     ('Do you really want to delete the courses selected?', )" 
+                     />
+              <input tal:condition="show_check_boxes"
+                     type="submit" name="refresh_level:method"
+                     class="context" value="Update" 
+                     />
+              <input tal:condition="submission_allowed" type="submit" name="register_courses:method"
+                     class="context" value="Submit" />  
+              <input tal:condition="info/validation_allowed" type="submit" name="validate_courses:method"
+                     class="context" value="Validate" />
+              <input tal:condition="info/rejection_allowed" type="submit" name="reject_courses:method"
+                     class="context" value="Reject" />
+                     
+              <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                     tal:attributes="value study_level_view"/>                         
+              <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
+                     tal:attributes="value contact_student_form"/>    
+                                           
+
+          </td>
+        </tr>
+      </table>
+
+    </form>
+    <br />
+      <form action="add_course_result" method="post" class="group" onsubmit="return submit_once()"
+          tal:condition="show_check_boxes">
+      <table>
+        <tr>
+          <th>Course Id</th>
+          <td><input type="text" name="course_id" 
+                     tal:attributes="value request/course_id|nothing"/></td>
+          <td colspan="2">
+            <input type="submit" name="add"
+                   class="context" value="Add Course" 
+                   />
+            <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                     tal:attributes="value study_level_view"/>                       
+          </td>                
+      </table>
+      </form>   
+  </span>
+  </span>        
+  </metal:block>    
+  </metal:main>
+
+</metal:body>
+
