From 2fca330a21a72b50f9d9a65316240c18f948029b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 30 Nov 2011 18:59:42 +0000 Subject: [PATCH] Dev EM-based validation and navigation sub-system: Dev removed obsolete code/comments git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev_tms@11545 b72ed6b6-b9f8-46b5-92b4-906544132732 --- group1.php | 835 +------------------------------------------------ qanda1.php | 897 +---------------------------------------------------- 2 files changed, 5 insertions(+), 1727 deletions(-) diff --git a/group1.php b/group1.php index 667e1724862..70ddcd5321d 100644 --- a/group1.php +++ b/group1.php @@ -57,7 +57,6 @@ //Move current step ########################################################################### if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev']=='Y' || $thissurvey['allowjumps']=='Y')) { -// $_SESSION['step'] = $thisstep-1; $moveResult = LimeExpressionManager::NavigateBackwards(($LEMdebugLevel>=2)); if ($moveResult['at_start']) { $_SESSION['step']=0; @@ -66,8 +65,6 @@ } if (isset($move) && $move == "movenext") { -// if ($_SESSION['step']==$thisstep) -// $_SESSION['step'] = $thisstep+1; $moveResult = LimeExpressionManager::NavigateForwards(false,($LEMdebugLevel>=2)); } if (isset($move) && bIsNumericInt($move) && $thissurvey['allowjumps']=='Y') @@ -92,7 +89,6 @@ // 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 // submit page. - //if (isset($_SESSION['finished'])) {$move='movesubmit'; } if ($_SESSION['step'] == 0) { display_first_page(); @@ -121,14 +117,12 @@ //Now, we check mandatory questions if necessary //CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED -// $notanswered=addtoarray_single(checkmandatorys($move,$backok),checkconditionalmandatorys($move,$backok)); $unansweredSQList = $moveResult['unansweredSQs']; if (strlen($unansweredSQList) > 0 && $backok != "N") { $notanswered = explode('|',$unansweredSQList); } //CHECK INPUT -// $notvalidated=checkpregs($move,$backok); $invalidSQList = $moveResult['invalidSQs']; if (strlen($invalidSQList) > 0 && $backok != "N") { $notvalidated = explode('|',$invalidSQList); @@ -144,38 +138,6 @@ if ($_SESSION['step']==0) $show_empty_group = true; -// if (isset($move) && $_SESSION['step'] != 0 && $move != "movesubmit") -// { -// while(isset($_SESSION['grouplist'][$_SESSION['step']-1]) && checkgroupfordisplay($_SESSION['grouplist'][$_SESSION['step']-1][0]) === false) -// { -// if ($_SESSION['prevstep'] > $_SESSION['step']) -// { -// $_SESSION['step']=$_SESSION['step']-1; -// } -// else -// { -// $_SESSION['step']=$_SESSION['step']+1; -// } -// if ($_SESSION['step']>$_SESSION['totalsteps']) -// { -// // We are skipping groups, but we moved 'off' the last group. -// // Now choose to implement an implicit submit (old behaviour), -// // or create an empty page giving the user the explicit option to submit. -// if (isset($show_empty_group_if_the_last_group_is_hidden) && $show_empty_group_if_the_last_group_is_hidden == true) -// { -// -// $show_empty_group = true; -// break; -// } else -// { -// $move = "movesubmit"; -// submitanswer(); // complete this answer (submitdate) -// break; -// } -// } -// } -// } - //SUBMIT ############################################################################### if ((isset($move) && $move == "movesubmit") && (!isset($notanswered) || is_array($notanswered)) && (!isset($notvalidated) || is_array($notvalidated) ) && (!isset($filenotvalidated) || !$filenotvalidated)) { @@ -392,20 +354,6 @@ $gid = $ginfo['gid']; $groupname = $ginfo['gname']; $groupdescription = $ginfo['gtext']; - -// $_SESSION['step'] = $_REQUEST['gid']+1; -// -// foreach($_SESSION['grouplist'] as $index=>$group) -// { -// if ($group[0]==$_REQUEST['gid']){ -// $grouparrayno = $index; -// break; -// } -// } -// -// $gid=$_SESSION['grouplist'][$grouparrayno][0]; -// $groupname=$_SESSION['grouplist'][$grouparrayno][1]; -// $groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; } else { @@ -417,15 +365,13 @@ } else { - $grouparrayno=$_SESSION['step']-1; - $gid=$_SESSION['grouplist'][$grouparrayno][0]; - $groupname=$_SESSION['grouplist'][$grouparrayno][1]; - $groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; + $ginfo = LimeExpressionManager::GetGroupIndexInfo($moveResult['gseq']); + $gid = $ginfo['gid']; + $groupname = $ginfo['gname']; + $groupdescription = $ginfo['gtext']; } } -//Setup an inverted fieldnamesInfo for quick lookup of field answers. -//$aFieldnamesInfoInv = aArrayInvert($_SESSION['fieldnamesInfo']); if ($_SESSION['step'] > $_SESSION['maxstep']) { $_SESSION['maxstep'] = $_SESSION['step']; @@ -441,27 +387,12 @@ require_once("qanda1.php"); //This should be qanda.php when finished //Iterate through the questions about to be displayed: - // TMSW Mandatory -> EM - -//$mandatorys=array(); -//$mandatoryfns=array(); -//$conmandatorys=array(); -//$conmandatoryfns=array(); -//$conditions=array(); $inputnames=array(); -//$qtypesarray = array(); - $qnumber = 0; -//This re-starts the group, after checking relevance, so get consistent and unduplcated set of replacement functions -// TMSW - move these two into LEM::NavigateXXX (since already calls StartProcessingGroup -//LimeExpressionManager::StartProcessingPage($thissurvey['allowjumps']=='Y'); -//LimeExpressionManager::StartProcessingGroup($gid,($thissurvey['anonymized']!="N"),$thissurvey['sid']); - foreach ($_SESSION['fieldarray'] as $key=>$ia) { -// $qtypesarray[$ia[1]] = $ia[4]; ++$qnumber; $ia[9] = $qnumber; // incremental question count; @@ -473,20 +404,13 @@ $qidattributes=getQuestionAttributes($ia[0],$ia[4]); if ($ia[4] != '*' && ($qidattributes===false || $qidattributes['hidden']==1)) { - // Should we really skip the question here, maybe the result won't be stored if we do that - // don't want to skip Equation type, otherwise mandatory hidden will prevent result from being available and stored. continue; } - // Following line DISABLED BY lemeur - // It prevents further calls to checkquestionfordisplay if using PREVIOUS button - // from the LimeSurvey Navigator Toolbar - // $_SESSION['fieldarray'][$key][7]='N'; //Get the answers/inputnames // TMSW - can content of retrieveAnswers() be provided by LEM? Review scope of what it provides. // TODO - retrieveAnswers is slow - queries database separately for each question. May be fixed in _CI or _YII ports, so ignore for now list($plus_qanda, $plus_inputnames)=retrieveAnswers($ia); - // TMSW - modify $qanda so not index-based? If not, shortcut is to replicate it. if ($plus_qanda) { $plus_qanda[] = $ia[4]; @@ -499,9 +423,7 @@ } //Display the "mandatory" popup if necessary - // TMSW Mandatory -> EM // TMSW - get question-level error messages - don't call **_popup() directly -// if (isset($notanswered) && $notanswered && $_SESSION['maxstep'] != $_SESSION['step']) if ($ginfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) { list($mandatorypopup, $popup)=mandatory_popup($ia, $notanswered); @@ -518,30 +440,6 @@ { list($filevalidationpopup, $fpopup) = file_validation_popup($ia, $filenotvalidated); } - - //Get list of mandatory questions - // TMSW Mandatory -> EM -// list($plusman, $pluscon)=create_mandatorylist($ia); -// if ($plusman !== null) -// { -// list($plus_man, $plus_manfns)=$plusman; -// $mandatorys=addtoarray_single($mandatorys, $plus_man); -// $mandatoryfns=addtoarray_single($mandatoryfns, $plus_manfns); -// } - // TMSW Mandatory -> EM -// if ($pluscon !== null) -// { -// list($plus_conman, $plus_conmanfns)=$pluscon; -// $conmandatorys=addtoarray_single($conmandatorys, $plus_conman); -// $conmandatoryfns=addtoarray_single($conmandatoryfns, $plus_conmanfns); -// } - -// //Build an array containing the conditions that apply for this page -// $plus_conditions=retrieveConditionInfo($ia); //Returns false if no conditions -// if ($plus_conditions) -// { -// $conditions = addtoarray_single($conditions, $plus_conditions); -// } } if ($ia[4] == "|") $upload_file = TRUE; @@ -568,10 +466,6 @@ if (isset($vpopup)) {echo $vpopup;} if (isset($fpopup)) {echo $fpopup;} -//foreach(file("$thistpl/startpage.pstpl") as $op) -//{ -// echo templatereplace($op); -//} echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //ALTER PAGE CLASS TO PROVIDE WHOLE-PAGE ALTERNATION @@ -613,18 +507,6 @@ END; -// If there are conditions or arrray_filter questions then include the appropriate Javascript -///* -//if ((isset($conditions) && is_array($conditions)) || -//(isset($array_filterqs) && is_array($array_filterqs)) || -//(isset($array_filterXqs) && is_array($array_filterXqs))) -//{ -// if (!isset($endzone)) -// { -// $endzone=""; -// } -// -// print << question id -// * $condition[n][1] => question with value to evaluate -// * $condition[n][2] => internal field name of element [1] -// * $condition[n][3] => value to be evaluated on answers labeled. -// * *NEW* tittle of questions to evaluate. -// * $condition[n][4] => type of question -// * $condition[n][5] => full SGQ code of question [1] -// * $condition[n][6] => method used to evaluate *NEW* -// * $condition[n][7] => scenario *NEW BY R.L.J. van den Burg* -// */ -///* -// for ($i=0;$i 1 && isset($oldscenario) && $oldscenario != $cd[7]) -// { // We have a new scenario, so "or" the scenario. -// $newjava .= ")) || (("; -// } -// elseif ($cqcount > 1 && $oldcq ==$cd[2]) -// { // Multiple values for the same question will be ORed. -// $newjava .= " || "; -// } -// elseif ($cqcount >1 && $oldcq != $cd[2]) -// { // DIffent questions within the same scenario will be ANDed. -// $newjava .= ") && ("; -// } -// $oldscenario=$cd[7]; -// -// -// if ($localEvaluationPossible == true && isset($localEvaluation)) -// { -// $newjava .= "$localEvaluation"; -// } // end local evaluations of conditions -// else -// { -// // The [3] element is for the value used to be compared with -// // If it is '' (empty) means not answered -// // then a space or a false are interpreted as no answer -// // as we let choose if the questions is answered or not -// // and doesnt care the answer, so we wait for a == or != -// // TempFix by lemeur ==> add a check on cd[3]=' ' as well because -// // condition editor seems not updated yet -// if ($cd[3] == '' || $cd[3] == ' ') -// { -// if ($cd[6] == '==') -// { -// $newjava .= "$JSsourceElt != null && ($JSsourceVal == ' ' || !$JSsourceVal)"; -// } -// else -// { -// // strange thing, isn't it ? well 0, ' ', '' or false are all false logic values then... -// $newjava .= "$JSsourceElt != null && $JSsourceVal"; -// } -// } // end specific case of No Answer -// elseif ($cd[4] == "M" || -// $cd[4] == "P") -// { -// //$newjava .= "!document.getElementById('$idname') || document.getElementById('$idname').value == ' '"; -// $newjava .= "$JSsourceElt != null && $JSsourceVal $cd[6] 'Y'"; // -// } // end specific case of M or P questions -// else -// { -// */ -// /* NEW -// * If the value is enclossed by @ -// * the value of this question must be evaluated instead. -// */ -///* -// if (preg_match('/^@([0-9]+X([0-9]+)X[^@]+)@/', $cd[3], $comparedfieldname) && isset($_SESSION['fieldnamesInfo'][$comparedfieldname[1]])) -// { -// $sgq_from_sgqa = $_SESSION['fieldnamesInfo'][$comparedfieldname[1]]; -// $qid_from_sgq=$comparedfieldname[2]; -// $q2type=$qtypesarray[$sgq_from_sgqa]; -// $idname2 = retrieveJSidname(Array('',$qid_from_sgq,$comparedfieldname[1],'Y',$q2type,$sgq_from_sgqa)); -// -// $newjava .= "( $JSsourceElt != null && $JSsourceVal != '') && "; -// -// $newjava .= "( document.getElementById('$idname2') != null && document.getElementById('$idname2').value != '') && "; -// $cqidattributes = getQuestionAttributes($cd[1]); -// //if (in_array($cd[4],array("A","B","K","N","5",":")) || (in_array($cd[4],array("Q",";")) && $cqidattributes['numbers_only']==1)) -// if (in_array($cd[6],array("<","<=",">",">="))) -// { // Numerical comparizons -// $newjava .= "(parseFloat($JSsourceVal) $cd[6] parseFloat(document.getElementById('$idname2').value))"; -// } -// elseif(preg_match("/^a(.*)b$/",$cd[6],$matchmethods)) -// { // String comparizons -// $newjava .= "($JSsourceVal ".$matchmethods[1]." document.getElementById('$idname2').value)"; -// } -// else -// { -// $newjava .= "($JSsourceVal $cd[6] document.getElementById('$idname2').value)"; -// } -// -// } // end target @SGQA@ -// elseif ($thissurvey['anonymized'] == "N" && preg_match('/^{TOKEN:([^}]*)}$/', $cd[3], $targetconditiontokenattr)) -// { -// if ( isset($_SESSION['token']) && -// in_array(strtolower($targetconditiontokenattr[1]),GetTokenConditionsFieldNames($surveyid))) -// { -// $cvalue=GetAttributeValue($surveyid,strtolower($targetconditiontokenattr[1]),$_SESSION['token']); -// if ($conditionSourceOnPreviousPage === false) -// { -// if (in_array($cd[4],array("A","B","K","N","5",":")) || (in_array($cd[4],array("Q",";")) && $cqidattributes['numbers_only']==1)) -// { -// $newjava .= "parseFloat($JSsourceVal) $cd[6] parseFloat('".javascript_escape($cvalue)."')"; -// } -// else -// { -// //$newjava .= "document.getElementById('$idname').value $cd[6] '".javascript_escape($cvalue)."'"; -// $newjava .= "$JSsourceVal $cd[6] '".javascript_escape($cvalue)."'"; -// } -// } -// else -// { // note that source of condition is not a TokenAttr because this case is processed -// // earlier -// // get previous qecho "
";print_r($_SESSION);echo "
";die();uestion answer value: $cd[2] -// if (isset($_SESSION[$cd[2]])) -// { -// $prevanswerToCompare=$_SESSION[$cd[2]]; -// if ($cd[6] != 'RX') -// { -// if (eval('if (trim($prevanswerToCompare) '.$cd[6].' trim($cvalue)) return true; else return false;')) -// { -// //$newjava .= "'tokenMatch' == 'tokenMatch'"; -// $newjava .= "true"; -// } -// else -// { -// //$newjava .= "'tokenNoMatch' == 'tokenMatchNot'"; -// $newjava .= "false"; -// } -// } -// else -// { -// if (preg_match('/'.trim($cvalue).'/',trim($prevanswerToCompare))) -// { -// //$newjava .= "'tokenMatch' == 'tokenMatch'"; -// $newjava .= "true"; -// } -// else -// { -// //$newjava .= "'tokenNoMatch' == 'tokenMatchNot'"; -// $newjava .= "false"; -// } -// } -// } -// else -// { -// //$newjava .= "'impossible to evaluate prevQ' == 'tokenAttr'"; -// $newjava .= "false"; -// } -// } -// } -// else -// { -// //$newjava .= "'Missing tokenAttr' == 'tokenAttr'"; -// $newjava .= "false"; -// } -// } // end target as TokenAttr -// else -// { // right operand is a Constant or an Answer Code -// $newjava .= "$JSsourceElt != null &&"; -// if ($cd[3] && $cd[6] != '!=') -// { // if the target value isn't 'No answer' AND if operator isn't != -// $newjava .= "$JSsourceVal != '' && "; -// } -// if ($cd[6] == 'RX') -// { -// $newjava .= "match_regex($JSsourceVal,'$cd[3]')"; -// } -// else -// { -// $cqidattributes = getQuestionAttributes($cd[1]); -// //if (in_array($cd[4],array("A","B","K","N","5",":")) || (in_array($cd[4],array("Q",";")) && $cqidattributes['numbers_only']==1)) -// if (in_array($cd[6],array("<","<=",">",">="))) -// { // Numerical comparizons -// $newjava .= "parseFloat($JSsourceVal) $cd[6] parseFloat('".$cd[3]."')"; -// } -// elseif(preg_match("/^a(.*)b$/",$cd[6],$matchmethods)) -// { // String comparizons -// $newjava .= "$JSsourceVal ".$matchmethods[1]." '$cd[3]'"; -// } -// else -// { -// $newjava .= "$JSsourceVal $cd[6] '$cd[3]'"; -// } -// } -// } // end target as Constant or Answer Code -// } // generic cases for javasript evals -// } // end not local eval -// -// if ((isset($oldq) && $oldq != $cd[0]) || !isset($oldq))//End If Statement -// { -// $endzone = ")))\n"; -// $endzone .= "\t\t{\n"; -// $endzone .= "\t\t\tdocument.getElementById('question$cd[0]').style.display='';\n"; -// $endzone .= "\t\t\tdocument.getElementById('display$cd[0]').value='on';\n"; -// $endzone .= "\t\t\tif(\$('#question$cd[0] div[id^=\"gmap_canvas\"]').length > 0)\n"; -// $endzone .= "\t\t\t{\n"; -// $endzone .= "\t\t\t\tresetMap($cd[0]);\n"; -// $endzone .= "\t\t\t}\n"; -// $endzone .= "\t\t}\n"; -// $endzone .= "\t\telse\n"; -// $endzone .= "\t\t{\n"; -// $endzone .= "\t\t\tdocument.getElementById('question$cd[0]').style.display='none';\n"; -// $endzone .= "\t\t\tdocument.getElementById('display$cd[0]').value='';\n"; -// $endzone .= "\t\t}\n"; -// $cqcount++; -// } -// -// // If next condition doesn't exist, or if nex condition is on a different question -// // then current If statemement is over. We just need to check if it should be wrapped in an -// // additionnal runonce If statement -// if ( ( isset($conditions[$i+1]) && $conditions[$i+1][0] != $cd[0]) || (! isset($conditions[$i+1])) ) -// { // After If Statement -// -// if ($newjava_runonce == true) -// { -// $java .= " if (document.getElementById('runonce').value == '0')\n" -// ." {\n"; -// $java .= $newjava; -// $endzone .= " }\n"; -// } -// else -// { -// $java .= $newjava; -// } -// $newjava = ""; -// } -// -// $oldq = $cd[0]; //Update oldq for next loop -// $oldcq = $cd[2]; //Update oldcq for next loop -// } // end foreach -// -// //Close the expression for those where the question source is not on this page -// //echo "OLDQ: $oldq, CD[0]: $cd[0], GID: $gid, sourceQuestionGid: $sourceQuestionGid[1]\n"; -// if (isset($sourceQuestionGid[1]) && ((isset($oldq) && $oldq != $cd[0] || !isset($oldq)) && $sourceQuestionGid[1] != $gid)) -// { -// $endzone .= " }\n"; -// } -// $java .= $endzone; -//} -// -//if ((isset($array_filterqs) && is_array($array_filterqs)) || -//(isset($array_filterXqs) && is_array($array_filterXqs))) -//{ -// $qattributes=questionAttributes(1); -// $array_filter_types=$qattributes['array_filter']['types']; -// $array_filter_exclude_types=$qattributes['array_filter_exclude']['types']; -// unset($qattributes); -// if (!isset($appendj)) {$appendj="";} -// -// foreach ($array_filterqs as $attralist) -// { -// $qbase = $surveyid."X".$gid."X".$attralist['qid']; -// $qfbase = $surveyid."X".$gid."X".$attralist['fid']; -// if ($attralist['type'] == "M" || $attralist['type'] == "P") -// { -// $tqquery = "SELECT type FROM {$dbprefix}questions WHERE qid='".$attralist['qid']."';"; -// $tqresult = db_execute_assoc($tqquery); //Checked -// $OrigQuestion = $tqresult->FetchRow(); -// -// if($OrigQuestion['type'] == "L" || $OrigQuestion['type'] == "O") -// { -// $qquery = "SELECT {$dbprefix}answers.code as title, {$dbprefix}questions.type, {$dbprefix}questions.other FROM {$dbprefix}answers, {$dbprefix}questions WHERE {$dbprefix}answers.qid={$dbprefix}questions.qid AND {$dbprefix}answers.qid='".$attralist['qid']."' AND {$dbprefix}answers.language='".$_SESSION['s_lang']."' order by code;"; -// } else { -// $qquery = "SELECT title, type, other FROM {$dbprefix}questions WHERE (parent_qid='".$attralist['qid']."' OR qid='".$attralist['qid']."') AND parent_qid!=0 AND language='".$_SESSION['s_lang']."' and scale_id=0 order by title;"; -// } -// $qresult = db_execute_assoc($qquery); //Checked -// $other=null; -// -// while ($fansrows = $qresult->FetchRow()) -// { -// if($fansrows['other']== "Y") $other="Y"; -// if(strpos($array_filter_types, $OrigQuestion['type']) === false) {} else -// { -// $fquestans = "java".$qfbase.$fansrows['title']; -// $tbody = "javatbd".$qbase.$fansrows['title']; -// if($OrigQuestion['type']=="1") { -// //for a dual scale array question type we have to massage the system -// $dtbody = "tbdisp".$qbase.$fansrows['title']."#0"; -// $dtbody2= "tbdisp".$qbase.$fansrows['title']."#1"; -// } else { -// $dtbody = "tbdisp".$qbase.$fansrows['title']; -// } -// $tbodyae = $qbase.$fansrows['title']; -// $appendj .= "\n"; -// $appendj .= "\tif ((document.getElementById('$fquestans') != null && document.getElementById('$fquestans').value == 'Y'))\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='';\n"; -// $appendj .= "\t\tdocument.getElementById('$dtbody').value = 'on';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('on')" - the hash in dual scale breaks the javascript -// if($OrigQuestion['type']=="1") { -// //for a dual scale array question type we have to massage the system -// $appendj .= "\t\tdocument.getElementById('$dtbody2').value = 'on';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('on')" - the hash in dual scale breaks the javascript -// } -// $appendj .= "\t}\n"; -// $appendj .= "\telse\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='none';\n"; -// $appendj .= "\t\tdocument.getElementById('$dtbody').value = 'off';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// if($OrigQuestion['type']=="1") { -// //for a dual scale array question type we have to massage the system -// $appendj .= "\t\tdocument.getElementById('$dtbody2').value = 'off';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// } -// // This line resets the text fields in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=text]').val('');\n"; -// // This line resets any radio group in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=checkbox]').attr('checked', false); "; -// $appendj .= "\t}\n"; -// } -// } -// -// if($other=="Y") { -// $fquestans = "answer".$qfbase."other"; -// $tbody = "javatbd".$qbase."other"; -// $dtbody = "tbdisp".$qbase."other"; -// $tbodyae = $qbase."other"; -// $appendj .= "\n"; -// $appendj .= "\tif (document.getElementById('$fquestans').value !== '')\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='';\n"; -// $appendj .= "\t\t$('#$dtbody').val('on');\n"; -// $appendj .= "\t}\n"; -// $appendj .= "\telse\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='none';\n"; -// $appendj .= "\t\tdocument.getElementById('$dtbody').value = 'off';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// // This line resets the text fields in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=text]').val('');"; -// // This line resets any radio group in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=radio]').attr('checked', false); "; -// $appendj .= "\t}\n"; -// } -// } -// } -// $java .= $appendj; -// foreach ($array_filterXqs as $attralist) -// { -// $qbase = $surveyid."X".$gid."X".$attralist['qid']; -// $qfbase = $surveyid."X".$gid."X".$attralist['fid']; -// if ($attralist['type'] == "M" || $attralist['type'] == "P") -// { -// $tqquery = "SELECT type FROM {$dbprefix}questions WHERE qid='".$attralist['qid']."';"; -// $tqresult = db_execute_assoc($tqquery); //Checked -// $OrigQuestion = $tqresult->FetchRow(); -// -// if($OrigQuestion['type'] == "L" || $OrigQuestion['type'] == "O") -// { -// $qquery = "SELECT {$dbprefix}answers.code as title, {$dbprefix}questions.type, {$dbprefix}questions.other FROM {$dbprefix}answers, {$dbprefix}questions WHERE {$dbprefix}answers.qid={$dbprefix}questions.qid AND {$dbprefix}answers.qid='".$attralist['qid']."' AND {$dbprefix}answers.language='".$_SESSION['s_lang']."' order by code;"; -// } else { -// $qquery = "SELECT title, type, other FROM {$dbprefix}questions WHERE (parent_qid='".$attralist['qid']."' OR qid='".$attralist['qid']."') AND parent_qid!=0 AND language='".$_SESSION['s_lang']."' and scale_id=0 order by title;"; -// } -// $qresult = db_execute_assoc($qquery); //Checked -// $other=null; -// while ($fansrows = $qresult->FetchRow()) -// { -// if($fansrows['other']== "Y") $other="Y"; -// if(strpos($array_filter_exclude_types, $OrigQuestion['type']) === false) {} else -// { -// $fquestans = "java".$qfbase.$fansrows['title']; -// $tbody = "javatbd".$qbase.$fansrows['title']; -// if($OrigQuestion['type']=="1") { -// //for a dual scale array question type we have to massage the system -// $dtbody = "tbdisp".$qbase.$fansrows['title']."#0"; -// $dtbody2 = "tbdisp".$qbase.$fansrows['title']."#1"; -// } else { -// $dtbody = "tbdisp".$qbase.$fansrows['title']; -// } -// $tbodyae = $qbase.$fansrows['title']; -// $appendj .= "\n"; -// $appendj .= "\tif (\n"; -// $appendj .= "\t\t(document.getElementById('$fquestans') != null && document.getElementById('$fquestans').value == 'Y')\n"; -//*/ -// /* If this question is a cascading question, then it also needs to check the status of the question that this one relies on */ -///* -// if(isset($array_filterXqs_cascades[$attralist['qid']])) -// { -// -// foreach($array_filterXqs_cascades[$attralist['qid']] as $cascader) -// { -// $cascadefqa ="java".$surveyid."X".$gid."X".$cascader.$fansrows['title']; -// $appendj .= "\t\t||\n"; -// $appendj .= "\t\t(document.getElementById('$cascadefqa') != null && document.getElementById('$cascadefqa').value == 'Y')\n"; -// } -// } -// $appendj .= "\t)\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='none';\n"; -// $appendj .= "\t\tdocument.getElementById('$dtbody').value = 'off';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// if($OrigQuestion['type'] == "1") { -// //for a dual scale array question type we have to massage the system -// $appendj .= "\t\tdocument.getElementById('$dtbody2').value = 'off';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// } -// // This line resets the text fields in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=text]').val('');\n"; -// // This line resets any radio group in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=radio]').attr('checked', false);\n"; -// $appendj .= "\t}\n"; -// $appendj .= "\telse\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='';\n"; -// $appendj .= "\t\tdocument.getElementById('$dtbody').value='on';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// if($OrigQuestion['type'] == "1") { -// $appendj .= "\t\tdocument.getElementById('$dtbody2').value='on';\n"; //Note - do not use jquery format here (ie: "$('#$dtbody').val('off')" - the hash in dual scale breaks the javascript -// } -// $appendj .= "\t}\n"; -// } -// } -// if($other=="Y") { -// $fquestans = "answer".$qfbase."other"; -// $tbody = "javatbd".$qbase."other"; -// $dtbody = "tbdisp".$qbase."other"; -// $tbodyae = $qbase."other"; -// $appendj .= "\n"; -// $appendj .= "\tif (document.getElementById('$fquestans').value !== '')\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='none';\n"; -// $appendj .= "\t\t$('#$dtbody').val('on');\n"; -// $appendj .= "\t}\n"; -// $appendj .= "\telse\n"; -// $appendj .= "\t{\n"; -// $appendj .= "\t\tdocument.getElementById('$tbody').style.display='';\n"; -// $appendj .= "\t\t$('#$dtbody').val('off');\n"; -// // This line resets the text fields in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=text]').val('');"; -// // This line resets any radio group in the hidden row -// $appendj .= "\t\t$('#$tbody input[type=radio]').attr('checked', false); "; -// $appendj .= "\t}\n"; -// } -// } -// } -// $java .= $appendj; -//} -// -//if (isset($java)) {echo $java;} -//echo "\n\t\tdocument.getElementById('runonce').value=1;\n" -//. "\t}\n" -//."\t//-->\n" -//."\t\n\n"; // End checkconditions javascript function -// */ - echo "\n\n\n"; echo templatereplace(file_get_contents("$thistpl/startgroup.pstpl")); echo "\n"; @@ -1315,7 +550,6 @@ function checkconditions(value, name, type) echo "\n"; //Display the "mandatory" message on page if necessary - // TMSW Mandatory -> EM if (isset($showpopups) && $showpopups == 1 && $ginfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) { echo "

" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.") . "

"; @@ -1440,29 +674,6 @@ function checkconditions(value, name, type) $sText = FlattenText($gInfo['gname']); $bGAnsw = !$gInfo['anyUnanswered']; -// $g = $_SESSION['grouplist'][$n]; -// if(!checkgroupfordisplay($g[0])) -// continue; -// -// $sText = FlattenText($g[1]); -// -// $bGAnsw = true; -// foreach($_SESSION['fieldarray'] as $ia) -// { -// if($ia[5] != $g[0]) -// continue; -// -// $qidattributes=getQuestionAttributes($ia[0], $ia[4]); -// if($qidattributes['hidden']==1 || !checkquestionfordisplay($ia[0])) -// continue; -// -// if (!bCheckQuestionForAnswer($ia[1], $aFieldnamesInfoInv)) -// { -// $bGAnsw = false; -// break; -// } -// } - ++$v; $class = ($n == $_SESSION['step'] - 1? 'current': ($bGAnsw? 'answer': 'missing')); @@ -1489,44 +700,6 @@ function checkconditions(value, name, type) echo "\n"; } -// echo "\n"; //This can go eventually - it's redundent for debugging -// -// if (isset($conditions) && is_array($conditions) && count($conditions) != 0) -// { -// //if conditions exist, create hidden inputs for 'previously' answered questions -// // Note that due to move 'back' possibility, there may be answers from next pages -// // However we make sure that no answer from this page are inserted here -// foreach (array_keys($_SESSION) as $SESak) -// { -// if (in_array($SESak, $_SESSION['insertarray']) && !in_array($SESak, $inputnames)) -// { -// echo "\n"; -// } -// } -// } - //SOME STUFF FOR MANDATORY QUESTIONS - // TMSW Mandatory -> EM -// if (remove_nulls_from_array($mandatorys)) -// { -// $mandatory=implode("|", remove_nulls_from_array($mandatorys)); -// echo "\n"; -// } -// if (remove_nulls_from_array($conmandatorys)) -// { -// $conmandatory=implode("|", remove_nulls_from_array($conmandatorys)); -// echo "\n"; -// } -// if (remove_nulls_from_array($mandatoryfns)) -// { -// $mandatoryfn=implode("|", remove_nulls_from_array($mandatoryfns)); -// echo "\n"; -// } -// if (remove_nulls_from_array($conmandatoryfns)) -// { -// $conmandatoryfn=implode("|", remove_nulls_from_array($conmandatoryfns)); -// echo "\n"; -// } - echo "\n"; echo "\n"; echo "\n"; diff --git a/qanda1.php b/qanda1.php index 89c9bf7d638..e786da5b4fb 100644 --- a/qanda1.php +++ b/qanda1.php @@ -56,473 +56,6 @@ { define('SHOW_NO_ANSWER',0); }; -//function retrieveConditionInfo($ia) -//{ -// //This function returns an array containing all related conditions -// //for a question - the array contains the fields from the conditions table -// global $dbprefix, $connect; -// -// if ($ia[7] == "Y") -// { //DEVELOP CONDITIONS ARRAY FOR THIS QUESTION -// $cquery = "SELECT {$dbprefix}conditions.qid, " -// ."{$dbprefix}conditions.scenario, " -// ."{$dbprefix}conditions.cqid, " -// ."{$dbprefix}conditions.cfieldname, " -// ."{$dbprefix}conditions.value, " -// ."{$dbprefix}questions.type, " -// ."{$dbprefix}questions.sid, " -// ."{$dbprefix}questions.gid, " -// ."{$dbprefix}conditions.method, " -// ."questionssrc.gid as srcgid " -// ."FROM {$dbprefix}conditions, " -// ."{$dbprefix}questions ," -// ."{$dbprefix}questions as questionssrc " -// ."WHERE {$dbprefix}conditions.cqid={$dbprefix}questions.qid " -// ."AND {$dbprefix}conditions.qid=questionssrc.qid " -// ."AND {$dbprefix}conditions.qid=$ia[0] " -// ."AND {$dbprefix}questions.language='".$_SESSION['s_lang']."' " -// ."AND {$dbprefix}conditions.cfieldname NOT LIKE '{%' " -// ."ORDER BY {$dbprefix}conditions.scenario, " -// ."{$dbprefix}conditions.cqid, " -// ."{$dbprefix}conditions.cfieldname"; -// $cresult = db_execute_assoc($cquery) or safe_die ("OOPS
$cquery
".$connect->ErrorMsg()); //Checked -// -// $cquerytoken = "SELECT c.qid, c.scenario, c.cqid, c.cfieldname, c.value, '' as type, 0 as sid, 0 as gid, c.method, q.gid as srcgid " -// ."FROM {$dbprefix}conditions c, {$dbprefix}questions q " -// ."WHERE c.qid=q.qid " -// ."AND c.qid=$ia[0] " -// ."AND c.cfieldname LIKE '{%' " -// ."ORDER BY c.scenario, c.cqid, c.cfieldname"; -// -// $cresulttoken = db_execute_assoc($cquerytoken) or safe_die ("OOPS
$cquerytoken
".$connect->ErrorMsg()); //Checked -// -// while ($tempcrow = $cresulttoken->FetchRow()) -// { -// $aAllConditions[] = $tempcrow; -// } -// while ($tempcrow = $cresult->FetchRow()) -// { -// $aAllConditions[] = $tempcrow; -// } -// // while ($crow = $cresult->FetchRow()) -// foreach ($aAllConditions as $crow) -// { -// if (preg_match("/^\+(.*)$/",$crow['cfieldname'],$cfieldnamematch)) -// { // this condition uses a single checkbox as source -// $crow['type'] = "+".$crow['type']; -// $crow['cfieldname'] = $cfieldnamematch[1]; -// } -// -// $conditions[] = array ($crow['qid'], -// $crow['cqid'], -// $crow['cfieldname'], -// $crow['value'], -// $crow['type'], -// $crow['sid']."X".$crow['gid']."X".$crow['cqid'], -// $crow['method'], -// $crow['scenario'], -// $crow['srcgid']); -// } -// -// -// foreach ($conditions as $condkey => $condarr) -// { // We need to sort the merged array by Ascending scenario, cqid, then cfieldname -// // otherwise condition evaluations of Tokens in Scenarii won't work in "live" Javascript eval -// $scenariolist[$condkey] = $condarr[7]; -// $cqidlist[$condkey] = $condarr[1]; -// $cfieldnamelist[$condkey] = $condarr[2]; -// } -// array_multisort($scenariolist,SORT_ASC,$cqidlist,SORT_ASC,$cfieldnamelist,SORT_ASC,$conditions); -// -// return $conditions; -// } -// else -// { -// return null; -// } -//} - -// returns the Javascript IdName of a question used in conditions -// $cd = Array ( -// 0 => Unused -// 1 => qid of the question -// 2 => fieldname of the question -// 3 => value used in comparison (only usd for type M and P egals 'Y', optionnal for other types) -// 4 => type of the question -// 5 => SGQ code corresponding to the fieldname -// if $currentgid is not null (Group by group survey), the fieldname depends on the groupId -//function retrieveJSidname($cd,$currentgid=null) -//{ -// global $dbprefix, $connect, $dropdownthreshold; -// -// if (preg_match("/^\+{0,1}[0-9]+X([0-9]+)X(.*)$/",$cd[2]) == 0) -// { // This is not a true fieldname (for instance a {TOKEN:ATTR..} -// // placeholder -// return "NoJSidname"; -// } -// //preg_match("/^[0-9]+X([0-9]+)X([0-9]+)$/",$cd[2],$matchFields); -// //^^^^^does not seem to work, explode below should -// $matchFields = explode('X', $cd[2], 3); -// $questiongid=$matchFields[1]; -// $questionFieldpart=$matchFields[2]; -// -// -// if ($cd[4] == "L") -// { -// $cccquery="SELECT code FROM {$dbprefix}answers WHERE qid={$cd[1]} AND language='".$_SESSION['s_lang']."'"; -// $cccresult=$connect->Execute($cccquery); // Checked -// $cccount=$cccresult->RecordCount(); -// } -// if ($cd[4] == "R") -// { -// if (!isset($currentgid) || $questiongid == $currentgid) -// { // if question is on same page then field is fvalue_XXXX -// //$idname="fvalue_".$cd[1].substr($cd[2], strlen($cd[2])-1,1); // broken when ranking more than 9 items -// $idname="fvalue_".$questionFieldpart; -// } -// else -// { // If question is on another page then field if javaXXXX -// $idname="java$cd[2]"; -// } -// } -// elseif ($cd[4] == "5" || -// $cd[4] == "A" || -// $cd[4] == "B" || -// $cd[4] == "C" || -// $cd[4] == "E" || -// $cd[4] == "F" || -// $cd[4] == "H" || -// $cd[4] == "G" || -// $cd[4] == "Y" || -// $cd[4] == "1" || -// ($cd[4] == "L" && $cccount <= $dropdownthreshold)) -// { -// $idname="java$cd[2]"; -// } -// elseif ($cd[4] == "M" || -// $cd[4] == "P") -// { -// $idname="java$cd[5]$cd[3]"; -// } -// elseif ($cd[4] == "+M" || -// $cd[4] == "+P") -// { -// $idname="java$cd[2]"; -// } -// elseif ($cd[4] == "D" || -// $cd[4] == "N" || -// $cd[4] == "S" || -// $cd[4] == "T" || -// $cd[4] == "U" || -// $cd[4] == "Q" || -// $cd[4] == "*" || -// $cd[4] == "K" ) -// { -// if (!isset($currentgid) || $questiongid == $currentgid) -// { // if question is on same page then field is answerXXXX -// $idname="answer$cd[2]"; -// } -// else -// { // If question is on another page then field if javaXXXX -// $idname="java$cd[2]"; -// } -// } -// else -// { -// $idname="java".$cd[2]; -// } -// -// return $idname; -//} - -// TMSW Mandatory -> EM -//function create_mandatorylist($ia) -//{ -// return array(null, null); -// //Checks current question and returns required mandatory arrays if required -// if ($ia[6] == 'Y') -// { -// switch($ia[4]) -// { -// case 'R': -// $thismandatory = setman_ranking($ia); -// break; -// case 'M': -// $thismandatory = setman_questionandcode($ia); -// break; -// case 'J': -// case 'P': -// case 'Q': -// case 'K': -// case 'A': -// case 'B': -// case 'C': -// case 'E': -// case 'F': -// case 'H': -// $thismandatory = setman_questionandcode($ia); -// break; -// case ':': -// case ';': -// $thismandatory = setman_multiflex($ia); -// break; -// case '1': -// $thismandatory = setman_questionandcode_multiscale($ia); -// break; -// case 'X': -// case '*': -// //Do nothing - boilerplate questions CANNOT be mandatory -// break; -// default: -// $thismandatory = setman_normal($ia); -// } -// -// if ($ia[7] != 'Y' && isset($thismandatory)) //Question is not conditional - addto mandatory arrays -// { -// $mandatory=$thismandatory; -// } -// if ($ia[7] == 'Y' && isset($thismandatory)) //Question IS conditional - add to conmandatory arrays -// { -// $conmandatory=$thismandatory; -// } -// } -// -// if (isset($mandatory)) -// { -// return array($mandatory, null); -// } -// elseif (isset($conmandatory)) -// { -// return array(null, $conmandatory); -// } -// else -// { -// return array(null, null); -// } -//} - -// TMSW Mandatory -> EM -//function setman_normal($ia) -//{ -// $mandatorys[]=$ia[1]; -// $mandatoryfns[]=$ia[1]; -// return array($mandatorys, $mandatoryfns); -//} -// -//// TMSW Mandatory -> EM -//function setman_ranking($ia) -//{ -// global $dbprefix, $connect; -// $ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$ia[0]} AND language='".$_SESSION['s_lang']."' ORDER BY sortorder, answer"; -// $ansresult = $connect->Execute($ansquery); //Checked -// $anscount = $ansresult->RecordCount(); -// $qidattributes=getQuestionAttributes($ia[0],$ia[4]); -// -// if (trim($qidattributes['max_answers'])!='') { -// $max_answers = $qidattributes['max_answers']; -// } -// else -// { -// $max_answers = $anscount; -// } -// -// for ($i=1; $i<=$max_answers; $i++) -// { -// $mandatorys[]=$ia[1].$i; -// $mandatoryfns[]=$ia[1]; -// } -// -// return array($mandatorys, $mandatoryfns); -//} - -// TMSW Mandatory -> EM -//function setman_questionandcode($ia) -//{ -// global $dbprefix, $connect; -// $qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0]." AND language='".$_SESSION['s_lang']."' and parent_qid=0"; -// $qresult = db_execute_assoc($qquery); //Checked -// while ($qrow = $qresult->FetchRow()) {$other = $qrow['other'];} -// $subquestionquery = "SELECT title FROM {$dbprefix}questions WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' ORDER BY question_order"; -// $sqresult = db_execute_assoc($subquestionquery); //Checked -// -// while ($subquestionrow = $sqresult->FetchRow()) -// { -// $mandatorys[]=$ia[1].$subquestionrow['title']; -// $mandatoryfns[]=$ia[1]; -// } -// -// if ($other == "Y" and ($ia[4]=="!" or $ia[4]=="L" or $ia[4]=="M" or $ia[4]=="P")) -// { -// $mandatorys[]=$ia[1]."other"; -// $mandatoryfns[]=$ia[1]; -// } -// -// return array($mandatorys, $mandatoryfns); -//} - - -/** - * The point of these functions (setman) is to return an array containing two arrays. - * The first ($mandatorys) is an array containing question, so they can all be checked - * The second ($mandatoryfns) is an arry containing the fieldnames of every question - * What's the difference? The difference arises from multiple option questions, and came - * about when trying to distinguish between answering just one option (which satisfies - * the mandatory requirement, and answering them all). The "mandatorys" input contains the - * actual specific response items that could be filled in.. ie: in a multiple option - * question, there will be a unique one for every possible answer. The "mandatoryfns" array - * contains the generic question fieldname for the question as a whole (it will be repeated - * for multiple option qeustions, but won't contain unique items. - * - * @param mixed $ia - * @return array See explanation above - */ -// TMSW Mandatory -> EM -//function setman_multiflex($ia) -//{ -// -// global $dbprefix, $connect; -// -// $mandatorys=array(); -// $mandatoryfns=array(); -// $ansquery = "SELECT * FROM {$dbprefix}questions -// WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' and scale_id=0 -// ORDER BY question_order, title"; -// $ansresult = db_execute_assoc($ansquery); -// $ans2query = "SELECT * FROM {$dbprefix}questions -// WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' and scale_id=1 -// ORDER BY question_order, title"; -// $ans2result = db_execute_assoc($ans2query); -// -// while ($ans2row=$ans2result->FetchRow()) -// { -// $lset[]=$ans2row; -// } -// -// $qidattributes=getQuestionAttributes($ia[0],$ia[4]); -// while ($ansrow = $ansresult->FetchRow()) -// { -// //Don't add to mandatory list if the row is filtered out with the array_filter option -// if (trim($qidattributes['array_filter'])!='') -// { -// //This particular one may not be mandatory if it's hidden -// $selected = getArrayFiltersForQuestion($ia[0]); -// if (!in_array($ansrow['title'],$selected)) -// { -// //This one's hidden, so don't add it to the mandatory list -// } -// else -// { -// //This one's not hidden. so add it to the mandatory list -// foreach($lset as $ls) -// { -// $mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title']; -// $mandatoryfns[]=$ia[1]; -// } -// } -// } -// elseif (trim($qidattributes['array_filter_exclude'])!='') -// { -// //This particular one may not be mandatory if it's hidden -//// TMSW ArrayFilter -> EM -// $selected = getArrayFilterExcludesForQuestion($ia[0]); -// if ($selected!=false && in_array($ansrow['title'],$selected)) -// { -// //This one's hidden, so don't add it to the mandatory list -// } -// else -// { -// //This one's not hidden. so add it to the mandatory list -// foreach($lset as $ls) -// { -// $mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title']; -// $mandatoryfns[]=$ia[1]; -// } -// } -// } else { //There is no array_filter option, so we should definitely add to the mandatory list here! -// foreach($lset as $ls) -// { -// $mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title']; -// $mandatoryfns[]=$ia[1]; -// } -// } -// } -// -// return array($mandatorys, $mandatoryfns); -//} - -// TMSW Mandatory -> EM -//function setman_questionandcode_multiscale($ia) -//{ -// global $dbprefix, $connect; -// $qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0]." AND language='".$_SESSION['s_lang']."'"; -// $qresult = db_execute_assoc($qquery); //Checked -// while ($qrow = $qresult->FetchRow()) -// { -// $other = $qrow['other']; -// } -// -// // Get Subquestions -// $subquery="SELECT * " -// ."FROM {$dbprefix}questions " -// ."WHERE parent_qid={$ia[0]} " -// ."AND language='".$_SESSION['s_lang']."' " -// ."ORDER BY question_order"; -// $subresult = db_execute_assoc($subquery); //Checked -// -// // Get Answer Scale 1 -// $ans1query="SELECT qid " -// ."FROM {$dbprefix}answers " -// ."WHERE qid={$ia[0]} " -// ."AND scale_id=0 " -// ."AND language='".$_SESSION['s_lang']."' " -// ."ORDER BY sortorder"; -// $ans1result = db_execute_assoc($ans1query); //Checked -// $ans1count = $ans1result->RowCount(); -// -// // Get Answer Scale 2 -// $ans2query="SELECT qid " -// ."FROM {$dbprefix}answers " -// ."WHERE qid={$ia[0]} " -// ."AND scale_id=1 " -// ."AND language='".$_SESSION['s_lang']."' " -// ."ORDER BY sortorder"; -// $ans2result = db_execute_assoc($ans2query); //Checked -// $ans2count = $ans2result->RowCount(); -// -// while ($subrow = $subresult->FetchRow()) -// { -// // first answer set -// if ($ans1count > 0) -// { -// $mandatorys[]=$ia[1].$subrow['title']."#0"; -// $mandatoryfns[]=$ia[1]; -// } -// else -// { -// $mandatorys[]=$ia[1].$subrow['title']; -// $mandatoryfns[]=$ia[1]; -// } -// -// // second answer set -// if ($ans2count > 0) -// { -// $mandatorys[]=$ia[1].$subrow['title']."#1"; -// $mandatoryfns[]=$ia[1]; -// } -// else -// { -// $mandatorys[]=$ia[1].$subrow['title']; -// $mandatoryfns[]=$ia[1]; -// } -// } -// -// if ($other == "Y" and ($ia[4]=="!" or $ia[4]=="L" or $ia[4]=="M" or $ia[4]=="P" or $ia[4]=="1")) -// { -// $mandatorys[]=$ia[1]."other"; -// $mandatoryfns[]=$ia[1]; -// } -// return array($mandatorys, $mandatoryfns); -//} /** * This function returns an array containing the "question/answer" html display @@ -549,9 +82,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval $name = $ia[0]; $qtitle=$ia[3]; -// //Replace INSERTANS statements with previously provided answers; -// $qtitle=dTexts__run($qtitle,$name); - //GET HELP // TMSW TODO - eliminate this - get from LEM @@ -565,7 +95,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval $answer = ""; if (!isset($_SESSION[$ia[1]])) {$_SESSION[$ia[1]] = "";} $qidattributes=getQuestionAttributes($ia[0],$ia[4]); - //echo "
";print_r($qidattributes);echo "
"; //Create the question/answer html // Previously in limesurvey, it was virtually impossible to control how the start of questions were formatted. @@ -802,7 +331,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval } //If this question is mandatory but wasn't answered in the last page //add a message HIGHLIGHTING the question -// TMSW Mandatory -> EM if (($_SESSION['step'] != $_SESSION['maxstep']) || ($_SESSION['step'] == $_SESSION['prevstep'])) { $mandatory_msg = mandatory_message($ia); } @@ -880,7 +408,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval $c = ($qtitle_custom!=$oldtitle)?1:0; }; - // $qtitle = $qtitle_custom; $question_text['all'] = $qtitle_custom; } else @@ -889,7 +416,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval }; // END: legacy question_start.pstpl code //=================================================================== - // echo '
[qanda.php] line '.__LINE__.": $question_text =\n".htmlspecialchars(print_r($question_text,true)).'
'; $qtitle = $question_text; // ===================================================== @@ -898,7 +424,6 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval return array($qanda, $inputnames); } -// TMSW Mandatory -> EM function mandatory_message($ia) { $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]); @@ -908,65 +433,8 @@ function mandatory_message($ia) else { return ""; } - //This function checks to see if this question is mandatory and - //is being re-displayed because it wasn't answered. It returns - global $notanswered, $clang, $dbprefix; - $qtitle=""; - - - if (isset($notanswered) && is_array($notanswered)) //ADD WARNINGS TO QUESTIONS IF THEY WERE MANDATORY BUT NOT ANSWERED - { - global $mandatorypopup, $popup; - if (in_array($ia[1], $notanswered)) - { - $qtitle .= "
".$clang->gT('This question is mandatory').'.'; - switch($ia[4]) - { - case 'A': - case 'B': - case 'C': - case 'Q': - case 'K': - case 'F': - case 'J': - case 'H': - case ':': - $qtitle .= "
\n".$clang->gT('Please complete all parts').'.'; - break; - case '1': - $qtitle .= "
\n".$clang->gT('Please check the items').'.'; - break; - case 'R': - $qtitle .= "
\n".$clang->gT('Please rank all items').'.'; - break; - case 'M': - case 'P': - $qtitle .= ' '.$clang->gT('Please check at least one item.').'.'; - $qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0]; - $qresult = db_execute_assoc($qquery); //Checked - $qrow = $qresult->FetchRow(); - if ($qrow['other']=='Y') - { - $qidattributes=getQuestionAttributes($ia[0],$ia[4]); - if (trim($qidattributes['other_replace_text'])!='') - { - $othertext=$qidattributes['other_replace_text']; - } - else - { - $othertext=$clang->gT('Other:'); - } - $qtitle .= "
\n".sprintf($clang->gT("If you choose '%s' you must provide a description."), $othertext); - } - break; - } // end switch - $qtitle .= "

