2 from Products
.Portfolio
.utils
import translate
3 _
= lambda msg
: translate(msg
, context
)
6 sd
= context
.session_data_manager
.getSessionData(create
= 1)
7 path
= context
.getPhysicalPath()
12 # check if lighbox is selected
13 sessionpath
= sd
.get('lightboxpath', None)
14 lightboxSelected
= False
15 if sessionpath
== path
:
16 lightboxSelected
= True
20 sd
.set('lightboxpath', path
)
21 selection
= context
.getUidList()
22 sd
.set('objects_selection', selection
)
23 sd
.set('objects_selection_dict', dict([(uid
, True) for uid
in selection
]))
24 lightboxSelected
= True
27 sd
.set('lightboxpath', None)
28 sd
.set('objects_selection', [])
29 sd
.set('objects_selection_dict', {})
30 lightboxSelected
= False
32 elif fg('delete.x') or form
.has_key('delete') :
34 if not lightboxSelected
:
35 for uid
in [int(uid
) for uid
in uids
] :
38 selection
= sd
.get('objects_selection', [])
39 selDict
= sd
.get('objects_selection_dict', {})
40 for uid
in [int(uid
) for uid
in uids
] :
45 sd
['objects_selection'] = selection
46 sd
['objects_selection_dict'] = selDict
51 msg
= _('Photo removed.')
53 msg
= _('Removed photos.')
55 msg
= _('Nothing to remove.')
58 context
.REQUEST
.RESPONSE
.setHeader('Content-Type', 'text/xml;;charset=utf-8')
59 return '<deleted>%s</deleted>' % msg
61 context
.setStatus(True, msg
)
65 buttons
.append({'name': 'unload', 'value': 'Unload from my selection'})
67 buttons
.append({'name':'load', 'value': 'Load in my selection'})
69 options
['buttons'] = buttons
70 options
['lightboxSelected'] = lightboxSelected
71 options
['container_type'] = 'lightbox'
72 options
.update(context
.getLightboxPhotosInfos(context
))
74 return context
.lightbox_view_template(**options
)