Skip to content

Commit

Permalink
Fixed issue #05771: ExprMgr_process_relevance_and_tailoring need more…
Browse files Browse the repository at this point in the history
… and more time after page reload

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@12396 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
tmswhite committed Feb 7, 2012
1 parent 600f66e commit 5290f03
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions classes/eval/ExpressionManager.php
Expand Up @@ -1937,6 +1937,16 @@ public function StartProcessingGroup($sid=NULL,$rooturl='',$hyperlinkSyntaxHighl
$this->hyperlinkSyntaxHighlighting=$hyperlinkSyntaxHighlighting;
}

/**
* Clear cache of tailoring content.
* When re-displaying same page, need to avoid generating double the amount of tailoring content.
*/
public function ClearSubstitutionInfo()
{
$this->substitutionNum=0;
$this->substitutionInfo=array(); // array of JavaScripts for managing each substitution
}

/**
* Process multiple substitution iterations of a full string, containing multiple expressions delimited by {}, return a consolidated string
* @param <type> $src
Expand Down
8 changes: 7 additions & 1 deletion classes/eval/LimeExpressionManager.php
Expand Up @@ -3408,6 +3408,7 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false)
static function GetLastMoveResult()
{
$LEM =& LimeExpressionManager::singleton();
$LEM->em->ClearSubstitutionInfo(); // need to avoid double-generation of tailoring info
return (isset($LEM->lastMoveResult) ? $LEM->lastMoveResult : NULL);
}

Expand Down Expand Up @@ -4692,10 +4693,15 @@ static function StartProcessingGroup($groupNum=NULL,$anonymized=false,$surveyid=
/**
* Should be called after each group finishes
*/
static function FinishProcessingGroup()
static function FinishProcessingGroup($skipReprocessing=false)
{
// $now = microtime(true);
$LEM =& LimeExpressionManager::singleton();
if ($skipReprocessing)
{
$LEM->pageTailorInfo=array();
$LEM->pageRelevanceInfo=array();
}
$LEM->pageTailorInfo[] = $LEM->em->GetCurrentSubstitutionInfo();
$LEM->pageRelevanceInfo[] = $LEM->groupRelevanceInfo;
// $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now));
Expand Down
6 changes: 5 additions & 1 deletion group.php
Expand Up @@ -18,6 +18,7 @@

// $LEMdebugLevel - customizable debugging for Lime Expression Manager
$LEMdebugLevel=0; // LEM_DEBUG_TIMING; // (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMskipReprocessing=false; // true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
switch ($thissurvey['format'])
{
case "A": //All in one
Expand Down Expand Up @@ -93,6 +94,7 @@
// Simply re-display the current page without re-processing POST or re-validating input. Means user will lose whatever data entry the just tried
// Also flash a message
$moveResult = LimeExpressionManager::GetLastMoveResult();
$LEMskipReprocessing=true;
$move = "movenext"; // so will re-display the survey
$invalidLastPage=true;
$vpopup="<script type=\"text/javascript\">\n
Expand Down Expand Up @@ -150,6 +152,7 @@
if (!isset($moveResult) && !($surveyMode != 'survey' && $_SESSION['step'] == 0)) {
// Just in case not set via any other means, but don't do this if it is the welcome page
$moveResult = LimeExpressionManager::GetLastMoveResult();
$LEMskipReprocessing=true;
}
}

Expand Down Expand Up @@ -218,6 +221,7 @@
}

$moveResult = LimeExpressionManager::GetLastMoveResult();
$LEMskipReprocessing=true;

// TODO - does this work automatically for token answer persistence? Used to be savedsilent()
}
Expand Down Expand Up @@ -847,7 +851,7 @@ function checkconditions(value, name, type)

}

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

Expand Down

0 comments on commit 5290f03

Please sign in to comment.