Skip to content
Browse files

Fixed issue #06158: in question-by-question mode, EM replacements in …

…same group but on different page use <span>
  • Loading branch information...
1 parent dd0ce95 commit 4311ebcc4dd860d1589c21a41f3120193349a82b @TMSWhite TMSWhite committed May 31, 2012
View
61 application/helpers/expressions/em_core_helper.php
@@ -1114,39 +1114,34 @@ public function GetOnPageJsVarsUsed()
return array();
}
$jsNames = array();
- if ($this->surveyMode=='group')
+ foreach ($names as $name)
{
- foreach ($names as $name)
+ if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$name))
{
- if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$name))
- {
- continue;
- }
- $val = $this->GetVarAttribute($name,'jsName','');
- $gseq = $this->GetVarAttribute($name,'gseq','');
- if ($val != '' && $gseq == $this->groupSeq) {
- $jsNames[] = $val;
- }
+ continue;
}
- }
- else
- {
- foreach ($names as $name)
+ $val = $this->GetVarAttribute($name,'jsName','');
+ switch ($this->surveyMode)
{
- if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$name))
- {
- continue;
- }
- $val = $this->GetVarAttribute($name,'jsName','');
- $qseq = $this->GetVarAttribute($name,'qseq','');
- if ($val != '' && $qseq == $this->questionSeq) {
- $jsNames[] = $val;
- }
+ case 'group':
+ $gseq = $this->GetVarAttribute($name,'gseq','');
+ $onpage = ($gseq == $this->groupSeq);
+ break;
+ case 'question':
+ $qseq = $this->GetVarAttribute($name,'qseq','');
+ $onpage = ($qseq == $this->questionSeq);
+ break;
+ case 'survey':
+ $onpage = true;
+ break;
+ }
+ if ($val != '' && $onpage) {
+ $jsNames[] = $val;
}
}
return array_unique($jsNames);
}
-
+
/**
* Return the list of all of the JavaScript variables used by the most recent expression
* @return <type>
@@ -1788,11 +1783,10 @@ public function ProcessBooleanExpression($expr,$groupSeq=-1,$questionSeq=-1)
* Start processing a group of substitions - will be incrementally numbered
*/
- public function StartProcessingGroup($sid=NULL,$rooturl='',$hyperlinkSyntaxHighlighting=true,$surveyMode='group')
+ public function StartProcessingGroup($sid=NULL,$rooturl='',$hyperlinkSyntaxHighlighting=true)
{
$this->substitutionNum=0;
$this->substitutionInfo=array(); // array of JavaScripts for managing each substitution
- $this->surveyMode=$surveyMode;
$this->sid=$sid;
$this->hyperlinkSyntaxHighlighting=$hyperlinkSyntaxHighlighting;
}
@@ -2271,6 +2265,19 @@ public function asSplitStringOnExpressions($src)
}
/**
+ * Specify the survey mode for this survey. Options are 'survey', 'group', and 'question'
+ * @param type $mode
+ */
+ public function SetSurveyMode($mode)
+ {
+ if (preg_match('/^group|question|survey$/',$mode))
+ {
+ $this->surveyMode = $mode;
+ }
+ }
+
+
+ /**
* Pop a value token off of the stack
* @return token
*/
View
7 application/helpers/expressions/em_manager_helper.php
@@ -2487,6 +2487,7 @@ private function setVariableAndTokenMappingsForExpressionManager($surveyid,$forc
return false; // means that those variables have been cached and no changes needed
}
$now = microtime(true);
+ $this->em->SetSurveyMode($this->surveyMode);
// TODO - do I need to force refresh, or trust that createFieldMap will cache langauges properly?
$fieldmap=createFieldMap($surveyid,$style='full',$forceRefresh,false,$_SESSION['LEMlang']);
@@ -3520,8 +3521,7 @@ static function StartProcessingPage($allOnOnePage=false,$initializeVars=false)
$LEM->em->StartProcessingGroup(
isset($_SESSION['LEMsid']) ? $_SESSION['LEMsid'] : NULL,
'',
- true,
- $LEM->surveyMode
+ true
);
$LEM->setVariableAndTokenMappingsForExpressionManager($_SESSION['LEMsid']);
}
@@ -5470,8 +5470,7 @@ static function StartProcessingGroup($gseq=NULL,$anonymized=false,$surveyid=NULL
$LEM->em->StartProcessingGroup(
isset($surveyid) ? $surveyid : NULL,
'',
- isset($LEM->surveyOptions['hyperlinkSyntaxHighlighting']) ? $LEM->surveyOptions['hyperlinkSyntaxHighlighting'] : false,
- $LEM->surveyMode
+ isset($LEM->surveyOptions['hyperlinkSyntaxHighlighting']) ? $LEM->surveyOptions['hyperlinkSyntaxHighlighting'] : false
);
$LEM->groupRelevanceInfo = array();
if (!is_null($gseq))

0 comments on commit 4311ebc

Please sign in to comment.
Something went wrong with that request. Please try again.