Changeset 1492


Ignore:
Timestamp:
25 Feb 2007, 16:24:11 (18 years ago)
Author:
joachim
Message:

create level button, create_level function

Location:
WAeUP_SRP/trunk/skins/waeup_student
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py

    r1490 r1492  
    4343    info['course'] = None
    4444items = []
    45 #current_level = sbrain.level
    46 #levels = context.objectIds()
    47 #review_state = wftool.getInfoFor(context,'review_state',None)
    48 #if review_state != 'content_addable':
    49 #    wftool.doActionFor(context,'close_for_edit')
     45current_level = sbrain.level
     46levels = context.objectIds()
     47review_state = wftool.getInfoFor(context,'review_state',None)
     48if review_state != 'content_addable':
     49    wftool.doActionFor(context,'close_for_edit')
    5050student_review_state = context.getStudentReviewState()
    51 may_register = student_review_state in ('shool_fee_payed',)
    52 #levels.sort()
    53 #if not levels and may_register:
    54 #    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
    55 #    level = getattr(context,"%s" % current_level)
    56 #    session = context.getSessionString()
    57 #    level.getContent().edit(mapping={'session': session})
    58 #    context.portal_workflow.doActionFor(level,'open')
    59 #    context.portal_workflow.doActionFor(level,'close_for_edit')
    60 #    levels.append(current_level)
    61 #for l in levels:
    62 #    row = {}
    63 #    row['id'] = l
    64 #    row['title'] = "Level %s" % l
    65 #    row['url'] = "%s/%s" % (context.absolute_url(),l)
    66 #    items.append(row)
     51may_register = 1 or student_review_state in ('shool_fee_payed',)
     52levels.sort()
     53info['create_level'] = None
     54if may_register:
     55    info['create_level'] = current_level
     56for l in levels:
     57    row = {}
     58    row['id'] = l
     59    row['title'] = "Level %s" % l
     60    row['url'] = "%s/%s" % (context.absolute_url(),l)
     61    items.append(row)
    6762
    6863info['items'] = items
  • WAeUP_SRP/trunk/skins/waeup_student/student_index.py

    r1380 r1492  
    4343        return context.payment_receipt()
    4444    elif context.portal_type == 'StudentStudyLevel':
    45         if context.objectIds():
    46             return context.study_level_view()
    47         student = context.students_catalog(id=context.getStudentId())[0]
    48         cert_id = student.course
    49         in_progress =  session.get('in_progress','finished')
    50         if in_progress == 'finished':
    51             session.set('in_progress','started')
    52             view = context.in_progress_view(refresh=3,page='study_level_view')
    53             response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    54             response.setHeader('Content-length','%d' % (len(view)))
    55             response.setStatus('OK')
    56             response.write(view)
    57             response.write('')
    58         elif in_progress == 'started':
    59             return
    60         #from Products.zdb import set_trace;set_trace()
    61         results = context.results_import(matric_no = student.matric_no)
    62         carry_overs = [brain for brain in results if brain.GRADE in ('D','E','F')]
    63         l = []
    64         for co in carry_overs:
    65             d = context.getCourseInfo(co.CosCode)
    66             d['grade'] = co.GRADE
    67             d['carry_level'] = co.CarryLevel
    68             cr_id = context.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
    69             getattr(context,cr_id).getContent().edit(mapping=d)
    70         res = context.portal_catalog(portal_type="Certificate", id = cert_id)
    71         l = []
    72         if res:
    73             cert = res[0]
    74             path = cert.getPath()
    75             query = Eq("path",path) &\
    76                     Eq('portal_type','CertificateCourse') &\
    77                     Eq('SearchableText', "%s" % student.level)
    78             courses = evalAdvancedQuery(query)
    79             for c in courses:
    80                 d = context.getCourseInfo(c.getId)
    81                 cr_id = context.invokeFactory('StudentCourseResult',c.getId)
    82                 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    83                 getattr(context,cr_id).getContent().edit(mapping=d)
    84         session.set('in_progress','finished')
    85         return "finished"
     45        return context.study_level_view()
    8646    students_url = "%s/campus/students" % (context.portal_url())
    8747    id = str(member)
  • WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt

    r1482 r1492  
    33    <metal:block fill-slot="header" 
    44                 tal:define="global info context/getStudyCourseInfo;
     5                 global create_level info/create_level|nothing;
    56                 global is_so info/is_so;
    67                 "
     
    9495        </table>
    9596      </form>
     97      <form action="" method="post" class="group"
     98            tal:attributes="action string:${context/absolute_url}/create_level"
     99            tal:define="rows python: info['items'];"
     100            >
     101        <table width="100%" cellspacing="0" cellpadding="2"
     102               summary="contents of the folder"
     103               class="folderButtons">
     104          <tr>
     105            <td align="left" valign="top" rowspan="3"></td>
     106            <td align="left" valign="top">
     107              <input type="submit" name="create_level" tal:condition="create_level"
     108                       class="destructive"
     109                       tal:attributes="onclick python:'return window.confirm(\'really create Level %s\')' % create_level;
     110                       value string: create Level ${create_level}"
     111                       />
     112            </td>
     113          </tr>
     114        </table>
     115      </form>         
    96116    </metal:main>
    97117 
Note: See TracChangeset for help on using the changeset viewer.