Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Yii' into Yii
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jun 5, 2012
2 parents 9ace39b + 8edc2a8 commit 9626eb1
Show file tree
Hide file tree
Showing 7 changed files with 1,046 additions and 941 deletions.
19 changes: 19 additions & 0 deletions application/controllers/admin/checkintegrity.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,25 @@ protected function _checkintegrity()
$aDelete['redundantsurveytables'] = $aOldSurveyTableAsk;
}
}

/**********************************************************************/
/* CHECK CPDB SURVEY_LINKS TABLE FOR REDUNDENT TOKEN TABLES */
/**********************************************************************/
//1: Get distinct list of survey_link survey ids, check if tokens
// table still exists for each one, and remove if not


/* TODO */

/**********************************************************************/
/* CHECK CPDB SURVEY_LINKS TABLE FOR REDUNDENT TOKEN ENTRIES */
/**********************************************************************/
//1: For each survey_link, see if the matching entry still exists in
// the token table and remove if it doesn't.


/* TODO */

return $aDelete;
}

Expand Down
3 changes: 2 additions & 1 deletion application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ function displayParticipants()
{
$aSurveyNames = Surveys_languagesettings::model()->with('survey', 'owner')->findAll('survey.owner_id=:uid AND surveyls_language=:lang',array('survey.uid'=>Yii::app()->session['loginID'], ':lang'=>$lang));
}
//echo "<pre>"; print_r($aSurveyNames); echo "</pre>";

/* Build a list of surveys that have tokens tables */
$tSurveyNames=array();
foreach($aSurveyNames as $row)
{
Expand Down
45 changes: 28 additions & 17 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3088,6 +3088,17 @@ function questionAttributes($returnByName=false)
"help"=>$clang->gT("Enter the code(s) of Multiple choice question(s) (separated by semicolons) to exclude the matching answer options in this question."),
"caption"=>$clang->gT('Array filter exclusion'));

$qattributes["array_filter_style"]=array(
"types"=>"1ABCEF:;MPLKQ",
'category'=>$clang->gT('Logic'),
'sortorder'=>100,
'inputtype'=>'singleselect',
'options'=>array(0=>$clang->gT('Hidden'),
1=>$clang->gT('Disabled')),
'default'=>0,
"help"=>$clang->gT("Specify how array-filtered sub-questions should be displayed"),
"caption"=>$clang->gT('Array filter style'));

