Changeset 6396
- Timestamp:
- 17 Jun 2011, 07:53:17 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py
r6395 r6396 49 49 def __init__(self, access_code): 50 50 self.id = principal_id(access_code) 51 self.title = u' Applicant'52 self.description = u'An Applica nt'51 self.title = u'My Application' 52 self.description = u'An Application Record' 53 53 self.credentialsPlugin = None 54 54 self.authenticatorPlugin = None … … 68 68 if prefix is not None: 69 69 self.id = '%s.%s' % (prefix, self.id) 70 self.title = u' Applicant'71 self.description = u'An applicant'70 self.title = u'My Application' 71 self.description = u'An Application Record' 72 72 self.groups = [] 73 73 self.access_code = access_code -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6394 r6396 485 485 return 486 486 487 class AccessCode Link(LeftSidebarLink):487 class AccessCodeViewLink(LeftSidebarLink): 488 488 grok.order(1) 489 489 grok.require('waeup.Public') 490 491 def render(self): 490 icon = 'actionicon_view.png' 491 title = 'View Record' 492 target = '/@@index' 493 494 @property 495 def url(self): 492 496 if not IApplicantPrincipal.providedBy(self.request.principal): 493 497 return '' … … 495 499 if access_code: 496 500 applicant_object = get_applicant_data(access_code) 497 url = absoluteURL(applicant_object, self.request) 498 return u'<div class="portlet"><a href="%s/edit">%s</a></div>' % ( 499 url,access_code) 500 return '' 501 return absoluteURL(applicant_object, self.request) + self.target 502 else: 503 return '' 504 505 class AccessCodeEditLink(AccessCodeViewLink): 506 grok.order(2) 507 grok.require('waeup.Public') 508 icon = 'actionicon_modify.png' 509 title = 'Edit Record' 510 target = '/@@edit' 511 512 @property 513 def url(self): 514 if not IApplicantPrincipal.providedBy(self.request.principal): 515 return '' 516 access_code = getattr(self.request.principal,'access_code',None) 517 if access_code: 518 applicant_object = get_applicant_data(access_code) 519 if applicant_object.locked: 520 return '' 521 return absoluteURL(applicant_object, self.request) + self.target 522 else: 523 return '' 524 525 class AccessCodeSlipLink(AccessCodeViewLink): 526 grok.order(3) 527 grok.require('waeup.Public') 528 icon = 'actionicon_pdf.png' 529 title = 'Download Slip' 530 target = '/application_slip.pdf' 501 531 502 532 class DisplayApplicant(WAeUPDisplayFormPage): … … 536 566 class PDFActionButton(ManageActionButton): 537 567 grok.context(IApplicant) 538 grok.view(DisplayApplicant)539 grok.require('waeup. handleApplication')568 #grok.view(DisplayApplicant) 569 grok.require('waeup.manageApplications') 540 570 icon = 'actionicon_pdf.png' 541 571 text = 'Download application slip' … … 653 683 target = 'edit_full' 654 684 655 class ApplicantEditActionButton(ManageActionButton):656 grok.context(IApplicant)657 grok.view(DisplayApplicant)658 grok.require('waeup.handleApplication')659 text = 'Edit application record'660 target = 'edit'661 662 685 class EditApplicantFull(WAeUPEditFormPage): 663 686 """A full edit view for applicant data. … … 779 802 grok.context(IApplicant) 780 803 grok.view(EditApplicantFull) 804 grok.require('waeup.manageApplications') 781 805 icon = 'actionicon_view.png' 782 806 text = 'View application record' -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r6127 r6396 207 207 grok.order(5) 208 208 grok.require('waeup.manageUniversity') 209 209 icon = 'actionicon_modify.png' # File must exist in static/ 210 210 title = 'Text of link' 211 211 212 @property 212 213 def url(self): 213 return 'URL to link to' 214 214 return '@@index' 215 216 @property 217 def icon_url(self): 218 """Get the icon URL. 219 """ 220 if self.icon: 221 static = self.view.static 222 if static is None or static.get(self.icon, None) is None: 223 # In derived classes defined in other modules/packages 224 # than w.s.browser, ``static`` might refer to a static dir 225 # local to the derived class' module. As we often like to 226 # get the icons from here 227 # (i.e. waeup.sirp.browser/static), we set the directory 228 # resource appropiately. 229 # 230 # XXX: The hardcoding of 'w.s.browser' should be replaced 231 # by something smarter. 232 # 233 # TODO: notes in here should go to general documentation. 234 static = queryAdapter( 235 self.request, Interface, name='waeup.sirp.browser') 236 return static[self.icon]() 237 return 238 239 # Render link only if url is provided. 215 240 def render(self): 216 return u'<div class="portlet"><a href="%s">%s</a></div>' % ( 217 self.url, self.title) 218 219 241 if self.url: 242 if self.icon_url: 243 return u'<div class="portlet"><a href="%s"><img src="%s" /> %s </a></div>' % ( 244 self.url, self.icon_url, self.title) 245 else: 246 return u'<div class="portlet"><a href="%s">%s </a></div>' % ( 247 self.url, self.title) 248 else: 249 return '' 220 250 221 251 #
Note: See TracChangeset for help on using the changeset viewer.