Skip to content

Commit

Permalink
Dev: various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 27, 2016
1 parent 479c69e commit 91c80c8
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 81 deletions.
2 changes: 1 addition & 1 deletion application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -1510,8 +1510,8 @@ public static function getQuestionReplacement($aQuestionQanda)
$sTemplateUrl=Template::model()->getTemplateURL($oSurveyId->template);
if(flattenText($aReplacement['QUESTIONHELP'], true,true) != '')
{
$aReplacement['QUESTIONHELP']= Yii::app()->getController()->renderPartial('/survey/system/questionhelp/questionhelp', array('questionHelp'=>$aReplacement['QUESTIONHELP']), true);;

$aReplacement['QUESTIONHELP']= '<div class="alert alert-info questionhelp"><span class="glyphicon glyphicon-question-sign"></span>&nbsp'.$aReplacement['QUESTIONHELP'].'</div>';
}
// Core value :the classes
$aReplacement['QUESTION_CLASS'] = Question::getQuestionClass($sType);
Expand Down
4 changes: 1 addition & 3 deletions application/helpers/frontend_helper.php
Expand Up @@ -146,8 +146,6 @@ function makegraph($currentstep, $total)
$size = intval(($currentstep-1)/$total*100);

$graph='
</script>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="'.$size.'" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: '.$size.'%;">
'.$size.'%
Expand Down Expand Up @@ -220,7 +218,7 @@ function makeLanguageChangerSurvey($sSelectedLanguage)
'sClass' => $sClass ,
'sTargetURL'=> $sTargetURL,
);

$sHTMLCode = Yii::app()->getController()->renderPartial('/survey/system/LanguageChanger/LanguageChanger', $languageChangerDatas, true);
return $sHTMLCode;
}
Expand Down
93 changes: 31 additions & 62 deletions application/helpers/qanda_helper.php
Expand Up @@ -1251,8 +1251,6 @@ function do_list_dropdown($ia)
if($optCategorySeparator=='')
unset($optCategorySeparator);

$answer='';

//// Retrieving datas

// Getting question
Expand All @@ -1263,6 +1261,8 @@ function do_list_dropdown($ia)
$ansresult = $oQuestion->getOrderedAnswers($aQuestionAttributes['random_order'], $aQuestionAttributes['alphasort'] );

$dropdownSize = '';


if (isset($aQuestionAttributes['dropdown_size']) && $aQuestionAttributes['dropdown_size'] > 0)
{
$_height = sanitize_int($aQuestionAttributes['dropdown_size']) ;
Expand Down Expand Up @@ -1295,6 +1295,13 @@ function do_list_dropdown($ia)
$_rowNum=0;
$_prefix='';

$selectData = array(
'name'=>$ia[1],
'dropdownSize'=>$dropdownSize,
'checkconditionFunction'=>$checkconditionFunction
);
$answer = Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/select', $selectData, true);

if (!isset($optCategorySeparator))
{
foreach ($ansresult as $ansrow)
Expand Down Expand Up @@ -1390,7 +1397,7 @@ function do_list_dropdown($ia)
'opt_select'=>'SELECTED',
'answer'=>gT('Please choose...')
);
$answer = Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/option', $optionData, true).$answer;
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/option', $optionData, true);
}

if (isset($other) && $other=='Y')
Expand Down Expand Up @@ -1430,12 +1437,6 @@ function do_list_dropdown($ia)
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/option', $optionData, true);
}

$selectData = array(
'name'=>$ia[1],
'value'=>$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]],
);

$answer .= Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/select_footer', $selectData, true);

if (isset($other) && $other=='Y')
{
Expand All @@ -1446,30 +1447,9 @@ function do_list_dropdown($ia)
$sselect_show_hide = '';
}

$sselect = '';
//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$sselect .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code
$sselectData = array(

);

$sselectData = array(
'name'=>$ia[1],
'dropdownSize'=>$dropdownSize,
'checkconditionFunction'=> $checkconditionFunction.'(this.value, this.name, this.type);'.$sselect_show_hide,
'value'=>$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]],
);