$qattributes["assessment_value"]=array(
"types"=>"MP",
'category'=>$clang->gT('Logic'),
Expand Down Expand Up @@ -3855,15 +3866,15 @@ function questionAttributes($returnByName=false)

//Timer attributes
$qattributes["time_limit"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>90,
"inputtype"=>"integer",
"help"=>$clang->gT("Limit time to answer question (in seconds)"),
"caption"=>$clang->gT("Time limit"));

$qattributes["time_limit_action"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>92,
'inputtype'=>'singleselect',
Expand All @@ -3875,7 +3886,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("Time limit action"));

$qattributes["time_limit_disable_next"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>94,
"inputtype"=>"singleselect",
Expand All @@ -3886,7 +3897,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("Time limit disable next"));

$qattributes["time_limit_disable_prev"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>96,
"inputtype"=>"singleselect",
Expand All @@ -3897,7 +3908,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("Time limit disable prev"));

$qattributes["time_limit_countdown_message"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>98,
"inputtype"=>"textarea",
Expand All @@ -3906,23 +3917,23 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("Time limit countdown message"));

$qattributes["time_limit_timer_style"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>100,
"inputtype"=>"textarea",
"help"=>$clang->gT("CSS Style for the message that displays in the countdown timer during the countdown"),
"caption"=>$clang->gT("Time limit timer CSS style"));

$qattributes["time_limit_message_delay"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>102,
"inputtype"=>"integer",
"help"=>$clang->gT("Display the 'time limit expiry message' for this many seconds before performing the 'time limit action' (defaults to 1 second if left blank)"),
"caption"=>$clang->gT("Time limit expiry message display time"));

$qattributes["time_limit_message"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>104,
"inputtype"=>"textarea",
Expand All @@ -3931,31 +3942,31 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("Time limit expiry message"));

$qattributes["time_limit_message_style"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>106,
"inputtype"=>"textarea",
"help"=>$clang->gT("CSS style for the 'time limit expiry message'"),
"caption"=>$clang->gT("Time limit message CSS style"));

$qattributes["time_limit_warning"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>108,
"inputtype"=>"integer",
"help"=>$clang->gT("Display a 'time limit warning' when there are this many seconds remaining in the countdown (warning will not display if left blank)"),
"caption"=>$clang->gT("1st time limit warning message timer"));

$qattributes["time_limit_warning_display_time"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>110,
"inputtype"=>"integer",
"help"=>$clang->gT("The 'time limit warning' will stay visible for this many seconds (will not turn off if this setting is left blank)"),
"caption"=>$clang->gT("1st time limit warning message display time"));

$qattributes["time_limit_warning_message"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>112,
"inputtype"=>"textarea",
Expand All @@ -3964,31 +3975,31 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("1st time limit warning message"));

$qattributes["time_limit_warning_style"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>114,
"inputtype"=>"textarea",
"help"=>$clang->gT("CSS style used when the 'time limit warning' message is displayed"),
"caption"=>$clang->gT("1st time limit warning CSS style"));

$qattributes["time_limit_warning_2"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>116,
"inputtype"=>"integer",
"help"=>$clang->gT("Display the 2nd 'time limit warning' when there are this many seconds remaining in the countdown (warning will not display if left blank)"),
"caption"=>$clang->gT("2nd time limit warning message timer"));

$qattributes["time_limit_warning_2_display_time"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>118,
"inputtype"=>"integer",
"help"=>$clang->gT("The 2nd 'time limit warning' will stay visible for this many seconds (will not turn off if this setting is left blank)"),
"caption"=>$clang->gT("2nd time limit warning message display time"));

$qattributes["time_limit_warning_2_message"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>120,
"inputtype"=>"textarea",
Expand All @@ -3997,7 +4008,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT("2nd time limit warning message"));

$qattributes["time_limit_warning_2_style"]=array(
"types"=>"STUX",
"types"=>"STUXL!",
'category'=>$clang->gT('Timer'),
'sortorder'=>122,
"inputtype"=>"textarea",
Expand Down
55 changes: 48 additions & 7 deletions application/helpers/expressions/em_manager_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1038,23 +1038,39 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
foreach ($cascadedAF as $_caf)
{
$sgq = ((isset($this->qcode2sgq[$_caf])) ? $this->qcode2sgq[$_caf] : $_caf);
$af_names[] = $sgq . substr($sq['sqsuffix'],1);;
$sgq .= substr($sq['sqsuffix'],1);
if (isset($this->knownVars[$sgq]))
{
$af_names[] = $sgq . '.NAOK';
}
}
foreach ($cascadedAFE as $_cafe)
{
$sgq = ((isset($this->qcode2sgq[$_cafe])) ? $this->qcode2sgq[$_cafe] : $_cafe);
$afe_names[] = $sgq . substr($sq['sqsuffix'],1);;
$sgq .= substr($sq['sqsuffix'],1);
if (isset($this->knownVars[$sgq]))
{
$afe_names[] = $sgq . '.NAOK';
}
}
}
else
{
foreach ($cascadedAF as $_caf)
{
$af_names[] = $_caf . $sq['sqsuffix'];
$sgq = $_caf . $sq['sqsuffix'];
if (isset($this->knownVars[$sgq]))
{
$af_names[] = $sgq . '.NAOK';
}
}
foreach ($cascadedAFE as $_cafe)
{
$afe_names[] = $_cafe . $sq['sqsuffix'];
$sgq = $_cafe . $sq['sqsuffix'];
if (isset($this->knownVars[$sgq]))
{
$afe_names[] = $sgq . '.NAOK';
}
}
}
break;
Expand Down Expand Up @@ -5815,12 +5831,23 @@ static function GetRelevanceAndTailoringJavaScript()
////////////////////////////////////////////////////////////////////////

// Do all sub-question filtering (e..g array_filter)
/**
* $afHide - if true, then use jQuery.show(). If false, then disable/enable the row
*/
$afHide = (isset($LEM->qattr[$arg['qid']]['array_filter_style']) ? ($LEM->qattr[$arg['qid']]['array_filter_style'] == '0') : true);
foreach ($subqParts as $sq)
{
$rowdividList[$sq['rowdivid']] = $sq['result'];

$relParts[] = " if ( " . $sq['relevancejs'] . " ) {\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n";
}
else
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n";
}
if ($sq['isExclusiveJS'] != '')
{
$relParts[] = " if ( " . $sq['isExclusiveJS'] . " ) {\n";
Expand All @@ -5842,7 +5869,14 @@ static function GetRelevanceAndTailoringJavaScript()
$relParts[] = " }\n";
$relParts[] = " else {\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n";
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
}
else
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
}
$relParts[] = " }\n";
}
else
Expand All @@ -5852,7 +5886,14 @@ static function GetRelevanceAndTailoringJavaScript()
}
else
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
}
else
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
}
}
$relParts[] = " relChange" . $arg['qid'] . "=true;\n";
$relParts[] = " $('#relevance" . $sq['rowdivid'] . "').val('');\n";
Expand Down
18 changes: 17 additions & 1 deletion application/helpers/qanda_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ function return_timer_script($aQuestionAttributes, $ia, $disable=null) {
global $thissurvey;

$clang = Yii::app()->lang;
header_includes(Yii::app()->getConfig("generalscripts").'coookies.js');
header_includes(Yii::app()->getConfig("generalscripts").'coookies.js', 'js');

/* The following lines cover for previewing questions, because no $_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['fieldarray'] exists.
This just stops error messages occuring */
if(!isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['fieldarray']))
Expand Down Expand Up @@ -1347,6 +1348,13 @@ function do_list_dropdown($ia)

$answer='';

//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$answer .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code

$query = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' ";
$result = Yii::app()->db->createCommand($query)->query(); //Checked
$row = $result->read(); $other = $row['other'];
Expand Down Expand Up @@ -1664,6 +1672,14 @@ function do_list_radio($ia)

$wrapper = setupColumns($dcols , $anscount,"answers-list radio-list","answer-item radio-item");
$answer = $wrapper['whole-start'];

//Time Limit Code
if (trim($aQuestionAttributes['time_limit'])!='')
{
$answer .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code

// Get array_filter stuff

$rowcounter = 0;
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/replacements_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
if($js_header_includes){
foreach ($js_header_includes as $jsinclude)
{
if (substr($jsinclude,0,4) == 'http')
if (substr($jsinclude,0,4) == 'http' || substr($jsinclude,0,strlen(Yii::app()->getConfig('generalscripts'))) == Yii::app()->getConfig('generalscripts'))
$_templatejs .= "<script type='text/javascript' src='{$jsinclude}'></script>\n";
else
$_templatejs .= "<script type='text/javascript' src='".Yii::app()->baseUrl.$jsinclude."'></script>\n";
Expand Down

0 comments on commit 9626eb1

Please sign in to comment.