Skip to content

Commit

Permalink
Fixed issue #13818: Error when using timer function in a question.
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Jun 28, 2018
1 parent 7338e98 commit d40dae7
Show file tree
Hide file tree
Showing 14 changed files with 9,464 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
!.gitattributes
!.editorconfig
!.travis.yml
!.babelrc


# upload directory : whole except the index.html and readme.txt
Expand Down
11 changes: 11 additions & 0 deletions application/config/questiontypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,15 @@
'scripts/array-totalsum'.$minVersion.'.js',
),
),
/* array-numeric question */
'timer-addition'=>array(
'devBaseUrl' => 'assets/packages/questions/timer/',
'basePath' => 'core.questions.timer',
'position' => CClientScript::POS_BEGIN,
'css'=> array(
),
'js'=>array(
'timer'.$minVersion.'.js',
),
),
);
2 changes: 1 addition & 1 deletion application/helpers/qanda_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ function return_timer_script($aQuestionAttributes, $ia, $disable = null)
global $thissurvey;

Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'coookies.js', CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'timer.js', CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerPackage('timer-addition');

$langTimer = array(
'hours'=>gT("hours"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
* @var $time_limit_warning_2_display_time
* @var $disable
*/
Yii::app()->getClientScript()->registerScript("TimerQuestion".$iQid, "
countdown($iQid, $time_limit, $time_limit_action, $time_limit_warning, $time_limit_warning_2, $time_limit_warning_display_time, $time_limit_warning_2_display_time, '$disable');
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
<!-- Call the countdown script -->
<script type='text/javascript'>
$(document).on('ready pjax:scriptcomplete', function()
{
countdown(<?php echo $iQid; ?>, <?php echo $time_limit; ?>, <?php echo $time_limit_action; ?>, <?php echo $time_limit_warning; ?>, <?php echo $time_limit_warning_2; ?>, <?php echo $time_limit_warning_display_time; ?>, <?php echo $time_limit_warning_2_display_time; ?>, '<?php echo $disable; ?>');
});
</script>

</div>
9 changes: 9 additions & 0 deletions assets/packages/questions/timer/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["env", {
"targets": {
"browsers": [">0.25%", "not op_mini all"]
}
}]
]
}

0 comments on commit d40dae7

Please sign in to comment.