Changeset 708
- Timestamp:
- 16 Oct 2006, 16:05:00 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r681 r708 1 1 #-*- mode: python; mode: fold -*- 2 2 # $Id$ 3 from string import Template 3 4 from Globals import InitializeClass 4 5 from AccessControl import ClassSecurityInfo … … 50 51 def loadFullTimeStudentsFromCSV(self): 51 52 """load Fulltime Studentdata from CSV values""" 52 #return53 53 import transaction 54 import random 54 55 tr_count = 0 55 56 name = 'short_full_time' … … 60 61 logger = logging.getLogger('%s_import' % name) 61 62 logger.info('Start loading from %s.csv' % name) 63 pwlist = [] 64 pwlist.append('"student_id","firstname","middlename","lastname","matric_no","jamb_reg_no","access_code"') 65 pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$matric_no","$jamb_reg_no","$access_code"') 62 66 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 63 67 try: … … 103 107 if matric_no not in matrics: 104 108 matrics.append(matric_no) 105 sid = generateStudentId( )109 sid = generateStudentId(student.get('Lastname')[0]) 106 110 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 107 111 logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) … … 115 119 logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) 116 120 s = getattr(self,sid) 121 access_code = "%d" % random.randint(1000000000,9999999999) 117 122 self.portal_registration.addMember(sid, 118 'uNsEt',123 access_code , 119 124 roles=('Member', 120 125 'Student',)) 126 pwl_dict = {'student_id': sid,'access_code':access_code} 121 127 s.invokeFactory('StudentApplication','application') 122 128 da = {'Title': 'Application Data'} … … 124 130 da['jamb_reg_no'] = student.get('EntryRegNo') 125 131 sp = s.personal 126 d = {'Title': 'Personal Data'}132 dp = {'Title': 'Personal Data'} 127 133 s.invokeFactory('StudentClearance','clearance') 128 134 sc = s.clearance … … 133 139 dc['nationality'] = student.get('Nationality') 134 140 dc['email'] = student.get('Emailaddress') 135 d ['firstname'] = student.get('FirstName')136 d ['middlename'] = student.get('MiddleName')137 d ['lastname'] = student.get('Lastname')138 d ['former_surname'] = student.get('FormerSurname')139 d ['sex'] = student.get('Sex') == 'F'140 d ['perm_address'] = student.get('PermanentAddress')141 d ['perm_city'] = student.get('PermanentAddressCity')142 d ['campus_address'] = student.get('CampusAddress')143 d ['phone'] = student.get('PhoneNumber')141 dp['firstname'] = student.get('FirstName') 142 dp['middlename'] = student.get('MiddleName') 143 dp['lastname'] = student.get('Lastname') 144 dp['former_surname'] = student.get('FormerSurname') 145 dp['sex'] = student.get('Sex') == 'F' 146 dp['perm_address'] = student.get('PermanentAddress') 147 dp['perm_city'] = student.get('PermanentAddressCity') 148 dp['campus_address'] = student.get('CampusAddress') 149 dp['phone'] = student.get('PhoneNumber') 144 150 s.application.getContent().edit(mapping=da) 145 sp.getContent().edit(mapping=d )151 sp.getContent().edit(mapping=dp) 146 152 sc.getContent().edit(mapping=dc) 147 153 # … … 150 156 s.invokeFactory('StudentStudyCourse','study_course') 151 157 sc = s.study_course 152 d = {} 153 #d['matricel_no'] = student.get('MatricNo') 154 #d['entry_reg_no'] = student.get('EntryRegNo') 155 #d['faculty'] = student.get('Faculty') 156 #d['department'] = student.get('Dept') 157 d['study_course'] = certcode 158 dsc = {} 159 dsc['study_course'] = certcode 158 160 css = student.get('CurrentSession') or '2004-2005' 159 161 cs = int(css.split('-')[0]) - 2000 160 162 cl = int(student.get('StudentLevel'))/100 161 d['entry_session'] = "200%s" % (cs - cl) 162 sc.getContent().edit(mapping=d) 163 dsc['entry_session'] = "200%s" % (cs - cl) 164 dsc['clr_ac_pin'] = access_code 165 sc.getContent().edit(mapping=dsc) 163 166 # 164 167 # Level … … 175 178 logger.info('Level %(level)s not in %(certcode)s' % vars()) 176 179 l.getContent().edit(mapping={'Title': "Level %s" % level}) 177 l.invokeFactory('StudentSemester','first')178 l.invokeFactory('StudentSemester','second')179 first_s = getattr(l,'first')180 first_s.getContent().edit(mapping={'Title': 'First Semester'})181 second_s = getattr(l,'second')182 second_s.getContent().edit(mapping={'Title': 'Second Semester'})180 ## l.invokeFactory('StudentSemester','first') 181 ## l.invokeFactory('StudentSemester','second') 182 ## first_s = getattr(l,'first') 183 ## first_s.getContent().edit(mapping={'Title': 'First Semester'}) 184 ## second_s = getattr(l,'second') 185 ## second_s.getContent().edit(mapping={'Title': 'Second Semester'}) 183 186 else: 184 187 em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student … … 192 195 tr_count = 0 193 196 tr_count += 1 197 pwl_dict.update(dc) 198 pwl_dict.update(da) 199 pwl_dict.update(dp) 200 pwlist.append(pwl_template.substitute(pwl_dict)) 194 201 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 195 202 ###) -
WAeUP_SRP/trunk/skins/waeup_pins/batch_view.pt
r696 r708 35 35 <td tal:content="pin/pin" /> 36 36 <td> 37 <a href="" tal:content="pin/student"37 <a tal:condition="pin/student_url" href="" tal:content="pin/student" 38 38 tal:attributes="href pin/student_url"></a> 39 <span tal:condition="not: pin/student_url" tal:content="pin/student" /> 39 40 </td> 40 41 </tr> -
WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py
r696 r708 31 31 if bd.prefix == "APP": 32 32 jno = item['student'] 33 item['student_url'] = "%s/%s" % (context.portal_url(), 34 context.portal_catalog(SearchableText=jno, 35 portal_type='StudentApplication')[0].relative_path 36 ) 33 res = context.portal_catalog(SearchableText=jno,portal_type='StudentApplication') 34 if len(res) == 1: 35 item['student_url'] = "%s/%s" % (context.portal_url(),res[0].relative_path) 36 else: 37 item['student_url'] == None 37 38 else: 38 39 item['student_url'] = '%s/%s' % (students_url,item['student'])
Note: See TracChangeset for help on using the changeset viewer.