Skip to content

Commit

Permalink
Dev EM-based validation and navigation sub-system:
Browse files Browse the repository at this point in the history
Dev Bugfix of other fields in List question - was being NULLed inappropriately
Dev Refactored the EM debug system (now has 4 levels)
Dev Basic All-in-one survey mode now works

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev_tms@11553 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
TMSWhite committed Dec 1, 2011
1 parent fa242a5 commit 4a2ae3e
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 158 deletions.
10 changes: 6 additions & 4 deletions admin/preview.php
Expand Up @@ -62,9 +62,9 @@
7 => 'N',
8 => 'N' ); // ia[8] is usedinconditions

LimeExpressionManager::StartSurvey($thissurvey['sid'], 'question', ($thissurvey['anonymized']!="N"), false);
LimeExpressionManager::StartSurvey($thissurvey['sid'], 'question', ($thissurvey['anonymized']!="N"), false,$LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq+1,false,($LEMdebugLevel>=2),true);
$moveResult = LimeExpressionManager::JumpTo($qseq+1,false,true);

$answers = retrieveAnswers($ia);

Expand Down Expand Up @@ -129,9 +129,8 @@ function noop_checkconditions(value, name, type)

$content .= templatereplace(file_get_contents("$thistpl/endgroup.pstpl")).$dummy_js;
$content .= '<p>&nbsp;</form>';
$content .= templatereplace(file_get_contents("$thistpl/endpage.pstpl"));

LimeExpressionManager::FinishProcessingPage($LEMdebugLevel);
LimeExpressionManager::FinishProcessingPage();

echo $content;

Expand All @@ -141,6 +140,9 @@ function noop_checkconditions(value, name, type)
if ($LEMdebugLevel >= 2) {
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>".$moveResult['message']."</td></tr></table>\n";
}

$content .= templatereplace(file_get_contents("$thistpl/endpage.pstpl"));

echo "</html>\n";


Expand Down
282 changes: 148 additions & 134 deletions classes/eval/LimeExpressionManager.php

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion classes/eval/test/navigation_test.php
Expand Up @@ -23,11 +23,13 @@
// 24811,
);

$LEMdebugLevel = 3;

foreach ($surveys as $surveyid)
{
print '<h3>Starting survey ' . $surveyid . "</h3>";
$now = microtime(true);
LimeExpressionManager::StartSurvey($surveyid, 'group', false, true);
LimeExpressionManager::StartSurvey($surveyid, 'group', false, true,$LEMdebugLevel);
print '<b>[StartSurvey() took ' . (microtime(true) - $now) . ' seconds]</b><br/>';

while(true) {
Expand Down
22 changes: 8 additions & 14 deletions group1.php
Expand Up @@ -42,7 +42,7 @@
if (!isset($_SESSION['step'])) // || !$_SESSION['step']) - don't do this for step0, else rebuild the session
{
$totalquestions = buildsurveysession();
LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, ($thissurvey['anonymized']!="N"), true);
LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, ($thissurvey['anonymized']!="N"), true,$LEMdebugLevel);
$_SESSION['step'] = 0;
if(isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') {
//If explicitply set, hide the welcome screen
Expand All @@ -57,21 +57,21 @@
//Move current step ###########################################################################
if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev']=='Y' || $thissurvey['allowjumps']=='Y'))
{
$moveResult = LimeExpressionManager::NavigateBackwards(($LEMdebugLevel>=2));
$moveResult = LimeExpressionManager::NavigateBackwards();
if ($moveResult['at_start']) {
$_SESSION['step']=0;
unset($moveResult); // so display welcome page again
}
}
if (isset($move) && $move == "movenext")
{
$moveResult = LimeExpressionManager::NavigateForwards(false,($LEMdebugLevel>=2));
$moveResult = LimeExpressionManager::NavigateForwards(false);
}
if (isset($move) && bIsNumericInt($move) && $thissurvey['allowjumps']=='Y')
{
$move = (int)$move;
if ($move > 0 && (($move <= $_SESSION['step']) || (isset($_SESSION['maxstep']) && $move <= $_SESSION['maxstep']))) {
$moveResult = LimeExpressionManager::JumpTo($move,false,($LEMdebugLevel>=2));
$moveResult = LimeExpressionManager::JumpTo($move,false);
}
}

Expand All @@ -80,9 +80,6 @@
$move = 'movesubmit';
}
$_SESSION['step']= $moveResult['seq']+1; // step is index base 1
if ($LEMdebugLevel>=2) {
$LEMmsg = $moveResult['message'];
}
$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
}

