Changeset 502


Ignore:
Timestamp:
11 Sep 2006, 10:39:59 (18 years ago)
Author:
joachim
Message:

Scratchcard Pin Generation
basic login in apply_admission

Location:
WAeUP_SRP/trunk
Files:
1 added
20 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Accommodation.py

    r411 r502  
    9191
    9292###)
    93 
    94        
    95                            
    9693               
    9794InitializeClass(Accommodation)
  • WAeUP_SRP/trunk/PatchCatalogToolXMLAdapter.py

    r486 r502  
    77    """Import the object from the DOM node.
    88    """
     9    #import pdb;pdb.set_trace()
    910    if self.environ.shouldPurge():
    1011        self._purgeProperties()
     
    1213        self._purgeIndexes()
    1314        self._purgeColumns()
    14 ##    self._initProperties(node)
    15 ##    self._initObjects(node)
    16 ##    self._initIndexes(node)
    17 ##    self._initColumns(node)
    1815    columns = []
    1916    for col in self._extractColumns()._get_childNodes():
     
    2724    na = node.attributes.items()
    2825    not_found = True
    29     if na[1][1] == "portal_catalog":
     26    if na[0][1] == "CMF Catalog":
    3027        not_found = False
    31         print na[1][1]
     28        #print na[1][1]
    3229        for ch in node._get_childNodes():
    3330            if ch.nodeName in ('index',):
  • WAeUP_SRP/trunk/ScratchCards.py

    r490 r502  
    1111#from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument
    1212from Products.CPSDocument.CPSDocument import CPSDocument
     13import DateTime
     14import Globals
     15p_home = Globals.package_home(globals())
     16i_home = Globals.INSTANCE_HOME
    1317
    1418class ScratchCardBatchesFolder(CPSDocument): ###(
     
    4549    security = ClassSecurityInfo()
    4650
    47     def __init__(self,id,**kw):
    48         CPSDocument.__init__(self,id,**kw)
    49         self.table = PinTable()
    50        
    5151    security.declareProtected(View,"Title")
    5252    def Title(self):
     
    6060        batch = self.getContent()
    6161        nr = batch.no_of_pins
     62        prefix = batch.prefix
     63        sold = batch.sold_by
     64        cost = batch.cost
    6265        import random
    6366        r = random
    6467        b_no = batch.batch_no
     68        #import pdb;pdb.set_trace()
     69        generated = []
     70        generated.append('"Serial","Pin","Sold","Cost"' % vars())
     71        generated.append('"%(prefix)s","%(b_no)d","%(sold)s","%(cost)f"' % vars())
     72        pins = self.portal_pins
    6573        for i in range(nr):
    66             pin = "%d%d" % (b_no,r.randint(999999999,1000000000))
    67             import pdp;pdb.set_trace()
    68             while len(res) > 0:
    69                 pin = "%d%d" % (b_no,r.randint(9999,1000000000))
    70                 res = self.table.searchResults(uid=pin)
    71             self.table.addRecord(pin=pin,serial=i,student="")
    72             print i,pin
     74            ri = r.randint(1000000000,9999999999)
     75            pin = "%s%d%d" % (prefix,b_no,ri)
     76            while len(pins.searchResults({'pin': pin})) > 0:
     77                ri = r.randint(1000000000,9999999999)
     78                pin = "%s%d%d" % (prefix,b_no,ri)
     79            pins.addRecord(pin=pin,serial=i,student="")
     80            generated.append('"%(i)d","%(prefix)s-%(b_no)d-%(ri)d"' % vars())
     81        print '\n'.join(generated)
     82        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
     83        open("%s/import/%s-%s-%s" % (i_home,prefix,b_no,current),"w+").write('\n'.join(generated))
    7384
    7485
  • WAeUP_SRP/trunk/Students.py

    r488 r502  
    55from AccessControl.SecurityManagement import newSecurityManager
    66from zExceptions import BadRequest
     7from Products.ZCatalog.ZCatalog import ZCatalog
    78from Products.CMFCore.utils import UniqueObject, getToolByName
    89from Products.CMFCore.permissions import View
     
    2526    r = random
    2627    return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000))
     28
     29def getStudentByRegNo(self,reg_no):
     30    """search student by JAMB Reg No and return StudentFolder"""
     31    search = ZCatalog.searchResults(self.portal_catalog,{'meta_type': 'StudentApplication',
     32                                  'jamb_reg_no': reg_no,
     33                                  })
     34    if len(search) < 1:
     35        return None
     36    return search[0].getObject().aq_parent
    2737
    2838class StudentsFolder(CPSDocument): ###(
     
    102112                logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars())
    103113                s = getattr(self,sid)
     114                self.portal_registration.addMember(sid,
     115                                                   'uNsEt' ,
     116                                                   roles=('Member',
     117                                                          'Student',))
    104118                s.invokeFactory('StudentApplication','application')
    105119                da = {'Title': 'Application Data'}
     
    314328            logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars())
    315329            s = getattr(self,sid)
     330            self.portal_registration.addMember(sid,
     331                                               'uNsEt' ,
     332                                               roles=('Member',
     333                                                      'Student',))
    316334            s.invokeFactory('StudentApplication','application')
    317335            da = {'Title': 'Application Data'}
     
    335353##            s.personal.getContent().edit(mapping=d)
    336354            s.application.getContent().edit(mapping=da)
     355            s.application.getContent().content_status_modify(workflow_action="open")
     356            s.application.manage_setLocalRoles(s_id, ['Owner',])
    337357        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
    338358    ###)
    339359
    340     security.declareProtected(View,"getStudentByRegNo")
    341     def getStudentByRegNo(self,reg_no):
    342         """search student by JAMB Reg No and return StudentFolder"""
    343         search = self.portal_catalog({'meta_type': 'StudentApplication',
    344                                       'jamb_reg_no': reg_no,
    345                                       })
    346         if len(search) < 1:
    347             return None
    348         return search[0].getObject().aq_parent
    349360
    350361    security.declareProtected(View,"Title")
  • WAeUP_SRP/trunk/WAeUPTables.py

    r490 r502  
    3131    for key, value in dict.items():
    3232        setattr(ob, key, value)
    33        
    3433    return ob
    3534       
     
    4039       
    4140    def addRecord(self, **data):
    42         raise NotImplementedError
     41        # The uid is the same as "bed".
     42        uid = data[self.key]
     43        res = self.searchResults({"%s" % self.key : uid})
     44        if len(res) > 0:
     45            raise ValueError("More than one record with uid %s" % uid)
     46        self.catalog_object(dict2ob(data), uid=uid)
     47        return uid
    4348   
    4449    def deleteRecord(self, uid):
    4550        self.uncatalog_object(uid)
    4651   
    47     def modifyRecord(self, uid, **data):
    48         records = self.searchResults(uid=uid)
     52    def searchAndSetRecord(self, **data):
     53        raise NotImplemented
     54
     55    def modifyRecord(self, **data):
     56        #records = self.searchResults(uid=uid)
     57        uid = data[self.key]
     58        records = self.searchResults({"%s" % self.key : uid})
    4959        if len(records) > 1:
    5060            # Can not happen, but anyway...
     
    5262        if len(records) == 0:
    5363            raise KeyError("No record for uid %s" % uid)
    54        
    5564        record = records[0]
    5665        record_data = {}
     
    6473   
    6574    meta_type = 'WAeUP Accommodation Tool'
    66    
     75    name = "accommodation"
     76    key = "bed"
    6777    def __init__(self):
    6878        WAeUPTable.__init__(self, 'portal_accommodation')
    69 
    70     def addRecord(self, **data):
    71         # The uid is the same as "bed".
    72         uid = data['bed']
    73         self.catalog_object(dict2ob(data), uid=uid)
    74         return uid
    7579
    7680
     
    8084   
    8185    meta_type = 'WAeUP Pin Tool'
    82    
     86    name = "pins"
     87    key = 'pin'
    8388    def __init__(self):
    8489        WAeUPTable.__init__(self, 'portal_pins')
    8590
    86     def addRecord(self, **data):
    87         # The uid is the same as "bed".
    88         uid = data['pin']
    89         self.catalog_object(dict2ob(data), uid=uid)
    90         return uid
    9191
     92    def searchAndSetRecord(self, uid, jamb_reg_no):
     93        #records = self.searchResults(uid=uid)
     94        records = self.searchResults({"%s" % self.key : uid})
     95        if len(records) > 1:
     96            # Can not happen, but anyway...
     97            raise ValueError("More than one record with uid %s" % uid)
     98        if len(records) == 0:
     99            return -1
     100        record = records[0]
     101        if record.student == "":
     102            record_data = {}
     103            for field in self.schema() + self.indexes():
     104                record_data[field] = getattr(record, field)
     105            # Add the updated data:
     106            record_data['student'] = jamb_reg_no
     107            self.catalog_object(dict2ob(record_data), uid)
     108            return 1
     109        if record.student != jamb_reg_no:
     110            return 0
     111        if record.student == jamb_reg_no:
     112            return 2
    92113
    93114InitializeClass(PinTable)
  • WAeUP_SRP/trunk/Widgets.py

    r488 r502  
    22
    33from cgi import escape
    4 
     4from types import *
    55from Globals import InitializeClass
    66##from Products.CPSSchemas.Widget import CPSWidgetType
     
    1313from DateTime.DateTime import DateTime
    1414from AccessControl import getSecurityManager
    15 
     15from Products.WAeUP_SRP.Students import getStudentByRegNo
    1616from re import compile
    1717
     
    211211###)
    212212
     213##def getStudentByRegNo(self,reg_no):
     214##    search = self.portal_catalog({'meta_type': 'StudentApplication',
     215##                                  'jamb_reg_no': reg_no,
     216##                                  })
     217##    if len(search) < 1:
     218##        return None
     219##    return search[0].getObject().
     220                   
    213221class JambRegNoWidget(CPSStringWidget): ###(
    214222    """ JambRegNo Widget"""
     
    232240                err = 'Invalid Registration Number in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)
    233241            else:
    234                 search = self.portal_catalog({'meta_type': 'StudentApplication',
    235                                               'jamb_reg_no': value,
    236                                               })
    237                 if len(search) < 1:
     242                s = getStudentByRegNo(self,value)
     243                if s is None:
    238244                    err = 'No JAMB data for %s' % (value)
    239245            if err:
     
    279285    reference = ''
    280286   
    281     def prepare(self, datastructure, **kw):
     287    def prepare(self, datastructure, **kw): ###(
    282288        """Prepare datastructure from datamodel."""
    283289        datamodel = datastructure.getDataModel()
    284290        v = datamodel[self.fields[0]]
    285291        widget_id = self.getWidgetId()
     292        if v and type(v) is StringType:
     293            p,b,n = v.split('-')
     294            v = ScratchCardPin(v,b,n)
    286295        if v:
    287296            b = '%s' % v.b
     
    293302        datastructure[widget_id+'_n'] = n
    294303       
     304###)
     305
    295306    def validate(self, datastructure, **kw):
    296307        """Validate datastructure and update datamodel."""
     
    298309        v = datastructure[widget_id]
    299310        err = 0
     311        p = self.prefix
    300312        b = datastructure[widget_id+'_b'].strip()
    301313        n = datastructure[widget_id+'_n'].strip()
    302314        #import pdb; pdb.set_trace()
    303         if not n in self.valid_pins:
    304             err = 'invalid Pin'
     315        pins = self.portal_pins
     316        pin = "%(p)s%(b)s%(n)s" % vars()
     317        ref = datastructure[self.reference]
     318        import pdb;pdb.set_trace()
     319        ok = pins.searchAndSetRecord(pin,ref)
     320        while 1:
     321            if ok == -1:
     322                err = 'invalid Pin'
     323                break
     324            if ok == 0:
     325                err = 'Pin already used'
     326                break
     327            if ok >= 1:
     328                student = getStudentByRegNo(self,ref)
     329                if student is None:
     330                    err = "Student not Found in validate SC"
     331                    break
     332                s_id = student.getId()
     333                if ok == 2:
     334                    break
     335            break
    305336        if err:
    306337            datastructure.setError(widget_id, err)
     
    311342            datastructure[widget_id+'_b'] = b
    312343            datastructure[widget_id+'_n'] = n
     344            datastructure['s_id'] = s_id
    313345        #import pdb;pdb.set_trace()
    314346        return not err
    315347
    316     def render(self, mode, datastructure, **kw):
     348    def render(self, mode, datastructure, **kw): ###(
    317349        """Render in mode from datastructure."""
    318350        render_method = 'widget_scratch_card_pin_render'
     
    327359        datamodel = datastructure.getDataModel()
    328360        v = datamodel[self.fields[0]]
     361        if v and type(v) is StringType:
     362            p,b,n = v.split('-')
     363            v = ScratchCardPin(v,b,n)
    329364        if v:
    330365            b = '%s' % v.b
     
    338373            datastructure[widget_id+'_n'] = n
    339374           
     375###)
     376
    340377
    341378        return meth(mode=mode,
  • WAeUP_SRP/trunk/exportimport.py

    r486 r502  
    1515
    1616# Zope3 component architecture
     17from zope.app import zapi
    1718from zope.component import adapts
    1819from zope.interface import implements
     
    3839NAME = 'waeup'
    3940
     41def importWAeUPTable(obj, parent_path, context, name):
     42    """ Import subobjects recursively.
     43    """
     44    importer = zapi.queryMultiAdapter((obj, context), IBody)
     45   
     46    path = '%s%s' % (parent_path, obj.getId().replace(' ', '_'))
     47    __traceback_info__ = path
     48    if importer:
     49        path = '%s%s' % (parent_path, name)
     50        filename = '%s%s' % (path, importer.suffix)
     51        body = context.readDataFile(filename)
     52        if body is not None:
     53            importer.filename = filename # for error reporting
     54            importer.body = body
     55
     56    if getattr(obj, 'objectValues', False):
     57        for sub in obj.objectValues():
     58            importObjects(sub, path+'/', context)
     59
    4060def exportWAeUP(context):
    4161    """Export our WAeUP tool configuration
     
    5676    pm.setLocalGroupRoles(site,['role:Authenticated',],'SectionReader')
    5777
    58     importObjects(site.portal_accommodation, '', context)
     78    importWAeUPTable(site.portal_accommodation, '', context,'accommodation')
     79    importWAeUPTable(site.portal_pins, '', context,'pins')
    5980   
    60 from Products.GenericSetup.ZCatalog.exportimport import ZCatalogXMLAdapter
     81from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter
     82#from Products.GenericSetup.ZCatalog.exportimport import ZCatalogXMLAdapter
    6183
    6284from interfaces import IWAeUPTable
    6385
    64 class WAeUPTableXMLAdapter(ZCatalogXMLAdapter):
    65    
     86class WAeUPTableXMLAdapter(CatalogToolXMLAdapter):
     87#class WAeUPTableXMLAdapter(ZCatalogXMLAdapter):
    6688    __used_for__ = IWAeUPTable
    67 
    6889    _LOGGER_ID = 'waeup_table'
    6990
    70     name = 'accommodation'
    71 
     91##    def _importNode(self, node):
     92##        """Import the object from the DOM node.
     93##        """
     94##        if self.environ.shouldPurge():
     95##            self._purgeProperties()
     96##            self._purgeObjects()
     97##            self._purgeIndexes()
     98##            self._purgeColumns()
     99##
     100##        self._logger.info('Catalog imported.')
    72101# This the XMLAdapter itself. It encodes the im- / export logic that is specific
    73102# to our tool. `im- / exportObjects` functions will find it thanks to the zope
  • WAeUP_SRP/trunk/interfaces.py

    r486 r502  
    2020    """Tables to store object relational data
    2121    """
    22 
     22       
    2323    def addRecord(**data):
    2424        """Adds a record, with the data expressed in the data mapping.
     
    3030        """Deletes the record specified by the uid"""
    3131   
     32    def searchAndSetRecord(self, **data):
     33        """
     34        searches a record and set a specific value if this is unset
     35        raises an error when not found.
     36        returns
     37        -1 if not found
     38        0 if already set by other
     39        1 if found and not set
     40        2 if found and set
     41        """
     42       
    3243    def modifyRecord(uid, **data):
    3344        """Modifies a record, with the data expressed in the data mapping.
  • WAeUP_SRP/trunk/profiles/default/accommodation.xml

    r486 r502  
    11<?xml version="1.0"?>
    2 <object name="portal_catalog" meta_type="CMF Catalog">
     2<object name="portal_accommodation" meta_type="CMF Catalog">
    33 <column value="bed"/>
    44 <column value="student"/>
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r486 r502  
    33 <property name="title"></property>
    44 <object name="accommodation" meta_type="CPS Layout"/>
    5  <object name="accopay" meta_type="CPS Layout"/>
    65 <object name="certificate" meta_type="CPS Layout"/>
    76 <object name="certificate_course" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/profiles/default/layouts/scratch_card_batch.xml

    r488 r502  
    3333  <property name="max_value">100000</property>
    3434 </widget>
    35  <widget name="prefix" meta_type="String Widget">
    36   <property name="title">Prefix</property>
    37   <property name="fields">
    38    <element value="prefix"/>
    39   </property>
    40   <property name="is_required">True</property>
    41   <property name="label">Prefix</property>
    42   <property name="label_edit">Prefix</property>
    43   <property name="readonly_layout_modes"/>
    44   <property name="hidden_layout_modes"/>
    45   <property name="hidden_readonly_layout_modes"/>
    46   <property name="display_width">3</property>
    47   <property name="size_max">3</property>
    48  </widget>
    49  <widget name="sold_by" meta_type="String Widget">
     35<widget name="prefix" meta_type="Select Widget">
     36 <property name="title">Prefix</property>
     37 <property name="fields">
     38  <element value="prefix"/>
     39 </property>
     40 <property name="label">Prefix</property>
     41 <property name="label_edit">Prefix</property>
     42 <property name="readonly_layout_modes"/>
     43 <property name="hidden_layout_modes"/>
     44 <property name="hidden_readonly_layout_modes"/>
     45 <property name="vocabulary">pin_prefixes</property>
     46</widget> <widget name="sold_by" meta_type="String Widget">
    5047  <property name="title">Sold by</property>
    5148  <property name="fields">
  • WAeUP_SRP/trunk/profiles/default/pins.xml

    r488 r502  
    11<?xml version="1.0"?>
    2 <object name="portal_catalog" meta_type="CMF Catalog">
     2<object name="portal_pins" meta_type="CMF Catalog">
    33 <column value="pin"/>
    44 <column value="student"/>
  • WAeUP_SRP/trunk/profiles/default/rolemap.xml

    r486 r502  
    22<rolemap>
    33  <roles>
     4    <role name="Student"/>
    45    <role name="SectionReader"/>
    56    <role name="SectionManager"/>
     
    78  <permissions>
    89    <permission name="List folder contents" acquire="True">
     10      <role name="Owner"/>
    911      <role name="SectionManager"/>
    1012      <role name="SectionReader"/>
     
    2628    </permission>
    2729    <permission name="List portal members" acquire="True">
    28       <role name="Member"/>
    2930      <role name="SectionManager"/>
    3031    </permission>
    3132    <permission name="Review portal content" acquire="True">
     33      <role name="Owner"/>
    3234      <role name="Reviewer"/>
    3335      <role name="SectionManager"/>
  • WAeUP_SRP/trunk/profiles/default/schemas/student_application.xml

    r486 r502  
    11<?xml version="1.0"?>
    22<object name="student_application" meta_type="CPS Schema">
    3  <field name="app_ac_batch_no" meta_type="CPS String Field"/>
    43 <field name="app_ac_date" meta_type="CPS DateTime Field"/>
    54 <field name="app_ac_pin" meta_type="CPS String Field">
    6   <property name="is_searchabletext">True</property>
     5  <property name="is_searchabletext">False</property>
    76 </field>
    8  <field name="app_ac_prefix" meta_type="CPS String Field"/>
    97 <field name="entry_mode" meta_type="CPS String Field"/>
    108 <field name="jamb_age" meta_type="CPS Int Field"/>
  • WAeUP_SRP/trunk/profiles/default/skins.xml

    r486 r502  
    99 <object name="waeup_academics" meta_type="Filesystem Directory View"
    1010    directory="WAeUP_SRP/skins/waeup_academics"/>
     11 <object name="waeup_pins" meta_type="Filesystem Directory View"
     12    directory="WAeUP_SRP/skins/waeup_pins"/>
    1113 <object name="waeup_student" meta_type="Filesystem Directory View"
    1214    directory="WAeUP_SRP/skins/waeup_student"/>
     
    1416  <layer name="waeup_custom" insert-after="custom"/>
    1517  <layer name="waeup_default" insert-after="waeup_custom"/>
     18  <layer name="waeup_pins" insert-after="waeup_custom"/>
    1619  <layer name="waeup_student" insert-after="waeup_custom"/>
    1720  <layer name="waeup_academics" insert-after="waeup_custom"/>
     
    2023  <layer name="waeup_custom" insert-after="custom"/>
    2124  <layer name="waeup_default" insert-after="waeup_custom"/>
     25  <layer name="waeup_pins" insert-after="waeup_custom"/>
    2226  <layer name="waeup_student" insert-after="waeup_custom"/>
    2327  <layer name="waeup_academics" insert-after="waeup_custom"/>
  • WAeUP_SRP/trunk/profiles/default/skins/waeup_pins.xml

    r501 r502  
    11<?xml version="1.0"?>
    2 <object name="waeup_student" meta_type="Folder">
     2<object name="waeup_pins" meta_type="Folder">
    33 <property name="title"></property>
    44</object>
  • WAeUP_SRP/trunk/skins/waeup_academics/academics_contents.pt

    r486 r502  
    4343  </div>
    4444    <span tal:omit-tag="" tal:condition="python:display_buttons or context.display_content()"
    45           tal:content="structure doc/render" />
     45          tal:content="structure python: doc.render(proxy=here,layout_mode='view')" />
    4646
    4747  <form action="" method="post" class="group"
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.pt

    r486 r502  
    3838                   dum_home mtool/createMemberArea"
    3939                   >
    40           <span tal:condition="nothing"
     40          <span tal:condition="python:1"
    4141              tal:define="dummy python: context.process_waeup_login(member=member,sc_pin=request.get('sc_pin',None))" />
    4242          <tal:block condition="first_time">
  • WAeUP_SRP/trunk/skins/waeup_default/process_waeup_login.py

    r472 r502  
    77request = context.REQUEST
    88response=request.response
    9 return
    10 ##
    11 ##if request.form.get('submit') == 'Login':
    12 ##    #waeup = context.portal_catalog(id = 'demouni')[0]
    13 ##    #waeup = context.portal_catalog(portal_type = 'University')[0]
    14 ##    if 1 or "Manager" in member.getRoles():
    15 ##        return
    16 ###return
    17 ##member_id = str(member)
     9import DateTime
     10current = DateTime.DateTime()
     11#
     12if request.form.get('submit') == 'Login':
     13    if "Manager" in member.getRoles():
     14        return
     15member_id = str(member)
     16student = getattr(context.students,member_id)
     17application = student.application
     18#student.invokeFactory('StudentPersonal','personal')
     19apdoc = application.getContent()
     20names = apdoc.jamb_lastname.split()
     21dp = {}
     22if len(names) == 3:
     23    dp['firstname'] = names[0].capitalize()
     24    dp['middlename'] = names[1].capitalize()
     25    dp['lastname'] = names[2].capitalize()
     26elif len(names) == 2:
     27    dp['firstname'] = names[0].capitalize()
     28    dp['lastname'] = names[1].capitalize()
     29else:
     30    dp['lastname'] = apdoc.jamb_lastname
     31    dp['sex'] = apdoc.jamb_sex == 'F'
     32    dp['lga'] = "%s/%s" % (apdoc.jamb_state,apdoc.jamb_lga )
     33student.personal.getContent().edit(mapping = dp)
     34##student.content_status_modify(workflow_action="enter_application_pin")
     35
     36da = {}
     37da['app_ac_pin'] = request.get('pin')
     38da['app_ac_date'] = current
     39apdoc.edit(mapping = da)
     40
     41return response.redirect("%s/application_form" % student.application.absolute_url())
     42
    1843##ma = getattr(context,member_id)
    1944##jkw = {'application_sc_pin': sc_pin}
     
    5378##context.notifyCPSDocumentCreation(ob=pd)
    5479##
    55 ##return response.redirect("%s" % ma.absolute_url())
    5680###return ma.personal_addon(REQUEST=context.REQUEST)
    5781
  • WAeUP_SRP/trunk/skins/waeup_pins/scratch_card_batch_create_do.py

    r501 r502  
    3333ob.getContent().edit(mapping=datamodel)
    3434
    35 context.notifyCPSDocumentCreation(ob=ob) # BBB obsolete in CPS 3.5.0
     35#context.notifyCPSDocumentCreation(ob=ob) # BBB obsolete in CPS 3.5.0
    3636
    3737return ob
  • WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py

    r488 r502  
    77import DateTime
    88current = DateTime.DateTime()
     9pr = context.portal_registration
    910
    1011
     
    2526                      layout_mode='create',
    2627                      formaction = "apply_admission",
    27                       submit = "check",
     28                      button = "Open JAMB Record",
    2829                      )
    2930if psm == 'invalid':
     
    4344                                 )
    4445elif psm == 'valid':
    45     jamb_id = ds.get('jamb_reg_no')
    46     student = context.getContent().getStudentByRegNo(jamb_id)
    47     if student is None:
    48         psm = "JAMB record %s not accessible." % (jamb_id)
    49         return context.application_pin_form(rendered = res,
    50                                  psm = psm,
    51                                  #psm = "%s, %s" % (psm,ds),
    52                                  ds = ds,
    53                                  )
    54 application = student.application
    55 if context.portal_workflow.getInfoFor(student,'review_state',None) == "created":
    56     #student.invokeFactory('StudentClearance','clearance')
    57     student.invokeFactory('StudentPersonal','personal')
    58     student.content_status_modify(workflow_action="enter_application_pin")
     46    s_id = ds.get('s_id')
     47    return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s"
     48          % (context.absolute_url(),s_id,'uNsEt',ds.get('app_ac_pin')))
     49   
     50##    jamb_id = ds.get('jamb_reg_no')
     51##    student = context.getContent().getStudentByRegNo(jamb_id)
     52##    if student is None:
     53##        psm = "JAMB record %s not accessible." % (jamb_id)
     54##        return context.application_pin_form(rendered = res,
     55##                                 psm = psm,
     56##                                 #psm = "%s, %s" % (psm,ds),
     57##                                 ds = ds,
     58##                                 )
     59##if context.portal_workflow.getInfoFor(student,'review_state',None) == "created":
     60##    #student.invokeFactory('StudentClearance','clearance')
     61##da = {}
     62##pin = str(ds.get('app_ac_pin'))
     63##da['app_ac_pin'] = pin
     64##da['app_ac_date'] = current
     65##apdoc.edit(mapping = da)
    5966
    6067
    61 apdoc = application.getContent()
    62 names = apdoc.jamb_lastname.split()
    63 dp = {}
    64 if len(names) == 3:
    65     dp['firstname'] = names[0].capitalize()
    66     dp['middlename'] = names[1].capitalize()
    67     dp['lastname'] = names[2].capitalize()
    68 elif len(names) == 2:
    69     dp['firstname'] = names[0].capitalize()
    70     dp['lastname'] = names[1].capitalize()
    71 else:
    72     dp['lastname'] = apdoc.jamb_lastname
    73 dp['sex'] = apdoc.jamb_sex == 'F'
    74 dp['lga'] = "%s/%s" % (apdoc.jamb_state,apdoc.jamb_lga )
    75 student.personal.getContent().edit(mapping = dp)
    76 da = {}
    77 da['app_ac_pin'] = ds.get('app_ac_pin')
    78 da['app_ac_date'] = current
    79 apdoc.edit(mapping = da)
    8068# now display the passport form with jamb-data readonly
    8169return context.REQUEST.RESPONSE.redirect("%s/application_form" % (student.application.absolute_url()))
  • WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt

    r493 r502  
    8181         class="standalone"
    8282         name="cpsdocument_create_button"
    83          value="apply"
    84          i18n:attributes="value" tal:condition="creation" />
     83         value="apply"
     84         tal:attributes="value options/button"
     85         tal:condition="creation" />
    8586
    8687</form>
    87 
    88                          
    8988</metal:block>
    9089
Note: See TracChangeset for help on using the changeset viewer.