Changeset 7674 for main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
- Timestamp:
- 22 Feb 2012, 08:27:56 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r7461 r7674 17 17 ## 18 18 import grok 19 import zope.i18nmessageid 20 from urllib import urlencode 19 21 from zope.component import getMultiAdapter, queryAdapter 20 22 from zope.interface import Interface … … 33 35 from waeup.sirp.utils.helpers import get_user_account 34 36 37 _ = zope.i18nmessageid.MessageFactory('waeup.sirp') 38 35 39 grok.templatedir('templates') 36 40 grok.context(ISIRPObject) # Make ISIRPObject the default context … … 41 45 class BreadCrumbManager(grok.ViewletManager): 42 46 grok.name('breadcrumbs') 47 48 class LanguageManager(grok.ViewletManager): 49 grok.name('languages') 43 50 44 51 class ActionBar(grok.ViewletManager): … … 200 207 url = self.view.url(breadcrumb.context, breadcrumb.target) 201 208 ) 209 210 class LanguageLink(grok.Viewlet): 211 """ An entry in the language selector. 212 213 This is only a baseclass that won't be rendered actually. Deriving 214 viewlets can override certain values and will be rendered with the 215 values set here as default. 216 """ 217 grok.baseclass() 218 grok.viewletmanager(LanguageManager) 219 grok.context(ISIRPObject) 220 grok.require('waeup.Public') 221 lang = 'de' 222 title = u'Deutsch' 223 224 def render(self): 225 args = {'lang':self.lang, 'view_name':self.view.__name__} 226 url = self.view.url( 227 self.context) + '/@@change_language?%s' % urlencode(args) 228 return u'| <a href="%s" title="%s">%s</a> ' % (url,self.title,self.lang) 229 230 class English(LanguageLink): 231 """A link to switch to English. 232 """ 233 lang = 'en' 234 title = u'English' 235 236 class French(LanguageLink): 237 """A link to switch to French. 238 """ 239 lang = 'fr' 240 title = u'Français' 241 242 class German(LanguageLink): 243 """A link to switch to German. 244 """ 245 lang = 'de' 246 title = u'Deutsch' 247 248 class Hausa(LanguageLink): 249 """A link to switch to Hausa. 250 """ 251 lang = 'ha' 252 title = u'Hausa' 253 254 class Yoruba(LanguageLink): 255 """A link to switch to Yoruba. 256 """ 257 lang = 'yo' 258 title = u'Yoruba' 202 259 203 260 … … 623 680 624 681 pnav = 1 625 tab_title = u'Academics'682 tab_title = _(u'Academics') 626 683 627 684 @property … … 638 695 grok.order(6) 639 696 grok.require('waeup.Anonymous') 640 tab_title = u'Enquiries'697 tab_title = _(u'Enquiries') 641 698 pnav = 2 642 699
Note: See TracChangeset for help on using the changeset viewer.