$sselect .= Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/select_footer', $sselectData, true);
$answer = $sselect.$answer;

if (isset($other) && $other=='Y')
{
$answer = "\n<script type=\"text/javascript\">\n"
$answer .= "\n<script type=\"text/javascript\">\n"
."<!--\n"
."function showhideother(name, value)\n"
."\t{\n"
Expand All @@ -1485,7 +1465,7 @@ function do_list_dropdown($ia)
."document.getElementById(hiddenothername).value='';\n" // reset othercomment field
."}\n"
."\t}\n"
."//--></script>\n".$answer;
."//--></script>\n";
$answer .= '<br/>';
$answer .= ' <input class="form-control" type="text" id="othertext'.$ia[1].'" name="'.$ia[1].'other" style="display:';

Expand All @@ -1511,38 +1491,26 @@ function do_list_dropdown($ia)
// --> END NEW FEATURE - SAVE
$inputnames[]=$ia[1]."other";
}
else
{
$answer .= "</p>";
}

// $checkotherscript = "";
// if (isset($other) && $other == 'Y' && $aQuestionAttributes['other_comment_mandatory']==1)
// {
// $checkotherscript = "\n<script type='text/javascript'>\n"
// . "\t<!--\n"
// . "oldonsubmitOther_{$ia[0]} = document.limesurvey.onsubmit;\n"
// . "function ensureOther_{$ia[0]}()\n"
// . "{\n"
// . "\tothercommentval=document.getElementById('othertext{$ia[1]}').value;\n"
// . "\totherval=document.getElementById('answer{$ia[1]}').value;\n"
// . "\tif (otherval == '-oth-' && othercommentval == '') {\n"
// . "alert('".sprintf(gT("You've selected the \"%s\" answer for question \"%s\". Please also fill in the accompanying \"other comment\" field.","js"),trim(javascriptEscape($othertext,true,true)),trim(javascriptEscape($ia[3],true,true)))."');\n"
// . "return false;\n"
// . "\t}\n"
// . "\telse {\n"
// . "if(typeof oldonsubmitOther_{$ia[0]} == 'function') {\n"
// . "\treturn oldonsubmitOther_{$ia[0]}();\n"
// . "}\n"
// . "\t}\n"
// . "}\n"
// . "document.limesurvey.onsubmit = ensureOther_{$ia[0]};\n"
// . "\t-->\n"
// . "</script>\n";
// }
// $answer = $checkotherscript . $answer;
$sselectData = array(
'name'=>$ia[1],
'dropdownSize'=>$dropdownSize,
'checkconditionFunction'=> $checkconditionFunction.'(this.value, this.name, this.type);'.$sselect_show_hide,
'value'=>$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]],
);

$answer .= Yii::app()->getController()->renderPartial('/survey/questions/list_dropdown/select_footer', $sselectData, true);


$inputnames[]=$ia[1];

//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$sselect .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code

return array($answer, $inputnames);
}

Expand Down Expand Up @@ -2928,7 +2896,8 @@ function do_multipleshorttext($ia)
'labelText'=>$ansrow['question'],
'prefix'=>$prefix,
'kpclass'=>$kpclass,
'rows'=>$drows.' '.$maxlength,
'rows'=>$drows,
'maxlength'=>$maxlength,
'checkconditionFunction'=>$checkconditionFunction.'(this.value, this.name, this.type)',
'dispVal'=>$dispVal,
'suffix'=>$suffix,
Expand Down
Expand Up @@ -7,7 +7,7 @@
* @var $slider_rating
*/
?>
</div>

