Changeset 5380 for main/waeup.sirp/trunk/src
- Timestamp:
- 7 Aug 2010, 14:03:41 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r5152 r5380 15 15 from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPXMLExporter, 16 16 IWAeUPXMLImporter, IDataCenter) 17 from waeup.sirp.browser.layout import WAeUPPage 17 18 18 19 grok.templatedir('templates') … … 226 227 227 228 class ManageLink(grok.Viewlet): 229 """A link displayed in the upper left box. 230 231 This viewlet renders a link to the application object's settings 232 form (the 'manage' view). 233 234 In derived classes you can create different links by setting a 235 different link and text attribute. The `link` parameter is 236 understood relative to the respective application object, so that 237 ``@@manage`` will create a link to 238 ``localhost:8080/app/@@manage``. 239 240 Links defined by descendants from this viewlet are displayed on 241 every page the user is allowed to go to, if the user has also the 242 permissions set by `grok.require()`. By default only users with 243 ``waeup.manageUniversity`` permission will see links defined by 244 this or derivated classes. 245 """ 228 246 grok.viewletmanager(LeftSidebar) 229 grok.context(I University)230 grok.view( UniversityPage)247 grok.context(IWAeUPObject) 248 grok.view(WAeUPPage) 231 249 grok.order(5) 232 250 # This link is only displayed, if the user is 233 251 # allowed to use it! 234 252 grok.require('waeup.manageUniversity') 253 254 link = '@@manage' 255 text = u'Portal Settings' 235 256 236 257 def render(self): 237 return u'<div class="portlet"><a href="manage">Settings</a></div>' 258 url = self.view.url(grok.getSite(), self.link) 259 return u'<div class="portlet"><a href="%s">%s</a></div>' % ( 260 url, self.text) 261 238 262 239 263 class ManageFacultiesLink(grok.Viewlet): … … 245 269 # allowed to use it! 246 270 grok.require('waeup.manageUniversity') 247 271 248 272 def render(self): 249 273 return u'<div class="portlet"><a href="faculties">Manage faculties</a></div>' 250 274 251 class ManageUsersLink(grok.Viewlet): 252 grok.viewletmanager(LeftSidebar) 253 grok.context(IUniversity) 254 grok.view(UniversityPage) 275 class ManageUsersLink(ManageLink): 276 """A link to users management, placed in upper left box. 277 """ 255 278 grok.order(6) 256 279 grok.require('waeup.manageUsers') 257 280 258 def render(self): 259 return u'<div class="portlet"><a href="users">Manage users</a></div>' 260 261 class ManageDataCenter(grok.Viewlet): 262 grok.viewletmanager(LeftSidebar) 263 grok.context(IUniversity) 264 grok.view(UniversityPage) 281 link = u'users' 282 text = u'Portal Users' 283 284 class ManageDataCenter(ManageLink): 285 """A link to datacenter, placed in upper left box. 286 """ 265 287 grok.order(6) 266 288 grok.require('waeup.manageUniversity') 267 289 268 def render(self):269 return u'<div class="portlet"><a href="datacenter">Data Center</a></div>'290 link = u'datacenter' 291 text = u'Data Center' 270 292 271 293 #
Note: See TracChangeset for help on using the changeset viewer.