|
|
@ -1316,12 +1316,12 @@ EOT; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private function addMultipleUploadJavascript($url, $inputName) |
|
|
|
private function addMultipleUploadJavascript($url, $inputName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
$icon = Display::return_icon('file_txt.gif'); |
|
|
|
$this->addHtml(" |
|
|
|
$this->addHtml(" |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
$(function () { |
|
|
|
$(function () { |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
$('#".$this->getAttribute('id')."').submit(function() { |
|
|
|
$('#".$this->getAttribute('id')."').submit(function(){ |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -1363,33 +1363,25 @@ EOT; |
|
|
|
previewCrop: true, |
|
|
|
previewCrop: true, |
|
|
|
dropzone: $('#dropzone') |
|
|
|
dropzone: $('#dropzone') |
|
|
|
}).on('fileuploadadd', function (e, data) { |
|
|
|
}).on('fileuploadadd', function (e, data) { |
|
|
|
data.context = $('<div/>').appendTo('#files'); |
|
|
|
data.context = $('<div class=\"row\" style=\"margin-bottom:35px\" />').appendTo('#files'); |
|
|
|
$.each(data.files, function (index, file) { |
|
|
|
$.each(data.files, function (index, file) { |
|
|
|
var node = $('<p/>').append($('<span/>').text(file.name)); |
|
|
|
var node = $('<div class=\"col-sm-5\">').text(file.name); |
|
|
|
/*if (!index) { |
|
|
|
|
|
|
|
node |
|
|
|
|
|
|
|
.append('<br>') |
|
|
|
|
|
|
|
.append(uploadButton.clone(true).data(data)); |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
node.appendTo(data.context); |
|
|
|
node.appendTo(data.context); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
}).on('fileuploadprocessalways', function (e, data) { |
|
|
|
}).on('fileuploadprocessalways', function (e, data) { |
|
|
|
var index = data.index, |
|
|
|
var index = data.index, |
|
|
|
file = data.files[index], |
|
|
|
file = data.files[index], |
|
|
|
node = $(data.context.children()[index]); |
|
|
|
node = $(data.context.children()[index]); |
|
|
|
if (file.preview) { |
|
|
|
if (file.preview) { |
|
|
|
node |
|
|
|
data.context |
|
|
|
.prepend('<br>') |
|
|
|
.prepend($('<div class=\"col-sm-2\">').html(file.preview)) |
|
|
|
.prepend(file.preview); |
|
|
|
; |
|
|
|
node |
|
|
|
} else { |
|
|
|
.append('<br>') |
|
|
|
data.context |
|
|
|
.append($('<span class=\"text-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); |
|
|
|
.prepend($('<div class=\"col-sm-2\">').html('".$icon."')) |
|
|
|
} |
|
|
|
; |
|
|
|
if (file.error) { |
|
|
|
|
|
|
|
node |
|
|
|
|
|
|
|
.append('<br>') |
|
|
|
|
|
|
|
.append($('<span class=\"text-danger\"/>').text(file.error)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (index + 1 === data.files.length) { |
|
|
|
if (index + 1 === data.files.length) { |
|
|
|
data.context.find('button') |
|
|
|
data.context.find('button') |
|
|
@ -1408,22 +1400,20 @@ EOT; |
|
|
|
var link = $('<a>') |
|
|
|
var link = $('<a>') |
|
|
|
.attr('target', '_blank') |
|
|
|
.attr('target', '_blank') |
|
|
|
.prop('href', file.url); |
|
|
|
.prop('href', file.url); |
|
|
|
|
|
|
|
$(data.context.children()[index]).parent().wrap(link); |
|
|
|
|
|
|
|
|
|
|
|
$(data.context.children()[index]).wrap(link); |
|
|
|
var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); |
|
|
|
|
|
|
|
$(data.context.children()[index]).parent().append(successMessage); |
|
|
|
} else if (file.error) { |
|
|
|
} else if (file.error) { |
|
|
|
var error = $('<span class=\"text-danger\"/>').text(file.error); |
|
|
|
var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error)); |
|
|
|
$(data.context.children()[index]) |
|
|
|
$(data.context.children()[index]).parent().append(error); |
|
|
|
.append('<br>') |
|
|
|
|
|
|
|
.append(error); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}).on('fileuploadfail', function (e, data) { |
|
|
|
}).on('fileuploadfail', function (e, data) { |
|
|
|
$.each(data.files, function (index) { |
|
|
|
$.each(data.files, function (index) { |
|
|
|
var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
|
|
var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
|
|
var error = $('<span class=\"text-danger\"/>').text(failedMessage); |
|
|
|
var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage)); |
|
|
|
$(data.context.children()[index]) |
|
|
|
$(data.context.children()[index]).parent().append(error); |
|
|
|
.append('<br>') |
|
|
|
|
|
|
|
.append(error); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}).prop('disabled', !$.support.fileInput) |
|
|
|
}).prop('disabled', !$.support.fileInput) |
|
|
|
.parent().addClass($.support.fileInput ? undefined : 'disabled'); |
|
|
|
.parent().addClass($.support.fileInput ? undefined : 'disabled'); |
|
|
@ -1431,8 +1421,7 @@ EOT; |
|
|
|
$('.fileinput-button').hide(); |
|
|
|
$('.fileinput-button').hide(); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
</script>" |
|
|
|
</script>"); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|