Changeset 2159


Ignore:
Timestamp:
24 Aug 2007, 07:07:00 (17 years ago)
Author:
Henrik Bettermann
Message:

allow SectionOfficer? to assume applicant's role

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

Legend:

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

    r2146 r2159  
    2222logger = logging.getLogger('Skins.apply_pume')
    2323
     24mtool = context.portal_membership
     25member = mtool.getAuthenticatedMember()
     26
    2427current = DateTime.DateTime()
    2528pr = context.portal_registration
     
    3336edit = "edit" in request.keys()
    3437slip = "slip" in request.keys()
     38manage = "manage" in request.keys()
    3539submitted = False
    3640mode = request.get('mode','')
    3741if not mode:
    38     if apply_pume or edit:
     42    if apply_pume or edit or manage:
    3943        mode = "edit"
    4044    else:
    4145        mode = "create"
    42 validate = create or edit or apply_pume
     46validate = create or edit or apply_pume or manage
    4347
    4448lt = context.portal_layouts
     
    5761        if object['status'] == "submitted":
    5862            submitted = True
    59         if not create and pin != object['pin']:
    60             logger.info('%s entered wrong pin %s' % (reg_no,pin))
     63        if not create and (pin != object['pin'] and not context.isSectionOfficer()):
     64            logger.info('%s/%s entered wrong pin %s' % (member,reg_no,pin))
    6165            return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
    6266if slip:
    6367    mode = "view_slip"
    64     logger.info('%s views application slip' % (reg_no))
     68    logger.info('%s/%s views application slip' % (member,reg_no))
    6569res,psm,ds = lt.renderLayout(layout_id= 'application',
    6670                             schema_id= 'application',
     
    105109        mode = "view"
    106110        psm = "The form has already been submitted and you are not allowed to resubmit the data!"
    107         logger.info('%s tried to resubmit application record' % (reg_no))
     111        logger.info('%s/%s tried to resubmit application record' % (member,reg_no))
    108112        res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',
    109113                                schema_id= 'application',
     
    114118                                commit = False,
    115119                                )
    116     # elif not dm.get('passport'):
    117     #     mode = "edit"
    118     #     psm = "Please upload Passport Photograph!"
    119     #     logger.info('%s tried to submit without uploading a passport foto' % (reg_no))
    120120    elif not request.has_key('confirm'):
    121121        mode = "edit"
    122122        psm = "Please confirm Passport Photograph!"
    123         logger.info('%s tried to submit without ticking confirmation check box' % (reg_no))
     123        logger.info('%s/%s tried to submit without ticking confirmation check box' % (member,reg_no))
    124124    else:
    125125        mode = "view"
     
    128128        data['status'] = "submitted"
    129129        context.applicants_catalog.modifyRecord(**data)
    130         logger.info('%s modified and submitted application record' % (reg_no))
     130        logger.info('%s/%s modified and submitted application record' % (member,reg_no))
    131131        res,psm_dummy,ds = lt.renderLayout(layout_id= 'application',
    132132                                schema_id= 'application',
     
    140140    if submitted:
    141141        mode = "view"
    142         logger.info('%s views application record' % (reg_no))
    143     else:
    144         mode = "edit"
    145         logger.info('%s edits application record' % (reg_no))
     142        logger.info('%s/%s views application record' % (member,reg_no))
     143    else:
     144        mode = "edit"
     145        logger.info('%s/%s edits application record' % (member,reg_no))
    146146    psm = ""
    147147    #set_trace()
     
    159159        mode = "view"
    160160        psm = "The form has already been submitted and you are not allowed to modify the data!"
    161         logger.info('%s tried to edit submitted application record' % (reg_no))
     161        logger.info('%s/%s tried to edit submitted application record' % (member,reg_no))
    162162        res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',
    163163                                schema_id= 'application',
     
    173173        data['status'] = "edited"
    174174        context.applicants_catalog.modifyRecord(**data)
    175         logger.info('%s modified application record' % (reg_no))
    176 
     175        logger.info('%s/%s modified application record' % (member,reg_no))
     176
     177elif manage:       
     178    if submitted:
     179        mode = "view"
     180        psm = "You are now assuming the applicant's role!"
     181        logger.info('%s/%s entered application record' % (member,reg_no))
     182        res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',
     183                                schema_id= 'application',
     184                                layout_mode = mode,
     185                                context=context,
     186                                mapping={},
     187                                ob=object,
     188                                commit = False,
     189                                )
     190    else:
     191        mode = "edit"
     192        psm = "You are now assuming the applicant's role!"
     193        logger.info('%s/%s entered application record' % (member,reg_no))
     194
     195   
    177196
    178197return context.apply_pume_form(rendered = res,
  • WAeUP_SRP/trunk/skins/waeup_student/apply_pume_manage_form.pt

    r2157 r2159  
    77  <metal:block define-macro="edit_form">
    88    <metal:block use-macro="here/main_template/macros/master">
    9       <metal:block fill-slot="main"
    10                    tal:define="info_applicants context/getApplicantsStatistics">
     9      <metal:block fill-slot="main">
    1110
    1211        <form action="" id="editForm" method="post"
     
    1918            <br />
    2019           
    21             <table>
     20            <table tal:define="info_applicants context/getApplicantsStatistics">
    2221            <tr>
    2322              <td>Number of records viewed:</td>
     
    5554                   />
    5655            <br /><br />
    57 
     56           
    5857
    5958            <div class="label">Registration No:</div>
     
    6665          </span>
    6766        </form>
     67       
     68        <br/>
     69       
     70        <form action="" id="editForm" method="post"
     71            enctype="multipart/form-data" class="workflow"
     72            tal:attributes="action string:${context/absolute_url}/apply_pume"
     73            >
     74        <input type="hidden" name="reg_no"
     75               tal:attributes="value ds/reg_no|nothing"
     76               tal:condition="ds/reg_no|nothing"/>
     77        <input type="submit"
     78               class="standalone"
     79               name="manage"
     80               value="Assume the Applicant's Role"
     81               />             
     82        </form>         
     83       
    6884      </metal:block>
    6985    </metal:block>
Note: See TracChangeset for help on using the changeset viewer.