2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.Portfolio
.utils
import translate
4 def _(message
) : return translate(message
, context
).encode('utf-8')
7 utool
= getToolByName(context
, 'portal_url')
8 portal
= utool
.getPortalObject()
11 # check if a lightbox is currently selected
12 lightboxpath
= req
.SESSION
.get('lightboxpath', None)
13 selectionIsLightbox
= False
14 if lightboxpath
is not None :
16 lightbox
= portal
.restrictedTraverse(lightboxpath
)
17 selectionIsLightbox
= True
19 req
.SESSION
.set('lightboxpath', None)
21 # breadcrumbs customization
22 if selectionIsLightbox
:
23 lastBcTitle
= '%s (%s)' % (_('My selection'), lightbox
.title_or_id())
25 lastBcTitle
= _('My selection')
29 , 'title' : portal
.title
30 , 'url' : portal_url
},
32 {'id' : 'selection_view'
33 ,'title' : lastBcTitle
34 , 'url' : '%s/selection_view' % portal_url
}
39 options
.update(context
.getSelectionPhotosInfos())
40 options
['container_type'] = 'selection'
41 options
['selectionIsLightbox'] = selectionIsLightbox
42 options
['breadcrumbs'] = breadcrumbs
44 if selectionIsLightbox
:
45 options
['lightbox'] = lightbox
47 options
['selectionName'] = 'not saved yet'
49 return context
.selection_view_template(**options
)