Nicolas Bally 17f6826d83 assets
2011-07-05 21:51:05 +02:00

87 lines
2.1 KiB
JavaScript

function initialize_uploads()
{
$('#data_file_upload_field').fileUploadUI({
uploadTable: $('#files'),
namespace : "data_file_upload",
downloadTable: $('#files'),
dragDropSupport : true,
onLoad : function (event, files, index, xhr, handler) {
var json;
if (typeof xhr.responseText !== "undefinied") {
eval(xhr.responseText);
} else {
eval(xhr.contents().text());
}
handler.uploadRow.remove();
} ,
onLoadAll: function (){
$('#data_files .new').each(function (){
$(this).removeClass("new");
});
update_multiple_selection_text();
},
buildUploadRow: function (files, index) {
return $('<tr><td>' + files[index].name + '<\/td>' +
'<td class="file_upload_progress"><div><\/div><\/td>' +
'<td class="file_upload_cancel">' +
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
'<\/td><\/tr>');
}
});
$('#image_upload_field').fileUploadUI({
uploadTable: $('#files'),
downloadTable: $('#files'),
namespace : "image_file_upload",
dragDropSupport : true,
onLoad : function (event, files, index, xhr, handler) {
var json;
if (typeof xhr.responseText !== "undefinied") {
eval(xhr.responseText);
} else {
eval(xhr.contents().text());
}
handler.uploadRow.remove();
} ,
onLoadAll: function (){
$('#image_files .new').each(function (){
$(this).removeClass("new");
});
update_multiple_selection_text();
},
buildUploadRow: function (files, index) {
return $('<tr><td>' + files[index].name + '<\/td>' +
'<td class="file_upload_progress"><div><\/div><\/td>' +
'<td class="file_upload_cancel">' +
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
'<\/td><\/tr>');
}
});
};
$(document).ready(function ($) {
initialize_uploads();
});