Skip to content

Commit

Permalink
Fixed issue #05981: EM attributes that should be static generate <spa…
Browse files Browse the repository at this point in the history
…n> elements
  • Loading branch information
TMSWhite committed Apr 3, 2012
1 parent f5bc206 commit faf102b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
25 changes: 24 additions & 1 deletion classes/expressions/ExpressionManager.php
Expand Up @@ -540,7 +540,14 @@ private function RDP_EvaluateConstantVarOrFunction()
if ($this->RDP_isValidVariable($token[0]))
{
$this->varsUsed[] = $token[0]; // add this variable to list of those used in this equation
$relStatus = $this->GetVarAttribute($token[0],'relevanceStatus',1);
if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$token[0]))
{
$relStatus=1; // static, so always relevant
}
else
{
$relStatus = $this->GetVarAttribute($token[0],'relevanceStatus',1);
}
if ($relStatus==1)
{
$result = array($this->GetVarAttribute($token[0],NULL,''),$token[1],'NUMBER');
Expand Down Expand Up @@ -1064,6 +1071,10 @@ public function GetAllJsVarsUsed()
$jsNames = array();
foreach ($names as $name)
{
if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$name))
{
continue;
}
$val = $this->GetVarAttribute($name,'jsName','');
if ($val != '') {
$jsNames[] = $val;
Expand Down Expand Up @@ -1095,6 +1106,10 @@ public function GetOnPageJsVarsUsed()
{
foreach ($names as $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) {
Expand All @@ -1106,6 +1121,10 @@ public function GetOnPageJsVarsUsed()
{
foreach ($names as $name)
{
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) {
Expand All @@ -1132,6 +1151,10 @@ public function GetJsVarsUsed()
$jsNames = array();
foreach ($names as $name)
{
if (preg_match("/\.(gid|grelevance|gseq|jsName|mandatory|qid|qseq|question|readWrite|relevance|rowdivid|sgqa|type)$/",$name))
{
continue;
}
$val = $this->GetVarAttribute($name,'jsName','');
if ($val != '') {
$jsNames[] = $val;
Expand Down
22 changes: 14 additions & 8 deletions classes/expressions/LimeExpressionManager.php
Expand Up @@ -2315,18 +2315,24 @@ private function setVariableAndTokenMappingsForExpressionManager($surveyid,$forc
. "','sgqa':'" . $sgqa
. "','qid':" . $questionNum
. ",'gid':" . $groupNum
. ",'mandatory':'" . $mandatory
. "','question':'" . htmlspecialchars(preg_replace('/[[:space:]]/',' ',$question),ENT_QUOTES)
. "','type':'" . $type
. "','relevance':'" . (($relevance != '') ? htmlspecialchars(preg_replace('/[[:space:]]/',' ',$relevance),ENT_QUOTES) : 1)
. "','readWrite':'" . $readWrite
. "','grelevance':'" . (($grelevance != '') ? htmlspecialchars(preg_replace('/[[:space:]]/',' ',$grelevance),ENT_QUOTES) : 1)
// . ",'mandatory':'" . $mandatory
// . "','question':'" . htmlspecialchars(preg_replace('/[[:space:]]/',' ',$question),ENT_QUOTES)
. ",'type':'" . $type
// . "','relevance':'" . (($relevance != '') ? htmlspecialchars(preg_replace('/[[:space:]]/',' ',$relevance),ENT_QUOTES) : 1)
// . "','readWrite':'" . $readWrite
// . "','grelevance':'" . (($grelevance != '') ? htmlspecialchars(preg_replace('/[[:space:]]/',' ',$grelevance),ENT_QUOTES) : 1)
. "','default':'" . (is_null($defaultValue) ? '' : $defaultValue)
. "','rowdivid':'" . (is_null($rowdivid) ? '' : $rowdivid)
. "','onlynum':'" . ($onlynum ? '1' : '')
. "','gseq':" . $groupSeq
. ",'qseq':" . $questionSeq
.$ansList."}";
// . ",'qseq':" . $questionSeq
.$ansList;

if ($type == 'M' || $type == 'P')
{
$this->varNameAttr[$jsVarName] .= ",'question':'" . htmlspecialchars(preg_replace('/[[:space:]]/',' ',$question),ENT_QUOTES) . "'";
}
$this->varNameAttr[$jsVarName] .= "}";

}

Expand Down

2 comments on commit faf102b

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be ported to Yii

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Please sign in to comment.