Changeset 1092 for WAeUP_SRP/trunk/skins
- Timestamp:
- 19 Dec 2006, 11:07:58 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_custom
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
r1082 r1092 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= came_from=None7 ##parameters= 8 8 ##title= 9 9 ## … … 21 21 from urllib import unquote 22 22 23 def checkRedirect(portal, mtool):24 to_member_home = False25 to_workspaces = False26 ## has_home = mtool.getHomeFolder()27 ## if has_home:28 ## to_member_home = True29 ## if not has_home and mtool.checkPermission('View', portal.workspaces):30 ## to_workspaces = True31 return to_member_home, to_workspaces32 33 23 request = context.REQUEST 34 24 response = request.RESPONSE … … 37 27 wftool = context.portal_workflow 38 28 portal = utool.getPortalObject() 39 portal_absolute_url = portal.absolute_url()40 29 41 redirect_url = came_from42 30 redirect_to_portal = False 43 to_member_home = False44 to_workspaces = False45 to_waeup_student_home = False46 47 31 is_anon = mtool.isAnonymousUser() 48 32 member = mtool.getAuthenticatedMember() 49 33 50 if redirect_url and redirect_url.endswith('/logged_out'): 51 redirect_to_portal = True 52 else: 53 if not is_anon: 54 if "Student" in member.getRoles(): 55 to_waeup_student_home = True 56 students = context.portal_url.getPortalObject().campus.students 57 student = getattr(students,str(member)) 58 student_app = getattr(student,'application') 59 student_pume = getattr(student,'pume',None) 60 s_review_state = wftool.getInfoFor(student,'review_state',None) 61 a_review_state = wftool.getInfoFor(student_app,'review_state',None) 62 logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state)) 63 app_doc = student_app.getContent() 64 #from Products.zdb import set_trace 65 #set_trace() 66 if s_review_state in ("student_created","admitted") and\ 67 a_review_state == 'created' : 68 wftool.doActionFor(student_app,'open') 69 if student_pume is not None: 70 wftool.doActionFor(student_pume,'close') 71 da = {} 72 pin = request.get('pin') 73 if not pin: 74 jamb_reg_no = app_doc.jamb_reg_no 75 for reg_no in (jamb_reg_no,jamb_reg_no.lower(),jamb_reg_no.upper()): 76 res = context.portal_pins(student=reg_no) 77 if len(res) > 0: 78 break 79 if len(res) > 0: 80 p = res[0].pin 81 if len(p) > 10: 82 pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:]) 83 else: 84 pin = p 85 da['app_ac_pin'] = pin 86 da['app_ac_date'] = current 87 app_doc.edit(mapping = da) 88 elif s_review_state in ("admitted") and a_review_state == 'opened' and\ 89 not app_doc.app_ac_pin: 34 if not is_anon: 35 if "Student" in member.getRoles(): 36 to_waeup_student_home = True 37 students = context.portal_url.getPortalObject().campus.students 38 student = getattr(students,str(member)) 39 student_app = getattr(student,'application') 40 student_pume = getattr(student,'pume',None) 41 s_review_state = wftool.getInfoFor(student,'review_state',None) 42 a_review_state = wftool.getInfoFor(student_app,'review_state',None) 43 logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state)) 44 app_doc = student_app.getContent() 45 #from Products.zdb import set_trace 46 #set_trace() 47 if s_review_state in ("student_created","admitted") and\ 48 a_review_state == 'created' : 49 wftool.doActionFor(student_app,'open') 50 if student_pume is not None: 51 wftool.doActionFor(student_pume,'close') 52 da = {} 53 pin = request.get('pin') 54 if not pin: 90 55 jamb_reg_no = app_doc.jamb_reg_no 91 56 for reg_no in (jamb_reg_no,jamb_reg_no.lower(),jamb_reg_no.upper()): … … 99 64 else: 100 65 pin = p 101 da = {} 102 da['app_ac_pin'] = pin 103 app_doc.edit(mapping = da) 104 elif "Manager" in member.getRoles(): 105 pass 106 else: 107 to_member_home, to_workspaces = checkRedirect(portal, mtool) 108 109 if (not to_member_home) and (not to_workspaces): 110 redirect_to_portal = True 111 112 if to_waeup_student_home: 113 #member.setProperties(last_login_time=current,login_time=current) 114 #if info['review_state'] == "application_pin_entered": 115 if s_review_state == "application_pin_entered": 116 return response.redirect("%s/application_edit_form" % student.absolute_url()) 117 #elif info['review_state'] == "admitted": 118 elif s_review_state in ('admitted', 'objection_raised',): 119 return response.redirect("%s/admission_form" % student.absolute_url()) 120 #elif info['review_state'] == "clearance_pin_entered": 121 elif s_review_state == "clearance_pin_entered": 122 return response.redirect("%s/clearance_edit_form" % student.absolute_url()) 123 return response.redirect("%s/student_index" % student.absolute_url()) 124 125 elif to_member_home: 126 redirect_url = mtool.getHomeFolder().absolute_url() 127 logger.info('"%s", "logged in"' % (member)) 128 elif to_workspaces: 129 redirect_url = portal.workspaces.absolute_url() 130 logger.info('"%s", "logged in"' % (member)) 131 elif redirect_to_portal: 132 redirect_url = portal_absolute_url 133 logger.info('"%s", "logged in"' % (member)) 134 135 REQUEST = context.REQUEST 136 RESPONSE = REQUEST.RESPONSE 137 138 # Setup skins 139 if (getattr(utool, 'updateSkinCookie', False) and 140 utool.updateSkinCookie()): 141 context.setupCurrentSkin() 142 143 # Anonymous 144 if is_anon: 145 RESPONSE.expireCookie('__ac', path='/') 66 da['app_ac_pin'] = pin 67 da['app_ac_date'] = current 68 app_doc.edit(mapping = da) 69 elif s_review_state in ("admitted") and a_review_state == 'opened' and\ 70 not app_doc.app_ac_pin: 71 jamb_reg_no = app_doc.jamb_reg_no 72 for reg_no in (jamb_reg_no,jamb_reg_no.lower(),jamb_reg_no.upper()): 73 res = context.portal_pins(student=reg_no) 74 if len(res) > 0: 75 break 76 if len(res) > 0: 77 p = res[0].pin 78 if len(p) > 10: 79 pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:]) 80 else: 81 pin = p 82 da = {} 83 da['app_ac_pin'] = pin 84 app_doc.edit(mapping = da) 85 if s_review_state == "application_pin_entered": 86 return response.redirect("%s/application_edit_form" % student.absolute_url()) 87 elif s_review_state in ('admitted', 'objection_raised',): 88 return response.redirect("%s/admission_form" % student.absolute_url()) 89 elif s_review_state == "clearance_pin_entered": 90 return response.redirect("%s/clearance_edit_form" % student.absolute_url()) 91 return response.redirect("%s/student_index" % student.absolute_url()) 92 else: 93 logger.info('"%s", "logged in"' % (member)) 94 return response.redirect(portal.absolute_url()) 95 else: 96 # Setup skins 97 if (getattr(utool, 'updateSkinCookie', False) and 98 utool.updateSkinCookie()): 99 context.setupCurrentSkin() 100 response.expireCookie('__ac', path='/') 146 101 return context.user_logged_in_failed() 147 102 148 login_time = member.getProperty('login_time', '2000/01/01')149 first_time = (str(login_time) == '2000/01/01')150 103 151 ##if first_time and member.has_role('Member') and not member.has_role('Student'):152 ## mtool.createMemberArea()153 ## now = context.ZopeTime()154 ## member.setProperties(last_login_time=now, login_time=now)155 156 if to_member_home or to_workspaces:157 redirect_url = '%s/?%s' % (redirect_url, 'portal_status_message=psm_logged_in')158 RESPONSE.redirect(redirect_url)
Note: See TracChangeset for help on using the changeset viewer.