Changeset 361
- Timestamp:
- 30 Jul 2006, 06:12:00 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Academics.py
r351 r361 22 22 p_home = Globals.package_home(globals()) 23 23 i_home = Globals.INSTANCE_HOME 24 25 def makeCertificateCode(code): 26 code = code.replace('.','') 27 code = code.replace('(','') 28 code = code.replace(')','') 29 code = code.replace('/','') 30 code = code.replace(' ','') 31 code = code.replace('_','') 32 return code 24 33 25 34 class AcademicsFolder(CPSDocument): ###( … … 272 281 dep = deps[depid] 273 282 certificates = dep.certificates 274 code = certificate.get('CertCode') 275 code = code.replace('.','') 276 code = code.replace('(','') 277 code = code.replace(')','') 278 code = code.replace('/','') 279 code = code.replace(' ','') 280 code = code.replace('_','') 283 code = makeCertificateCode(certificate.get('CertCode')) 281 284 certificate_id = code 282 285 c = getattr(certificates,certificate_id,None) -
WAeUP_SRP/trunk/Students.py
r200 r361 13 13 from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder 14 14 from Products.CPSCore.CPSMembershipTool import CPSUnrestrictedUser 15 ##class StudentsFolder(BaseBTreeFolder): ###( 16 ## """ 17 ## WAeUP container for the various WAeUP containers data 18 ## """ 19 ## meta_type = 'Students Folder' 20 ## portal_type = meta_type 21 ## security = ClassSecurityInfo() 22 ## 23 ## 24 ##InitializeClass(StudentsFolder) 25 26 ##def addStudentsFolder(container, id, REQUEST=None, **kw): 27 ## """Add a Student.""" 28 ## ob = StudentsFolder(id, **kw) 29 ## return CPSBase_adder(container, ob, REQUEST=REQUEST) 30 #####) 15 from Products.WAeUP_SRP.Academics import makeCertificateCode 16 17 class StudentsFolder(CPSDocument): ###( 18 """ 19 WAeUP container for the various WAeUP containers data 20 """ 21 meta_type = 'Students Folder' 22 portal_type = meta_type 23 security = ClassSecurityInfo() 24 25 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsFromCSV")###( 26 def loadFullTimeStudentsFromCSV(self): 27 """load Fulltime Studentdata from CSV values""" 28 #return 29 name = 'short_full_time' 30 no_import = False 31 logger = logging.getLogger('%s_import' % name) 32 logger.info('Start loading from %s.csv' % name) 33 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 34 try: 35 students = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 36 except: 37 logger.error('Error reading %s.csv' % name) 38 return 39 l = self.portal_catalog({'meta_type': "Student"}) 40 studs = {} 41 for s in l: 42 studs[s.id] = s.getObject() 43 l = self.portal_catalog({'meta_type': "Certificate"}) 44 certs = {} 45 for c in l: 46 certs[s.id] = c.getObject() 47 for student in students: 48 logger.info('processing "%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"' % student) 49 sid = student.get('MatricNo') 50 certcode = makeCertificateCode(student.get('CourseMajor')) 51 s = studs.get(sid,None) 52 if certcode not in certs.keys(): 53 em = 'Certificate with ID %s %s not found' % (certcode, student.get('CourseMajor')) 54 if not no_import: 55 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 56 no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n') 57 logger.info(em) 58 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"' % student) 59 continue 60 if s is None: 61 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 62 logger.info('Creating Student with ID %(MatricNo)s %(fullname)s' % faculty) 63 students_folder.invokeFactory('Student', sid) 64 s = getattr(self,sid) 65 s.invokeFactory('StudentPersonal','personal') 66 sp = getattr(self,sid) 67 d = {'Title': 'Personal Data'} 68 d['fullname'] = student.get('fullname') 69 d['firstname'] = student.get('FirstName') 70 d['middlename'] = student.get('MiddleName') 71 d['lastname'] = student.get('LastName') 72 d['former_surname'] = student.get('FormerSurname') 73 d['sex'] = student.get('Sex') == 'M' 74 d['nationality'] = student.get('Nationality') 75 d['state'] = student.get('State') 76 d['lga'] = student.get('LGA') 77 d['street'] = student.get('PermanentAddress') 78 d['city'] = student.get('PermanentAddressCity') 79 d['campus_address'] = student.get('CampusAddress') 80 d['phone'] = student.get('PhoneNumber') 81 d['email'] = student.get('EmailAddress') 82 f.getContent().edit(mapping=d) 83 else: 84 em = 'Faculty with ID %(MatricNo)s %(fullname)s already exists' % student 85 if not no_import: 86 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 87 no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n') 88 logger.info(em) 89 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"' % student) 90 return self.students.folder_contents() 91 ###) 92 93 InitializeClass(StudentsFolder) 94 95 def addStudentsFolder(container, id, REQUEST=None, **kw): 96 """Add a Student.""" 97 ob = StudentsFolder(id, **kw) 98 return CPSBase_adder(container, ob, REQUEST=REQUEST) 99 ###) 31 100 32 101 class Student(CPSDocument): ###( -
WAeUP_SRP/trunk/__init__.py
r279 r361 26 26 from Products.WAeUP_SRP.Academics import CourseTicket, addCourseTicket 27 27 from Products.WAeUP_SRP.Academics import CertificateCourse, addCertificateCourse 28 from Products.WAeUP_SRP.Students import StudentsFolder, addStudentsFolder 28 29 from Products.WAeUP_SRP.Students import Student, addStudent 29 30 from Products.WAeUP_SRP.Students import StudentPersonal, addStudentPersonal … … 49 50 AccoFolder, 50 51 Accommodation, 52 StudentsFolder, 51 53 Student, 52 54 StudentPersonal, … … 70 72 addAccoFolder, 71 73 addAccommodation, 74 addStudentsFolder, 72 75 addStudent, 73 76 addStudentPersonal, … … 91 94 {}, # AccoFolder 92 95 {}, # Accommodation 96 {}, # StudentsFolder, 93 97 {}, # Student, 94 98 {}, # StudentPersonal, -
WAeUP_SRP/trunk/profiles/default/schemas.xml
r296 r361 17 17 <object name="student_admission" meta_type="CPS Schema"/> 18 18 <object name="student_clearance" meta_type="CPS Schema"/> 19 <object name="student_clearence" meta_type="CPS Schema"/>20 19 <object name="student_documents" meta_type="CPS Schema"/> 21 20 <object name="student_eligibility" meta_type="CPS Schema"/> -
WAeUP_SRP/trunk/profiles/default/schemas/student_personal.xml
r199 r361 1 1 <?xml version="1.0"?> 2 2 <object name="student_personal" meta_type="CPS Schema"> 3 <field name="age" meta_type="CPS DateTime Field"/>4 3 <field name="birthday" meta_type="CPS DateTime Field"/> 4 <field name="campus_address" meta_type="CPS String Field"/> 5 <field name="city" meta_type="CPS String Field"/> 5 6 <field name="email" meta_type="CPS String Field"> 6 7 <property name="is_searchabletext">True</property> 7 8 </field> 9 <field name="entry_reg_no" meta_type="CPS String Field"/> 8 10 <field name="firstname" meta_type="CPS String Field"> 9 11 <property name="is_searchabletext">True</property> 10 12 </field> 13 <field name="former_surname" meta_type="CPS String Field"> 14 <property name="is_searchabletext">True</property> 15 </field> 16 <field name="fullname" meta_type="CPS String Field"/> 11 17 <field name="lastname" meta_type="CPS String Field"> 12 18 <property name="is_searchabletext">True</property> 13 19 </field> 20 <field name="lga" meta_type="CPS String Field"/> 21 <field name="matricel_nr" meta_type="CPS String Field"/> 14 22 <field name="middlename" meta_type="CPS String Field"> 15 23 <property name="is_searchabletext">True</property> 16 24 </field> 25 <field name="nationality" meta_type="CPS String Field"/> 26 <field name="phone" meta_type="CPS Boolean Field"/> 17 27 <field name="sex" meta_type="CPS Boolean Field"/> 18 <field name="username" meta_type="CPS String Field"> 28 <field name="state" meta_type="CPS String Field"/> 29 <field name="street" meta_type="CPS String Field"> 19 30 <property name="is_searchabletext">True</property> 20 31 </field> -
WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml
r332 r361 41 41 <action title="Add JAMB Data" action_id="add_jamb" category="object" 42 42 condition_expr="" url_expr="string:${object/absolute_url}/create_jamb" 43 visible="True"> 44 <permission value="University Manage"/> 45 </action> 43 visible="True"/> 46 44 <action title="Check Admission Status" action_id="check_admission" 47 45 category="object" … … 68 66 <action title="action_folder_contents" action_id="contents" category="object" 69 67 condition_expr="" url_expr="string:${object/absolute_url}/folder_contents" 70 visible="False"> 71 <permission value="University Manage"/> 72 </action> 68 visible="False"/> 69 <action title="import fulltime students" action_id="import_fulltime" 70 category="import" condition_expr="" 71 url_expr="string:${object_url}/loadFullTimeStudentsFromCSV" 72 visible="True"/> 73 73 </object> -
WAeUP_SRP/trunk/skins/waeup_custom/getCPSCandidateLocalRoles.py
r350 r361 18 18 mtool = getToolByName(context, 'portal_membership') 19 19 #return mtool.getCPSCandidateLocalRoles(context) 20 return [' SectionReader','SectionManager']20 return ['Manager','SectionReader','SectionManager'] -
WAeUP_SRP/trunk/skins/waeup_custom/getContentInfo.py
r306 r361 200 200 info['type_l10n'] = cpsmcat(proxy.getTypeInfo().Title()) 201 201 else: 202 LOG("getContentInfo() pb getting Type Information",203 DEBUG,204 'Proxy :',205 proxy)202 ## LOG("getContentInfo() pb getting Type Information", 203 ## DEBUG, 204 ## 'Proxy :', 205 ## proxy) 206 206 info['type_l10n'] = '' 207 207 info['review_state'] = wtool.getInfoFor(proxy, 'review_state', '')
Note: See TracChangeset for help on using the changeset viewer.