Changeset 1415


Ignore:
Timestamp:
14 Feb 2007, 12:54:55 (18 years ago)
Author:
joachim
Message:

added new Function add_student

Location:
WAeUP_SRP/trunk
Files:
6 added
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1411 r1415  
    7272            sid = "%c%d" % (letter,r.randint(99999,1000000))
    7373        return sid
     74
     75    def generatePassword(self,s=None): ###(
     76        import random
     77        r = random
     78        ##if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'):
     79        if s is None:
     80            s = 'abcdefghklmnpqrstuvwxy23456789'
     81        pw = ''
     82        while len(pw) < 6:
     83            pw += r.choice(s)
     84        return pw
    7485    ###)
    7586
     
    133144            transaction.commit()
    134145        return sid,jamb_reg_no
     146    ###)
     147
     148    security.declareProtected(ModifyPortalContent,'createStudent') ###(
     149    def createStudent(self,dict):
     150        students_folder = self.portal_url.getPortalObject().campus.students
     151        sid = self.waeup_tool.generateStudentId('?')
     152        students_folder.invokeFactory('Student', sid)
     153        student_obj = getattr(students_folder,sid)
     154        password = self.generatePassword()
     155        self.makeStudentMember(sid,password)
     156        status,entry_mode = dict.get('entry_mode').split('_')
     157        wfaction = 'return'
     158        if status == "NEW":
     159            wfaction = 'admit'
     160        matric_no = dict.get('matric_no')
     161        email = dict.get('email')
     162        level = dict.get('level')
     163        study_course = dict.get('study_course')
     164        self.portal_workflow.doActionFor(student_obj,wfaction)
     165        student_obj.manage_setLocalRoles(sid, ['Owner',])
     166        student_obj.invokeFactory('StudentApplication','application')
     167        application = student_obj.application
     168        self.portal_workflow.doActionFor(application,'open',dest_container=application)
     169        da = {'Title': 'Application Data'}
     170        student_obj.invokeFactory('StudentPersonal','personal')
     171        da['entry_mode'] = entry_mode
     172        personal = student_obj.personal
     173        self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
     174        dp = {'Title': 'Personal Data'}
     175        student_obj.invokeFactory('StudentClearance','clearance')
     176        clearance = student_obj.clearance
     177        self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
     178        dc = {'Title': 'Clearance/Eligibility Record'}
     179        dc['matric_no'] = matric_no
     180        da['app_email'] = dp['email'] = email
     181        dp['firstname'] = dict.get('firstname')
     182        dp['middlename'] = dict.get('middlename')
     183        dp['lastname'] = dict.get('lastname')
     184        da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict
     185        sex = dict.get('sex')
     186        if sex:
     187            da['jamb_sex'] = 'F'
     188        else:
     189            da['jamb_sex'] = 'M'
     190        dp['sex'] = sex
     191        application.getContent().edit(mapping=da)
     192        self.portal_workflow.doActionFor(application,'close',dest_container=application)
     193        personal.getContent().edit(mapping=dp)
     194        clearance.getContent().edit(mapping=dc)
     195        self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
     196        catd = {}
     197        catd['id'] = sid
     198        catd['entry_mode']= entry_mode
     199        catd['email'] = email
     200        catd['matric_no'] = matric_no
     201        catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp
     202        catd['sex'] = dp['sex']
     203        catd['level'] = level
     204        certificate_brain = self.getCertificateBrain(study_course)
     205        if certificate_brain:
     206            cpath = certificate_brain.getPath().split('/')
     207            catd['faculty'] = cpath[-4]
     208            catd['department'] = cpath[-3]
     209            catd['course'] = study_course
     210        self.students_catalog.addRecord(**catd)
     211        #
     212        # Study Course
     213        #
     214        student_obj.invokeFactory('StudentStudyCourse','study_course')
     215        sc = student_obj.study_course
     216        self.portal_workflow.doActionFor(sc,'open',dest_container=sc)
     217        dsc = {}
     218        dsc['study_course'] = study_course
     219        dsc['current_level'] = level
     220        sc.getContent().edit(mapping=dsc)
     221
     222        return sid,password
    135223    ###)
    136224
     
    206294            em = 'Certificate %s org-code %s not found\n' % (certcode, certcode_org)
    207295            logger.info(em)
    208 ##        validlevel = False
    209 ##        try:
    210 ##            il = int(level) + 100
    211 ##            level = "%s" % il
    212 ##            validlevel = True
    213 ##        except:
    214 ##            em = '"%(matric_no)s","invalid Level","%(Level)s"' % student
    215 ##            logger.info(em)
    216 ##        if not validlevel:
    217 ##            erg = self.results_import(matric_no = student.matric_no)
    218 ##            level = 'xxx'
    219 ##            if erg:
    220 ##                level = erg[0].Level
    221 ##            try:
    222 ##                il = int(level) + 100
    223 ##                level = "%s" % il
    224 ##                em = '"%s","fixed Level from results_import","%s"' % (student.matric_no,erg[0].Level)
    225 ##                logger.info(em)
    226 ##                validlevel = True
    227 ##            except:
    228 ##                em = '"%s","invalid Level in results_import","%s"' % (student.matric_no,erg[0].Level)
    229 ##                logger.info(em)
    230296        matric_no = student.matric_no
    231297        sid = student_id
  • WAeUP_SRP/trunk/doc/srp_documentation.mm

    r1412 r1415  
    22<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
    33<node CREATED="1170079518946" ID="Freemind_Link_650524897" MODIFIED="1170079543007" TEXT="WAeUP Documentation">
    4 <node CREATED="1170079578051" ID="_" MODIFIED="1170079619012" POSITION="right" TEXT="Student Registration Portal">
    5 <node CREATED="1170079621592" ID="Freemind_Link_1297017754" MODIFIED="1170079640872" TEXT="Campus">
    6 <node CREATED="1170079643589" ID="Freemind_Link_1231068129" MODIFIED="1170080364243" TEXT="Academics">
    7 <node CREATED="1170080366716" ID="Freemind_Link_415048819" MODIFIED="1170082092260" TEXT="n * Faculty">
     4<node CREATED="1170079621592" ID="Freemind_Link_1297017754" MODIFIED="1170079640872" POSITION="right" TEXT="Campus">
     5<node CREATED="1170079643589" FOLDED="true" ID="Freemind_Link_1231068129" MODIFIED="1170080364243" TEXT="Academics">
     6<node CREATED="1170080366716" FOLDED="true" ID="Freemind_Link_415048819" MODIFIED="1170082092260" TEXT="n * Faculty">
    87<node CREATED="1171114205479" ID="Freemind_Link_777914383" LINK="../profiles/default/types/Faculty.xml" MODIFIED="1171114273018" TEXT="Type: Faculty"/>
    98<node CREATED="1171124926993" ID="Freemind_Link_1995598127" LINK="../profiles/default/schemas/faculty.xml" MODIFIED="1171124974083" TEXT="Schema: faculty"/>
     
    3534</node>
    3635<node CREATED="1170082138244" FOLDED="true" ID="Freemind_Link_1354366927" MODIFIED="1170082146391" TEXT="Students">
    37 <node CREATED="1170082147831" ID="Freemind_Link_115332414" MODIFIED="1170082160733" TEXT="n * Student">
     36<node CREATED="1170082147831" FOLDED="true" ID="Freemind_Link_115332414" MODIFIED="1170082160733" TEXT="n * Student">
    3837<node CREATED="1171114205479" ID="Freemind_Link_1051911128" LINK="../profiles/default/types/Student.xml" MODIFIED="1171353141707" TEXT="Type: Student"/>
    3938<node CREATED="1171124926993" ID="Freemind_Link_1838352082" LINK="../profiles/default/schemas/student.xml" MODIFIED="1171353152905" TEXT="Schema: student"/>
     
    7372</node>
    7473<node CREATED="1171014603296" ID="Freemind_Link_592162547" MODIFIED="1171014611096" TEXT="Imports"/>
     74<node CREATED="1171379675232" FOLDED="true" ID="Freemind_Link_41196870" MODIFIED="1171379685192" TEXT="Userinterface">
     75<node CREATED="1171379691280" FOLDED="true" ID="Freemind_Link_24219" MODIFIED="1171379703554" TEXT="Officers">
     76<node CREATED="1171379710053" FOLDED="true" ID="Freemind_Link_1668598079" MODIFIED="1171379734695" TEXT="add_student">
     77<node CREATED="1171379737777" ID="Freemind_Link_490783588" MODIFIED="1171379757546" TEXT="Script: add_student"/>
     78<node CREATED="1171362924343" ID="Freemind_Link_1507034557" LINK="../skins/waeup_accommodation/student_create_form.pt" MODIFIED="1171382378983" TEXT="PT: student_create_form"/>
     79<node CREATED="1171379759850" ID="Freemind_Link_435667013" LINK="../profiles/default/schemas/student_create.xml" MODIFIED="1171380077013" TEXT="Schema: student_create"/>
     80<node CREATED="1171015856280" ID="Freemind_Link_976681849" LINK="../profiles/default/layouts/student_create.xml" MODIFIED="1171382310446" TEXT="Layout: student_create"/>
    7581</node>
    76 <node CREATED="1170082502675" ID="Freemind_Link_1051871348" MODIFIED="1170082511430" TEXT="Accommodation">
     82</node>
     83</node>
     84</node>
     85<node CREATED="1170082502675" FOLDED="true" ID="Freemind_Link_1051871348" MODIFIED="1170082511430" TEXT="Accommodation">
    7786<node CREATED="1171114205479" ID="Freemind_Link_685193459" LINK="../profiles/default/types/AccoFolder.xml" MODIFIED="1171360542032" TEXT="Type: AccoFolder"/>
    78 <node CREATED="1170082513362" ID="Freemind_Link_579142716" MODIFIED="1170082530016" TEXT="n * Hall">
     87<node CREATED="1170082513362" FOLDED="true" ID="Freemind_Link_579142716" MODIFIED="1170082530016" TEXT="n * Hall">
    7988<node CREATED="1171114205479" ID="Freemind_Link_913388948" LINK="../profiles/default/types/AccoHall.xml" MODIFIED="1171360892599" TEXT="Type: AccoHall"/>
    8089<node CREATED="1171124926993" ID="Freemind_Link_108322260" LINK="../profiles/default/schemas/acco_hall.xml" MODIFIED="1171361085015" TEXT="Schema: acco_hall"/>
     
    8998</node>
    9099</node>
     100<node CREATED="1171381167605" FOLDED="true" ID="Freemind_Link_370176221" MODIFIED="1171381186185" TEXT="User Interface">
     101<node CREATED="1171381191363" ID="Freemind_Link_1384539281" MODIFIED="1171381247729" TEXT="Student">
     102<node CREATED="1171362489012" FOLDED="true" ID="Freemind_Link_875925244" MODIFIED="1171376833636" TEXT="reserve_accommodation">
     103<node CREATED="1171362515581" ID="Freemind_Link_1380319587" LINK="../skins/waeup_accommodation/reserve_accommodation.py" MODIFIED="1171376963675" TEXT="Script: reserve_accommodation"/>
     104<node CREATED="1171362924343" ID="Freemind_Link_1031270994" LINK="../skins/waeup_accommodation/accommodation_pin_edit_form.pt" MODIFIED="1171377530623" TEXT="PT: accommodation_pin_edit_form"/>
     105<node CREATED="1171124926993" ID="Freemind_Link_59643823" LINK="../profiles/default/schemas/student_accommodation.xml" MODIFIED="1171377094450" TEXT="Schema: student_accommodation"/>
     106<node CREATED="1171124982312" ID="Freemind_Link_1633331359" LINK="../profiles/default/layouts/student_accommodation_fe.xml" MODIFIED="1171377120846" TEXT="Layout: student_accommodation_fe"/>
    91107</node>
    92 <node CREATED="1170082542534" ID="Freemind_Link_243354429" MODIFIED="1170082550976" TEXT="Pins">
     108</node>
     109<node CREATED="1171381259796" ID="Freemind_Link_43065296" MODIFIED="1171381265497" TEXT="Officer"/>
     110</node>
     111</node>
     112<node CREATED="1170082542534" FOLDED="true" ID="Freemind_Link_243354429" MODIFIED="1170082550976" TEXT="Pins">
    93113<node CREATED="1170082553111" ID="Freemind_Link_1225342224" MODIFIED="1170082566118" TEXT="n * Batch"/>
    94114</node>
    95 <node CREATED="1170931308473" ID="Freemind_Link_249696543" MODIFIED="1170931315740" TEXT="Catalogs">
     115<node CREATED="1170931308473" FOLDED="true" ID="Freemind_Link_249696543" MODIFIED="1170931315740" TEXT="Catalogs">
    96116<node CREATED="1170931319920" ID="Freemind_Link_1633117071" MODIFIED="1170931337246" TEXT="portal_catalog"/>
    97117<node CREATED="1170931338501" ID="Freemind_Link_80471593" LINK="../profiles/default/students_catalog.xml" MODIFIED="1170959145493" TEXT="students_catalog"/>
     
    99119</node>
    100120</node>
    101 </node>
    102121</map>
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r1393 r1415  
    1616 <object name="scratch_card_batch" meta_type="CPS Layout"/>
    1717 <object name="scratch_card_search" meta_type="CPS Layout"/>
    18  <object name="student_study_course" meta_type="CPS Layout"/>
    1918 <object name="student_accommodation" meta_type="CPS Layout"/>
    2019 <object name="student_accommodation_fe" meta_type="CPS Layout"/>
     
    2625 <object name="student_clearance_fe" meta_type="CPS Layout"/>
    2726 <object name="student_course_result" meta_type="CPS Layout"/>
     27 <object name="student_create" meta_type="CPS Layout"/>
    2828 <object name="student_personal" meta_type="CPS Layout"/>
    2929 <object name="student_personal_fe" meta_type="CPS Layout"/>
     
    3434 <object name="student_search" meta_type="CPS Layout"/>
    3535 <object name="student_study_level" meta_type="CPS Layout"/>
     36 <object name="student_study_course" meta_type="CPS Layout"/>
    3637 <object name="student_transfer" meta_type="CPS Layout"/>
    3738 <object name="study_level" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/profiles/default/layouts/certificate.xml

    r1404 r1415  
    11<?xml version="1.0"?>
    2 <?xml-stylesheet type="text/xsl" href="types.xsl"?>
     2<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
    33<object name="certificate" meta_type="CPS Layout">
    44 <property name="layout_create_method"></property>
  • WAeUP_SRP/trunk/profiles/default/layouts/student_application.xml

    r1137 r1415  
    11<?xml version="1.0"?>
     2<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
    23<object name="student_application" meta_type="CPS Layout">
    34 <property name="layout_create_method"></property>
  • WAeUP_SRP/trunk/profiles/default/schemas.xml

    r1393 r1415  
    1515 <object name="student" meta_type="CPS Schema"/>
    1616 <object name="scratch_card_batch" meta_type="CPS Schema"/>
    17  <object name="student_course_result" meta_type="CPS Schema"/>
    1817 <object name="student_accommodation" meta_type="CPS Schema"/>
    1918 <object name="student_application" meta_type="CPS Schema"/>
    2019 <object name="student_clearance" meta_type="CPS Schema"/>
     20 <object name="student_course_result" meta_type="CPS Schema"/>
     21 <object name="student_create" meta_type="CPS Schema"/>
    2122 <object name="student_personal" meta_type="CPS Schema"/>
    2223 <object name="student_pume" meta_type="CPS Schema"/>
  • WAeUP_SRP/trunk/profiles/default/vocabularies.xml

    r1393 r1415  
    55 <object name="acco_hall_reserved_rooms" meta_type="CPS Method Vocabulary"/>
    66 <object name="courselevel" meta_type="CPS Vocabulary"/>
     7 <object name="entry_modes" meta_type="CPS Vocabulary"/>
    78 <object name="exam_subjects" meta_type="CPS Vocabulary"/>
    89 <object name="exam_types" meta_type="CPS Vocabulary"/>
  • WAeUP_SRP/trunk/skins/waeup_student/getFormattedStudentEntry.py

    r1315 r1415  
    1616d = {}
    1717for f in fields:
    18     d[f] = getattr(brain,f,'--')
     18    d[f] = getattr(brain,f,'')
    1919    if f == "sex":
    2020        if d[f]:
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentReviewState.py

    r1161 r1415  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=student=None, with_items=None
     7##parameters=
    88##title=
    99##
     
    1212return Info about the current Student
    1313"""
     14try:
     15    from Products.AdvancedQuery import Eq, Between, Le,In
     16    evalAQ = context.portal_catalog.evalAdvancedQuery
     17except:
     18    evalAdvancedQuery = None
    1419student_id = context.getStudentId()
    15 res = context.portal_catalog(id = student_id,portal_type='Student')
     20#res = context.portal_catalog(id = student_id,portal_type='Student')
     21query = Eq('id',student_id)
     22res = evalAQ(query)
    1623if not res:# or len(res) > 1:
    1724    return None
Note: See TracChangeset for help on using the changeset viewer.