Changeset 6396 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 17 Jun 2011, 07:53:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.