- Timestamp:
- 10 Mar 2011, 16:35:07 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r5825 r5828 31 31 from waeup.sirp.browser.pages import LoginPage 32 32 from waeup.sirp.interfaces import IWAeUPObject 33 from waeup.sirp.browser.viewlets import AddActionButton 33 from waeup.sirp.browser.viewlets import ( 34 AddActionButton, ManageActionButton, PrimaryNavTab, 35 ) 34 36 from waeup.sirp.applicants import get_applicant_data, ResultEntry 35 37 from waeup.sirp.applicants.interfaces import ( … … 70 72 grok.name('index') 71 73 title = 'Applicants' 72 pnav = 174 pnav = 2 73 75 74 76 def getApplications(self): … … 79 81 yield(dict(url=url, name=key)) 80 82 83 class ManageApplicantsRootActionButton(ManageActionButton): 84 grok.context(IApplicantsRoot) 85 grok.view(ApplicationsPage) 86 text = 'Manage applicant containers' 87 88 class ApplicantsRootEditPage(WAeUPPage): 89 grok.context(IApplicantsRoot) 90 grok.name('manage') 91 grok.template('applicantsrooteditpage') 92 title = 'Edit applicants containers' 93 pnav = 2 94 95 def update(self, entries=None, DELETE=None, CANCEL=None): 96 if CANCEL is not None: 97 self.redirect(self.url(self.context)) 98 return 99 if DELETE is None: 100 return 101 if entries is None: 102 return 103 if not isinstance(entries, list): 104 entries = [entries] 105 for name in entries: 106 del self.context[name] 107 self.flash('Deleted "%s"' % name) 108 return 109 110 def getApplications(self): 111 """Get a list of all stored applicant containers. 112 """ 113 for key, val in self.context.items(): 114 url = self.url(val) 115 yield(dict(url=url, name=key)) 116 81 117 class AddApplicantsContainerActionButton(AddActionButton): 82 118 grok.context(IApplicantsRoot) 83 grok.view(Applica tionsPage)119 grok.view(ApplicantsRootEditPage) 84 120 text = 'Add applicants container' 85 121 … … 89 125 grok.template('addcontainer') 90 126 title = 'Add applicants container' 91 pnav = 1 92 93 def update(self, providername=None, name=None, ADD=None, CANCEL=None): 127 pnav = 2 128 129 def update(self, providername=None, name=None, title=None, 130 description=None, ADD=None, CANCEL=None): 94 131 if CANCEL is not None: 95 132 self.redirect(self.url(self.context)) … … 107 144 name=providername) 108 145 container = provider.factory() 146 if title: 147 container.title = title 148 if description: 149 container.description = description 109 150 self.context[name] = container 110 151 self.flash('Added "%s".' % name) … … 140 181 ] 141 182 return result 142 183 184 185 class ApplicantsTab(PrimaryNavTab): 186 """Faculties-tab in primary navigation. 187 """ 188 grok.context(IWAeUPObject) 189 grok.order(3) 190 grok.require('waeup.View') 191 grok.template('primarynavtab') 192 193 pnav = 2 194 tab_title = u'Applicants' 195 196 @property 197 def link_target(self): 198 return self.view.application_url('applicants') 199 200 143 201 #class AddApplicant(WAeUPAddFormPage): 144 202 # grok.context(IApplicantContainer) … … 174 232 label = 'Applicant' 175 233 title = 'Applicant' 176 pnav = 1234 pnav = 2 177 235 178 236 class EditApplicant(WAeUPEditFormPage):
Note: See TracChangeset for help on using the changeset viewer.