Skip to content

Commit

Permalink
Fixed issue #09259: slider min/max can be set as non-numeric, which t…
Browse files Browse the repository at this point in the history
…hen breaks survey

New feature : can use Expression Manager in slider min/max/step and default
Dev: this fix survey manager error : and error is shown on survey logic file
Dev: todo : find a way to show an 'alert' on survey logic file if EM have var in same page
  • Loading branch information
Shnoulle committed Sep 27, 2014
1 parent 1707438 commit d53b377
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
8 changes: 4 additions & 4 deletions application/helpers/common_helper.php
Expand Up @@ -3416,31 +3416,31 @@ function questionAttributes($returnByName=false)
'category'=>$clang->gT('Slider'),
'sortorder'=>10,
'inputtype'=>'text',
"help"=>$clang->gT('Slider minimum value'),
"help"=>$clang->gT('You can use Expression manager, but this must be a number before showing the page else set to 0. If minimum value is not set, this value is used.'),
"caption"=>$clang->gT('Slider minimum value'));

$qattributes["slider_max"]=array(
"types"=>"K",
'category'=>$clang->gT('Slider'),
'sortorder'=>11,
'inputtype'=>'text',
"help"=>$clang->gT('Slider maximum value'),
"help"=>$clang->gT('You can use Expression manager, but this must be a number before showing the page else set to 100. If maximum value is not set, this value is used.'),
"caption"=>$clang->gT('Slider maximum value'));

$qattributes["slider_accuracy"]=array(
"types"=>"K",
'category'=>$clang->gT('Slider'),
'sortorder'=>30,
'inputtype'=>'text',
"help"=>$clang->gT('Slider accuracy'),
"help"=>$clang->gT('You can use Expression manager, but this must be a number before showing the page else set to 1.'),
"caption"=>$clang->gT('Slider accuracy'));

$qattributes["slider_default"]=array(
"types"=>"K",
'category'=>$clang->gT('Slider'),
'sortorder'=>50,
'inputtype'=>'text',
"help"=>$clang->gT('Slider start as this value (this will set the initial value).'),
"help"=>$clang->gT('Slider start as this value (this will set the initial value). You can use Expression manager, but this must be a number before showing the page.'),
"caption"=>$clang->gT('Slider initial value'));

$qattributes["slider_middlestart"]=array(
Expand Down
4 changes: 4 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -9090,6 +9090,10 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
case 'max_num_of_files':
case 'multiflexible_max':
case 'multiflexible_min':
case 'slider_accuracy':
case 'slider_min':
case 'slider_max':
case 'slider_default':
$value = '{' . $value . '}';
break;
case 'other_replace_text':
Expand Down
38 changes: 8 additions & 30 deletions application/helpers/qanda_helper.php
Expand Up @@ -3165,36 +3165,14 @@ function do_multiplenumeric($ia)
$prefixclass="slider";
$slider_layout=true;
$extraclass .=" withslider";
if (trim($aQuestionAttributes['slider_accuracy'])!='')
{
$slider_step = $aQuestionAttributes['slider_accuracy'];
}
else
{
$slider_step = 1;
}

if (trim($aQuestionAttributes['slider_min'])!='')
{
$slider_mintext = $aQuestionAttributes['slider_min'];
$slider_min = $aQuestionAttributes['slider_min'];
}
else
{
$slider_mintext = 0;
$slider_min = 0;
}
if (trim($aQuestionAttributes['slider_max'])!='')
{
$slider_maxtext = $aQuestionAttributes['slider_max'];
$slider_max = $aQuestionAttributes['slider_max'];
}
else
{
$slider_maxtext = "100";
$slider_max = 100;
}
$slider_default= (trim($aQuestionAttributes['slider_default'])!='')?$aQuestionAttributes['slider_default']:"";
$slider_step=trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_accuracy']}}",$ia[0],array(),false,1,1,false,false,true));
$slider_step = (is_numeric($slider_step))?$slider_step:1;
$slider_min = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_min']}}",$ia[0],array(),false,1,1,false,false,true));
$slider_mintext = $slider_min = (is_numeric($slider_min))?$slider_min:0;
$slider_max = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_max']}}",$ia[0],array(),false,1,1,false,false,true));
$slider_maxtext = $slider_max = (is_numeric($slider_max))?$slider_max:100;
$slider_default=trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_default']}}",$ia[0],array(),false,1,1,false,false,true));
$slider_default = (is_numeric($slider_default))?$slider_default:"";

if ($slider_default == '' && $aQuestionAttributes['slider_middlestart']==1)
{
Expand Down

0 comments on commit d53b377

Please sign in to comment.