4ee9852df4ebcda45a80cae66eae516f1c4c1044
1 ##parameters=title='', description='', create='', **others
2 from Products
.Portfolio
.utils
import translate
3 def _(message
) : return translate(message
, context
).encode('utf-8')
8 uids
= req
.SESSION
.get('objects_selection', [])
10 return context
.setStatus(False, _('No photo selected.'))
12 from Products
.CMFCore
.utils
import getToolByName
13 from Products
.Plinn
.utils
import makeValidId
15 mtool
= getToolByName(context
, 'portal_membership')
16 ttool
= getToolByName(context
, 'portal_types')
18 home
= mtool
.getHomeFolder()
19 id = makeValidId(home
, title
)
21 return context
.setStatus(False, _('You must enter a title.'))
22 newid
= ttool
.constructContent('Lightbox', home
, id, title
=title
, description
=description
, uids
=uids
)
23 newOb
= getattr(home
, newid
)
24 ti
= newOb
.getTypeInfo()
25 immediate_view
= ti
.immediate_view
27 newOb
.setStatus(True, _('Lightbox created.'))
28 lightboxpath
= newOb
.getPhysicalPath()
29 lightboxpath
= req
.SESSION
.set('lightboxpath', lightboxpath
)
31 return newOb
.setRedirect(newOb
, immediate_view
, ajax
=others
.get('ajax'))
34 raise NotImplementedError