Fix multiple file upload return message when using zip files BT#10887

pull/2458/head
jmontoyaa 8 years ago
parent 0af32bb728
commit 78b24dd82d
  1. 4
      app/Resources/public/css/base.css
  2. 1
      main/inc/ajax/document.ajax.php
  3. 8
      main/inc/lib/document.lib.php
  4. 2
      main/inc/lib/fileUpload.lib.php
  5. 13
      main/inc/lib/formvalidator/FormValidator.class.php

@ -6302,10 +6302,10 @@ ul#toolnavbox-two li a.btn{
position: relative;
top: -30px;
}
a.panel-image:hover{
panel-image:hover{
background-color: #f5f5f5;
}
a.panel-image{
panel-image{
display: inline-block;
width: 100%;
border: 1px solid #DDD;

@ -118,6 +118,7 @@ switch ($action) {
get_lang('Uploaded')
);
} else {
$json['name'] = isset($file['name']) ? $file['name'] : get_lang('Unknown');
$json['url'] = '';
$json['error'] = get_lang('Error');
}

@ -2753,8 +2753,8 @@ class DocumentManager
$base_work_dir = $sys_course_path.$course_dir;
if (isset($files[$fileKey])) {
$upload_ok = process_uploaded_file($files[$fileKey], $show_output);
if ($upload_ok) {
$uploadOk = process_uploaded_file($files[$fileKey], $show_output);
if ($uploadOk) {
$new_path = handle_uploaded_document(
$course_info,
$files[$fileKey],
@ -2783,8 +2783,8 @@ class DocumentManager
}
return [
'title' => $path,
'url' => $path,
'title' => $files[$fileKey]['name'],
'url' => '#',
];
}

@ -1093,7 +1093,7 @@ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_
* @param int $groupId group.id
* @param bool $output Optional. If no output not wanted on success, set to false.
* @param bool $onlyUploadFile
* @param string $whatIfFileExists
* @param string $whatIfFileExists (only works if $onlyUploadFile is false)
*
* @return boolean true if it succeeds false otherwise
*/

@ -1683,15 +1683,20 @@ EOT;
$(data.context.children()[index]).parent().wrap(link);
// Update file name with new one from Chamilo
$(data.context.children()[index]).parent().find('.file_name').html(file.name);
var successMessage = $('<div class=\"col-sm-3\">').html(
var message = $('<div class=\"col-sm-3\">').html(
$('<span class=\"message-image-success\"/>').text('".addslashes(get_lang('UplUploadSucceeded'))."')
);
$(data.context.children()[index]).parent().append(successMessage);
$(data.context.children()[index]).parent().append(message);
} else if (file.error) {
var error = $('<div class=\"col-sm-3\">').html(
var link = $('<div>')
.attr({class : 'panel-image'}) ;
$(data.context.children()[index]).parent().wrap(link);
// Update file name with new one from Chamilo
$(data.context.children()[index]).parent().find('.file_name').html(file.name);
var message = $('<div class=\"col-sm-3\">').html(
$('<span class=\"message-image-danger\"/>').text(file.error)
);
$(data.context.children()[index]).parent().append(error);
$(data.context.children()[index]).parent().append(message);
}
});
$('#dropzone').removeClass('hover');

Loading…
Cancel
Save