Changeset 7240 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 30 Nov 2011, 23:13:26 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
r7195 r7240 32 32 from waeup.sirp.browser.theming import get_all_themes, WAeUPThemeGray1 33 33 from waeup.sirp.students.interfaces import IStudentNavigation 34 from waeup.sirp.applicants.interfaces import IApplicant 34 35 from waeup.sirp.authentication import get_principal_role_manager 35 36 … … 163 164 if usertitle == 'Unauthenticated User': 164 165 return u'Anonymous User' 165 elif usertitle == 'Applicant':166 return self.request.principal.id167 166 return usertitle 168 167 … … 172 171 userid = self.request.principal.id 173 172 return userid 173 174 def isStudent(self): 175 usertype = getattr(self.request.principal, 'user_type', None) 176 if not usertype: 177 return False 178 return self.request.principal.user_type == 'student' 179 180 def isApplicant(self): 181 usertype = getattr(self.request.principal, 'user_type', None) 182 if not usertype: 183 return False 184 return self.request.principal.user_type == 'applicant' 174 185 175 186 def getStudentName(self): … … 180 191 return 181 192 182 def isStudent(self): 183 prm = get_principal_role_manager() 184 roles = [x[0] for x in 185 prm.getRolesForPrincipal(self.request.principal.id)] 186 return 'waeup.Student' in roles 193 def getApplicantName(self): 194 """Return the applicant name. 195 """ 196 if IApplicant.providedBy(self.context): 197 return self.context.fullname 198 return 187 199 188 200 def update(self): … … 209 221 210 222 def render(self): 211 if self.isStudent() or not self.isAuthenticated():223 if self.isStudent() or self.isApplicant() or not self.isAuthenticated(): 212 224 return self.studenttemp.render(self) 213 225 return self.stafftemp.render(self) -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7234 r7240 150 150 camefrom = None 151 151 152 def isStudent(self):153 prm = get_principal_role_manager()154 roles = [x[0] for x in prm.getRolesForPrincipal(self.request.principal.id)]155 return 'waeup.Student' in roles156 157 152 def update(self, SUBMIT=None, camefrom=None): 158 153 self.camefrom = camefrom … … 160 155 if self.request.principal.id != 'zope.anybody': 161 156 self.flash('You logged in.') 162 if self. isStudent():157 if self.request.principal.user_type == 'student': 163 158 rel_link = '/students/%s' % self.request.principal.id 159 self.redirect(self.application_url() + rel_link) 160 return 161 elif self.request.principal.user_type == 'applicant': 162 container, application_number = self.request.principal.id.split('_') 163 rel_link = '/applicants/%s/%s' % ( 164 container, application_number) 164 165 self.redirect(self.application_url() + rel_link) 165 166 return … … 222 223 email_from = self.config.email_admin 223 224 username = self.request.principal.id 225 usertype = getattr(self.request.principal, 226 'user_type', 'system').title() 224 227 body = data['body'] 225 228 email_to = self.config.email_admin 226 229 subject = self.config.email_subject 227 success = send_mail(fullname,username, self.config.name,230 success = send_mail(fullname,username,usertype,self.config.name, 228 231 body,email_from,email_to,subject) 229 232 if success: … … 248 251 email_to = self.config.email_admin 249 252 subject = self.config.email_subject 250 success = send_mail(fullname,username,self.config.name, 253 usertype = u'Anonymous' 254 success = send_mail(fullname,username,usertype,self.config.name, 251 255 body,email_from,email_to,subject) 252 256 if success: … … 467 471 email_from = self.config.email_admin 468 472 username = self.request.principal.id 473 usertype = getattr(self.request.principal, 474 'user_type', 'system').title() 469 475 body = data['body'] 470 476 email_to = self.context.email 471 477 subject = self.config.email_subject 472 success = send_mail(fullname,username, self.config.name,478 success = send_mail(fullname,username,usertype,self.config.name, 473 479 body,email_from,email_to,subject) 474 480 if success: -
main/waeup.sirp/trunk/src/waeup/sirp/browser/static/waeup-base.css
r7135 r7240 70 70 71 71 .studentmenu { 72 text-align: center;72 text-align: left; 73 73 line-height: 2; 74 74 } -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/studentsitelayout.pt
r7184 r7240 56 56 57 57 <div class="yui-b"> 58 <div class="block" tal:condition="layout/getStudentName">58 <div class="block" > 59 59 <div class="studentmenu"> 60 <tal:left content="structure provider:top_student" /> 60 <div tal:condition="layout/getStudentName" 61 tal:replace="structure provider:top_student"> 62 Student Links 63 </div> 64 <div tal:content="structure provider:actionbar"> 65 Student Actions 66 </div> 61 67 </div> 62 68 </div> … … 89 95 <div tal:replace="structure view/content"> THE CONTENT 90 96 </div> 91 <span tal:replace="structure provider:actionbar"></span>92 97 </div> 93 98 </div>
Note: See TracChangeset for help on using the changeset viewer.