Changeset 1482 for WAeUP_SRP/trunk/skins/waeup_student
- Timestamp:
- 23 Feb 2007, 16:56:46 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_student
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/add_course_result.py
r805 r1482 10 10 # $Id$ 11 11 """ 12 FIXME: add docstring.12 add a course_result object. 13 13 """ 14 from urllib import urlencode 15 request = context.REQUEST 16 course_cat = context.courses_catalog 17 from Products.AdvancedQuery import Eq, Between, Le,In 18 aq_portal = context.portal_catalog.evalAdvancedQuery 19 course_id = request.get('course_id') 20 d = context.getCourseInfo(course_id) 21 args = {} 22 err = '' 23 while True: 24 if d['title'] == 'unknown': 25 err = "no such course" 26 break 27 if context.hasObject(course_id): 28 err = "course already exists" 29 break 30 if context.hasObject("%s_co" % course_id): 31 err = "course already exists as carryover" 32 break 33 break 14 34 15 return context.REQUEST.RESPONSE.redirect("%s/content_create?type_name=StudentCourseResult" 16 % (context.absolute_url())) 35 if err: 36 args['course_id'] = course_id 37 args['error'] = err 38 url = "%s?%s" % (context.absolute_url(),urlencode(args)) 39 return request.RESPONSE.redirect(url) 40 ##cert_id = context.aq_parent.getContent().study_course 41 ##res = context.portal_catalog(portal_type="Certificate", id = cert_id) 42 ##l = [] 43 ##if res: 44 ## cert = res[0] 45 ## path = cert.getPath() 46 ## query = Eq("path",path) &\ 47 ## Eq('portal_type','CertificateCourse') &\ 48 ## Eq('SearchableText', "%s" % student.level) &\ 49 ## Eq('id',course_id) 50 ##course = aq_portal(query)[0] 51 cr_id = context.invokeFactory('StudentCourseResult',course_id) 52 ##d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 53 ##getattr(context,cr_id).getContent().edit(mapping=d) 54 args['course_id'] = course_id 55 from urllib import urlencode 56 url = "%s?%s" % (context.absolute_url(),urlencode(args)) 57 return request.RESPONSE.redirect(url) 58 -
WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py
r1471 r1482 45 45 current_level = sbrain.level 46 46 levels = context.objectIds() 47 #context.portal_workflow.doActionFor(context,'close_for_edit') 47 review_state = wftool.getInfoFor(context,'review_state',None) 48 if review_state != 'content_addable': 49 context.portal_workflow.doActionFor(context,'close_for_edit') 48 50 49 #levels.sort()50 #if int(current_level) > int(levels[-1]):51 #if not levels: 52 # context.invokeFactory('StudentStudyLevel',"%s" % current_level)53 # level = getattr(context,"%s" % current_level)54 # level.getContent().edit(mapping={'session': "2006/2007"})55 #context.portal_workflow.doActionFor(level,'open')56 #context.portal_workflow.doActionFor(level,'close_for_edit')57 #levels.append(current_level)58 #for l in levels:59 #row = {}60 #row['id'] = l61 #row['title'] = "Level %s" % l62 #row['url'] = "%s/%s" % (context.absolute_url(),l)63 #items.append(row)51 levels.sort() 52 if not levels: 53 context.invokeFactory('StudentStudyLevel',"%s" % current_level) 54 level = getattr(context,"%s" % current_level) 55 session = context.getSessionString() 56 level.getContent().edit(mapping={'session': session}) 57 context.portal_workflow.doActionFor(level,'open') 58 context.portal_workflow.doActionFor(level,'close_for_edit') 59 levels.append(current_level) 60 for l in levels: 61 row = {} 62 row['id'] = l 63 row['title'] = "Level %s" % l 64 row['url'] = "%s/%s" % (context.absolute_url(),l) 65 items.append(row) 64 66 65 67 info['items'] = items -
WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py
r1380 r1482 57 57 normal = [] 58 58 carry_overs = [] 59 credits_total = 0 59 60 for id,obj in context.objectItems(): 61 try: 62 credit = int(obj.getContent().credits) 63 except ValueError: 64 credit = 3 65 credits_total += credit 60 66 if id.endswith('_co'): 61 67 d = context.getCourseInfo(id[:-3]) … … 69 75 d['coe'] = 'Elective' 70 76 normal.append(d) 71 77 info['credits_total'] = credits_total 72 78 carry_overs.sort(cmp_semester) 73 79 info['carry_overs'] = carry_overs -
WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt
r1409 r1482 64 64 /> 65 65 </td> 66 <td><a href="view" tal:attributes="href string:${row/url}"> 67 <strong tal:content="row/title" /></a> </td> 66 <td><a href="view" tal:condition="python: 0" 67 tal:attributes="href string:${row/url}"> 68 <strong tal:content="row/title" /></a> 69 <strong tal:condition="python: 1" tal:content="row/title" /> 70 </td> 68 71 </tr> 69 72 </table> -
WAeUP_SRP/trunk/skins/waeup_student/study_level_view.pt
r1417 r1482 19 19 </metal:block> 20 20 <metal:main fill-slot="main" tal:condition="python:1"> 21 <form action="add_course_result" method="post" class="group"> 22 <h3>Add a course</h3> 23 <table> 24 <tr> 25 <th>Course Id</th> 26 <td><input type="text" name="course_id" 27 tal:attributes="value request/course_id|nothing"/></td> 28 <td tal:condition="request/error|nothing" 29 tal:content="request/error" /> 30 </tr> 31 <tr> 32 <th></th> 33 <td colspan="2"> 34 <input type="submit" name="add" 35 class="context" value="Add Course" 36 /> 37 </td> 38 </tr> 39 </table> 40 </form> 21 41 <form action="." method="post" class="group"> 22 42 <h3>Carryover Courses</h3> … … 36 56 <td width="2%" tal:content="row/semester"></td> 37 57 <td width="2%" tal:content="row/credits"></td> 38 <td width="8%" tal:content="row/grade| nothing"></td>58 <td width="8%" tal:content="row/grade|string:"></td> 39 59 </tr> 40 60 </table> … … 57 77 <td width="8%" tal:content="row/coe|nothing"></td> 58 78 </tr> 79 <tr> 80 <td colspan="1"></td> 81 <th colspan="3">Total credits</th> 82 <td width="8%" tal:content="info/credits_total"></td> 83 </tr> 59 84 </table> 60 85 <table width="100%" cellspacing="0" cellpadding="2" … … 70 95 % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))" 71 96 /> 72 <input tal:condition="python: 1" type="submit" name="register_checked:method"97 <input tal:condition="python:0" type="submit" name="register_checked:method" 73 98 class="context" value="Register" /> 74 99 <input tal:condition="python:0" type="submit" name="retract_checked:method" 75 100 class="context" value="Retract" /> 76 <input type="submit" name=" folder_delete:method" value="button_delete"101 <input type="submit" name="course_result_delete:method" value="button_delete" 77 102 class="destructive" i18n:attributes="value" 78 103 tal:attributes="onclick python:'return window.confirm(\'%s\')' % … … 89 114 </form> 90 115 </metal:main> 91 92 <metal:sub fill-slot="sub"/>93 116 </metal:body> 94 117 </metal:html> 118
Note: See TracChangeset for help on using the changeset viewer.