Skip to content

Commit

Permalink
Merge branch 'master' into 192_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TMSWhite committed May 7, 2012
2 parents 9258196 + 8114b53 commit f36f8af
Show file tree
Hide file tree
Showing 39 changed files with 32,530 additions and 19,639 deletions.
165 changes: 82 additions & 83 deletions admin/conditionshandling.php
@@ -1,17 +1,17 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: conditionshandling.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: conditionshandling.php 11664 2011-12-16 05:19:42Z tmswhite $
*/

//
// TODO
Expand Down Expand Up @@ -60,30 +60,30 @@
if (isset($stringcomparizonoperators) && $stringcomparizonoperators == 1)
{
$method = array(
"<" => $clang->gT("Less than"),
"<=" => $clang->gT("Less than or equal to"),
"==" => $clang->gT("equals"),
"!=" => $clang->gT("Not equal to"),
">=" => $clang->gT("Greater than or equal to"),
">" => $clang->gT("Greater than"),
"RX" => $clang->gT("Regular expression"),
"a<b" => $clang->gT("Less than (Strings)"),
"a<=b" => $clang->gT("Less than or equal to (Strings)"),
"a>=b" => $clang->gT("Greater than or equal to (Strings)"),
"a>b" => $clang->gT("Greater than (Strings)")
);
"<" => $clang->gT("Less than"),
"<=" => $clang->gT("Less than or equal to"),
"==" => $clang->gT("equals"),
"!=" => $clang->gT("Not equal to"),
">=" => $clang->gT("Greater than or equal to"),
">" => $clang->gT("Greater than"),
"RX" => $clang->gT("Regular expression"),
"a<b" => $clang->gT("Less than (Strings)"),
"a<=b" => $clang->gT("Less than or equal to (Strings)"),
"a>=b" => $clang->gT("Greater than or equal to (Strings)"),
"a>b" => $clang->gT("Greater than (Strings)")
);
}
else
{
$method = array(
"<" => $clang->gT("Less than"),
"<=" => $clang->gT("Less than or equal to"),
"==" => $clang->gT("equals"),
"!=" => $clang->gT("Not equal to"),
">=" => $clang->gT("Greater than or equal to"),
">" => $clang->gT("Greater than"),
"RX" => $clang->gT("Regular expression")
);
"<" => $clang->gT("Less than"),
"<=" => $clang->gT("Less than or equal to"),
"==" => $clang->gT("equals"),
"!=" => $clang->gT("Not equal to"),
">=" => $clang->gT("Greater than or equal to"),
">" => $clang->gT("Greater than"),
"RX" => $clang->gT("Regular expression")
);
}

if (isset($_POST['method']))
Expand Down Expand Up @@ -200,12 +200,12 @@

if ($count_caseinsensitivedupes == 0)
{
$query = "INSERT INTO {$dbprefix}conditions (qid, scenario, cqid, cfieldname, method, value) VALUES "
. "('{$qid}', '{$p_scenario}', '{$p_cqid}', '{$conditionCfieldname}', '{$p_method}', '$ca')";
$result = $connect->Execute($query) or safe_die ("Couldn't insert new condition<br />$query<br />".$connect->ErrorMsg());
$query = "INSERT INTO {$dbprefix}conditions (qid, scenario, cqid, cfieldname, method, value) VALUES "
. "('{$qid}', '{$p_scenario}', '{$p_cqid}', '{$conditionCfieldname}', '{$p_method}', '$ca')";
$result = $connect->Execute($query) or safe_die ("Couldn't insert new condition<br />$query<br />".$connect->ErrorMsg());
}
}
}
}

