Skip to content

Commit

Permalink
Dev Merged my fixes during the last couple days from stable branch to…
Browse files Browse the repository at this point in the history
… dev

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@10088 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed May 17, 2011
1 parent 2deb3dd commit 59bf056
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 11 deletions.
2 changes: 1 addition & 1 deletion admin/activate_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php',$simulate =
case "M": //Multiple choice
case "P": //Multiple choice with comment
case "O": //DROPDOWN LIST WITH COMMENT
if ($arow['aid'] != 'other' && $arow['aid'] != 'comment' && $arow['aid'] != 'othercomment')
if ($arow['aid'] != 'other' && strpos($arow['aid'],'comment')===false && strpos($arow['aid'],'othercomment')===false)
{
$createsurvey .= " C(5)";
}
Expand Down
73 changes: 73 additions & 0 deletions admin/exportresults.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,79 @@
return;
}

<<<<<<< .working
=======




// ======================================================================
// Actual export routines start here !
// ======================================================================

$tokenTableExists=tableExists('tokens_'.$surveyid);
$aTokenFieldNames=array();

if ($tokenTableExists)
{
$aTokenFieldNames=GetTokenFieldsAndNames($surveyid);
$attributeFieldAndNames=GetTokenFieldsAndNames($surveyid,true);
$attributeFields=array_keys($attributeFieldAndNames);
}

