Skip to content

Commit

Permalink
Fixed issue #11144: Response view shifted when file upload question i…
Browse files Browse the repository at this point in the history
…s used and description/title attribute is disabled
  • Loading branch information
c-schmitz committed Jun 3, 2016
1 parent 3ee8f0b commit a57c76d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 10 additions & 2 deletions application/controllers/admin/responses.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,16 @@ public function getResponses_json($iSurveyID)
{
if (isset($aFilesInfo[$iFileIndex]))
{
$aSurveyEntry[] = htmlspecialchars($aFilesInfo[$iFileIndex]['title'],ENT_QUOTES, 'UTF-8');
$aSurveyEntry[] = htmlspecialchars($aFilesInfo[$iFileIndex]['comment'],ENT_QUOTES, 'UTF-8');
if ($aQuestionAttributes['show_title'])
{
if (!isset($aFilesInfo[$iFileIndex]['title'])) $aFilesInfo[$iFileIndex]['title']='';
$aSurveyEntry[] = htmlspecialchars($aFilesInfo[$iFileIndex]['title'],ENT_QUOTES, 'UTF-8');
}
if ($aQuestionAttributes['show_comment'])
{
if (!isset($aFilesInfo[$iFileIndex]['comment'])) $aFilesInfo[$iFileIndex]['comment']='';
$aSurveyEntry[] = htmlspecialchars($aFilesInfo[$iFileIndex]['comment'],ENT_QUOTES, 'UTF-8');
}
$aSurveyEntry[] = CHtml::link(rawurldecode($aFilesInfo[$iFileIndex]['name']), $this->getController()->createUrl("/admin/responses",array("sa"=>"actionDownloadfile","surveyid"=>$surveyid,"iResponseId"=>$row['id'],"sFileName"=>$aFilesInfo[$iFileIndex]['name'])) );
$aSurveyEntry[] = sprintf('%s Mb',round($aFilesInfo[$iFileIndex]['size']/1000,2));
}
Expand Down
20 changes: 14 additions & 6 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1554,16 +1554,24 @@ function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $sLanguage)
case "|": //File upload
if (substr($sFieldCode, -9) != 'filecount') {
//Show the filename, size, title and comment -- no link!
$files = json_decode($sValue);
$files = json_decode($sValue,true);
$sValue = '';
if (is_array($files)) {
foreach ($files as $file) {
$sValue .= rawurldecode($file->name) .
' (' . round($file->size) . 'KB) ' .
strip_tags($file->title);
if (trim(strip_tags($file->comment))!="")
if (!isset($file['title']))
{
$sValue .=' - ' . strip_tags($file->comment);
$file['title']='';
}
if (!isset($file['comment']))
{
$file['comment']='';
}
$sValue .= rawurldecode($file['name']) .
' (' . round($file['size']) . 'KB) ' .
strip_tags($file['title']);
if (trim(strip_tags($file['comment']))!="")
{
$sValue .=' - ' . strip_tags($file['comment']);
}

}
Expand Down

0 comments on commit a57c76d

Please sign in to comment.