source: trunk/skins/lemill/script_editPieces.py @ 1212

Revision 1212, 1.3 KB checked in by jukka, 13 years ago (diff)

Closed #990, spent 12h. It should work, but I'm not 100% happy with all of the buttons I had to made to slide_uploader-page.

Line 
1## Script (Python) "delete_resource"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##parameters=description=''
7##title=Delete resource
8##
9"""Edit several pieces at once"""
10REQUEST=context.REQUEST
11
12lenpieces= int(REQUEST.get('lenpieces'))
13values=[]
14pieces=[]
15d={}
16return_page = REQUEST.SESSION.get('return_page')
17kwargs={}
18# these two come from state.kwargs, not piece_edit form
19edit_page=return_page['edit_page']
20edit_nr=return_page['edit_nr']
21
22
23for n in range(lenpieces):
24    d={}
25    d['title'] = REQUEST.get('title_%s' % n)
26    d['description'] = REQUEST.get('description_%s' % n)
27    d['tags'] = REQUEST.get('tags_%s' % n)
28    d['originalAuthor'] = REQUEST.get('originalAuthor_%s' % n)
29    d['rights'] = REQUEST.get('rights_%s' % n)
30    values.append(d)
31    pieces.append(REQUEST.get('uid_%s' % n))
32    context.lemill_tool.savePiece(pieces[n], values[n])
33
34del REQUEST.SESSION['new_pieces']
35
36if REQUEST.SESSION.has_key('slide_uploader'):
37    n_pieces=REQUEST.SESSION['slide_uploader']
38    del REQUEST.SESSION['slide_uploader']
39    return REQUEST.RESPONSE.redirect(context.absolute_url()+'/slide_uploader?n_pieces=%s' % n_pieces)
40else:   
41    del REQUEST.SESSION['return_page']
42    return REQUEST.RESPONSE.redirect(context.absolute_url()+'/%s?edit=%s#%s' % (edit_page, edit_nr, edit_nr))
43   
Note: See TracBrowser for help on using the repository browser.