<input
type="hidden"
name="java<?php echo $ia[1];?>"
Expand Down
@@ -1,7 +1,6 @@
<?php
/**
* List DropDown Option group header Html
* @var $categoryname flattenText($categoryname)
* List DropDown Option group footer Html
*/
?>
<optgroup class="dropdowncategory" label="<?php echo $categoryname;?>">
</optgroup>
@@ -1,6 +1,7 @@
<?php
/**
* List DropDown Option group footer Html
* List DropDown Option group header Html
* @var $categoryname flattenText($categoryname)
*/
?>
</optgroup>
<optgroup class="dropdowncategory" label="<?php echo $categoryname;?>">
Expand Up @@ -5,6 +5,7 @@
* @var $value $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]
*/
?>
<!-- list_dropdown select_footer -->
</select>
<input
type="hidden"
Expand Down
4 changes: 3 additions & 1 deletion application/views/survey/questions/longfreetext/item.php
Expand Up @@ -11,6 +11,7 @@
* @var $dispVal
*/
?>
<!-- longfreetext item -->
<p class='question answer-item text-item <?php echo $extraclass; ?>'>
<label for='answer<?php echo $name; ?>' class='hide label'>
<?php eT('Your answer'); ?>
Expand All @@ -24,7 +25,8 @@ class="form-control textarea <?php echo $kpclass; ?>"
cols="<?php echo $tiwidth; ?>"
<?php echo $maxlength; ?>
onkeyup="<?php echo $checkconditionFunction;?>"
/>
>
<?php echo $dispVal;?>
</textarea>
</p>
<!-- End : longfreetext item -->
Expand Up @@ -4,4 +4,4 @@
*/
?>

</ul>
</div>
Expand Up @@ -3,4 +3,4 @@
* Multiple short texts question, header Html
*/
?>
<ul class="list-unstyled subquestions-list questions-list text-list">
<div class="list-unstyled subquestions-list questions-list text-list">
Expand Up @@ -16,8 +16,7 @@
* @var $checkconditionFunction $checkconditionFunction.'(this.value, this.name, this.type);"
*/
?>


<!--item_inputtext -->
<li class="question-item answer-item text-item <?php echo $extraclass;?>" <?php echo $sDisplayStyle;?> >
<?php if($alert):?>
<!-- color code missing mandatory questions red -->
Expand Down
Expand Up @@ -14,8 +14,9 @@
* @var $suffix
*/
?>
<!-- Multiple short texts question, item text area Html -->
<!-- question attribute "display_rows" is set -> we need a textarea to be able to show several rows -->
<li class="question-item answer-item text-item <?php echo $extraclass;?>" <?php echo $sDisplayStyle;?>>
<div class="question-item answer-item text-item <?php echo $extraclass;?>" <?php echo $sDisplayStyle;?>>
<div class="form-group-row row">
<label class='control-label col-xs-12' for="answer<?php echo $myfname; ?>">
<?php echo $labelText;?>
Expand All @@ -28,10 +29,11 @@ class="form-control textarea <?php echo $kpclass;?>"
name="<?php echo $myfname;?>"
id="answer<?php echo $myfname;?>"
rows="<?php echo $rows;?>"
<?php echo $maxlength;?>
onkeyup="<?php echo $checkconditionFunction; ?>"
>
<?php echo $dispVal;?>
</textarea>
<?php echo $suffix;?>
</div>
</li>
</div>
Expand Up @@ -38,4 +38,4 @@ class="text <?php echo $kpclass;?>"

<!-- Suffix -->
<?php echo $suffix; ?>
</p>;
</p>
11 changes: 11 additions & 0 deletions application/views/survey/system/questionhelp/questionhelp.php
@@ -0,0 +1,11 @@
<?php
/**
* Question help. For now, called from SurveyRunTime::getQuestionReplacement
* @var $questionHelp $aReplacement['QUESTIONHELP']
*/
?>
<!-- views/survey/system/questionhelp -->
<div class="alert alert-info questionhelp">
<span class="glyphicon glyphicon-question-sign"></span>
&nbsp;<?php echo $questionHelp; ?>
</div>
3 changes: 2 additions & 1 deletion templates/default/views/question.pstpl
Expand Up @@ -13,7 +13,8 @@
<!-- Question help -->
<div class="row question-wrapper">
<div class="col-sm-12 questionhelpcontainer">
<span class='glyphicon glyphicon-help'></span>{QUESTION_HELP}
<span class='glyphicon glyphicon-help'></span>
{QUESTION_HELP}
</div>
</div>

Expand Down

0 comments on commit 91c80c8

Please sign in to comment.