@@ -3,9 +3,6 @@ | |||||
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | <%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | ||||
<%namespace name="h" file="jm2l:templates/helpers.mako"/> | <%namespace name="h" file="jm2l:templates/helpers.mako"/> | ||||
<%def name="jsAddOn()"> | <%def name="jsAddOn()"> | ||||
<script src="/js/jm2l.js"></script> | |||||
<script src="/vendor/ckeditor/ckeditor.js"></script> | |||||
<script src="/vendor/select2/js/select2.js"></script> | |||||
</%def> | </%def> | ||||
<%def name="cssAddOn()"> | <%def name="cssAddOn()"> | ||||
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css"> | <link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css"> | ||||
@@ -58,19 +55,18 @@ | |||||
</td> | </td> | ||||
% if one_dic.has_key("Justif"): | % if one_dic.has_key("Justif"): | ||||
<td style="text-align:center;"> | <td style="text-align:center;"> | ||||
${h.uploader("Justif", one_dic["User"]["uid"], "Justif")} | |||||
${h.uploader("Justif", one_dic["User"]["uid"], "Justif_"+one_dic["User"]["slug"], True)} | |||||
</td> | </td> | ||||
% else: | % else: | ||||
<td><i>Rien</i></td> | |||||
<td style="text-align:center;"><i>Rien</i></td> | |||||
% endif | % endif | ||||
</tr> | |||||
<tr> | |||||
% if one_dic.has_key("RIB"): | % if one_dic.has_key("RIB"): | ||||
<td style="text-align:center;"> | <td style="text-align:center;"> | ||||
${h.uploader("RIB", one_dic["User"]["uid"], "RIB")} | |||||
${h.uploader("RIB", one_dic["User"]["uid"], "RIB_"+one_dic["User"]["slug"], True)} | |||||
</td> | </td> | ||||
% else: | % else: | ||||
<td><i>Rien</i></td> | |||||
<td style="text-align:center;"><i>Rien</i></td> | |||||
% endif | % endif | ||||
</tr> | </tr> | ||||
% endfor | % endfor | ||||
@@ -217,13 +217,17 @@ TabJs = {'select':[], 'desc':[]} | |||||
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
## Wrapper pour uploader | ## Wrapper pour uploader | ||||
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
<%def name="uploader(MediaType, UID, desc=None)"> \ | |||||
<%def name="uploader(MediaType, UID, desc=None, disp_only=False)"> \ | |||||
<!-- The file upload form used as target for the file upload widget --> | <!-- The file upload form used as target for the file upload widget --> | ||||
<form class="fileupload" id="fileupload_${MediaType}" action="/uploader/${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data"> | |||||
% if disp_only: | |||||
<form class="fileupload" id="fileupload_${MediaType}_${UID}" action="/uploader/_${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data"> | |||||
% else: | |||||
<form class="fileupload" id="fileupload_${MediaType}_${UID}" action="/uploader/${MediaType}/${UID}/proceed" method="POST" enctype="multipart/form-data"> | |||||
% endif | |||||
<!-- Redirect browsers with JavaScript disabled to the origin page --> | <!-- Redirect browsers with JavaScript disabled to the origin page --> | ||||
<noscript><input type="hidden" name="redirect" value="/"></noscript> | <noscript><input type="hidden" name="redirect" value="/"></noscript> | ||||
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> | <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> | ||||
<div class="fileupload-buttonbar"> | |||||
<div class="fileupload-buttonbar" ${["","style=display:none"][disp_only]}> | |||||
<!-- The fileinput-button span is used to style the file input field as button --> | <!-- The fileinput-button span is used to style the file input field as button --> | ||||
<span class="btn btn-success fileinput-button"> | <span class="btn btn-success fileinput-button"> | ||||
<i class="icon-plus icon-white"></i> | <i class="icon-plus icon-white"></i> | ||||
@@ -186,6 +186,10 @@ class MediaUpload(MediaPath): | |||||
def __init__(self, request): | def __init__(self, request): | ||||
self.request = request | self.request = request | ||||
self.media_table = self.request.matchdict.get('media_table') | self.media_table = self.request.matchdict.get('media_table') | ||||
self.display_only = False | |||||
if self.media_table.startswith('_'): | |||||
self.display_only = True | |||||
self.media_table = self.media_table[1:] | |||||
self.linked_id = self.request.matchdict.get('uid') | self.linked_id = self.request.matchdict.get('uid') | ||||
if not self.linked_id.isdigit(): | if not self.linked_id.isdigit(): | ||||
raise HTTPBadRequest('Wrong Parameter') | raise HTTPBadRequest('Wrong Parameter') | ||||
@@ -398,14 +402,15 @@ class MediaUpload(MediaPath): | |||||
info['thumbnailUrl'] = self.ExtMimeIcon(mime) | info['thumbnailUrl'] = self.ExtMimeIcon(mime) | ||||
else: | else: | ||||
info['thumbnailUrl'] = self.ExtMimeIcon(mime) | info['thumbnailUrl'] = self.ExtMimeIcon(mime) | ||||
info['deleteType'] = DELETEMETHOD | |||||
info['deleteUrl'] = self.request.route_url('media_upload', | |||||
sep='', | |||||
name='', | |||||
media_table=self.media_table, | |||||
uid=self.linked_id) + '/' + name | |||||
if DELETEMETHOD != 'DELETE': | |||||
info['deleteUrl'] += '&_method=DELETE' | |||||
if not self.display_only: | |||||
info['deleteType'] = DELETEMETHOD | |||||
info['deleteUrl'] = self.request.route_url('media_upload', | |||||
sep='', | |||||
name='', | |||||
media_table=self.media_table, | |||||
uid=self.linked_id) + '/' + name | |||||
if DELETEMETHOD != 'DELETE': | |||||
info['deleteUrl'] += '&_method=DELETE' | |||||
return info | return info | ||||
else: | else: | ||||
return None | return None | ||||