Back to index

plone3  3.1.7
globalui.py
Go to the documentation of this file.
00001 from zope import component
00002 from zope.component import getMultiAdapter
00003 from zope.lifecycleevent.interfaces import IObjectModifiedEvent
00004 
00005 from kss.core.interfaces import IKSSView
00006 
00007 from plone.app.kss.portlets import attributesModified
00008 
00009 @component.adapter(None, IKSSView, IObjectModifiedEvent)
00010 def attributesTriggerPortalTabsReload(obj, view, event):
00011     triggeringAttributes = ('title', 'description')
00012     if attributesModified(triggeringAttributes, event):
00013         ksscore = view.getCommandSet('core')
00014         selector = ksscore.getHtmlIdSelector('portal-globalnav')
00015         zopecommands = view.getCommandSet('zope')
00016         zopecommands.refreshViewlet(selector,
00017                                     'plone.portalheader',
00018                                     'plone.global_sections')
00019 
00020 @component.adapter(None, IKSSView, IObjectModifiedEvent)
00021 def attributesTriggerDocumentBylineReload(obj, view, event):
00022     ksscore = view.getCommandSet('core')
00023     selector = ksscore.getHtmlIdSelector('plone-document-byline')
00024     zopecommands = view.getCommandSet('zope')
00025     zopecommands.refreshViewlet(selector,
00026                                 'plone.belowcontenttitle',
00027                                 'plone.belowcontenttitle.documentbyline')
00028 
00029 @component.adapter(None, IKSSView, IObjectModifiedEvent)
00030 def attributesTriggerBreadcrumbsReload(obj, view, event):
00031     triggeringAttributes = ('title', 'description')
00032     if attributesModified(triggeringAttributes, event):
00033         ksscore = view.getCommandSet('core')
00034         selector = ksscore.getHtmlIdSelector('portal-breadcrumbs')
00035         zopecommands = view.getCommandSet('zope')
00036         zopecommands.refreshViewlet(selector,
00037                                     'plone.portaltop',
00038                                     'plone.path_bar')
00039 
00040 @component.adapter(None, IKSSView, IObjectModifiedEvent)
00041 def attributesTriggerHeadTitleReload(obj, view, event):
00042     triggeringAttributes = ('title', )
00043     if attributesModified(triggeringAttributes, event):
00044         htmlhead = getMultiAdapter((obj, view.request, view), name=u'plone.htmlhead')
00045         headtitle = getMultiAdapter((obj, view.request, view, htmlhead), name=u'plone.htmlhead.title')
00046         headtitle.update()
00047         ksscore = view.getCommandSet('core')
00048         ksscore.replaceHTML(
00049             'head title',
00050             headtitle.render(),
00051             withKssSetup='False')
00052