1a06cef13d79b10ce543fde2e95bf499d65313d9
2 from Products
.Portfolio
.utils
import translate
3 _
= lambda msg
: translate(msg
, context
)
7 sd
= context
.session_data_manager
.getSessionData(create
= 1)
8 path
= context
.getPhysicalPath()
13 # check if lighbox is selected
14 sessionpath
= sd
.get('lightboxpath', None)
15 lightboxSelected
= False
16 if sessionpath
== path
:
17 lightboxSelected
= True
18 buttons
.append({'name': 'unload', 'value': 'Unload from my selection'})
20 buttons
.append({'name':'load', 'value': 'Load in my selection'})
24 sd
.set('lightboxpath', path
)
25 selection
= context
.getUidList()
26 sd
.set('objects_selection', selection
)
27 sd
.set('objects_selection_dict', dict([(uid
, True) for uid
in selection
]))
30 sd
.set('lightboxpath', None)
31 sd
.set('objects_selection', [])
32 sd
.set('objects_selection_dict', {})
34 elif fg('delete.x') or form
.has_key('delete') :
36 if not lightboxSelected
:
37 for uid
in [int(uid
) for uid
in uids
] :
40 selection
= sd
.get('objects_selection', [])
41 selDict
= sd
.get('objects_selection_dict', {})
42 for uid
in [int(uid
) for uid
in uids
] :
47 sd
['objects_selection'] = selection
48 sd
['objects_selection_dict'] = selDict
53 msg
= _('Photo removed.')
55 msg
= _('Removed photos.')
57 msg
= _('Nothing to remove.')
60 context
.REQUEST
.RESPONSE
.setHeader('Content-Type', 'text/xml;;charset=utf-8')
61 return '<deleted>%s</deleted>' % msg
63 context
.setStatus(True, msg
)
66 options
['buttons'] = buttons
67 options
['lightboxSelected'] = lightboxSelected
68 options
['container_type'] = 'lightbox'
69 options
.update(context
.getLightboxPhotosInfos(context
))
71 return context
.lightbox_view_template(**options
)