Ignore:
Timestamp:
9 Mar 2008, 12:47:17 (17 years ago)
Author:
joachim
Message:

implement #500

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_upload/uploads_index.py

    r3291 r3292  
    1 ## Script (Python) "getUploadsInfo"
     1## Script (Python) "uploads_index"
    22##bind container=container
    33##bind context=context
     
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=student=None
     7##parameters=
    88##title=
    99##
    10 # $Id:getUploadsInfo.py 486 2006-09-06 10:09:39Z joachim $
     10# $Id:uploads_index.py 486 2006-09-06 10:09:39Z joachim $
    1111"""
    1212return Info about the Uploads
     
    3535info['doc'] = context.getContent()
    3636
    37 items = []
    3837edit = request.form.has_key('edit')
    3938ids = request.get('ids',[])
     
    5958        request.RESPONSE.redirect(context.absolute_url())
    6059
     60wrong = []
     61imported = []
     62importable = []
    6163for id,upload in context.objectItems():
     64    add_to = wrong
    6265    row = {}
    6366    doc = upload.getContent()
     
    6770    row['title'] = doc.filename
    6871    row['url'] = upload.absolute_url()
    69     row['msg'], row['invalid_keys'] = doc['checkKeys']()
     72    row['imported'] = False
     73    row['invalid_keys'] = []
     74    import_message = getattr(doc,'import_message','')
     75    if import_message:
     76        row['imported'] = True
     77        row['msg'] = import_message
     78        row['imported_at'] = doc.imported_at.strftime("%d/%m/%y %H:%M:%S")
     79        add_to = imported
     80    else:
     81        row['msg'],row['invalid_keys'] = doc['checkKeys']()
     82        if not row['msg'] and not row['invalid_keys']:
     83            add_to = importable
    7084    row['filename'] = doc.filename
    7185    row['import_layout'] = doc.import_layout
    7286    row['upload_date'] =  doc.upload_date.strftime("%d/%m/%y %H:%M:%S")
    7387    row['uploaded_by'] = doc.uploaded_by
    74     items.append(row)
    75 items.sort()
    76 info['items'] = items
     88    add_to.append(row)
     89wrong.sort()
     90imported.sort()
     91importable.sort()
     92info['wrong'] = wrong
     93info['imported'] = imported
     94info['importable'] = importable
    7795
    7896validate = "upload" in request.keys()
Note: See TracChangeset for help on using the changeset viewer.