-##parameters=
-form = context.REQUEST.form
-formId = form.get('formId')
-epozInsert = form.get('epozInsert', False)
-file = form.get('file', None)
-fileOb = None
-
-if file : fileOb = context.addAttachment(file, formId)
-
-onload = None
-if fileOb is not None :
- if fileOb.meta_type == 'Photo' :
- fileUrl = 'attachments/%s/getThumbnail' % fileOb.getId()
- if epozInsert :
- onload = "dispatchImageAndHideUploadForm('%s', '%s', true);" % (fileUrl, formId)
- else :
- ratio = float(fileOb.height)/fileOb.width
- dispatchValue = "%f_%s" % (ratio, fileUrl)
- onload = "dispatchImageAndHideUploadForm('%s','%s', false);" % (dispatchValue, formId)
- else :
- dispatchValue = '%s[%s]' % (fileOb.getId(), 'attachments/'+fileOb.getId())
- onload = "dispatchFileAndHideUploadForm('%s', '%s');" % (dispatchValue, formId)
-
-hideFormCode = "hideUploadForm('%s');" % formId
-
-return context.plinn_attachment_template(onload=onload,
- hideFormCode=hideFormCode,
- formId=formId)
\ No newline at end of file