Skip to content

Commit

Permalink
Fixed issue #08735: "Exit and clear survey" button text is a link <a>…
Browse files Browse the repository at this point in the history
… which adopts the <a> CSS-style (color)

Dev: Fix the button only, other must be in dev for 2.06 or 2.1
  • Loading branch information
Shnoulle committed Feb 20, 2014
1 parent cdc8cb9 commit 8c9c638
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
13 changes: 8 additions & 5 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -171,8 +171,8 @@ protected function createIncrementalQuestionIndex($LEMsessid, $surveyMode)
*/
function run($surveyid,$args) {
global $errormsg;

extract($args);

if (!$thissurvey) {
$thissurvey = getSurveyInfo($surveyid);
}
Expand Down Expand Up @@ -243,7 +243,6 @@ function run($surveyid,$args) {
}
else
{

//RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ########################################
if (!isset($_SESSION[$LEMsessid]['step'])) // || !$_SESSION[$LEMsessid]['step']) - don't do this for step0, else rebuild the session
{
Expand Down Expand Up @@ -272,7 +271,7 @@ function run($surveyid,$args) {
}

$totalquestions = $_SESSION['survey_'.$surveyid]['totalquestions'];

if (!isset($_SESSION[$LEMsessid]['totalsteps']))
{
$_SESSION[$LEMsessid]['totalsteps'] = 0;
Expand All @@ -296,13 +295,17 @@ function run($surveyid,$args) {
else
{
// trying to use browser back buttons, which may be disallowed if no 'previous' button is present
$LEMskipReprocessing=true;
$LEMskipReprocessing=true;
$move = "movenext"; // so will re-display the survey
$invalidLastPage=true;
$backpopup=$clang->gT("Please use the LimeSurvey navigation buttons or index. It appears you attempted to use the browser back button to re-submit a page.");
}
}

if(isset($move) && $move=="clearcancel")
{
$moveResult = LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, true, false, true);
//$backpopup=$clang->gT("Clear all need confirmation.");
}
if (!(isset($_POST['saveall']) || isset($_POST['saveprompt']) || isset($_GET['sid']) || $LEMskipReprocessing || (isset($move) && (preg_match('/^changelang_/',$move)))))
{
$_SESSION[$LEMsessid]['prevstep'] = $_SESSION[$LEMsessid]['step'];
Expand Down
3 changes: 3 additions & 0 deletions application/helpers/frontend_helper.php
Expand Up @@ -2336,6 +2336,9 @@ function getMove()
if(Yii::app()->request->getParam($sAccepteMove))
$move=$sAccepteMove;
}
if($move=='clearall' && App()->request->getPost('confirm-clearall')!='confirm'){
$move="clearcancel";
}
if($move=='default')
{
$surveyid=Yii::app()->getConfig('surveyID');
Expand Down
10 changes: 3 additions & 7 deletions application/helpers/replacements_helper.php
Expand Up @@ -368,13 +368,9 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
}
if (isset($surveyid) && !$iscompleted)
{
$aURLParams=array('move'=>'clearall','lang'=>$s_lang);
if (returnGlobal('token'))
{
$aURLParams['token'] = trim(sanitize_token(strip_tags(returnGlobal('token'))));
}
// Use a real link for accessibility : this need to be accessible without javascript
$_clearall="<a href='".Yii::app()->getController()->createUrl("survey/index/sid/$surveyid",$aURLParams,'&amp;')."' class='clearall button confirm-needed' title='".$clang->gT("Are you sure you want to clear all your responses?", 'js')."'>".$clang->gT("Exit and clear survey")."</a>";
$_clearall=CHtml::htmlButton($clang->gT("Exit and clear survey"),array('type'=>'submit','id'=>"clearall",'value'=>'clearall','name'=>'clearall','class'=>'clearall button','data-confirmedby'=>'confirm-clearall'));
$_clearall.=CHtml::checkBox("confirm-clearall",false,array('id'=>'confirm-clearall','value'=>'confirm','class'=>'hide jshide'));
$_clearall.=CHtml::label($clang->gT("Are you sure you want to clear all your responses?"),'confirm-clearall',array('class'=>'hide jshide'));
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions scripts/survey_runtime.js
Expand Up @@ -106,9 +106,10 @@ function limesurveySubmitHandler(){

// Ask confirmation on click on .needconfirm
function needConfirmHandler(){
$(document).on('click',".confirm-needed", function(event){
text=$(this).attr('title');
$(document).on('click',"[data-confirmedby]", function(event){
text=$("label[for='"+$(this).data('confirmedby')+"']").html();
if (confirm(text)) {
$("#"+$(this).data('confirmedby')).prop('checked',true);
return true;
}
$(".button.ui-button" ).button( "option", "disabled", false );
Expand Down

0 comments on commit 8c9c638

Please sign in to comment.