unset($posted_condition_value);
// Please note that auto_unescape is already applied in database.php included above
Expand Down Expand Up @@ -366,10 +366,10 @@
while($row=$result->FetchRow())
{
$proformaconditions[]=array("scenario"=>$row['scenario'],
"cqid"=>$row['cqid'],
"cfieldname"=>$row['cfieldname'],
"method"=>$row['method'],
"value"=>$row['value']);
"cqid"=>$row['cqid'],
"cfieldname"=>$row['cfieldname'],
"method"=>$row['method'],
"value"=>$row['value']);
} // while
foreach ($copyconditionsto as $copyc)
{
Expand Down Expand Up @@ -542,13 +542,13 @@
while ($myrows=$result->FetchRow())
{ //key => value
$theserows[]=array("qid"=>$myrows['qid'],
"sid"=>$myrows['sid'],
"gid"=>$myrows['gid'],
"question"=>$myrows['question'],
"type"=>$myrows['type'],
"mandatory"=>$myrows['mandatory'],
"other"=>$myrows['other'],
"title"=>$myrows['title']);
"sid"=>$myrows['sid'],
"gid"=>$myrows['gid'],
"question"=>$myrows['question'],
"type"=>$myrows['type'],
"mandatory"=>$myrows['mandatory'],
"other"=>$myrows['other'],
"title"=>$myrows['title']);
}
}
}
Expand Down Expand Up @@ -581,13 +581,13 @@
while($myrows=$result->FetchRow())
{
$postrows[]=array("qid"=>$myrows['qid'],
"sid"=>$myrows['sid'],
"gid"=>$myrows['gid'],
"question"=>$myrows['question'],
"type"=>$myrows['type'],
"mandatory"=>$myrows['mandatory'],
"other"=>$myrows['other'],
"title"=>$myrows['title']);
"sid"=>$myrows['sid'],
"gid"=>$myrows['gid'],
"question"=>$myrows['question'],
"type"=>$myrows['type'],
"mandatory"=>$myrows['mandatory'],
"other"=>$myrows['other'],
"title"=>$myrows['title']);
} // while
}
$postquestionscount=count($postrows);
Expand All @@ -597,11 +597,11 @@

if (isset($postquestionscount) && $postquestionscount > 0)
{ //Build the array used for the questionNav and copyTo select boxes
foreach ($postrows as $pr)
{
$pquestions[]=array("text"=>$pr['title'].": ".substr(strip_tags($pr['question']), 0, 80),
"fieldname"=>$pr['sid']."X".$pr['gid']."X".$pr['qid']);
}
foreach ($postrows as $pr)
{
$pquestions[]=array("text"=>$pr['title'].": ".substr(strip_tags($pr['question']), 0, 80),
"fieldname"=>$pr['sid']."X".$pr['gid']."X".$pr['qid']);
}
}

// Previous question parsing ==> building cquestions[] and canswers[]
Expand Down Expand Up @@ -687,17 +687,18 @@
//Get question attribute for $canswers
$qidattributes=getQuestionAttributes($rows['qid'], $rows['type']);
if (isset($qidattributes['multiflexible_max']) && trim($qidattributes['multiflexible_max'])!='') {
$maxvalue=$qidattributes['multiflexible_max'];
$maxvalue=floatval($qidattributes['multiflexible_max']);
} else {
$maxvalue=10;
}
if (isset($qidattributes['multiflexible_min']) && trim($qidattributes['multiflexible_min'])!='') {
$minvalue=$qidattributes['multiflexible_min'];
$minvalue=floatval($qidattributes['multiflexible_min']);
} else {
$minvalue=1;
}
if (isset($qidattributes['multiflexible_step']) && trim($qidattributes['multiflexible_step'])!='') {
$stepvalue=$qidattributes['multiflexible_step'];
$stepvalue=floatval($qidattributes['multiflexible_step']);
if ($stepvalue==0) $stepvalue=1;
} else {
$stepvalue=1;
}
Expand All @@ -715,21 +716,21 @@
. "AND q.language='".GetBaseLanguageFromSurveyID($surveyid)."'"
." AND sq.language='".GetBaseLanguageFromSurveyID($surveyid)."'"
." AND q.qid={$rows['qid']}
AND sq.scale_id=0
ORDER BY sq.question_order";
AND sq.scale_id=0
ORDER BY sq.question_order";

$y_axis_db = db_execute_assoc($fquery);

// Get the X-Axis
$aquery = "SELECT sq.*
FROM ".db_table_name('questions')." q, ".db_table_name('questions')." sq
WHERE q.sid=$surveyid
AND sq.parent_qid=q.qid
AND q.language='".GetBaseLanguageFromSurveyID($surveyid)."'
AND sq.language='".GetBaseLanguageFromSurveyID($surveyid)."'
AND q.qid=".$rows['qid']."
AND sq.scale_id=1
ORDER BY sq.question_order";
// Get the X-Axis
$aquery = "SELECT sq.*
FROM ".db_table_name('questions')." q, ".db_table_name('questions')." sq
WHERE q.sid=$surveyid
AND sq.parent_qid=q.qid
AND q.language='".GetBaseLanguageFromSurveyID($surveyid)."'
AND sq.language='".GetBaseLanguageFromSurveyID($surveyid)."'
AND q.qid=".$rows['qid']."
AND sq.scale_id=1
ORDER BY sq.question_order";

