090c57bf4af260d60fd9fa08fdcfa36d5e65d59a
2 form
= context
.REQUEST
.form
3 formId
= form
.get('formId')
4 epozInsert
= form
.get('epozInsert', False)
5 file = form
.get('file', None)
8 if file : fileOb
= context
.addAttachment(file, formId
)
11 if fileOb
is not None :
12 if fileOb
.meta_type
== 'Photo' :
13 fileUrl
= 'attachments/%s/getThumbnail' % fileOb
.getId()
15 onload
= "dispatchImageAndHideUploadForm('%s', '%s', true);" % (fileUrl
, formId
)
17 ratio
= float(fileOb
.height
)/fileOb
.width
18 dispatchValue
= "%f_%s" % (ratio
, fileUrl
)
19 onload
= "dispatchImageAndHideUploadForm('%s','%s', false);" % (dispatchValue
, formId
)
21 dispatchValue
= '%s[%s]' % (fileOb
.getId(), 'attachments/'+fileOb
.getId())
22 onload
= "dispatchFileAndHideUploadForm('%s', '%s');" % (dispatchValue
, formId
)
24 hideFormCode
= "hideUploadForm('%s');" % formId
26 return context
.plinn_attachment_template(onload
=onload
,
27 hideFormCode
=hideFormCode
,