efa7cc97603e1c9d6696c2b21f69e020f6ae4f6c
[Plinn.git] / skins / control / emptyClipboard.py
1 ##parameters=delete='', empty='', indexes=[], ajax=''
2 from ZTUtils import make_query
3 request = context.REQUEST
4 response = request.RESPONSE
5
6 if empty :
7 message = 'Clipboard emptied.'
8 response.expireCookie('__cp', path=request['BASEPATH1'] or "/")
9 elif delete :
10 if not indexes :
11 message = 'Please select one or more items first.'
12 elif len(indexes) == 1 :
13 message = 'Item removed from clipboard.'
14 else :
15 message = 'Items removed from clipboard.'
16 context.popCP(indexes)
17
18
19 if not ajax:
20 redirUrl = request['HTTP_REFERER'].split('?')[0] + \
21 '?' + make_query(portal_status_message=message)
22 response.redirect(redirUrl)
23 else :
24 options={}
25 options['template'] = 'widgets'
26 options['macro'] = 'clipboard'
27 options['fragmentId'] = 'clipboard'
28 return context.use_macro(**options)