\n"; - } - } - return $qtitle; } -// TMSW Validation -> EM function validation_message($ia) { global $clang; @@ -988,31 +456,6 @@ function validation_message($ia) else { return ""; } - - //This function checks to see if this question requires validation and - //that validation has not been met. - global $notvalidated, $dbprefix, $connect, $clang; - $qtitle=""; - if (isset($notvalidated) && is_array($notvalidated)) //ADD WARNINGS TO QUESTIONS IF THEY ARE NOT VALID - { - global $validationpopup, $popup; - if (in_array($ia[1], $notvalidated)) - { - $help=''; - $helpselect="SELECT help\n" - ."FROM {$dbprefix}questions\n" - ."WHERE qid={$ia[0]} AND language='".$_SESSION['s_lang']."'"; - $helpresult=db_execute_assoc($helpselect) or safe_die($helpselect.'
'.$connect->ErrorMsg()); //Checked - while ($helprow=$helpresult->FetchRow()) - { - $help=' '.$helprow['help'].''; - } - $qtitle .= '
'.$clang->gT('This question must be answered correctly').'.'.$help.'
-'; - } - } - - return $qtitle; } // TMSW Validation -> EM @@ -1431,63 +874,6 @@ function countdown(questionid,timer,action,warning,warning2,warninghide,warning2 return $output; } -// TMSW ArrayFilter -> EM -//function return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) -//// function which returns TRUE if the given $ansrow contains a row which is selected, ie, not filtered out in previous answer -//{ -// $filter_select = TRUE; -// if -// ( -// (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set -// $thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode -// ) || // OR -// (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set -// $thissurvey['format'] == 'G' && // and the survey is being presented in group-by-group mode -// getArrayFiltersOutGroup($ia[0]) == true // and the source question for the array filter is in a different group than this question -// ) -// ) -// { -// $selected = getArrayFiltersForQuestion($ia[0]); -// if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code']; -// if (!empty($selected) && !in_array($ansrow['title'],$selected)) -// { -// $filter_select = FALSE; -// } -// else -// { -// $filter_select = TRUE; -// } -// } -// -// if -// (isset($qidattributes['array_filter_exclude']) && -// ( -// (trim($qidattributes['array_filter_exclude'])!='' && -// $thissurvey['format'] == 'S' -// ) || -// (trim($qidattributes['array_filter_exclude'])!='' && -// $thissurvey['format'] == 'G' && -// getArrayFiltersExcludesOutGroup($ia[0]) == true -// ) -// ) -// ) -// { -//// TMSW ArrayFilter -> EM -// $selected = getArrayFilterExcludesForQuestion($ia[0]); -// if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code']; -// if (!empty($selected) && !in_array($ansrow['title'],$selected)) -// { -// $filter_select = TRUE; -// } -// else -// { -// $filter_select = FALSE; -// } -// } -// return $filter_select; -//} - -// TMSW ArrayFilter -> EM function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) { $htmltbody2 = "\n\n\t<$method id='javatbd$rowname'"; $htmltbody2 .= ($class !== null) ? " class='$class'": ""; @@ -1500,188 +886,8 @@ function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $hiddenfield = "\n"; } return array($htmltbody2, $hiddenfield); -// -// /* We're just going to work out whether to do the include or exclude version of the function at this point */ -// if(isset($qidattributes['array_filter_exclude']) && trim($qidattributes['array_filter_exclude']) != '') { -// list($html2body, $hiddenfield) = return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc, $valuename, $method, $class); -// } else { -// list($html2body, $hiddenfield) = return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc, $valuename, $method, $class); -// } -// return array($html2body, $hiddenfield); } -//function return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) { -// /* DO ARRAY_FILTER ATTRIBUTE -// We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts -// know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row -// should be displayed initially. If no answers for the source question have been selected then the whole -// answer row should start in the display-off position for array_filter or the display-on position -// for array_filter_exclude. */ -// -// //Are we doing array_filter, or array_filter_exclude. Where a conflict occurs, do array_filter -// -// $htmltbody2 = ''; -// $hiddenfield= ''; -// if ( -// (trim($qidattributes['array_filter'])!='' && // the array_filter attribute is set -// $thissurvey['format'] == 'G' && // and the survey is being presented group by group -// getArrayFiltersOutGroup($ia[0]) == false // and the source question is in the same group (ie displayed on same page) -// ) || // OR -// (trim($qidattributes['array_filter'])!='' && // the array_filter attribute is set -// $thissurvey['format'] == 'A' // and the survey is being presented all on one page -// ) -// ) -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname' style='display: none'"; -// $htmltbody2 .= ($class !== null) ? " class='$class'": ""; -// $htmltbody2 .= ">\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = "\n"; -// } -// } else if -// ( -// (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set -// $thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode -// ) || // OR -// (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set -// $thissurvey['format'] == 'G' && // and the survey is being presented in group-by-group mode -// getArrayFiltersOutGroup($ia[0]) == true // and the source question for the array filter is in a different group than this question -// ) -// ) -// { -// $selected = getArrayFiltersForQuestion($ia[0]); -// if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code']; -// if (!empty($selected) && !in_array($ansrow['title'],$selected)) -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname' style='display: none'"; -// $htmltbody2 .= ($class !== null) ? " class='$class'": ""; -// $htmltbody2 .= ">\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = "\n"; -// } -// $_SESSION[$valuename] = ''; //Remove any saved results for this since it is no longer being displayed -// } -// else -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname'"; -// $htmltbody2 .= ($class !== null) ? " class='$class'": ""; -// $htmltbody2 .= ">"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = "\n"; -// } -// } -// } -// else -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname'"; -// $htmltbody2 .= ($class !== null) ? " class='$class'": ""; -// $htmltbody2 .= ">\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = "\n"; -// } -// } -// -// //End of array_filter attribute -// -// return array($htmltbody2, $hiddenfield); -//} -// -//function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) { -// /* DO ARRAY_FILTER_EXCLUDE ATTRIBUTE -// We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts -// know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row -// should be displayed initially. If no answers for the source question have been selected then the whole -// answer row should start in the display-on position. */ -// -// $htmltbody2 = ''; -// $hiddenfield= ''; -// if ( -// (trim($qidattributes['array_filter_exclude'])!='' && // the array_filter attribute is set -// $thissurvey['format'] == 'G' && // and the survey is being presented group by group -// getArrayFiltersExcludesOutGroup($ia[0]) == false // and this question _is_ in the current group for the array filter (ie it's on the same page) -// ) || // OR -// (trim($qidattributes['array_filter_exclude'])!='' && // the array_filter attribute is set -// $thissurvey['format'] == 'A' // and the survey is being presented all on one page -// ) -// ) -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname'>\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = "\n"; -// } -// } else if -// ( -// (trim($qidattributes['array_filter_exclude'])!='' && -// $thissurvey['format'] == 'S' -// ) || -// (trim($qidattributes['array_filter_exclude'])!='' && -// $thissurvey['format'] == 'G' && -// getArrayFiltersExcludesOutGroup($ia[0]) == true -// ) -// ) -// { -// $selected = getArrayFilterExcludesForQuestion($ia[0]); -// if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code']; -// if (!empty($selected) && !in_array($ansrow['title'],$selected)) -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname'>\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield=""; -// } -// } -// else -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname' style='display: none'>"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield="\n"; -// } -// $_SESSION[$valuename]=''; //Remove any saved results for this since it is no longer being displayed -// } -// } -// else -// { -// $htmltbody2 = "\n\n\t<$method id='javatbd$rowname' style='display: none'>\n"; -// if($ia[4]=="1") { -// //This is an array dual scale question and we have to massage the tbidpslay rowname -// $hiddenfield = "\n"; -// $hiddenfield .= "\n"; -// } else { -// $hiddenfield = ""; -// } -// } -// //End of array_filter attribute -// -// return array($htmltbody2, $hiddenfield); -//} - // ================================================================== // setting constants for 'checked' and 'selected' inputs define('CHECKED' , ' checked="checked"' , true); @@ -3120,23 +2326,6 @@ function do_multiplechoice($ia) $autoArray[$ia[1]]['parent'] = $ia[1]; } -// if (trim($qidattributes['exclude_all_others'])!='') -// { -// $excludeallothers=explode(';',trim($qidattributes['exclude_all_others'])); -// $excludeallotherscript = " -// \n"; -// } } } $answer .= " onclick='cancelBubbleThis(event);"; - /* Exclude all others coding */ -// if(in_array($ansrow['title'], $excludeallothers)) -// { -// $answer .= "excludeAllOthers$ia[1](this.id, \"yes\");"; // was "this.id" -// $excludeallotherscripton .= "/* SKIPPING QUESTION {$ia[1]} */\n"; -// // $excludeallotherscripton .= "alert(value+'---'+'answer$ia[1]{$ansrow['code']}');\n"; -// $excludeallotherscripton .= "if( value != 'answer$ia[1]{$ansrow['title']}') {\n" -// . "\tthiselt=document.getElementById('answer$ia[1]{$ansrow['title']}');\n" -// . "thiselt.checked='';\n" -// . "thiselt.disabled='true';\n" -// . "if (doconditioncheck == 'yes') {\n" -// . "\t$checkconditionFunction(thiselt.value, thiselt.name, thiselt.type);\n" -// . "}\n}\n"; -// $excludeallotherscriptoff .= "document.getElementById('answer$ia[1]{$ansrow['title']}').disabled='';\n"; -// } -// elseif (count($excludeallothers)>0) -// { -// $excludeallotherscripton .= "\tthiselt=document.getElementById('answer$ia[1]{$ansrow['title']}');\n" -// . "thiselt.checked='';\n" -// . "thiselt.disabled='true';\n" -// . "if (doconditioncheck == 'yes') {\n" -// . "\t$checkconditionFunction(thiselt.value, thiselt.name, thiselt.type);\n" -// . "}\n"; -// $excludeallotherscriptoff.= "document.getElementById('answer$ia[1]{$ansrow['title']}').disabled='';\n"; -// } - /* End of exclude all others coding */ $answer .= $callmaxanswscriptcheckbox /* Include checkbox for script for maxanswers if that attribute is selected */ . "$checkconditionFunction(this.value, this.name, this.type)' />\n" @@ -3335,20 +2493,7 @@ function do_multiplechoice($ia) { $myfname = $ia[1].'other'; list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $qidattributes, $thissurvey, array("code"=>"other"), $myfname, $trbc, $myfname, "li"); -// if(count($excludeallothers) > 0) -// { -// $excludeallotherscripton .= "thiselt=document.getElementById('answer{$ia[1]}othercbox');\n" -// . "thiselt.checked='';\n" -// . "thiselt.disabled='true';\n"; -// $excludeallotherscripton .= "thiselt=document.getElementById('answer$ia[1]other');\n" -// . "thiselt.value='';\n" -// . "thiselt.disabled='true';\n" -// . "if (doconditioncheck == 'yes') {\n" -// . "\t$checkconditionFunction(thiselt.value, thiselt.name, thiselt.type);\n" -// . "}\n"; -// $excludeallotherscriptoff .="document.getElementById('answer$ia[1]other').disabled='';\n"; -// $excludeallotherscriptoff .="document.getElementById('answer{$ia[1]}othercbox').disabled='';\n"; -// } + if($wrapper['item-start'] == "\t
  • \n") { $startitem = "\t$htmltbody2\n"; @@ -3491,22 +2636,6 @@ function do_multiplechoice($ia) $answer = $minanswscript . $checkotherscript . $answer; -// if (count($excludeallothers)>0) -// { -// $excludeallotherscript .= " -// if (document.getElementById(value).checked) -// { -// $excludeallotherscripton -// } -// else -// { -// $excludeallotherscriptoff -// } -// } -// //--> -// "; -// $answer = $excludeallotherscript . $answer; -// } $answer .= $postrow; return array($answer, $inputnames); } @@ -4615,10 +3744,8 @@ function do_multiplenumeric($ia) $answer .= " if (bob.value == '' || bob.value == '".$clang->gT("Answer is invalid. The total of all entries should not add up to more than ").$max_num_value."')\n"; $answer .= " {\n"; $answer .= " bob.value = '';\n"; - // $answer .= " document.getElementById('totalvalue_{$ia[1]}').style.color='black';\n"; $answer .= " document.getElementById('totalvalue_{$ia[1]}').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " }\n"; - // $answer .= " document.getElementById('max_num_value_{$ia[1]}').style.color='black';\n"; $answer .= " document.getElementById('max_num_value_{$ia[1]}').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " }\n"; $answer .= " break;\n"; @@ -4626,8 +3753,6 @@ function do_multiplenumeric($ia) $answer .= " if (totalvalue_".$ia[1]." < $min_num_value)\n"; $answer .= " {\n"; $answer .= " bob.value = '".sprintf($clang->gT("Answer is invalid. The total of all entries should add up to at least %s.",'js'),$min_num_value)."';\n"; - // $answer .= " document.getElementById('totalvalue_".$ia[1]."').style.color='red';\n"; - // $answer .= " document.getElementById('min_num_value_".$ia[1]."').style.color='red';\n"; $answer .= " document.getElementById('totalvalue_".$ia[1]."').setAttribute(ieAtt,'" . $errorClass . "');\n"; $answer .= " document.getElementById('min_num_value_".$ia[1]."').setAttribute(ieAtt,'" . $errorClass . "');\n"; $answer .= " }\n"; @@ -4636,10 +3761,8 @@ function do_multiplenumeric($ia) $answer .= " if (bob.value == '' || bob.value == '".sprintf($clang->gT("Answer is invalid. The total of all entries should add up to at least %s.",'js'),$min_num_value)."')\n"; $answer .= " {\n"; $answer .= " bob.value = '';\n"; - // $answer .= " document.getElementById('totalvalue_".$ia[1]."').style.color='black';\n"; $answer .= " document.getElementById('totalvalue_".$ia[1]."').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " }\n"; - // $answer .= " document.getElementById('min_num_value_".$ia[1]."').style.color='black';\n"; $answer .= " document.getElementById('min_num_value_".$ia[1]."').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " }\n"; $answer .= " break;\n"; @@ -4651,8 +3774,6 @@ function do_multiplenumeric($ia) $answer .= " if (bob.value == '' || bob.value == '".$clang->gT("Answer is invalid. The total of all entries should not add up to more than ").$equals_num_value."')\n"; $answer .= " {\n"; $answer .= " bob.value = '';\n"; - // $answer .= " document.getElementById('totalvalue_".$ia[1]."').style.color='black';\n"; - // $answer .= " document.getElementById('equals_num_value_".$ia[1]."').style.color='black';\n"; $answer .= " document.getElementById('totalvalue_".$ia[1]."').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " document.getElementById('equals_num_value_".$ia[1]."').setAttribute(ieAtt,'" . $goodClass . "');\n"; $answer .= " }\n"; @@ -4660,8 +3781,6 @@ function do_multiplenumeric($ia) $answer .= " else\n"; $answer .= " {\n"; $answer .= " bob.value = '".$clang->gT("Answer is invalid. The total of all entries should not add up to more than ").$equals_num_value."';\n"; - // $answer .= " document.getElementById('totalvalue_".$ia[1]."').style.color='red';\n"; - // $answer .= " document.getElementById('equals_num_value_".$ia[1]."').style.color='red';\n"; $answer .= " document.getElementById('totalvalue_".$ia[1]."').setAttribute(ieAtt,'" . $errorClass . "');\n"; $answer .= " document.getElementById('equals_num_value_".$ia[1]."').setAttribute(ieAtt,'" . $errorClass . "');\n"; $answer .= " }\n"; @@ -5227,20 +4346,6 @@ function do_gender($ia) if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { - /* columns now done by CSS - if ($dcols > 2) - { - $answer .= "\n\n"; - } - elseif ($dcols > 1) - { - $answer .= "\n\n"; - } - else - { - $answer .= "
    "; - } - */ $answer .= "\t
  • \n