Expand Down Expand Up @@ -338,17 +335,14 @@
{
setcookie("limesurvey_timers", "0");

LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', ($thissurvey['anonymized']!="N"), false);
LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', ($thissurvey['anonymized']!="N"), false,$LEMdebugLevel);
$gseq = LimeExpressionManager::GetGroupSeq($_REQUEST['gid']);
if ($gseq == -1) {
echo 'Invalid Group' . $_REQUEST['gid'];
}
$moveResult = LimeExpressionManager::JumpTo($gseq+1,false,($LEMdebugLevel>=2),true);
$moveResult = LimeExpressionManager::JumpTo($gseq+1,false,true);
if (isset($moveResult)) {
$_SESSION['step']= $moveResult['seq']+1; // step is index base 1?
if ($LEMdebugLevel>=2) {
$LEMmsg = $moveResult['message'];
}
}

$stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
Expand Down Expand Up @@ -642,7 +636,7 @@ function checkconditions(value, name, type)

LimeExpressionManager::FinishProcessingGroup();
echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
LimeExpressionManager::FinishProcessingPage($LEMdebugLevel);
LimeExpressionManager::FinishProcessingPage();

if (!$previewgrp){
$navigator = surveymover(); //This gets globalised in the templatereplace function
Expand Down Expand Up @@ -719,7 +713,7 @@ function checkconditions(value, name, type)
echo LimeExpressionManager::GetDebugTimingMessage();
}
if ($LEMdebugLevel >= 2) {
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>".$LEMmsg."</td></tr></table>\n";
echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>".$moveResult['message']."</td></tr></table>\n";
}
echo "</form>\n";

Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -895,7 +895,7 @@
switch ($thissurvey['format'])
{
case "A": //All in one
require_once("survey.php");
require_once("survey1.php");
break;
case "S": //One at a time
require_once("group1.php"); // question.php");
Expand Down
2 changes: 1 addition & 1 deletion printanswers.php
Expand Up @@ -174,7 +174,7 @@
}
$printoutput .= "\t<div class='printouttitle'><strong>".$clang->gT("Survey name (ID):")."</strong> $surveyname ($surveyid)</div><p>&nbsp;\n";

LimeExpressionManager::StartProcessingPage(false,true,true); // means that all variables are on the same page
LimeExpressionManager::StartProcessingPage(false,true); // means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1,($thissurvey['anonymized']!="N"),$surveyid);

Expand Down
2 changes: 1 addition & 1 deletion survey.php
Expand Up @@ -250,7 +250,7 @@
$inputnames=array();
$groupUnconditionnalQuestionsCount=array();

LimeExpressionManager::StartProcessingPage(false,true,true); // means that all variables are on the same page
LimeExpressionManager::StartProcessingPage(false,true); // means that all variables are on the same page

foreach ($_SESSION['grouplist'] as $gl)
{
Expand Down
6 changes: 4 additions & 2 deletions survey1.php
Expand Up @@ -22,6 +22,8 @@
if (!isset($_SESSION['totalsteps'])) {$_SESSION['totalsteps']=0;}
if (isset($move) && $move == "moveprev") {$_SESSION['step'] = $thisstep-1;}
if (isset($move) && $move == "movenext") {$_SESSION['step'] = $thisstep+1;}
$_SESSION['maxstep']=1;
$_SESSION['prevstep']=$_SESSION['step'];

// We do not keep the participant session anymore when the same browser is used to answer a second time a survey (let's think of a library PC for instance).
// Previously we used to keep the session and redirect the user to the
Expand Down Expand Up @@ -240,7 +242,7 @@
//******************************************************************************************************

//GET GROUP DETAILS
require_once("qanda.php");
require_once("qanda1.php");
// TMSW Mandatory -> EM
//$mandatorys=array();
//$mandatoryfns=array();
Expand All @@ -250,7 +252,7 @@
$inputnames=array();
$groupUnconditionnalQuestionsCount=array();

LimeExpressionManager::StartProcessingPage(false,true,true); // means that all variables are on the same page
LimeExpressionManager::StartProcessingPage(false,true); // means that all variables are on the same page

foreach ($_SESSION['grouplist'] as $gl)
{
Expand Down

0 comments on commit 4a2ae3e

Please sign in to comment.