Changeset 1494


Ignore:
Timestamp:
26 Feb 2007, 09:16:06 (18 years ago)
Author:
joachim
Message:

make register courses work

Location:
WAeUP_SRP/trunk/skins/waeup_student
Files:
5 edited

Legend:

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

    r1492 r1494  
    1212    def set_trace():
    1313        pass
     14from Products.AdvancedQuery import Eq, Between, Le,In
     15aq_portal = context.portal_catalog.evalAdvancedQuery
    1416
    1517current = DateTime.DateTime()
     
    2729student = context.students_catalog(id=context.getStudentId())[0]
    2830cert_id = student.course
     31current_level = student.level
    2932in_progress =  session.get('in_progress','finished')
    3033if in_progress == 'finished':
    3134    session.set('in_progress','started')
    32     view = context.in_progress_view(refresh=3,page='study_level_view')
     35    view = context.in_progress_view(refresh=3,page='%s/study_level_view' % current_level)
    3336    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    3437    response.setHeader('Content-length','%d' % (len(view)))
     
    4043context.invokeFactory('StudentStudyLevel',"%s" % current_level)
    4144level = getattr(context,"%s" % current_level)
    42 session = context.getSessionString()
    43 level.getContent().edit(mapping={'session': session})
     45study_session = context.getSessionString()
     46level.getContent().edit(mapping={'session': study_session})
    4447context.portal_workflow.doActionFor(level,'open')
    4548context.portal_workflow.doActionFor(level,'close_for_edit')
     
    5154    d['grade'] = co.GRADE
    5255    d['carry_level'] = co.CarryLevel
    53     cr_id = context.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
    54     getattr(context,cr_id).getContent().edit(mapping=d)
     56    cr_id = level.invokeFactory('StudentCourseResult',"%s_co" % co.CosCode)
     57    getattr(level,cr_id).getContent().edit(mapping=d)
    5558res = context.portal_catalog(portal_type="Certificate", id = cert_id)
    5659l = []
     
    6164            Eq('portal_type','CertificateCourse') &\
    6265            Eq('SearchableText', "%s" % student.level)
    63     courses = evalAdvancedQuery(query)
     66    courses = aq_portal(query)
    6467    for c in courses:
    6568        d = context.getCourseInfo(c.getId)
    66         cr_id = context.invokeFactory('StudentCourseResult',c.getId)
     69        cr_id = level.invokeFactory('StudentCourseResult',c.getId)
    6770        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
    68         getattr(context,cr_id).getContent().edit(mapping=d)
     71        getattr(level,cr_id).getContent().edit(mapping=d)
    6972session.set('in_progress','finished')
    70 return "finished"
     73return response.redirect("%s/study_level_view" % level.absolute_url())
  • WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py

    r1493 r1494  
    1212return Info about the Students StudyCourse
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
     19
    1420request = context.REQUEST
    1521
     
    4955    wftool.doActionFor(context,'close_for_edit')
    5056student_review_state = context.getStudentReviewState()
    51 may_register = 0 #1 or student_review_state in ('shool_fee_payed',)
     57#may_register = 0 #1 or student_review_state in ('shool_fee_payed',)
     58may_register = (1 or student_review_state in ('shool_fee_payed',)) and\
     59               current_level not in levels
    5260levels.sort()
    5361info['create_level'] = None
  • WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py

    r1482 r1494  
    1212return Info about the Studylevel
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419from Products.AdvancedQuery import Eq, Between, Le,In
    15 evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
     20aq_portal = context.portal_catalog.evalAdvancedQuery
    1621request = context.REQUEST
    1722session = request.SESSION
     
    6671    if id.endswith('_co'):
    6772        d = context.getCourseInfo(id[:-3])
     73        d['id'] = id
    6874        d['grade'] = obj.getContent().grade
    6975        carry_overs.append(d)
    7076    else:
    7177        d = context.getCourseInfo(id)
     78        d['id'] = id
    7279        coe = obj.getContent().core_or_elective
    7380        d['coe'] = 'Core'
  • WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt

    r1493 r1494  
    6565                     />
    6666            </td>
    67             <td><a href="view" tal:condition="python: 0"
     67            <td><a href="view" tal:condition="python: 1"
    6868                   tal:attributes="href string:${row/url}">
    6969              <strong tal:content="row/title" /></a>
    70               <strong tal:condition="python: 1" tal:content="row/title" />
     70              <strong tal:condition="python: 0" tal:content="row/title" />
    7171            </td>
    7272          </tr>
     
    9898            tal:attributes="action string:${context/absolute_url}/create_level"
    9999            tal:define="rows python: info['items'];"
     100            tal:condition="create_level"
    100101            >
    101102        <table width="100%" cellspacing="0" cellpadding="2"
     
    105106            <td align="left" valign="top" rowspan="3"></td>
    106107            <td align="left" valign="top">
    107               <input type="submit" name="create_level" tal:condition="create_level"
     108              <input type="submit" name="create_level"
    108109                       class="destructive"
    109                        tal:attributes="onclick python:'return window.confirm(\'Do you really want to register for Level %s\?')' % create_level;
     110                       tal:attributes="onclick python:'return window.confirm(\'Do you really want to register for Level %s ?\')' % create_level;
    110111                       value string: Register for Level ${create_level}"
    111112                       />
  • WAeUP_SRP/trunk/skins/waeup_student/study_level_view.pt

    r1482 r1494  
    4646            <td align="left" valign="middle" style="width: 5px;">
    4747              <input type="checkbox" name="ids:list" value="" id="" class="noborder"
    48                      tal:define="id row/code"
     48                     tal:define="id row/id"
    4949                     tal:attributes="value id;
    5050                     id python:'cb_' + id;
     
    6565            <td align="left" valign="middle" style="width: 5px;">
    6666              <input type="checkbox" name="ids:list" value="" id="" class="noborder"
    67                      tal:define="id row/code"
     67                     tal:define="id row/id"
    6868                     tal:attributes="value id;
    6969                     id python:'cb_' + id;
Note: See TracChangeset for help on using the changeset viewer.