- Timestamp:
- 31 Aug 2006, 10:37:54 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Academics.py
r440 r454 456 456 ###) 457 457 458 class StudyLevel(CPSDocument): ###( 459 """ 460 WAeUP StudyLevel containing the courses and students 461 """ 462 meta_type = 'StudyLevel' 463 portal_type = meta_type 464 security = ClassSecurityInfo() 465 466 security.declareProtected(View,"Title") 467 def Title(self): 468 """compose title""" 469 return "Level %s" % self.aq_parent.getId() 470 471 472 InitializeClass(StudyLevel) 473 474 def addStudyLevel(container, id, REQUEST=None, **kw): 475 """Add a StudyLevel.""" 476 ob = StudyLevel(id, **kw) 477 return CPSBase_adder(container, ob, REQUEST=REQUEST) 478 479 ###) 480 458 481 class CertificateCourse(CPSDocument): ###( 459 482 """ … … 476 499 """compose title""" 477 500 ce = self.getCourseEntry(self.id.upper()) 501 #print self.id, self.aq_parent.id 478 502 if ce: 479 503 return "%s" % ce.Title … … 610 634 ###) 611 635 612 class CourseTicket(CPSDocument): ###( 613 """ 614 WAeUP CourseTicket 615 """ 616 meta_type = 'CourseTicket' 617 portal_type = meta_type 618 security = ClassSecurityInfo() 619 def getCourseEntry(self,cid): 620 res = self.portal_catalog({'meta_type': "Course", 621 'id': cid}) 622 if res: 623 return res[-1] 624 else: 625 return None 626 627 security.declareProtected(View,"Title") 628 def Title(self): 629 """compose title""" 630 ce = self.getCourseEntry(self.id.upper()) 631 if ce: 632 return "%s" % ce.Title 633 return "No such course" 634 635 InitializeClass(CourseTicket) 636 637 def addCourseTicket(container, id, REQUEST=None, **kw): 638 """Add a CourseTicket.""" 639 ob = CourseTicket(id, **kw) 640 return CPSBase_adder(container, ob, REQUEST=REQUEST) 641 ###) 642 636 -
WAeUP_SRP/trunk/Students.py
r453 r454 112 112 dc = {'Title': 'Clearance Data'} 113 113 dc['matric_no'] = matric_no 114 lga = student.get('State') + ' / ' + student.get('LGA') 114 lga = student.get('State') + ' / ' + student.get('LGA') 115 115 dc['lga'] = lga 116 116 dc['nationality'] = student.get('Nationality') 117 117 dc['email'] = student.get('Emailaddress') 118 css = student.get('CurrentSession') or '2004-2005'119 cs = int(css.split('-')[0]) - 2000120 cl = int(student.get('StudentLevel'))/100121 dc['entry_session'] = "200%s" % (cs - cl)122 118 d['firstname'] = student.get('FirstName') 123 119 d['middlename'] = student.get('MiddleName') … … 143 139 #d['department'] = student.get('Dept') 144 140 d['study_course'] = certcode 141 css = student.get('CurrentSession') or '2004-2005' 142 cs = int(css.split('-')[0]) - 2000 143 cl = int(student.get('StudentLevel'))/100 144 d['entry_session'] = "200%s" % (cs - cl) 145 145 sc.getContent().edit(mapping=d) 146 146 # … … 151 151 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 152 152 logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student) 153 sc.invokeFactory('Stud yLevel', level)153 sc.invokeFactory('StudentStudyLevel', level) 154 154 l = getattr(sc, level) 155 155 certificate = certs[certcode] … … 198 198 logger.error('Error reading %s.csv' % name) 199 199 return 200 ## l = self.portal_catalog({'meta_type': "Student"})201 ## students = {}202 ## for s in l:203 ## students[s.id] = s.getObject()204 200 l = self.portal_catalog({'meta_type': "Course"}) 205 201 courses = {} … … 217 213 continue 218 214 sf = res[0].getObject().aq_parent 219 print sf215 result['StudentId'] = sf.getId() 220 216 course = result.get('CosCode') 221 217 if course not in courses.keys(): … … 238 234 if l is None: 239 235 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 240 logger.info('Creating Level %(Level)s for %( Matnumber)s' % result)241 sc.invokeFactory('Stud yLevel', level)236 logger.info('Creating Level %(Level)s for %(StudentId)s %(Matnumber)s' % result) 237 sc.invokeFactory('StudentStudyLevel', level) 242 238 l = getattr(sc, level) 243 #l.getContent().edit(mapping={'Title': "Level %s" % level})244 239 l.invokeFactory('Semester','first') 245 240 l.invokeFactory('Semester','second') … … 248 243 second_s = getattr(l,'second') 249 244 second_s.getContent().edit(mapping={'Title': 'Second Semester'}) 250 snr = result.get('Sem ester')245 snr = result.get('Semster') 251 246 semester = getattr(l,'first') 252 247 if snr == "2": 253 248 semester = getattr(l,'second') 254 logger.info('Creating CourseTicket %(CosCode)s in Level %(Level)s for%(Matnumber)s' % result)249 logger.info('Creating CourseTicket %(CosCode)s in Level %(Level)s for %(StudentId)s %(Matnumber)s' % result) 255 250 semester.invokeFactory('CourseTicket',course) 256 251 ct = getattr(semester,course) 257 252 d = {} 253 dlev = {} 258 254 d['ansbook'] = result.get('Ansbook') 259 255 d['status'] = result.get('CosStuatus') 260 256 d['score'] = result.get('Score') 261 d['carry_level'] = result.get('CarryLevel') 257 dlev['session'] = result.get('Session') 258 dlev['carry_level'] = result.get('CarryLevel') 262 259 d['grade'] = result.get('Grade') 263 d['weight'] = result.get('Weight')264 d ['verdict'] = result.get('Verdict')265 d['import_id'] = result.get('id')266 gpa = result.get('GPA').replace(',','.')267 d['gpa'] = float(gpa)260 #d['weight'] = result.get('Weight') 261 dlev['verdict'] = result.get('Verdict') 262 #d['import_id'] = result.get('id') 263 #gpa = result.get('GPA').replace(',','.') 264 #d['gpa'] = float(gpa) 268 265 ct.getContent().edit(mapping = d) 266 l.getContent().edit(mapping = dlev) 269 267 if tr_count > MAX_TRANS: 270 268 transaction.commit() … … 307 305 return self.title 308 306 309 310 307 InitializeClass(Student) 311 308 … … 367 364 ###) 368 365 366 class StudentStudyLevel(CPSDocument): ###( 367 """ 368 WAeUP Student container for the various student data 369 """ 370 meta_type = 'StudentStudyLevel' 371 portal_type = meta_type 372 security = ClassSecurityInfo() 373 374 security.declareProtected(View,"Title") 375 def Title(self): 376 """compose title""" 377 return "Level %s" % self.aq_parent.getId() 378 379 security.declareProtected(View,"gpa") 380 def gpa(self): 381 """calculate the gpa""" 382 sum = 0 383 course_count = 0 384 for semester in ('first','second'): 385 sf=getattr(self,semester) 386 for sc in sf.objectValues(): 387 result = sc.getContent() 388 res = self.portal_catalog({'meta_type': 'Course', 389 'id': sc.aq_parent.id}) 390 if len(res) != 1: 391 continue 392 course = res[0].getObject().getContent() 393 sum += course.credits * ['F','E','D','C','B','A'].index(result.grade) 394 course_count += 1 395 if course_count: 396 return sum/course_count 397 return 0.0 398 399 InitializeClass(StudentStudyLevel) 400 401 def addStudentStudyLevel(container, id, REQUEST=None, **kw): 402 """Add a Students personal data.""" 403 ob = StudentStudyLevel(id, **kw) 404 return CPSBase_adder(container, ob, REQUEST=REQUEST) 405 406 ###) 407 369 408 class StudentStudyCourse(CPSDocument): ###( 370 409 """ … … 414 453 ###) 415 454 416 class StudyLevel(CPSDocument): ###(417 """418 WAeUP StudyLevel containing the courses and students419 """420 meta_type = 'StudyLevel'421 portal_type = meta_type422 security = ClassSecurityInfo()423 424 security.declareProtected(View,"Title")425 def Title(self):426 """compose title"""427 return "Level %s" % self.aq_parent.getId()428 429 430 InitializeClass(StudyLevel)431 432 def addStudyLevel(container, id, REQUEST=None, **kw):433 """Add a StudyLevel."""434 ob = StudyLevel(id, **kw)435 return CPSBase_adder(container, ob, REQUEST=REQUEST)436 437 ###)438 439 455 class Semester(CPSDocument): ###( 440 456 """ … … 454 470 ###) 455 471 472 class CourseTicket(CPSDocument): ###( 473 """ 474 WAeUP CourseTicket 475 """ 476 meta_type = 'CourseTicket' 477 portal_type = meta_type 478 security = ClassSecurityInfo() 479 def getCourseEntry(self,cid): 480 res = self.portal_catalog({'meta_type': "Course", 481 'id': cid}) 482 if res: 483 return res[-1] 484 else: 485 return None 486 487 security.declareProtected(View,"Title") 488 def Title(self): 489 """compose title""" 490 cid = self.getId() 491 ce = self.getCourseEntry(cid) 492 if ce: 493 return "%s" % ce.Title 494 return "No course with id %s" % cid 495 496 InitializeClass(CourseTicket) 497 498 def addCourseTicket(container, id, REQUEST=None, **kw): 499 """Add a CourseTicket.""" 500 ob = CourseTicket(id, **kw) 501 return CPSBase_adder(container, ob, REQUEST=REQUEST) 502 ###) 503 456 504 class ScratchCardBatchesFolder(CPSDocument): ###( 457 505 """ -
WAeUP_SRP/trunk/__init__.py
r452 r454 20 20 21 21 waeup_types = ( 22 "University.University", 23 "Academics.AcademicsFolder", 24 "Academics.Certificate", 25 "Academics.CertificateCourse", 26 "Academics.Faculty", 27 "Academics.Department", 28 "Academics.Course", 29 "Academics.CourseTicket", 30 "Academics.CertificateCourse", 31 "Accommodation.AccoFolder", 32 "Accommodation.Accommodation", 33 "Students.StudentsFolder", 34 "Students.Student", 35 "Students.StudentStudyCourse", 36 "Students.StudentAdmission", 37 "Students.StudentClearance", 38 "Students.StudentPersonal", 39 "Students.ScratchCardBatch", 40 "Students.ScratchCardBatchesFolder", 41 "Students.StudyLevel", 42 "Students.Semester", 22 ("University",('University',)), 23 ("Academics", 24 ("AcademicsFolder", 25 "Certificate", 26 "CertificateCourse", 27 "Faculty", 28 "Department", 29 "Course", 30 "StudyLevel", 31 "CertificateCourse", 32 ) 33 ), 34 ("Accommodation", 35 ("AccoFolder", 36 "Accommodation", 37 ) 38 ), 39 ("Students", 40 ("StudentsFolder", 41 "Student", 42 "StudentStudyCourse", 43 "CourseTicket", 44 "StudentAdmission", 45 "StudentClearance", 46 "StudentPersonal", 47 "ScratchCardBatch", 48 "ScratchCardBatchesFolder", 49 "StudentStudyLevel", 50 "Semester", 51 ) 52 ), 43 53 ) 44 54 45 55 contentClasses = [] 46 56 cc = [] 47 for t in waeup_types: 48 module,name = t.split('.') 49 mod = __import__('Products.WAeUP_SRP.%(module)s' % vars(), 57 for modu,names in waeup_types: 58 mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(), 50 59 globals(), 51 60 locals(), 52 [ "%(name)s" % vars(),"add%(name)s" % vars()]61 ['*',] 53 62 ) 54 contentClasses.append(getattr(mod,name)) 55 cc.append(getattr(mod,"add%(name)s" % vars())) 56 contentConstructors = tuple(cc) 63 for name in names: 64 #print name 65 contentClasses.append(getattr(mod,name)) 66 cc.append(getattr(mod,"add%(name)s" % vars())) 67 contentConstructors = tuple(cc) 57 68 58 69 fti = [{} for t in range(len(contentConstructors))] -
WAeUP_SRP/trunk/profiles/default/layouts.xml
r444 r454 24 24 <object name="student_schoolresults" meta_type="CPS Layout"/> 25 25 <object name="student_semester" meta_type="CPS Layout"/> 26 <object name="student_study_level" meta_type="CPS Layout"/> 26 27 <object name="study_level" meta_type="CPS Layout"/> 27 28 <object name="university" meta_type="CPS Layout"/> -
WAeUP_SRP/trunk/profiles/default/layouts/course_results.xml
r398 r454 25 25 <property name="label">Carry Level</property> 26 26 <property name="label_edit">Carry Level</property> 27 <property name="readonly_layout_modes"/>28 <property name="hidden_layout_modes"/>29 <property name="hidden_readonly_layout_modes"/>30 </widget>31 <widget name="gpa" meta_type="Float Widget">32 <property name="title">GPA</property>33 <property name="fields">34 <element value="gpa"/>35 </property>36 <property name="label">GPA</property>37 <property name="label_edit">GPA</property>38 27 <property name="readonly_layout_modes"/> 39 28 <property name="hidden_layout_modes"/> … … 73 62 <property name="hidden_readonly_layout_modes"/> 74 63 </widget> 75 <widget name="status" meta_type="String Widget">76 <property name="title">Status</property>77 <property name="fields">78 <element value="status"/>79 </property>80 <property name="label">Status</property>81 <property name="label_edit">Status</property>82 <property name="readonly_layout_modes"/>83 <property name="hidden_layout_modes"/>84 <property name="hidden_readonly_layout_modes"/>85 </widget>86 <widget name="verdict" meta_type="String Widget">87 <property name="title">Verdict</property>88 <property name="fields">89 <element value="verdict"/>90 </property>91 <property name="label">Verdict</property>92 <property name="label_edit">Verdict</property>93 <property name="readonly_layout_modes"/>94 <property name="hidden_layout_modes"/>95 <property name="hidden_readonly_layout_modes"/>96 </widget>97 <widget name="weight" meta_type="String Widget">98 <property name="title">Weight</property>99 <property name="fields">100 <element value="weight"/>101 </property>102 <property name="label">Weight</property>103 <property name="label_edit">Weight</property>104 <property name="readonly_layout_modes"/>105 <property name="hidden_layout_modes"/>106 <property name="hidden_readonly_layout_modes"/>107 </widget>108 64 <table> 109 65 <row> … … 114 70 </row> 115 71 <row> 116 <cell name="status"/>117 </row>118 <row>119 72 <cell name="score"/> 120 </row>121 <row>122 <cell name="verdict"/>123 </row>124 <row>125 <cell name="weight"/>126 </row>127 <row>128 <cell name="gpa"/>129 73 </row> 130 74 <row> -
WAeUP_SRP/trunk/profiles/default/schemas.xml
r444 r454 20 20 <object name="student_personal" meta_type="CPS Schema"/> 21 21 <object name="students" meta_type="CPS Schema"/> 22 <object name="student_study_level" meta_type="CPS Schema"/> 22 23 <object name="study_level" meta_type="CPS Schema"/> 23 24 <object name="university" meta_type="CPS Schema"/> -
WAeUP_SRP/trunk/profiles/default/schemas/course_results.xml
r398 r454 3 3 <field name="ansbook" meta_type="CPS String Field"/> 4 4 <field name="carry_level" meta_type="CPS String Field"/> 5 <field name="gpa" meta_type="CPS Float Field"/>6 5 <field name="grade" meta_type="CPS String Field"/> 7 6 <field name="import_id" meta_type="CPS String Field"/> 8 7 <field name="score" meta_type="CPS Int Field"/> 9 <field name="status" meta_type="CPS String Field"/>10 <field name="verdict" meta_type="CPS String Field"/>11 <field name="weight" meta_type="CPS String Field"/>12 8 </object> -
WAeUP_SRP/trunk/profiles/default/types.xml
r444 r454 17 17 <object name="Semester" meta_type="CPS Flexible Type Information"/> 18 18 <object name="Student" meta_type="CPS Flexible Type Information"/> 19 <object name="StudentStudyLevel" meta_type="CPS Flexible Type Information"/> 19 20 <object name="StudentStudyCourse" meta_type="CPS Flexible Type Information"/> 20 21 <object name="StudentClearance" meta_type="CPS Flexible Type Information"/> -
WAeUP_SRP/trunk/profiles/default/types/StudentStudyCourse.xml
r435 r454 12 12 <property name="filter_content_types">True</property> 13 13 <property name="allowed_content_types"> 14 <element value="Stud yLevel"/>14 <element value="StudentStudyLevel"/> 15 15 </property> 16 16 <property name="allow_discussion">False</property> -
WAeUP_SRP/trunk/profiles/default/workflows.xml
r453 r454 15 15 <object name="waeup_student_wf" meta_type="CPS Workflow"/> 16 16 <object name="waeup_workspace_wf" meta_type="CPS Workflow"/> 17 <object name="workspace_calendar_wf" meta_type="CPS Workflow"/>18 <object name="workspace_content_wf" meta_type="CPS Workflow"/>19 <object name="workspace_folder_wf" meta_type="CPS Workflow"/>20 <object name="workspace_folderish_content_wf" meta_type="CPS Workflow"/>21 17 <bindings> 22 18 <default/> … … 105 101 <bound-workflow workflow_id="section_folder_wf"/> 106 102 </type> 103 <type type_id="StudentStudyLevel"> 104 <bound-workflow workflow_id="section_folder_wf"/> 105 </type> 107 106 <type type_id="University"> 108 107 <bound-workflow workflow_id="section_folder_wf"/> -
WAeUP_SRP/trunk/skins/waeup_academics/academics_content_lib_info_detail_tab.pt
r452 r454 119 119 <span tal:content="info/type">ID</span> 120 120 </td> 121 <span tal:condition="python: context.portal_type == 'CoursesFolder'">121 <span tal:condition="python: info['doc'].portal_type == 'Course'"> 122 122 <td> 123 123 <span tal:content="info/semester">ID</span> … … 128 128 <td> 129 129 <span tal:content="info/passmark">ID</span> 130 </td> 131 </span> 132 <span tal:define="docu python: info['doc']" 133 tal:condition="python: docu.portal_type == 'CourseTicket'"> 134 <td> 135 <span tal:content="docu/grade">ID</span> 136 </td> 137 <td> 138 <span tal:content="docu/score">ID</span> 139 </td> 140 </span> 141 <span tal:define="docu python: info['doc']" 142 tal:condition="python: docu.portal_type == 'Student'"> 143 <td> 144 <span tal:content="info/clearance/matric_no">ID</span> 130 145 </td> 131 146 </span> -
WAeUP_SRP/trunk/skins/waeup_academics/academics_contents.pt
r435 r454 42 42 <span tal:define="redirect python: response.redirect(url)"></span> 43 43 </div> 44 <span tal:omit-tag="" tal:condition="python:display_buttons or (context.portal_type in ('Certificate','Department'))"44 <span tal:omit-tag="" tal:condition="python:display_buttons or context.display_content()" 45 45 tal:content="structure doc/render" /> 46 46 -
WAeUP_SRP/trunk/skins/waeup_academics/academics_contents_display_buttons.py
r371 r454 14 14 15 15 #if context.portal_type in ('Department','Certificate','StudyLevel'): 16 if context.portal_type in ('Department','StudyLevel',): 16 if context.portal_type in ('Department', 17 'StudyLevel', 18 'Student', 19 'StudentAdmission', 20 'StudentClearance', 21 'StudentPersonal', 22 'StudentStudyCourse', 23 'StudentStudyLevel', 24 ): 17 25 return None 18 26 return 1 -
WAeUP_SRP/trunk/skins/waeup_custom/getContentInfo.py
r440 r454 232 232 core = 'elective' 233 233 info['core_or_elective'] = core 234 elif doc.portal_type == 'Student': 235 info['clearance'] = proxy.clearance.getContent() 234 236 info['time'] = doc.modified() 235 237 info['doc'] = doc
Note: See TracChangeset for help on using the changeset viewer.