Ajout de l'argument « skipfile » qui permet de marquer de manière externe les élément...
[Portfolio.git] / skins / lightbox_save_control.py
1 ##parameters=title='', description='', create='', **others
2 from Products.Portfolio.utils import translate
3 def _(message) : return translate(message, context).encode('utf-8')
4
5 req = context.REQUEST
6
7 if create :
8 uids = req.SESSION.get('objects_selection', [])
9 if len(uids) == 0 :
10 return context.setStatus(False, _('No photo selected.'))
11
12 from Products.CMFCore.utils import getToolByName
13 from Products.Plinn.utils import makeValidId
14
15 mtool = getToolByName(context, 'portal_membership')
16 ttool = getToolByName(context, 'portal_types')
17
18 home = mtool.getHomeFolder()
19 id = makeValidId(home, title)
20 if not id :
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
26
27 newOb.setStatus(True, _('Lightbox created.'))
28 lightboxpath = newOb.getPhysicalPath()
29 lightboxpath = req.SESSION.set('lightboxpath', lightboxpath)
30
31 return newOb.setRedirect(newOb, immediate_view, ajax=others.get('ajax'))
32
33 else :
34 raise NotImplementedError