Changeset 2539
- Timestamp:
- 5 Nov 2007, 18:07:42 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_student/create_level.py
r2489 r2539 18 18 aq_portal = context.portal_catalog_real.evalAdvancedQuery 19 19 aq_courses = context.courses_catalog.evalAdvancedQuery 20 aq_results = context.course_results.evalAdvancedQuery 20 21 21 22 current = DateTime.DateTime() 22 23 request = context.REQUEST 23 #session = request.SESSION24 24 response = request.RESPONSE 25 25 redirect = response.redirect … … 28 28 member = mtool.getAuthenticatedMember() 29 29 member_id = str(member) 30 requested_id = context.getStudentId() 31 #set_trace() 32 create_level = request.form.get('create_level',None) 33 if not create_level or not requested_id or\ 34 (not context.isStaff() and member_id != requested_id): 35 logger.info('%s tried to access %s' % (member_id,requested_id)) 36 return redirect("%s/srp_anonymous_view" % context.portal_url()) 37 student_id = context.getStudentId() 38 30 39 lt = context.portal_layouts 31 40 wt = context.waeup_tool 32 student = context.students_catalog(id= context.getStudentId())[0]41 student = context.students_catalog(id=student_id)[0] 33 42 cert_id = student.course 34 43 current_level = student.level 35 44 current_session = student.session 36 45 in_progress = request.get('in_progress','not started') 37 #level_created = request.get('level_created','xxx') 38 create_level = request.get('create_level',None) 46 if aq_results(Eq('student_id',student_id) & Eq('level_id',current_level)): 47 logger.info('%s tried to create already existing level %s' % (student.id,current_level)) 48 return 39 49 40 ##if context.hasObject(current_level) and create_level:41 ## if getattr(context,current_level).objectIds():42 ## logger.info('%s tried to add already existing level %s' % (student.id,current_level))43 ## return44 50 logger.info('%s started to create level %s' % (student.id,current_level)) 45 46 ##if in_progress in ('not started','started'):47 ## session.set('in_progress','started')48 ## view = context.in_progress_view(refresh=20,page='create_level?in_progress=started')49 ## response.setHeader('Content-type','text/html; charset=ISO-8859-15')50 ## response.setHeader('Content-length','%d' % (len(view)))51 ## response.setStatus('OK')52 ## response.write(view)53 ## response.write('')54 ## if in_progress == 'started':55 ## return56 51 57 52 if context.hasObject(current_level): … … 61 56 level = getattr(context,"%s" % current_level) 62 57 context.portal_workflow.doActionFor(level,'open') 63 #study_session = context.getSessionString()64 58 level.getContent().edit(mapping={'session': current_session}) 65 59 context.portal_workflow.doActionFor(level,'close_for_edit') 66 #context.waeup_tool.doCommit()67 60 level_id = level.getId() 68 student_id = context.getStudentId()69 61 session_id = context.getLevelSession(level.getContent(),student_id,level_id) 70 62 results = [] … … 108 100 d = context.getCourseInfo(co.CosCode) 109 101 d['course_id'] = course_id 110 #d['grade'] = co.GRADE111 102 d['carry_over'] = carry_over 112 # course_id = level.invokeFactory('StudentCourseResult',"%s_co" % course_id)113 # course_result = getattr(level,course_id)114 # context.portal_workflow.doActionFor(course_result,'open')115 # course_result.getContent().edit(mapping=d)116 # context.waeup_tool.doCommit()117 103 d['code'] = course_id 118 104 d['student_id'] = student_id … … 121 107 records.append(d) 122 108 123 #level['create_course_results'](cert_id,current_level)124 109 res = context.portal_catalog(portal_type="Certificate", id = cert_id) 125 110 if res: … … 136 121 l += course_id, 137 122 d = context.getCourseInfo(c.getId) 138 # course_id = level.invokeFactory('StudentCourseResult',c.getId)139 # course_result = getattr(level,course_id)140 # context.portal_workflow.doActionFor(course_result,'open')141 # d['core_or_elective'] = True142 # course_result.getContent().edit(mapping=d)143 # context.waeup_tool.doCommit()144 123 d['carry_over'] = False 145 124 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') … … 148 127 d['level_id'] = level_id 149 128 d['session_id'] = session_id 150 #context.course_results.addRecord(**d)151 129 records.append(d) 152 130 if records: … … 154 132 logger.info('%s finished to create level %s' % (student.id,current_level)) 155 133 156 #if current_session == '05':157 # next_session = '06'158 # next_level = "%s" % (int(current_level) + 100)159 # study_course = getattr(student,'study_course')160 # context.portal_workflow.doActionFor(study_course,'open')161 # study_course_doc = study_course.getContent()162 # study_course_doc.edit(mapping= {'current_level': next_level,163 # 'current_session': next_session,})164 # context.portal_workflow.doActionFor(study_course,'close_for_edit')165 166 134 return response.redirect("%s/%s" % (context.absolute_url(),current_level))
Note: See TracChangeset for help on using the changeset viewer.