switch ( $_POST["type"] ) {
case "doc":
header("Content-Disposition: attachment; filename=results-survey".$surveyid.".doc");
header("Content-type: application/vnd.ms-word");
$separator="\t";
break;
case "xls":
header("Content-Disposition: attachment; filename=results-survey".$surveyid.".xls");
header("Content-type: application/vnd.ms-excel");
$workbook = new PHPExcel();
// Creating the first worksheet

$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=".$surveyid;
$result=db_execute_assoc($query) or safe_die("Couldn't get privacy data<br />$query<br />".$connect->ErrorMsg());
$row = $result->FetchRow();

$sheet = $workbook->getActiveSheet();
$row['surveyls_title']=str_replace(array('*', ':', '/', '\\', '?', '[', ']'),array(' '),$row['surveyls_title']); // Remove invalid characters
$sheet->setTitle(substr($row['surveyls_title'],0,31));
$separator="~|";
break;
case "csv":
header("Content-Disposition: attachment; filename=results-survey".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
$separator=",";
break;
case "pdf":
$pdf = new PDF($pdforientation,'mm','A4');
$pdf->SetFont($pdfdefaultfont,'',$pdffontsize);
$pdf->AddPage();
$pdf->intopdf("PDF Export ".date("Y.m.d-H:i",time()));
$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=".$surveyid;
$result=db_execute_assoc($query) or safe_die("Couldn't get privacy data<br />$query<br />".$connect->ErrorMsg());
while ($row = $result->FetchRow())
{
$pdf->intopdf($clang->gT("General information in language: ").getLanguageNameFromCode($row['surveyls_language']),'B');
$pdf->ln();
$pdf->titleintopdf($row['surveyls_title'],$row['surveyls_description']);
$surveyname=$row['surveyls_title'];
}
$pdf->AddPage();
$separator="\t";
break;
default:
header("Content-Disposition: attachment; filename=results-survey".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
$separator=",";
break;
}
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");

>>>>>>> .merge-right.r10071
// Export Language is set by default to surveybaselang
// * the explang language code is used in SQL queries
// * the alang object is used to translate headers and hardcoded answers
Expand Down
8 changes: 8 additions & 0 deletions admin/preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@

$_SESSION['s_lang'] = $language;
$_SESSION['fieldmap']=createFieldMap($surveyid,'full',true,$qid);
// Prefill question/answer from defaultvalues
foreach ($_SESSION['fieldmap'] as $field)
{
if (isset($field['defaultvalue']))
{
$_SESSION[$field['fieldname']]=$field['defaultvalue'];
}
}
$clang = new limesurvey_lang($language);

$thissurvey=getSurveyInfo($surveyid);
Expand Down
6 changes: 3 additions & 3 deletions admin/printablesurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function try_debug($line)
$pdf_form = '
<form action="'.$scriptname.'?action=showprintablesurvey&amp;sid='.$surveyid.'&amp;lang='.$surveyprintlang.'" method="post">
<input type="submit" value="'.$clang->gT('PDF Export').'"/>
<input type="hidden" name="checksessionbypost" value="'.$_SESSION['checksessionpost'].'"/>
<input type="hidden" name="checksessionbypost" value="'.htmlspecialchars($_SESSION['checksessionpost']).'"/>
<input type="hidden" name="printableexport" value="true"/>
</form>
';
Expand Down Expand Up @@ -307,7 +307,7 @@ function input_type_image( $type , $title = '' , $x = 40 , $y = 1 , $line = '' )

if(!empty($title))
{
$div_title = ' title="'.$title.'"';
$div_title = ' title="'.htmlspecialchars($title).'"';
}
else
{
Expand All @@ -330,7 +330,7 @@ function input_type_image( $type , $title = '' , $x = 40 , $y = 1 , $line = '' )
// define('IMAGE_'.$type.'_SIZE' , ' width="'.$image_dimensions[0].'" height="'.$image_dimensions[1].'"');
define('IMAGE_'.$type.'_SIZE' , ' width="14" height="14"');
}
$output = '<img src="'.PRINT_TEMPLATE_URL.'print_img_'.$type.'.png"'.constant('IMAGE_'.$type.'_SIZE').' alt="'.$title.'" class="input-'.$type.'" />';
$output = '<img src="'.PRINT_TEMPLATE_URL.'print_img_'.$type.'.png"'.constant('IMAGE_'.$type.'_SIZE').' alt="'.htmlspecialchars($title).'" class="input-'.$type.'" />';
break;

case 'rank':
Expand Down
2 changes: 1 addition & 1 deletion admin/statistics_function.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('LimeSurvey');
$pdf->SetTitle('Statistic Survey '.$surveyid);
$pdf->SetTitle('Statistic survey '.$surveyid);
$pdf->SetSubject($surveyInfo['surveyls_title']);
$pdf->SetKeywords('LimeSurvey, Statistics, Survey '.$surveyid.'');
$pdf->SetDisplayMode('fullpage', 'two');
Expand Down
3 changes: 3 additions & 0 deletions common_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,8 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
$fieldmap[$fieldname]['mandatory']=$arow['mandatory'];
$fieldmap[$fieldname]['hasconditions']=$conditions;
$fieldmap[$fieldname]['usedinconditions']=$usedinconditions;
if ($qtypes[$arow['type']]['hasdefaultvalues'])
{
if ($arow['same_default'])
{
$fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='".GetBaseLanguageFromSurveyID($surveyid)."'");
Expand All @@ -2395,6 +2397,7 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
$fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='{$clang->langcode}'");
}
}
}
switch($arow['type'])
{
case "L": //RADIO LIST
Expand Down
12 changes: 6 additions & 6 deletions qanda.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ function do_boilerplate($ia)
// ---------------------------------------------------------------
function do_5pointchoice($ia)
{
global $clang;
global $clang, $imageurl;
global $js_header_includes, $css_header_includes;

if ($ia[8] == 'Y')
Expand Down Expand Up @@ -1700,12 +1700,12 @@ function do_5pointchoice($ia)
$answer.="
<div style=\"float:left;\">
<div style=\"text-align:center; margin-bottom:6px; width:370px;\"><div style=\"width:2%; float:left;\">1</div><div style=\"width:46%;float:left;\">2</div><div style=\"width:4%;float:left;\">3</div><div style=\"width:46%;float:left;\">4</div><div style=\"width:2%;float:left;\">5</div></div><br/>
<div id=\"{$id}sliderBg\" style=\"background-image:url('./images/sliderBg.png'); text-align:center; background-repeat:no-repeat; height:22px; width:396px;\">
<div id=\"{$id}sliderBg\" style=\"background-image:url('{$imageurl}/sliderBg.png'); text-align:center; background-repeat:no-repeat; height:22px; width:396px;\">
<center>
<div id=\"{$id}slider\" style=\"width:365px;\"></div>
</center>
</div></div>
<div id=\"{$id}emoticon\" style=\"text-align:left; margin:10px; padding-left:10px;\"><img id=\"{$id}img1\" style=\"margin-left:10px;\" src=\"./images/emoticons/{$value}.png\"/><img id=\"{$id}img2\" style=\"margin-left:-31px;margin-top:-31px;\" src=\"./images/emoticons/{$value}.png\" /></div>
<div id=\"{$id}emoticon\" style=\"text-align:left; margin:10px; padding-left:10px;\"><img id=\"{$id}img1\" style=\"margin-left:10px;\" src=\".{$imageurl}/emoticons/{$value}.png\"/><img id=\"{$id}img2\" style=\"margin-left:-31px;margin-top:-31px;\" src=\"{$imageurl}/emoticons/{$value}.png\" /></div>
<script type=\"text/javascript\">
$('#$id').hide();
var value=$value;
Expand All @@ -1721,7 +1721,7 @@ function do_5pointchoice($ia)
max: 5,
step: 1,
slide: function(event,ui){
$('#{$id}img2').attr('src','./images/emoticons/'+ui.value+'.png');
$('#{$id}img2').attr('src','{$imageurl}/emoticons/'+ui.value+'.png');
$('#{$id}img2').fadeIn(time);
$('#$id input').each(function(){ $(this).removeAttr('checked');});
$('#answer$ia[1]'+ui.value).attr('checked','checked');
Expand All @@ -1732,11 +1732,11 @@ function do_5pointchoice($ia)
});
}
});
$('#{$id}slider a').css('background-image', 'url(\'./images/slider.png\')');
$('#{$id}slider a').css('background-image', 'url(\'{$imageurl}/slider.png\')');
$('#{$id}slider a').css('width', '11px');
$('#{$id}slider a').css('height', '28px');
$('#{$id}slider a').css('border', 'none');
//$('#{$id}slider').css('background-image', 'url(\'./images/sliderBg.png\')');
//$('#{$id}slider').css('background-image', 'url(\'{$imageurl}/sliderBg.png\')');
$('#{$id}slider').css('visibility','hidden');
$('#{$id}slider a').css('visibility', 'visible');
</script>
Expand Down

0 comments on commit 59bf056

Please sign in to comment.