$x_axis_db=db_execute_assoc($aquery) or safe_die ("Couldn't get answers to Array questions<br />$aquery<br />".$connect->ErrorMsg());

Expand All @@ -749,7 +750,7 @@
{
for($ii=$minvalue; $ii<=$maxvalue; $ii+=$stepvalue)
{
$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['title'], $ii, $ii);
$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['title']."_".$key, $ii, $ii);
}
}
}
Expand Down Expand Up @@ -1384,7 +1385,7 @@
$conditionsoutput_main_content .= "\t$thisAttrName\n";
// TIBO not sure this is used anymore !!
$conditionsList[]=array("cid"=>$rows['cid'],
"text"=>$thisAttrName);
"text"=>$thisAttrName);
}
else
{
Expand All @@ -1395,7 +1396,7 @@
{
$conditionsoutput_main_content .= "\t$cqn[0] (qid{$rows['cqid']})\n";
$conditionsList[]=array("cid"=>$rows['cid'],
"text"=>$cqn[0]." ({$rows['value']})");
"text"=>$cqn[0]." ({$rows['value']})");
}
else
{
Expand Down Expand Up @@ -1641,7 +1642,7 @@
}

$conditionsoutput_main_content .= "\t<div class='condition-tbl-full'>\n"
// ."\t\t<input type='submit' value='".$clang->gT("Copy conditions")."' onclick=\"if (confirm('".$clang->gT("Are you sure you want to copy these condition(s) to the questions you have selected?","js")."')){prepareCopyconditions(); return true;} else {return false;}\" $disableCopyCondition/>\n"
// ."\t\t<input type='submit' value='".$clang->gT("Copy conditions")."' onclick=\"if (confirm('".$clang->gT("Are you sure you want to copy these condition(s) to the questions you have selected?","js")."')){prepareCopyconditions(); return true;} else {return false;}\" $disableCopyCondition/>\n"
."\t\t<input type='submit' value='".$clang->gT("Copy conditions")."' onclick=\"prepareCopyconditions(); return true;\" $disableCopyCondition/>\n"
."<input type='hidden' name='subaction' value='copyconditions' />\n"
."<input type='hidden' name='sid' value='$surveyid' />\n"
Expand Down Expand Up @@ -1805,10 +1806,10 @@
."<select name='method' id='method' style='font-family:verdana; font-size:10' >\n";
foreach ($method as $methodCode => $methodTxt)
{
$selected=$methodCode=="==" ? " selected='selected'" : "";
$selected=$methodCode=="==" ? " selected='selected'" : "";
$conditionsoutput_main_content .= "\t<option value='".$methodCode."'$selected>".$methodTxt."</option>\n";
}
/**
/**
."\t<option value='<'>".$clang->gT("Less than")."</option>\n"
."\t<option value='<='>".$clang->gT("Less than or equal to")."</option>\n"
."\t<option selected='selected' value='=='>".$clang->gT("Equals")."</option>\n"
Expand All @@ -1820,7 +1821,7 @@
."\t<option value='a<=b'>".$clang->gT("Less than or equal to (Strings)")."</option>\n"
."\t<option value='a>=b'>".$clang->gT("Greater than or equal to (Strings)")."</option>\n"
."\t<option value='a>b'>".$clang->gT("Greater than (Strings)")."</option>\n"
**/
**/
$conditionsoutput_main_content .="</select>\n"
."</div>\n"
."</div>\n";
Expand Down Expand Up @@ -2127,5 +2128,3 @@ function showSpeaker($hinttext)
return $reshtml;

}

