Changeset 3283
- Timestamp:
- 7 Mar 2008, 16:37:05 (17 years ago)
- Location:
- WAeUP_SRP/base/skins/waeup_upload
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_upload/uploads_form.pt
r3277 r3283 40 40 <td align="left" valign="middle" style="width: 5px;"> 41 41 <input type="checkbox" name="ids:list" value="" id="" class="noborder" 42 tal:define="id row/id"42 tal:define="id string:${row/id}.csv" 43 43 tal:attributes="value id; 44 44 id python:'cb_' + id; … … 47 47 </td> 48 48 <td tal:condition="nothing"> <a href="view" tal:attributes="href string:${row/url}"> <span tal:content="row/id" /></a> </td> 49 <td tal:content=" row/id" ></td>49 <td tal:content="string:${row/id}.csv" ></td> 50 50 <td> 51 51 <select name="import_layout:record" tal:attributes="name string:${row/id}.import_layout:record"> … … 69 69 </span> 70 70 </td> 71 <td tal:condition=" nothing">71 <td tal:condition="python:0"> 72 72 <a href="edit" tal:attributes="href string:${row/url}/external_edit_form" 73 73 target="edit" -
WAeUP_SRP/base/skins/waeup_upload/uploads_index.py
r3277 r3283 25 25 26 26 path_info = request.get('PATH_INFO').split('/') 27 27 NO_KEY = '----' 28 28 info = {} 29 29 info['action'] = "%s" % context.absolute_url() … … 36 36 #set_trace() 37 37 if edit and ids: 38 for id in ids: 39 doc = getattr(context, "%s.csv" % id).getContent() 40 doc.edit(mapping = request.form[id]) 38 for long_id in ids: 39 short_id = long_id.replace('.csv','') 40 doc = getattr(context, long_id).getContent() 41 doc.edit(mapping = request.form[short_id]) 41 42 msg, invalid_keys = doc['checkKeys']() 42 43 new_keys = [] 43 44 for key in invalid_keys: 44 id_key = "%s|%s" % ( id,key)45 id_key = "%s|%s" % (short_id,key) 45 46 if request.form.has_key(id_key): 46 new_keys += (key,request.form.get(id_key)['valid_key']), 47 new_key = request.form.get(id_key)['valid_key'] 48 if new_key != NO_KEY: 49 new_keys += (key,new_key), 47 50 if new_keys: 48 51 doc.editHeadline(new_keys) … … 53 56 doc = upload.getContent() 54 57 row['valid_keys'] = doc['getKeys']() 58 row['valid_keys'][0] = NO_KEY 55 59 row['id'] = id.replace('.csv','') 56 60 row['title'] = doc.filename … … 75 79 commit = True, 76 80 ) 77 if psm == 'invalid': 78 return context.uploads_form(rendered = res, 79 psm = "Please correct your input!", 80 mode = mode, 81 ds = ds, 82 info = info, 83 ) 84 elif psm == '': 81 while True: 82 if psm == 'invalid': 83 psm = "Please correct your input!" 84 # return context.uploads_form(rendered = res, 85 # psm = "Please correct your input!", 86 # mode = mode, 87 # ds = ds, 88 # info = info, 89 # ) 90 elif psm == 'valid': 91 filename = ds['upload_file'].filename 92 if filename not in context.objectIds(): 93 break 94 psm = "Upload file exists" 85 95 return context.uploads_form(rendered = res, 86 96 psm = psm, … … 89 99 info = info, 90 100 ) 91 elif psm == 'valid':92 pass93 filename = ds['upload_file'].filename94 101 95 if filename not in context.objectIds(): 96 context.invokeFactory('Upload',filename) 97 upload = getattr(context,filename) 98 d = {} 99 d['filename'] = d['id'] = filename 100 d['upload_date'] = DateTime.DateTime() 101 d['import_layout'] = ds.get('import_layout','') 102 d['uploaded_by'] = str(member) 103 d['url'] = upload.absolute_url() 104 upload.getContent().edit(mapping=d) 105 #info['items'].append(d) 102 context.invokeFactory('Upload',filename) 103 upload = getattr(context,filename) 104 d = {} 105 d['filename'] = d['id'] = filename 106 d['upload_date'] = DateTime.DateTime() 107 d['import_layout'] = ds.get('import_layout','') 108 d['uploaded_by'] = str(member) 109 d['url'] = upload.absolute_url() 110 upload.getContent().edit(mapping=d) 111 106 112 request.RESPONSE.redirect(context.absolute_url()) 107 113 -
WAeUP_SRP/base/skins/waeup_upload/widget_uploadfile_render.pt
r3277 r3283 72 72 id string:${radio_name}_change" 73 73 /> 74 <label i18n:translate="cpsschemas_label_file_change"75 tal:attributes="for string:${radio_name}_change">Change</label>76 74 <input type="file" name="." size="24" 77 75 tal:attributes="name name;
Note: See TracChangeset for help on using the changeset viewer.