Changeset 3452


Ignore:
Timestamp:
19 Apr 2008, 09:19:02 (17 years ago)
Author:
joachim
Message:

sanitize getClearanceInfo and clearance_edit,
adopt views,
infopenalty? is now set to False.

Location:
WAeUP_SRP/base
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r3406 r3452  
    179179        is_staff = info['is_staff'] = not is_anonymous and not is_student
    180180        roles = member.getRolesInContext(context)
    181         is_sectionofficer = info['is_sectionofficer'] = not is_student and ("SectionOfficer" in roles or
    182                                                                             "SectionManager" in roles or
    183                                                                             "Manager" in roles)
     181        info['is_sectionofficer'] = not is_student and ("SectionOfficer" in roles or
     182                                                        "SectionManager" in roles or
     183                                                        "Manager" in roles)
     184        info['is_clearanceofficer'] = not is_student and ("ClearanceOfficer" in roles)
    184185        is_allowed = info['is_allowed'] = not is_anonymous
    185186        requested_id = context.getStudentId()
  • WAeUP_SRP/base/skins/waeup_student/clearance_edit_form.pt

    r3451 r3452  
    44
    55  <metal:main fill-slot="main"
    6            tal:define="
    7                info context/getClearanceInfo;
    8                s_name context/getStudentNameInContext;">
     6              tal:define="info context/getClearanceInfo;">
    97               
    108      <metal:block tal:condition="not: info">
     
    1311      <metal:block tal:condition="info">
    1412      <metal:block tal:define="               
    15                is_so context/isSectionOfficer;
    16                is_staff context/isStaff;
    17                is_co context/isClearanceOfficer;
    18                is_student context/isStudent;
     13               is_so info/is_sectionofficer;
     14               is_staff info/is_staff;
     15               is_co info/is_clearanceofficer;
     16               is_student info/is_student;
    1917               review_state info/review_state;
    2018               clear_review_state info/clear_review_state;
     
    3735      <h3>
    3836        <span tal:condition="info">
    39           <span tal:content="s_name" />:
     37          <span tal:content="info/student_name" />:
    4038        </span>
    4139        <span tal:content="here/title_or_id" />
  • WAeUP_SRP/base/skins/waeup_student/clearance_slip.pt

    r2579 r3452  
    1717              />       
    1818             
    19         <table tal:define="sc python: info['course_doc']">
     19        <table tal:define="sc python: info['course_doc'];
     20               f_id sc/faculty;
     21               d_id sc/department;
     22               sc_id sc/course;
     23               f_title context/academics/?f_id/Title|string:Faculty not yet in Prospectus;
     24               d_title context/academics/?f_id/?d_id/Title|string:Department not yet in Prospectus;
     25               sc_title context/academics/?f_id/?d_id/certificates/?sc_id/Title|string:Course not in Prospectus"
     26               >
    2027        <tr>
    2128          <td width="180px">Certificate:</td>
    22           <td><span tal:content="sc/title" /></td>
     29          <td><span tal:content="sc_title" /></td>
    2330        </tr>
    2431        <tr>
    2532          <td>Certificate ID:</td>
    26           <td tal:content="sc/study_course" />
     33          <td tal:content="sc/course" />
    2734        </tr>
    28         <span  tal:omit-tag=""
    29                tal:define="f_id sc/faculty;
    30                         d_id sc/department;
    31                         f_title context/academics/?f_id/Title|string:Faculty not yet in Prospectus;
    32                         d_title context/academics/?f_id/?d_id/Title|string:Department not yet in Prospectus"
    33                         >
    3435            <tr>
    3536              <td>Faculty:</td>
     
    4041              <td><span tal:content="d_title" /></td>
    4142            </tr>
    42           </span>
    4343        </table>                 
    4444             
  • WAeUP_SRP/base/skins/waeup_student/clearance_view.pt

    r3451 r3452  
    22    <metal:main fill-slot="main"
    33                tal:define="info context/getClearanceInfo;
    4                         is_so context/isSectionOfficer;
    5                         is_student context/isStudent;
    6                         s_name context/getStudentNameInContext;
     4                        is_so info/is_sectionofficer;
     5                        is_student info/is_student;
    76                        ">
    87      <span tal:condition="not: info">
     
    2726        <h3>
    2827           <span tal:condition="python:is_so and info">
    29              <span tal:content="s_name" />:
     28             <span tal:content="info/student_name" />:
    3029           </span>
    3130           <span tal:condition="python:is_student">
    3231             My
    3332           </span>
    34            <span tal:content="here/title_or_id" />
     33           <span tal:content="context/title_or_id" />
    3534        </h3>       
    3635
  • WAeUP_SRP/base/skins/waeup_student/getClearanceInfo.py

    r2975 r3452  
    1212return Info about the current Student
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419import logging
    1520logger = logging.getLogger('Skins.getClearanceInfo')
     
    4247    return None
    4348
     49student_record = context.students_catalog.getRecordByKey(student_id)
    4450students_object = context.portal_url.getPortalObject().campus.students
    4551student = getattr(students_object, student_id)
    46 res = context.portal_catalog(portal_type='Student',id = student_id)
    47 if len(res) == 0:
    48     return None
    49 creation_date = DateTime(res[0].CreationDate)
    50 info['penalty'] = creation_date.lessThan(DateTime('2006/12/5'))
     52# res = context.portal_catalog(portal_type='Student',id = student_id)
     53# if len(res) == 0:
     54#     return None
     55# creation_date = DateTime(res[0].CreationDate)
     56# info['penalty'] = creation_date.lessThan(DateTime('2006/12/5'))
     57info['penalty'] = False
    5158info['id'] = student_id
    5259info['student'] = student
    53 info['review_state'] = context.getStudentReviewState()
    54 info['app'] = student.application
     60info['student_name'] = student_record.name
     61#info['review_state'] = context.getStudentReviewState()
     62info['review_state'] = student_record.review_state
     63# info['app'] = student.application
    5564info['app_doc'] = student.application.getContent()
    5665info['clear'] = student.clearance
     
    5968info['per'] = student.personal
    6069info['per_review_state'] = wf.getInfoFor(student.personal,'review_state',None)
    61 if info['review_state'] in ('clearance_requested', 'cleared_and_validated',):
    62     info['penalty'] = info['penalty'] and\
    63                       info['clear_doc'].entry_date.greaterThan(DateTime('2006/12/30'))
    64 course = getattr(student,'study_course',None)
    65 if course:
    66     cert_id = course.getContent().study_course
    67     res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
    68     ci = {}
    69     if len(res) > 0:
    70         info['course'] = course
    71         brain = res[0]
    72         ci['study_course'] = brain.getId
    73         ci['title'] = brain.Title
    74         pl = brain.getPath().split('/')
    75         ci['faculty'] = pl[-4]
    76         ci['department'] = pl[-3]
    77         info['course_doc'] = ci
    78     else:
    79         info['course'] = None
     70ci = {}
     71ci['course'] = student_record.course
     72ci['faculty'] = student_record.faculty
     73ci['department'] = student_record.department
     74info['course_doc'] = ci
     75# if info['review_state'] in ('clearance_requested', 'cleared_and_validated',):
     76#     info['penalty'] = info['penalty'] and\
     77#                       info['clear_doc'].entry_date.greaterThan(DateTime('2006/12/30'))
     78# course = getattr(student,'study_course',None)
     79# if course:
     80#     cert_id = course.getContent().study_course
     81#     res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
     82#     ci = {}
     83#     if len(res) > 0:
     84#         info['course'] = course
     85#         brain = res[0]
     86#         ci['study_course'] = brain.getId
     87#         ci['title'] = brain.Title
     88#         pl = brain.getPath().split('/')
     89#         ci['faculty'] = pl[-4]
     90#         ci['department'] = pl[-3]
     91#         info['course_doc'] = ci
     92#     else:
     93#         info['course'] = None
    8094return info
Note: See TracChangeset for help on using the changeset viewer.