?>
20 changes: 10 additions & 10 deletions admin/importoldresponses.php
Expand Up @@ -50,7 +50,7 @@
<div class='header ui-widget-header'>
".$clang->gT("Import responses from a deactivated survey table")."
</div>
<form id='personalsettings' method='post'>
<form id='personalsettings' method='post'>
<ul>
<li><label for='spansurveyid'>".$clang->gT("Target survey ID:")."</label>
<span id='spansurveyid'> $surveyid<input type='hidden' value='$surveyid' name='sid'></span>
Expand Down Expand Up @@ -89,9 +89,9 @@
);


$aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true));
$aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true));
$aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true));
$aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true));

// Only import fields where the fieldnames are matching
$aValidFields=array_intersect($aFieldsOldTable,$aFieldsNewTable);

Expand All @@ -113,17 +113,17 @@
$aSRIDConversions[$iOldID]=$connect->Insert_Id($activetable,"id");
}

$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount);
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount);

$sOldTimingsTable=substr($oldtable,0,strrpos($oldtable,'_')).'_timings'.substr($oldtable,strrpos($oldtable,'_'));
$sNewTimingsTable=db_table_name_nq("survey_{$surveyid}_timings");
if (tableExists(sStripDBPrefix($sOldTimingsTable)) && tableExists(sStripDBPrefix($sNewTimingsTable)) && returnglobal('importtimings')=='Y')
{
// Import timings
$aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true));
$aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true));
$aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true));
$aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true));
$aValidTimingFields=array_intersect($aFieldsOldTimingTable,$aFieldsNewTimingTable);

$queryOldValues = "SELECT ".implode(", ",$aValidTimingFields)." FROM {$sOldTimingsTable} ";
$resultOldValues = db_execute_assoc($queryOldValues) or safe_die("Error:<br />$queryOldValues<br />".$connect->ErrorMsg());
$iRecordCountT=$resultOldValues->RecordCount();
Expand All @@ -132,12 +132,12 @@
{
if (isset($aSRIDConversions[$row['id']]))
{
$row['id']=$aSRIDConversions[$row['id']];
$row['id']=$aSRIDConversions[$row['id']];
}
$sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",",array_map("db_quote_id",array_keys($row))).") VALUES (".implode(",",array_map("db_quoteall",array_values($row))).")";
$result = $connect->Execute($sInsertSQL) or safe_die("Error:<br />$sInsertSQL<br />".$connect->ErrorMsg());
}
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
}
$importoldresponsesoutput = browsemenubar($clang->gT("Quick statistics"));
}
Expand Down
7 changes: 6 additions & 1 deletion admin/scripts/answers.js
Expand Up @@ -97,6 +97,12 @@ function addinput()
newposition=Number(position)+1;
languages=langs.split(';');

sNextCode=getNextCode($(this).parent().parent().find('.code').val());
while ($(this).parent().parent().parent().find('input[value="'+sNextCode+'"]').length>0)
{
sNextCode=getNextCode(sNextCode);
}

for (x in languages)
{
tablerow=$('#tabpage_'+languages[x]).find('#answers_'+languages[x]+'_'+scale_id+' .row_'+position);
Expand All @@ -110,7 +116,6 @@ function addinput()
assessment_style='style="display:none;"';
assessment_type='hidden';
}
sNextCode=getNextCode($(this).parent().parent().find('.code').val());
if (x==0) {
inserthtml='<tr class="row_'+newposition+'" style="display:none;"><td><img class="handle" src="../images/handle.png" /></td><td><input class="code" onkeypress="return goodchars(event,\'1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ_\')" type="text" maxlength="5" size="5" value="'+htmlspecialchars(sNextCode)+'" /></td><td '+assessment_style+'><input class="assessment" type="'+assessment_type+'" maxlength="5" size="5" value="1"/></td><td><input type="text" size="100" class="answer" value="'+htmlspecialchars(newansweroption_text)+'"></input><a class="editorLink"><img class="btneditanswerena" src="../images/edithtmlpopup.png" width="16" height="16" border="0" /><img class="btneditanswerdis" alt="Give focus to the HTML editor popup window" src="../images/edithtmlpopup_disabled.png" style="display: none;" width="16" height="16" align="top" border="0" /></a></td><td><img src="../images/addanswer.png" class="btnaddanswer" /><img src="../images/deleteanswer.png" class="btndelanswer" /></td></tr>'
}
Expand Down

0 comments on commit f36f8af

Please sign in to comment.