Skip to content

Commit

Permalink
Fixed issue #11800 : time limit expiry message + disable submit
Browse files Browse the repository at this point in the history
Fixed issue #11795 : superfluous class .col-xs-12 in timer
Dev : for #11800 : use css transition
  • Loading branch information
Shnoulle committed Oct 16, 2016
1 parent 04f8af9 commit 8b97701
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 229 deletions.
1 change: 1 addition & 0 deletions application/controllers/survey/index.php
Expand Up @@ -30,6 +30,7 @@ public function run()
$aLangData=getLanguageData();
$aRadix=getRadixPointData($aLangData[ Yii::app()->getConfig('defaultlang')]['radixpoint']);
$aLSJavascriptVar['sLEMradix']=$aRadix['separator'];
$aLSJavascriptVar['lang']=new stdClass;
$sLSJavascriptVar="LSvar=".json_encode($aLSJavascriptVar) . ';';

// Template configuration
Expand Down
1 change: 1 addition & 0 deletions application/core/packages/limesurvey/survey.css
Expand Up @@ -95,3 +95,4 @@
/* in inline form : width need to be auto */
.form-inline .input-group .ls-input-group-extra{width: auto;white-space: initial;}


1 change: 1 addition & 0 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -1427,6 +1427,7 @@ public function setJavascriptVar($iSurveyId)
$aLSJavascriptVar['bNumRealValue']=(int)(bool)Yii::app()->getConfig('bNumRealValue',0);
$aRadix=getRadixPointData($aSurveyinfo['surveyls_numberformat']);
$aLSJavascriptVar['sLEMradix']=$aRadix['separator'];
$aLSJavascriptVar['lang']=new stdClass; // To add more easily some lang string here

/*
$aCfieldnameWithDependences = Condition::model()->getAllCfieldnameWithDependenciesForOneSurvey($iSurveyId);
Expand Down
50 changes: 36 additions & 14 deletions application/helpers/qanda_helper.php
Expand Up @@ -540,8 +540,16 @@ function file_validation_popup($ia, $filenotvalidated = null)
function return_timer_script($aQuestionAttributes, $ia, $disable=null)
{
global $thissurvey;
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'coookies.js');
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'coookies.js',CClientScript::POS_HEAD);
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts").'timer.js',CClientScript::POS_HEAD);

$langTimer=array(
'hours'=>gT("hours"),
'mins'=>gT("mins"),
'seconds'=>gT("seconds"),
);
/* Registering script : don't go to EM : no need usage of ls_json_encode */
App()->getClientScript()->registerScript("LSVarLangTimer","LSvar.lang.timer=".json_encode($langTimer).";",CClientScript::POS_BEGIN);
/**
* The following lines cover for previewing questions, because no $_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['fieldarray'] exists.
* This just stops error messages occuring
Expand All @@ -555,14 +563,15 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null)
//Used to count how many timer questions in a page, and ensure scripts only load once
$thissurvey['timercount'] = (isset($thissurvey['timercount']))?$thissurvey['timercount']++:1;

if ($thissurvey['format'] != "S")
{
if ($thissurvey['format'] != "G")
{
return "\n\n<!-- TIMER MODE DISABLED DUE TO INCORRECT SURVEY FORMAT -->\n\n";
//We don't do the timer in any format other than question-by-question
}
}
/* Work in all mode system : why disable it ? */
//~ if ($thissurvey['format'] != "S")
//~ {
//~ if ($thissurvey['format'] != "G")
//~ {
//~ return "\n\n<!-- TIMER MODE DISABLED DUE TO INCORRECT SURVEY FORMAT -->\n\n";
//~ //We don't do the timer in any format other than question-by-question
//~ }
//~ }

$time_limit=$aQuestionAttributes['time_limit'];
$disable_next=trim($aQuestionAttributes['time_limit_disable_next']) != '' ? $aQuestionAttributes['time_limit_disable_next'] : 0;
Expand All @@ -586,20 +595,21 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null)
$time_limit_warning_2_message=str_replace("{TIME}", $timer_html, $time_limit_warning_2_message);
$time_limit_warning_2_display_time=trim($aQuestionAttributes['time_limit_warning_2_display_time']) != '' ? $aQuestionAttributes['time_limit_warning_2_display_time']+1 : 0;
$time_limit_message_style=trim($aQuestionAttributes['time_limit_message_style']) != '' ? $aQuestionAttributes['time_limit_message_style'] : "";
$time_limit_message_style.="\n display: none;"; //Important to hide time limit message at start
$time_limit_message_class="hidden ls-timer-content ls-timer-message ls-no-js-hidden";
$time_limit_warning_style=trim($aQuestionAttributes['time_limit_warning_style']) != '' ? $aQuestionAttributes['time_limit_warning_style'] : "";
$time_limit_warning_style.="\n display: none;"; //Important to hide time limit warning at the start
$time_limit_warning_class="hidden ls-timer-content ls-timer-warning ls-no-js-hidden";
$time_limit_warning_2_style=trim($aQuestionAttributes['time_limit_warning_2_style']) != '' ? $aQuestionAttributes['time_limit_warning_2_style'] : "";
$time_limit_warning_2_style.="\n display: none;"; //Important to hide time limit warning at the start
$time_limit_warning_2_class="hidden ls-timer-content ls-timer-warning2 ls-no-js-hidden";
$time_limit_timer_style=trim($aQuestionAttributes['time_limit_timer_style']) != '' ? $aQuestionAttributes['time_limit_timer_style'] : "position: relative;";
$time_limit_timer_class="ls-timer-content ls-timer-countdown ls-no-js-hidden";

