Mercurial > hg > orthanc
comparison OrthancExplorer/file-upload.js @ 3102:9b18c8d4d459
'fix' for Orthanc issue #21: added a select file button + a warning specific for Firefox users
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 10 Jan 2019 10:10:26 +0100 |
parents | c9c2faf76bec |
children | 81b58b549845 |
comparison
equal
deleted
inserted
replaced
3069:3db9697a0a58 | 3102:9b18c8d4d459 |
---|---|
25 .css('width', '100%') | 25 .css('width', '100%') |
26 .css('background-color', 'red'); | 26 .css('background-color', 'red'); |
27 $('#progress .label').text('Failure'); | 27 $('#progress .label').text('Failure'); |
28 }) | 28 }) |
29 .bind('fileuploaddrop', function (e, data) { | 29 .bind('fileuploaddrop', function (e, data) { |
30 let target = $('#upload-list'); | 30 appendFilesToUploadList(data.files); |
31 $.each(data.files, function (index, file) { | |
32 target.append('<li class="pending-file">' + file.name + '</li>'); | |
33 }); | |
34 target.listview('refresh'); | |
35 }) | 31 }) |
36 .bind('fileuploadsend', function (e, data) { | 32 .bind('fileuploadsend', function (e, data) { |
37 // Update the progress bar. Note: for some weird reason, the | 33 // Update the progress bar. Note: for some weird reason, the |
38 // "fileuploadprogressall" does not work under Firefox. | 34 // "fileuploadprogressall" does not work under Firefox. |
39 let progress = parseInt(currentUpload / totalUploads * 100, 10); | 35 let progress = parseInt(currentUpload / totalUploads * 100, 10); |
43 .css('width', progress + '%') | 39 .css('width', progress + '%') |
44 .css('background-color', 'green'); | 40 .css('background-color', 'green'); |
45 }); | 41 }); |
46 }); | 42 }); |
47 | 43 |
44 function appendFilesToUploadList(files) { | |
45 let target = $('#upload-list'); | |
46 $.each(files, function (index, file) { | |
47 target.append('<li class="pending-file">' + file.name + '</li>'); | |
48 }); | |
49 target.listview('refresh'); | |
50 } | |
48 | 51 |
52 $('#fileupload').live('change', function (e) { | |
53 appendFilesToUploadList(e.target.files); | |
54 }) | |
49 | 55 |
50 $('#upload').live('pageshow', function() { | 56 $('#upload').live('pageshow', function() { |
51 alert('WARNING - This page is currently affected by Orthanc issue #21: ' + | 57 if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) { |
52 '"DICOM files might be missing after uploading with Mozilla Firefox." ' + | 58 $("#issue-21-warning").css('display', 'none'); |
53 'Do not use this upload feature for clinical uses, or carefully ' + | 59 } |
54 'check that all instances have been properly received by Orthanc. ' + | 60 |
55 'Please use the command-line "ImportDicomFiles.py" script to circumvent this issue.'); | 61 // alert('WARNING - This page is currently affected by Orthanc issue #21: ' + |
62 // '"DICOM files might be missing after uploading with Mozilla Firefox." ' + | |
63 // 'Do not use this upload feature for clinical uses, or carefully ' + | |
64 // 'check that all instances have been properly received by Orthanc. ' + | |
65 // 'Please use the command-line "ImportDicomFiles.py" script to circumvent this issue.'); | |
56 $('#fileupload').fileupload('enable'); | 66 $('#fileupload').fileupload('enable'); |
57 }); | 67 }); |
58 | 68 |
59 $('#upload').live('pagehide', function() { | 69 $('#upload').live('pagehide', function() { |
60 $('#fileupload').fileupload('disable'); | 70 $('#fileupload').fileupload('disable'); |