Index: WAeUP_SRP/trunk/skins/waeup_futminna/create_level_501.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/create_level_501.py	(revision 6858)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/create_level_501.py	(revision 6858)
@@ -0,0 +1,91 @@
+##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
+from Products.AdvancedQuery import Eq, Between, Le,In
+try:
+    aq_portal = context.portal_catalog.evalAdvancedQuery
+except:
+    aq_portal = context.portal_catalog_real.evalAdvancedQuery
+aq_courses = context.courses_catalog.evalAdvancedQuery
+aq_results = context.course_results.evalAdvancedQuery
+
+current = DateTime.DateTime()
+request = context.REQUEST
+response = request.RESPONSE
+redirect = response.redirect
+logger = logging.getLogger('Skins.create_level_501')
+info = context.waeup_tool.getAccessInfo(context)
+student_id = info['student_id']
+if student_id is None:
+    return None
+
+student = context.students_catalog.getRecordByKey(student_id)
+cert_id = student.course
+current_level = student.level
+
+if current_level not in ['500','510',]:
+    logger.info('%s tried to create level 501 but is not in level 500' % student.id)
+    return 'Forbidden'
+
+current_session = student.session
+in_progress =  request.get('in_progress','not started')
+if aq_results(Eq('student_id',student_id) & Eq('level_id','100')):
+    logger.info('%s tried to create already existing level 100' % student.id)
+    return 'Forbidden'
+
+if context.hasObject('100') or context.hasObject('501'):
+    logger.info('%s tried to create already existing level 100' % student.id)
+    return 'Forbidden'
+
+context.invokeFactory('StudentStudyLevel',"%s" % '501')
+level = getattr(context,"501")
+context.portal_workflow.doActionFor(level,'open')
+level.getContent().edit(mapping={'session': current_session})
+level_id = level.getId()
+session_id = context.getLevelSession(level.getContent(),student_id,level_id)
+results = []
+records = []
+l = []
+
+res = context.portal_catalog(portal_type="Certificate", id = cert_id)
+if res:
+    cert = res[0]
+    path = cert.getPath()
+    academics_level = '100'
+    query = Eq("path","%s/%s" % (path,academics_level)) &\
+            Eq('portal_type','CertificateCourse')
+    courses = aq_portal(query)
+    for c in courses:
+        course_id = "%s" % c.getId
+        if course_id in l:
+            # don't add twice
+            continue
+        l += course_id,
+        d = context.getCourseInfo(c.getId)
+        d['carry_over'] = False
+        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
+        d['course_id'] = course_id
+        d['student_id'] = student_id = context.getStudentId()
+        d['level_id'] = level_id
+        d['session_id'] = session_id
+        records.append(d)
+
+if records:
+    existing_uids = context.course_results.addMultipleRecords(records)
+    if existing_uids:
+        logger.info('%s level 501 %s existing keys' % (student.id,
+                                                     ",".join(existing_uids)))
+
+logger.info('%s created level 501 (100 carry overs)' % student.id)
+
+return response.redirect("%s/501" % context.absolute_url())
Index: WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/getStudentLevelsVoc.py	(revision 6858)
@@ -36,4 +36,9 @@
 else:
     raise KeyError
+
+# FUTMinna only
+if ikey == 501:
+    return "100 Level Carryover Courses"
+
 level_nr,repeat = divmod(ikey, 100)
 l = []
Index: WAeUP_SRP/trunk/skins/waeup_futminna/getStudyCourseInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/getStudyCourseInfo.py	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/getStudyCourseInfo.py	(revision 6858)
@@ -94,4 +94,6 @@
                (student_record.entry_mode.startswith('pd') and current_level == '500'))  #fceokene only
 
+info['may_register_501'] = (current_level == '500') and '501' not in levels
+
 missing_data = has_paid and\
                current_level not in levels and\
Index: WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/getStudyLevelInfo.py	(revision 6858)
@@ -47,10 +47,12 @@
 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['submission_allowed']= school_fee_paid and is_current_level and not has_verdict and level_id != '501'
+info['validation_allowed']= review_state == 'courses_registered' and is_current_level and level_id != '501'
+info['rejection_allowed']= review_state in ('courses_registered', 'courses_validated','returning',) and\
+                                             is_current_level and level_id != '501'
 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\
+                            level_id == '501' or\
                             (is_so) # and is_current_level and not has_verdict)
 
@@ -60,16 +62,4 @@
 
 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
@@ -96,9 +86,11 @@
             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['show_submit'] = not info['credits_exceeded'] and level_id != '501'
+info['show_update'] = level_id != '501'
+#end customization
 
 info['gpa'] = gpa
Index: WAeUP_SRP/trunk/skins/waeup_futminna/study_course_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/study_course_view.pt	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/study_course_view.pt	(revision 6858)
@@ -133,4 +133,24 @@
       </table>
     </form>  
+
+    <form action="" method="post" class="group" onsubmit="return submit_once()"
+          tal:attributes="action string:${context/absolute_url}/create_level_501"
+          tal:define="rows python: info['items'];"
+          tal:condition="info/may_register_501"
+          >
+      <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"
+                     class="destructive"
+                     tal:attributes="value string: Register 100L Carryover Courses"
+                     />
+          </td>
+        </tr>
+      </table>
+    </form>
     
     <div tal:condition="info/missing_data">
Index: WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_futminna/study_level_view.pt	(revision 6858)
@@ -13,4 +13,5 @@
     is_ca info/is_ca;
     show_check_boxes info/show_check_boxes;
+    show_update info/show_update;
     has_verdict info/has_verdict;
     submission_allowed info/submission_allowed;
@@ -209,5 +210,5 @@
                      ('Do you really want to delete selected courses?', )" 
                      />
-              <input tal:condition="python: 1" type="submit" name="refresh_level:method"
+              <input tal:condition="show_update" type="submit" name="refresh_level:method"
                      class="context" value="Update" 
                      />
@@ -215,5 +216,5 @@
                      
               <br /><br />
-              <input tal:condition="not: info/credits_exceeded" 
+              <input tal:condition="info/show_submit"
                      type="submit" name="register_courses:method"
                      class="context" value="Submit to Course Adviser" 
@@ -229,5 +230,5 @@
               <br /><br />
               
-              <span tal:condition="python: 1">
+              <span tal:condition="show_update">
               <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. 
@@ -257,5 +258,5 @@
                      ('Do you really want to delete the courses selected?', )" 
                      />
-              <input 
+              <input tal:condition="show_update"
                      type="submit" name="refresh_level:method"
                      class="context" value="Update" 
@@ -294,5 +295,5 @@
                      ('Do you really want to delete the courses selected?', )" 
                      />
-              <input tal:condition="show_check_boxes"
+              <input tal:condition="show_update"
                      type="submit" name="refresh_level:method"
                      class="context" value="Update" 
Index: WAeUP_SRP/trunk/skins/waeup_student/register_courses.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/register_courses.py	(revision 6857)
+++ WAeUP_SRP/trunk/skins/waeup_student/register_courses.py	(revision 6858)
@@ -33,4 +33,8 @@
 student = getattr(students_folder,student_id)
 
+# FUTMinna only
+if context.getId() == '501':
+    return 'Forbidden'
+
 info = context.getStudyLevelInfo()
 if info['credits_exceeded']:
