Ignore:
Timestamp:
4 Nov 2005, 17:07:18 (19 years ago)
Author:
joachim
Message:

=studylevel + Title

Location:
waeup_product/trunk/skins/waeup_student
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • waeup_product/trunk/skins/waeup_student/create_jamb.py

    r112 r152  
    3737elif psm == 'valid':
    3838    s_id = "s%s" % ds.get('reg_nr')
    39     name = ds.get('name')
    40     skw = {'title': name}
     39    skw = {'title': "%(firstname)s %(lastname)s" % ds}
    4140    context.invokeFactory('Student',s_id)
    4241    student = getattr(context,s_id)   
     
    4645    student.invokeFactory('Jamb',jamb_id)
    4746    jamb = getattr(student,jamb_id)   
    48     ds.set('title', name)
     47    ds.set('title', "%(reg_nr)s (%(lastname)s)" % ds)
    4948    jamb.getContent().edit(mapping=ds)
    5049    context.notifyCPSDocumentCreation(ob=jamb)
     
    5756    if noCPSMember:
    5857        pr.addMember(s_id, 'UnSeT',roles=('Member','Student','Contributor'))
     58    student.manage_setLocalRoles(s_id, ['Owner'])
     59    jamb.manage_setLocalRoles(s_id, ['Owner'])
     60##    student.getContent().setOwnership(s_id)
     61##    jamb.getContent().setOwnership(s_id)
    5962##    groups = context.portal_directories.groups
    6063##    gm = list(groups.getEntry('Students')['members'])
     
    6366##                      'members': gm}) 
    6467    return context.students_folder_view_manager(psm=psm)
    65 ##    return context.create_jamb_form(rendered = res,
    66 ##                                 psm = psm,
    67 ##                                 ds = ds,
    68 ##                                 )
    69    
    70 return res,psm,ds
    7168
  • waeup_product/trunk/skins/waeup_student/process_waeup_login.py

    r137 r152  
    2525pd = getattr(ma,pdid)
    2626pkw = {}
    27 pkw['sex'] = getattr(jamb,'sex')
    28 pkw['firstname'] = getattr(jamb,'firstname')
    29 pkw['middlename'] = getattr(jamb,'middlename')
    30 pkw['lastname'] = getattr(jamb,'lastname')
    31 pkw['aggregate'] = getattr(jamb,'aggregate')
    32 pkw['faculty'] = getattr(jamb,'faculty')
    33 pkw['age'] = getattr(jamb,'age')
    34 pkw['state'] = getattr(jamb,'state')
     27jc = jamb.getContent()
     28pkw['sex'] = getattr(jc,'sex')
     29pkw['firstname'] = getattr(jc,'firstname')
     30pkw['middlename'] = getattr(jc,'middlename')
     31pkw['lastname'] = getattr(jc,'lastname')
     32pkw['aggregate'] = getattr(jc,'aggregate')
     33pkw['faculty'] = getattr(jc,'faculty')
     34pkw['age'] = getattr(jc,'age')
     35pkw['state'] = getattr(jc,'state')
    3536
    36 pd.edit(mapping=pkw)
     37pd.getContent().edit(mapping=pkw)
    3738context.notifyCPSDocumentCreation(ob=pd)
    3839return response.redirect(ma.absolute_url())
  • waeup_product/trunk/skins/waeup_student/register_level.py

    r142 r152  
    2828                                 create = 1,
    2929                                 type_name = type_name,
    30                                  psm = 'Not yet active',
    31                                  #psm = 'Please correct your errors',
     30                                 #psm = 'Not yet active',
     31                                 psm = 'Please correct your errors',
    3232                                 )
    3333elif psm == '':
     
    4242    psm = (ds)
    4343    oid = ds.get('Title')
    44     return context.common_edit_form(rendered = res,
     44    if hasattr(context,oid):
     45        return context.common_edit_form(rendered = res,
    4546                                 create = 1,
    4647                                 type_name = type_name,
    47                                  psm = 'Not yet active',
    48                                  #psm = 'Please correct your errors',
     48                                 psm = 'You already registered for that level',
    4949                                 )
    50    
    51     halls = getattr(context,'accommodation').contentValues()
    52     beds = []
    53     student = context.PERSONAL.getContent()
    54     sf = context.getContent()
    55     for hall in halls:
    56         h = hall.getContent()
    57         ba = int(getattr(h,'beds_assigned',0))
    58         bal = getattr(h,'beds_assigned_list',[])
    59         nr_of_beds = int(h.nr_of_blocks) * int(h.nr_of_floors) * int(h.rooms_per_floor) * int(h.beds_per_room)
    60         if h.which_sex == student.sex and nr_of_beds > len(bal):
    61             break
    62     dict = {'heading': h.heading,
    63             'text': h.text,
    64             'which_sex': h.which_sex,
    65             'nr_of_blocks': h.nr_of_blocks,
    66             'nr_of_floors': h.nr_of_floors,
    67             'rooms_per_floor': h.rooms_per_floor,
    68             'beds_per_room': h.beds_per_room,
    69             'nr_of_free': nr_of_beds,
    70             'beds_assigned': ba,
    71              }
    72     ba += 1
    73     dict['beds_assigned'] = ba
    74     bal.append(('%s:%d' % (pm.getAuthenticatedMember(),ba)))
    75     dict['beds_assigned_list'] = bal
    76     psm = "h:%(heading)s free:%(nr_of_free)s %(beds_assigned)s" % dict
    77     sf.edit(mapping = ds)
    78     h.edit(mapping = dict)
    79     #psm = "Your not admitted"
    80     return context.booked_accommodation(v=dict)
     50    context.invokeFactory(type_name,oid)
     51    object = getattr(context,oid)
     52    voc = pv.courselevel
     53    ds.set('Title',voc.get(oid))
     54    object.getContent().edit(mapping=ds,proxy=object)
     55    context.notifyCPSDocumentCreation(ob=object)
     56    psm = 'new %s created' % oid
     57    semester_id = 'Semester_1_%s_%s' % (oid,context.getId())
     58    object.invokeFactory('Semester',semester_id)
     59    semester = getattr(object,semester_id)
     60    semester.getContent().edit(mapping={'Title': 'First Semester'})
     61    semester_id = 'Semester_2_%s_%s' % (oid,context.getId())
     62    object.invokeFactory('Semester',semester_id)
     63    semester = getattr(object,semester_id)
     64    semester.getContent().edit(mapping={'Title': 'Second Semester'})
     65    context_ti = context.portal_types[context.portal_type]
     66    index = context_ti.getActionById('view','university_view')
     67    return getattr(context,index)(psm=psm)
Note: See TracChangeset for help on using the changeset viewer.