Skip to content

Commit

Permalink
Fixed issue #12739: File upload question format: Title and comment ma…
Browse files Browse the repository at this point in the history
…y be garbled when going back and forth
  • Loading branch information
c-schmitz committed Oct 12, 2017
1 parent 3e3a2ce commit 5605450
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions application/helpers/qanda_helper.php
Expand Up @@ -2511,13 +2511,12 @@ function upload_$ia[1]() {
$filecountvalue = $tempval;
}
}
$value = htmlspecialchars($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]],ENT_QUOTES,'utf-8');
$fileuploadDatas = array(
$fileuploadData = array(
'fileid' => $ia[1],
'value' => $value,
'value' => $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]],
'filecountvalue'=>$filecountvalue,
);
$answer .= doRender('/survey/questions/file_upload/answer', $fileuploadDatas, true);
$answer .= doRender('/survey/questions/file_upload/answer', $fileuploadData, true);

$answer .= '<script type="text/javascript">
var surveyid = '.Yii::app()->getConfig('surveyID').';
Expand Down
6 changes: 4 additions & 2 deletions application/views/survey/questions/file_upload/answer.php
Expand Up @@ -20,8 +20,10 @@ class='btn btn-default upload'
<span class='fa fa-upload'></span>&nbsp;<?php eT('Upload files'); ?>
</a>
</div>
<input type='hidden' id='<?php echo $fileid;?>' name='<?php echo $fileid;?>' value='<?php echo $value;?>' />
<input type='hidden' id='<?php echo $fileid;?>_filecount' name='<?php echo $fileid;?>_filecount' value="<?php echo $filecountvalue?>" />
<?php
echo CHtml::hiddenField($fileid, $value, array('name'=>$fileid));
echo CHtml::hiddenField($fileid.'_filecount', $filecountvalue, array('name'=>$fileid.'_filecount'));
?>
<div id='<?php echo $fileid;?>_uploadedfiles'>
</div>
<!-- end of answer -->
2 changes: 1 addition & 1 deletion scripts/modaldialog.js
Expand Up @@ -82,7 +82,7 @@ function displayUploadedFiles(jsonstring, filecount, fieldname, show_title, show

if (jsonstring !== '')
{
jsonobj = eval('(' + jsonstring + ')');
jsonobj = JSON.parse(jsonstring);
display = '<table width="100%" class="question uploadedfiles"><thead><tr><td width="20%">&nbsp;</td>';
if (show_title != 0)
display += '<th>'+uploadLang.headTitle+'</th>';
Expand Down

0 comments on commit 5605450

Please sign in to comment.