$timersessionname="timer_question_".$ia[0];
if (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$timersessionname]))
{
$time_limit=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$timersessionname];
}

$output = doRender('/survey/question_timer/timer_header', array('timersessionname'=>$timersessionname,'timersessionname'=>$timersessionname,'timersessionname'=>$timersessionname,'time_limit'=>$time_limit), true);
$output = doRender('/survey/question_timer/timer_header', array('timersessionname'=>$timersessionname,'time_limit'=>$time_limit), true);

if ($thissurvey['timercount'] < 2)
{
Expand Down Expand Up @@ -630,7 +640,15 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null)
$iAction = '3';
}

$output .= doRender('/survey/question_timer/timer_javascript', array('iAction'=>$iAction, 'disable_next'=>$disable_next, 'disable_prev'=>$disable_prev, 'time_limit_countdown_message' =>$time_limit_countdown_message ), true);
$output .= doRender('/survey/question_timer/timer_javascript', array(
'timersessionname'=>$timersessionname,
'time_limit'=>$time_limit,
'iAction'=>$iAction,
'disable_next'=>$disable_next,
'disable_prev'=>$disable_prev,
'time_limit_countdown_message' =>$time_limit_countdown_message,
'time_limit_message_delay' => $time_limit_message_delay
), true);

}

Expand All @@ -639,12 +657,16 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null)
array(
'iQid'=>$ia[0],
'time_limit_message_style'=>$time_limit_message_style,
'time_limit_message_class'=>$time_limit_message_class,
'time_limit_message'=>$time_limit_message,
'time_limit_warning_style'=>$time_limit_warning_style,
'time_limit_warning_class'=>$time_limit_warning_class,
'time_limit_warning_message'=>$time_limit_warning_message,
'time_limit_warning_2_style'=>$time_limit_warning_2_style,
'time_limit_warning_2_class'=>$time_limit_warning_2_class,
'time_limit_warning_2_message'=>$time_limit_warning_2_message,
'time_limit_timer_style'=>$time_limit_timer_style,
'time_limit_timer_class'=>$time_limit_timer_class,
),
true
);
Expand Down
25 changes: 7 additions & 18 deletions application/views/survey/question_timer/timer_content.php
Expand Up @@ -12,25 +12,14 @@
* @var
*/
?>
<div class='col-sm-12 questionmancontainer'>
<div id='question<?php echo $iQid; ?>_timer' class='alert alert-info' style='<?php echo $time_limit_message_style; ?>'>
<?php echo $time_limit_message; ?>
</div>
<div id='LS_question<?php echo $iQid; ?>_Timer' class='<?php echo $time_limit_timer_class; ?> alert alert-info' style='<?php echo $time_limit_timer_style; ?>'>
</div>

<div class='col-sm-12 questionmancontainer'>
<div id='LS_question<?php echo $iQid; ?>_warning' class='alert alert-danger' style='<?php echo $time_limit_warning_style; ?>'>
<?php echo $time_limit_warning_message; ?>
</div>
<div id='LS_question<?php echo $iQid; ?>_warning' class='<?php echo $time_limit_warning_class; ?> alert alert-warning' style='<?php echo $time_limit_warning_style; ?>'>
<?php echo $time_limit_warning_message; ?>
</div>

<div class='col-sm-12 questionmancontainer'>
<div id='LS_question<?php echo $iQid; ?>_warning_2' class='alert alert-danger' style='<?php echo $time_limit_warning_2_style; ?>'>
<?php echo $time_limit_warning_2_message; ?>
</div>
<div id='LS_question<?php echo $iQid; ?>_warning_2' class='<?php echo $time_limit_warning_2_class; ?> alert alert-warning' style='<?php echo $time_limit_warning_2_style; ?>'>
<?php echo $time_limit_warning_2_message; ?>
</div>

<div class='col-sm-12 questionmancontainer'>
<div id='LS_question<?php echo $iQid; ?>_Timer' class='alert alert-warning' style='<?php echo $time_limit_timer_style; ?>'>
</div>
<div id='question<?php echo $iQid; ?>_timer' class='<?php echo $time_limit_message_class; ?> alert alert-danger' style='<?php echo $time_limit_message_style; ?>'>
<?php echo $time_limit_message; ?>
</div>
1 change: 0 additions & 1 deletion application/views/survey/question_timer/timer_footer.php
Expand Up @@ -23,5 +23,4 @@
});
</script>

</div>
</div>
15 changes: 1 addition & 14 deletions application/views/survey/question_timer/timer_header.php
Expand Up @@ -6,17 +6,4 @@
* @var $time_limit
*/
?>
<div class="row" id="timer_header">
<div class="col-xs-12">
<input
type='hidden'
name='timerquestion'
value='<?php echo $timersessionname; ?>'
/>

<input
type='hidden'
name='<?php echo $timersessionname; ?>'
id='<?php echo $timersessionname; ?>'
value='<?php echo $time_limit; ?>'
/>
<div class="timer_header">

0 comments on commit 8b97701

Please sign in to comment.