Skip to content

Commit

Permalink
Fixed Issue #04956: Problems with the file upload user interface
Browse files Browse the repository at this point in the history
Thank you magiclko for the patch.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@10028 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Amit Shanker committed May 1, 2011
1 parent 58c945c commit 6b9498b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions qanda.php
Expand Up @@ -3813,6 +3813,18 @@ function do_file_upload($ia)

//$answer .= '<br />Trouble uploading files? Try the <a href="#" onclick="showBasic()">Simple Uploader</a><div id="basic">'.$basic.'</div>';

$answer .= '<script type="text/javascript">
$(document).ready(function(){
var fieldname = "'.$ia[1].'";
var filecount = $("#"+fieldname+"_filecount").val();
var json = $("#"+fieldname).val();
var show_title = "'.$qidattributes["show_title"].'";
var show_comment = "'.$qidattributes["show_comment"].'";
var pos = "'.($pos ? 1 : 0).'";
displayUploadedFiles(json, filecount, fieldname, show_title, show_comment, pos);
});
</script>';

$answer .= '<script type="text/javascript">
$(".basic_'.$ia[1].'").change(function() {
var i;
Expand Down
8 changes: 7 additions & 1 deletion scripts/modaldialog.js
Expand Up @@ -120,11 +120,17 @@ function isValueInArray(arr, val) {
function displayUploadedFiles(jsonstring, filecount, fieldname, show_title, show_comment, pos) {
var jsonobj;
var i;
var display = '';

if (jsonstring == '[]') {
$('#'+fieldname+'_uploadedfiles').html(display);
return;
}

if (jsonstring !== '')
{
jsonobj = eval('(' + jsonstring + ')');
var display = '<table width="100%"><tr><th align="center" width="20%">&nbsp;</th>';
display = '<table width="100%"><tr><th align="center" width="20%">&nbsp;</th>';
if (show_title != 0)
display += '<th align="center"><b>Title</b></th>';
if (show_comment != 0)
Expand Down

0 comments on commit 6b9498b

Please sign in to comment.