Changeset 2168 for WAeUP_SRP


Ignore:
Timestamp:
29 Aug 2007, 06:24:39 (17 years ago)
Author:
Henrik Bettermann
Message:

add new layout for application record management
(please test!)

Location:
WAeUP_SRP/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r2094 r2168  
    77  <object name="academics_search" meta_type="CPS Layout"/>
    88  <object name="application" meta_type="CPS Layout"/>
     9  <object name="application_manage" meta_type="CPS Layout"/>
    910  <object name="certificate" meta_type="CPS Layout"/>
    1011  <object name="certificate_course" meta_type="CPS Layout"/>
     
    3031  <object name="student_clearance_fe" meta_type="CPS Layout"/>
    3132  <object name="student_course_result" meta_type="CPS Layout"/>
    32   <object name="student_course_result_fe" meta_type="CPS Layout"/> 
     33  <object name="student_course_result_fe" meta_type="CPS Layout"/>
    3334  <object name="student_create" meta_type="CPS Layout"/>
    3435  <object name="student_firsttime_login" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/skins/waeup_student/apply_pume.py

    r2162 r2168  
    9797elif psm == '' and not manage:
    9898    return context.apply_pume_form(rendered = res,
    99                                    psm = None,
     99                                   psm = psm,
    100100                                   ds = ds,
    101101                                   mode = mode,
     
    132132        mode = "view"
    133133        psm = "You successfully applied for PUME!"
    134         data['application_date'] = current
    135134        if object['status'] == 'edited':
    136135            data['status'] = "submitted"
     136            data['application_date'] = current
    137137            logger.info('%s/%s modified and submitted application record' % (member,reg_no))
    138138        elif object['status'] == 'reset':
     
    183183    else:
    184184        mode = "edit"
    185         psm = "Content changed"
     185        psm = "Content changed!"
    186186        data['status'] = "edited"
    187187        context.applicants_catalog.modifyRecord(**data)
  • WAeUP_SRP/trunk/skins/waeup_student/apply_pume_manage.py

    r2161 r2168  
    3737#REQUEST.set('type_name',type_name)
    3838reset = "reset" in request.keys()
     39edit = "edit" in request.keys()
    3940lt = context.portal_layouts
    4041
     
    4243new_reg_no = request.get('new_reg_no','').upper()
    4344
    44 if reset:
     45if reset or edit:
    4546    reg_no = reg_no
    4647elif new_reg_no:
     
    5051psm = ''
    5152object = {}
     53ds = []
     54
     55if reg_no:
     56    brains = context.applicants_catalog(reg_no = reg_no)
     57    if len(brains) == 1:
     58        for field in context.applicants_catalog.schema():
     59            object[field] = getattr(brains[0],field,None)
     60
     61        res,psm,ds = lt.renderLayout(layout_id= 'application_manage',
     62                                     schema_id= 'application',
     63                                     layout_mode = "edit",
     64                                     context=context,
     65                                     mapping=REQUEST,
     66                                     ob=object,
     67                                     commit = False,
     68                                    )
     69if psm == 'invalid':
     70    return context.apply_pume_manage_form(rendered = res,
     71                                   psm = "Please correct your input!",
     72                                   #psm = "%s, %s" % (psm,ds),
     73                                   ds = ds,
     74                                  )
     75elif psm == '':
     76    psm = 'Registration Number not found!'
     77    return context.apply_pume_manage_form(rendered = res,
     78                                   psm = psm,
     79                                   ds = ds,
     80                                  )
     81elif psm == 'valid':
     82    psm = ''
     83    pass
     84   
    5285data = {}
     86dm = ds.getDataModel()
     87for field in context.applicants_catalog.schema():
     88    if dm.has_key("%s" % field):
     89        data[field] = dm.get(field)
     90
     91
    5392if reset and reg_no:
    54     data['reg_no'] = reg_no
     93    #data['reg_no'] = reg_no
    5594    psm = "You successfully reset the record! The applicant will be able to edit and resubmit the data."
    5695    data['status'] = "reset"
     
    5897    logger.info('%s reset application record of %s' % (member,reg_no))
    5998
     99if edit and reg_no:
     100    #data['reg_no'] = reg_no
     101    psm = "Content changed!"
     102    context.applicants_catalog.modifyRecord(**data)
     103    logger.info('%s edited application record of %s' % (member,reg_no))
     104
    60105#set_trace()
    61106
    62 ds = []
     107
    63108if reg_no:
    64109    brains = context.applicants_catalog(reg_no = reg_no)
     
    66111        for field in context.applicants_catalog.schema():
    67112            object[field] = getattr(brains[0],field,None)
    68         res,psm_dummy,ds = lt.renderLayout(layout_id= 'application',
     113        res,psm_dummy,ds = lt.renderLayout(layout_id= 'application_manage',
    69114                                     schema_id= 'application',
    70                                      layout_mode = "view_slip",
     115                                     layout_mode = "edit",
    71116                                     context=context,
    72117                                     ob=object,
  • WAeUP_SRP/trunk/skins/waeup_student/apply_pume_manage_form.pt

    r2161 r2168  
    5353                   tal:condition="python: 'submitted' in ds['status']"
    5454                   />
     55                   
     56                   
     57                   
     58                   
     59                   
     60            <input type="submit" class="standalone"
     61                   name="edit"
     62                   value="Save"
     63                   />                   
     64                   
     65                   
     66                   
     67                   
     68                   
    5569            <br /><br />
    5670           
Note: See TracChangeset for help on using the changeset viewer.