Changeset 2961 for WAeUP_SRP


Ignore:
Timestamp:
19 Dec 2007, 11:16:49 (17 years ago)
Author:
Henrik Bettermann
Message:

install button to execute transitions return and pay_school_fee

Location:
WAeUP_SRP
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py

    r2837 r2961  
    5858student_path = "%s/campus/students/%s" % (context.portal_url(),student_id)
    5959students_folder = context.portal_url.getPortalObject().campus.students
    60 # res = context.students_catalog(id = student_id)
    61 # if not res:
    62 #     return None
    63 # student_record = res[0]
     60
    6461student_record = context.students_catalog.getRecordByKey(student_id)
    6562if student_record is None:
     
    6966for field in context.students_catalog.schema():
    7067    info[field] = getattr(student_record,field)
    71 
    72 #res = context.portal_catalog(portal_type='Student',id = student_id)
    73 #if res:
    74 #    info['review_state'] = res[0].review_state
    7568
    7669#info['review_state'] = context.getStudentReviewState()
     
    9891              'PaymentsFolder': 'payments_view',
    9992              }
    100 #logger.info("before search")
    101 #starttime = DateTime.DateTime().timeTime()
    102 #sos = context.portal_catalog(container_path=student_path_root)
    103 # query = Eq('container_path',student_path_root)
    104 # sos = aq_portal(query)
    105 # logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime))
    106 # starttime = DateTime.DateTime().timeTime()
    107 # for so in sos:
    108 #     row = {}
    109 #     row['id'] = so.getId
    110 #     row['title'] = so.Title
    111 #     url = row['url'] = "%s/%s" % (student_path,so.getId)
    112 #     row['type'] = so.portal_type
    113 #     review_state = row['review_state'] = so.review_state
    114 #     row['is_editable'] = (is_student and review_state == "opened") or is_sectionofficer
    115 #     sv_link = s_view_links.get(so.portal_type,None) or "waeup_document_view"
    116 #     row['s_view_link'] = "%s/%s" % (url,sv_link)
    117 #     se_link = s_edit_links.get(so.portal_type,None)
    118 #     row['s_edit_link'] = None
    119 #     if se_link:
    120 #         row['s_edit_link'] = "%s/%s" % (url,se_link)
    121 #     row['display'] = review_state in ('opened','closed','bed_reserved','maintenance_fee_paid',)\
    122 #                     and so.portal_type not in  ('StudentPume','StudentAccommodation','PaymentsFolder',) or\
    123 #                     so.portal_type == 'StudentStudyCourse'
    124 #     items.append(row)
    125 #sos = context.portal_catalog(container_path=student_path_root)
     93
    12694student_obj = getattr(students_folder,student_id)
    12795subobjects = student_obj.objectValues()
    128 #logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime))
    129 #starttime = DateTime.DateTime().timeTime()
     96
    13097for subobject in subobjects:
    13198    row = {}
     
    146113                    subobject.portal_type == 'StudentStudyCourse'
    147114    items.append(row)
    148 #logger.info("listtime %f" % (DateTime.DateTime().timeTime() - starttime))
    149 #set_trace()
     115
    150116items.sort(cmp=lambda x,y: cmp( x['title'],y['title']))
    151117info['items'] = items
    152118info['member'] = member
     119
     120try:
     121    current_level = int(info['level'])
     122except:
     123    current_level = 0
     124info['transition_return_allowed'] = info['review_state'] == 'school_fee_paid' and current_level > 100 and is_sectionofficer
     125info['transition_pay_school_fee_allowed'] = info['review_state'] == 'returning' and is_sectionofficer
     126
    153127return info
    154128
  • WAeUP_SRP/base/skins/waeup_student/student_view.pt

    r2793 r2961  
    22  <metal:main fill-slot="main"
    33              tal:define="info context/getStudentFolderInfo;
    4               baseinfo info/base_info|nothing"
     4                          baseinfo info/base_info|nothing"
    55              >
    66    <metal:block tal:condition="not: info">
     
    104104          <input type="submit" class="context" value="Send Email with Authentication Data" />
    105105        </form>
     106       
     107       
     108       
     109       
     110        <form action="" method="post" class="group"
     111              tal:condition="info/transition_return_allowed"
     112              tal:attributes="action string:${context/absolute_url}/changeRegState">
     113          <input type="submit" class="context" value="Execute Transition 'return'" />
     114          <input type="hidden" name="transition"
     115                 tal:attributes="value string:return"
     116                 /> &nbsp; <br /><br />     
     117          <font color='red'>Attention: This low-level method does not change the study course and/or payment objects! They must be edited separately.</font>
     118        </form>       
     119       
     120        <form action="" method="post" class="group"
     121              tal:condition="info/transition_pay_school_fee_allowed"
     122              tal:attributes="action string:${context/absolute_url}/changeRegState">
     123          <input type="submit" class="context" value="Execute Transition 'pay_school_fee'" />
     124          <input type="hidden" name="transition"
     125                 tal:attributes="value string:pay_school_fee"
     126                 /> &nbsp; <br /><br />
     127          <font color='red'>Attention: This low-level method does not change the study course and/or payment objects! They must be edited separately.</font>
     128        </form>             
     129   
     130   
     131       
     132       
    106133        <div tal:condition="python:info['review_state']=='deactivated'">
    107134          <font color="red">This student record has been deactivated!</font>
  • WAeUP_SRP/base/skins/waeup_utilities/changeRegState.py

    r2194 r2961  
    1515mtool = context.portal_membership
    1616member = mtool.getAuthenticatedMember()
    17 if str(member) not in ('admin','joachim') or transition is None:
    18     return
     17
     18#if str(member) not in ('admin','joachim') or transition is None:
     19#    return 'Forbidden!'
     20   
     21if not context.isSectionOfficer() or transition is None:
     22    return 'Forbidden!'   
    1923
    2024import logging
     
    3438try:
    3539    wftool.doActionFor(student,transition)
    36     logger.info('%s executes transition %s for %s' % (member,transition,student_id))
     40    logger.info('%s executed transition %s for %s' % (member,transition,student_id))
    3741except:
    3842    logger.info('%s tried to execute transition %s for %s, transition not allowed' % (member,transition,student_id))
     43    return 'Transition not allowed!'
    3944
    4045return request.RESPONSE.redirect("%s" % context.absolute_url())
  • WAeUP_SRP/uniben/profiles/default/workflows/waeup_student_wf/definition.xml

    r2901 r2961  
    182182  <exit-transition transition_id="register_courses"/>
    183183  <exit-transition transition_id="deactivate"/>
     184  <exit-transition transition_id="return"/>
    184185  <permission-map name="Delete objects" acquired="False">
    185186   <permission-role>Manager</permission-role>
Note: See TracChangeset for help on using the changeset viewer.