Ignore:
Timestamp:
7 Sep 2006, 12:34:56 (18 years ago)
Author:
joachim
Message:

modified scratch_card_pin widget to include prefix and batch_no
modified schemas and layouts accordingly.

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

Legend:

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

    r486 r488  
    1818pr = context.portal_registration
    1919
    20 prefix = 'APP'
    2120res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe',
    2221                      schema_id= 'student_application',
    2322                      context=context,
    2423                      mapping=validate and REQUEST,
    25                       ob={'app_ac_prefix': prefix},
     24                      ob={},
    2625                      layout_mode='create',
    2726                      formaction = "apply_admission",
     
    3130    return context.application_pin_form(rendered = res,
    3231                                 psm = "Please correct your input.",
    33                                  #psm = "psm : #%s#" % (psm,),
     32                                 #psm = "%s, %s" % (psm,ds),
    3433                                 firstlayout = True,
    3534                                 lastlayout = True,
     
    4544elif psm == 'valid':
    4645    jamb_id = ds.get('jamb_reg_no')
    47     catalog = context.portal_catalog
    48     search = catalog({'meta_type': 'StudentApplication',
    49                      'jamb_reg_no': jamb_id
    50                      })
    51 
    52     if len(search) < 1:
    53         psm = "JAMB record %s not found." % (jamb_id)
     46    student = context.getContent().getStudentByRegNo(jamb_id)
     47    if student is None:
     48        psm = "JAMB record %s not accessible." % (jamb_id)
    5449        return context.application_pin_form(rendered = res,
    5550                                 psm = psm,
     51                                 #psm = "%s, %s" % (psm,ds),
    5652                                 ds = ds,
    5753                                 )
    58 application = search[0].getObject()
    59 student = application.aq_parent
     54application = student.application
    6055if context.portal_workflow.getInfoFor(student,'review_state',None) == "created":
    6156    #student.invokeFactory('StudentClearance','clearance')
     
    8075student.personal.getContent().edit(mapping = dp)
    8176da = {}
    82 da['app_ac_prefix'] = prefix
    83 da['app_ac_batch_no'] = ds.get('app_ac_batch_no')
    8477da['app_ac_pin'] = ds.get('app_ac_pin')
    8578da['app_ac_date'] = current
  • WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_create_do.py

    r486 r488  
    55
    66Datamodel may be examined to create a suitable id.
    7 
    8 Returns the created object (usually a proxy).
    97"""
    108from Products.CMFCore.utils import getToolByName
    119
    12 id = datamodel.get('prefix').upper()
    13 datamodel.set('prefix',id)
    14 bl = context.portal_catalog({'meta_type': "ScratchCardBatch"})
    15 b_ids = [b.getId(), for b in bl]
     10prefix = datamodel.get('prefix').upper()
     11datamodel.set('prefix',prefix)
     12bl = context.portal_catalog({'meta_type': "ScratchCardBatch",})
     13b_ids = []
     14for b in bl:
     15    b_ids.append(b.getId)
    1616next = 1
    17 while "%(prefix)s_%(next)d" % vars() in b_ids:
     17while b_ids and "%s_%d" % (prefix,next) in b_ids:
    1818    next += 1
    19 id = "%(prefix)s_%(next)d" % vars()
    20 ##if not id:
    21 ##    id = 'my ' + type_name
    22 ##id = context.computeId(compute_from=id) # XXX shouldn't use a skin
    23 ##
    24 language = datamodel.get('Language')
    25 if not language:
    26     ts = getToolByName(context, 'translation_service')
    27     language = ts.getSelectedLanguage()
     19id = "%s_%d" % (prefix,next)
     20datamodel.set('batch_no',next)
     21##language = datamodel.get('Language')
     22##if not language:
     23##    ts = getToolByName(context, 'translation_service')
     24##    language = ts.getSelectedLanguage()
    2825
    2926# Datamodel is passed so that flexti can initialize the object.
    3027new_id = context.invokeFactory(type_name, id, datamodel=datamodel,
    31                                language=language,
    3228                               )
    3329if new_id is not None:
  • WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_created.py

    r486 r488  
    1 ##parameters=
     1## Script (Python) "cpsdocument_created"
     2##bind container=container
     3##bind context=context
     4##bind namespace=
     5##bind script=script
     6##bind subpath=traverse_subpath
     7##parameters=object=None
     8##title=
     9##
    210# $Id$
    3 
     11if object is not None:
     12    batch = object
     13batch.getContent().makePins()
    414return
Note: See TracChangeset for help on using the changeset viewer.