diff --git a/include/limesurvey/admin/admin_functions.php b/include/limesurvey/admin/admin_functions.php
index 92932a60..c62c69ee 100644
--- a/include/limesurvey/admin/admin_functions.php
+++ b/include/limesurvey/admin/admin_functions.php
@@ -335,7 +335,8 @@ function getAdminHeader($meta=false)
{
$strAdminHeader.=$meta;
}
- $strAdminHeader.="\n"
+ $strAdminHeader.="\n";
+ $strAdminHeader.= "\n"
. "\n"
. "\n"
. "\n"
diff --git a/include/limesurvey/admin/import_functions.php b/include/limesurvey/admin/import_functions.php
index 54abcf33..ae8506c9 100644
--- a/include/limesurvey/admin/import_functions.php
+++ b/include/limesurvey/admin/import_functions.php
@@ -1399,6 +1399,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
}
}
+ $aOldNewFieldmap=aReverseTranslateFieldnames($oldsid,$newsid,$aGIDReplacements,$aQIDReplacements);
// Import conditions --------------------------------------------------------------
if(isset($xml->conditions))
{
@@ -1457,6 +1458,19 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
$insertdata["method"]='==';
}
+ // Now process the value and replace @sgqa@ codes TIBO
+ if (preg_match("/^@(.*)@$/",$insertdata["value"],$cfieldnameInCondValue))
+ {
+ if (isset($aOldNewFieldmap[$cfieldnameInCondValue[1]]))
+ {
+ $newvalue = '@'.$aOldNewFieldmap[$cfieldnameInCondValue[1]].'@';
+ $insertdata["value"] = $newvalue;
+ }
+
+ }
+
+
+
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data {$query} \n".$connect->ErrorMsg());
@@ -1561,7 +1575,6 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
GiveAllSurveyPermissions($_SESSION['loginID'],$newsid);
if ($bTranslateInsertansTags)
{
- $aOldNewFieldmap=aReverseTranslateFieldnames($oldsid,$newsid,$aGIDReplacements,$aQIDReplacements);
TranslateInsertansTags($newsid,$oldsid,$aOldNewFieldmap);
}
diff --git a/include/limesurvey/admin/integritycheck.php b/include/limesurvey/admin/integritycheck.php
index 2c2fed55..dee6053f 100644
--- a/include/limesurvey/admin/integritycheck.php
+++ b/include/limesurvey/admin/integritycheck.php
@@ -28,27 +28,30 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
. "
".$clang->gT("Data Consistency Check")." \n"
. "".$clang->gT("If errors are showing up you might have to execute this script repeatedly.")."
\n"
. "
\n";
-
+
/****** Plainly delete survey permissions if the survey or user does not exist ***/
-
+
$connect->query("delete FROM {$dbprefix}survey_permissions where sid not in (select sid from {$dbprefix}surveys)");
$connect->query("delete FROM {$dbprefix}survey_permissions where uid not in (select uid from {$dbprefix}users)");
-
+
+ // Silently fix subquestions
+ fixSubquestions();
+
/***** Check for activate survey tables with missing survey entry **/
-
+
$sQuery = db_select_tables_like("{$dbprefix}survey\_%");
$aResult = db_execute_num($sQuery) or safe_die("Couldn't get list of conditions from database $query ".$connect->ErrorMsg());
while ($aRow=$aResult->FetchRow())
{
- $tablename=substr($aRow[0],strlen($dbprefix));
+ $tablename=substr($aRow[0],strlen($dbprefix));
if ($tablename=='survey_permissions') continue;
- $iSurveyID=substr($tablename,strpos($tablename,'_')+1);
+ $iSurveyID=substr($tablename,strpos($tablename,'_')+1);
$qquery="SELECT sid FROM {$dbprefix}surveys WHERE sid='{$iSurveyID}'";
$qresult=$connect->Execute($qquery) or safe_die ("Couldn't check questions table for qids $qquery ".$connect->ErrorMsg());
$qcount=$qresult->RecordCount();
if ($qcount==0)
{
- $date = date('YmdHis').rand(1,1000);
+ $date = date('YmdHis').rand(1,1000);
$sOldTable = "survey_{$iSurveyID}";
$sNewTable = "old_survey_{$iSurveyID}_$date";
@@ -63,24 +66,24 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
$setsequence="ALTER TABLE $sNewTable ALTER COLUMN id SET DEFAULT nextval('{$sNewTable}_id_seq'::regclass);";
$deactivateresult = $connect->Execute($setsequence) or die ("Couldn't make backup of the survey table. Please try again. The database reported the following error: ".htmlspecialchars($connect->ErrorMsg())."
Survey was not deactivated either.
".$clang->gT("Main Admin Screen")."");
}
-
+
}
}
/***** Check for activate token tables with missing survey entry **/
-
+
$sQuery = db_select_tables_like("{$dbprefix}tokens\_%");
$aResult = db_execute_num($sQuery) or safe_die("Couldn't get list of token tables from database $query ".$connect->ErrorMsg());
while ($aRow=$aResult->FetchRow())
{
- $tablename=substr($aRow[0],strlen($dbprefix));
- $iSurveyID=substr($tablename,strpos($tablename,'_')+1);
+ $tablename=substr($aRow[0],strlen($dbprefix));
+ $iSurveyID=substr($tablename,strpos($tablename,'_')+1);
$qquery="SELECT sid FROM {$dbprefix}surveys WHERE sid='{$iSurveyID}'";
$qresult=$connect->Execute($qquery) or safe_die ("Couldn't check survey table for sid $qquery ".$connect->ErrorMsg());
$qcount=$qresult->RecordCount();
if ($qcount==0)
{
- $date = date('YmdHis').rand(1,1000);
+ $date = date('YmdHis').rand(1,1000);
$sOldTable = "tokens_{$iSurveyID}";
$sNewTable = "old_tokens_{$iSurveyID}_$date";
$deactivatequery = db_rename_table( db_table_name_nq($sOldTable), db_table_name_nq($sNewTable));
@@ -98,11 +101,11 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
} else {
$deactivateresult = $connect->Execute($deactivatequery) or die ("Couldn't deactivate because: \n".htmlspecialchars($connect->ErrorMsg())." - Query: ".htmlspecialchars($deactivatequery)."
\nAdmin\n");
}
-
+
}
}
-
-
+
+
/**********************************************************************/
/* CHECK CONDITIONS */
/**********************************************************************/
@@ -179,7 +182,7 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
/**********************************************************************/
$sQuery = "SELECT * FROM {$dbprefix}defaultvalues where qid not in (select qid from {$dbprefix}questions)";
$result = db_execute_assoc($sQuery) or safe_die($connect->ErrorMsg());
- $iCountDefaultValues=$result->RecordCount();
+ $iCountDefaultValues=$result->RecordCount();
if ($iCountDefaultValues>0) {
$integritycheck .= "
".sprintf($clang->gT("There are %s orphaned default value entries which can be deleted."),$iCountDefaultValues)."
".$clang->gT("All quota language settings meet consistency standards")."
\n";
- }
+ }
/**********************************************************************/
/* Check quota members */
/**********************************************************************/
$sQuery = "SELECT * FROM {$dbprefix}quota_members where quota_id not in (select id from {$dbprefix}quota) or qid not in (select qid from {$dbprefix}questions) or sid not in (select sid from {$dbprefix}surveys)";
$result = db_execute_assoc($sQuery) or safe_die($connect->ErrorMsg());
- $iCountQuotaMembers=$result->RecordCount();
-
-
+ $iCountQuotaMembers=$result->RecordCount();
+
+
if ($iCountQuotaMembers>0) {
$integritycheck .= "
".sprintf($clang->gT("There are %s orphaned quota members which can be deleted."),$iCountQuotaMembers)."
";
}
else
{
$integritycheck .= "
".$clang->gT("All quota members meet consistency standards")."
\n\t\t".$clang->gT("Make a comment on your choice here:")."\n";
if(isset($_POST['printableexport'])){$pdf->intopdf("Make a comment on your choice here:");}
- $question['ANSWER'] .= "\t\t".input_type_image('textarea',$clang->gT("Make a comment on your choice here:"),50,8)."\n\t
\n";
+ $question['ANSWER'] .= "\t\t".input_type_image('textarea',$clang->gT("Make a comment on your choice here:"),50,8).addsgqacode(" (".$deqrow['sid']."X".$deqrow['gid']."X".$deqrow['qid']."comment)")."\n\t\n";
for($i=0;$i<9;$i++)
{
@@ -1078,7 +1082,7 @@ while ($degrow = $degresult->FetchRow())
while ($mearow = $mearesult->FetchRow())
{
$longest_string = longest_string($mearow['question'] , $longest_string );
- $question['ANSWER'] .= "\t
\n";
if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *only one* of the following:"),"U");}
if(isset($_POST['printableexport'])){$pdf->intopdf(" o ".$clang->gT("Yes"));}
@@ -1207,20 +1211,19 @@ while ($degrow = $degresult->FetchRow())
$question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid);
- $question['ANSWER'] = '
+ $question['ANSWER'] = "
-
1
-
2
-
3
-
4
-
5
+
1".addsgqacode(" (1)")."
+
2".addsgqacode(" (2)")."
+
3".addsgqacode(" (3)")."
+
4".addsgqacode(" (4)")."
+
5".addsgqacode(" (5)")."
-
-';
+ ";
if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose the appropriate response for each item:"),"U");}
$pdfoutput = array();
@@ -1275,7 +1278,7 @@ while ($degrow = $degresult->FetchRow())
$question['ANSWER'] .= "\n
\n\t\n\t\t
\n\t\t\t
\n";
for ($i=1; $i<=10; $i++)
{
- $question['ANSWER'] .= "\t\t\t
$i
\n";
+ $question['ANSWER'] .= "\t\t\t
$i".addsgqacode(" ($i)")."
\n";
}
$question['ANSWER'] .= "\t
\n\n\t\n";
if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose the appropriate response for each item:"),"U");}
@@ -1313,9 +1316,9 @@ while ($degrow = $degresult->FetchRow())
-
'.$clang->gT("Yes").'
-
'.$clang->gT("Uncertain").'
-
'.$clang->gT("No").'
+
'.$clang->gT("Yes").addsgqacode(" (Y)").'
+
'.$clang->gT("Uncertain").addsgqacode(" (U)").'
+
'.$clang->gT("No").addsgqacode(" (N)").'
@@ -1354,9 +1357,9 @@ while ($degrow = $degresult->FetchRow())
-
'.$clang->gT("Increase").'
-
'.$clang->gT("Same").'
-
'.$clang->gT("Decrease").'
+
'.$clang->gT("Increase").addsgqacode(" (I)").'
+
'.$clang->gT("Same").addsgqacode(" (S)").'
+
'.$clang->gT("Decrease").addsgqacode(" (D)").'
@@ -1584,7 +1587,7 @@ while ($degrow = $degresult->FetchRow())
$column_headings = array();
while ($frow = $fresult->FetchRow())
{
- $column_headings[] = $frow['answer'];
+ $column_headings[] = $frow['answer'].addsgqacode(" (".$frow['code'].")");
}
if (trim($qidattributes['answer_width'])!='')
{
@@ -1691,7 +1694,7 @@ while ($degrow = $degresult->FetchRow())
$pdfoutput[0][0]='';
while ($frow = $fresult->FetchRow())
{
- $printablesurveyoutput2 .="\t\t\t
";
$pdfoutput[$a][0]=$mearow['answer'];
for ($i=1; $i<=$fcount; $i++)
diff --git a/include/limesurvey/admin/remotecontrol/lsrc.testclient.php b/include/limesurvey/admin/remotecontrol/lsrc.testclient.php
index fce49bc0..cc34570d 100644
--- a/include/limesurvey/admin/remotecontrol/lsrc.testclient.php
+++ b/include/limesurvey/admin/remotecontrol/lsrc.testclient.php
@@ -20,6 +20,8 @@
//// errors are ok, but warnings have nothing to say (in this case, sometimes warnings are useful!)
//ini_set("error_reporting", "E_ALL & ~E_WARNING");
+die('Test client is deactivated for security reasons. Open lsrc.testclient.php and comment this line to activate the test client.');
+
include_once("lsrc.client.php");
/**
* initiate the testclient object
diff --git a/include/limesurvey/admin/scripts/admin_core.js b/include/limesurvey/admin/scripts/admin_core.js
index 03fd5846..604bcc9c 100644
--- a/include/limesurvey/admin/scripts/admin_core.js
+++ b/include/limesurvey/admin/scripts/admin_core.js
@@ -1,6 +1,7 @@
//$Id: admin_core.js 10855 2011-08-26 13:30:41Z mot3 $
$(document).ready(function(){
+ setupAllTabs();
if(typeof(userdateformat) !== 'undefined')
{
$(".popupdate").datepicker({ dateFormat: userdateformat,
diff --git a/include/limesurvey/admin/scripts/emailtemplates.js b/include/limesurvey/admin/scripts/emailtemplates.js
index 51721bb3..3607b751 100644
--- a/include/limesurvey/admin/scripts/emailtemplates.js
+++ b/include/limesurvey/admin/scripts/emailtemplates.js
@@ -10,8 +10,8 @@ $(document).ready(function(){
/**
* This function loads each FCKeditor only when the tab is clicked and only if it is not already loaded
*/
-function loadHTMLEditor(event, ui)
-{
+function loadHTMLEditor(event, ui)
+{
if (typeof ui.panel.selector != 'undefined')
{
sSelector=ui.panel.selector;
@@ -22,18 +22,18 @@ function loadHTMLEditor(event, ui)
}
if ($(sSelector+' iframe').size()==0)
{
- sCKEditorInstanceName='oFCKeditor_'+$(sSelector+' textarea').attr('id').replace(/-/i, "_");
+ sCKEditorInstanceName='oFCKeditor_'+$(sSelector+' textarea').attr('id').replace(/-/g, "_");
eval("if (typeof "+sCKEditorInstanceName+" != 'undefined')"+sCKEditorInstanceName+".ReplaceTextarea();");
}
}
function fillin(tofield, fromfield)
{
- if (confirm(sReplaceTextConfirmation))
+ if (confirm(sReplaceTextConfirmation))
{
if (document.getElementById(tofield).readOnly == false)
- {
- $('#'+tofield).val($('#'+fromfield).val());
+ {
+ $('#'+tofield).val($('#'+fromfield).val());
}
updateCKeditor(tofield,$('#'+fromfield).val());
diff --git a/include/limesurvey/admin/statistics.php b/include/limesurvey/admin/statistics.php
index 56909939..a8d160fe 100644
--- a/include/limesurvey/admin/statistics.php
+++ b/include/limesurvey/admin/statistics.php
@@ -61,8 +61,7 @@ $maxchars = 50;
-//don't call this script directly!
-if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
+include_once("login_check.php");
//some includes, the progressbar is used to show a progressbar while generating the graphs
//include_once("login_check.php");
@@ -409,7 +408,7 @@ foreach ($filters as $flt)
}
$statisticsoutput .= "\t\t
\n"
-
+
.""
//use current groupname and groupid as heading
@@ -484,7 +483,7 @@ foreach ($filters as $flt)
// File Upload will need special filters in future, hence the special treatment
if ($flt[2] == "|") {$myfield = "|$myfield";}
-
+
//numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
if ($flt[2] == "N") {$myfield = "N$myfield";}
$statisticsoutput .= " do we want to pre-check the checkbox?
if (isset($summary) && (array_search("K{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}", $summary) !== FALSE))
{$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " /> ";
-
+
//show speaker
$statisticsoutput .= showSpeaker($flt[3]." - ".FlattenText($row[1]))." \n";
@@ -580,10 +579,10 @@ foreach ($filters as $flt)
."\t\t\t\t\t \n";
-
+
//we added 1 form -> increase counter
$counter2++;
-
+
}
break;
@@ -603,16 +602,16 @@ foreach ($filters as $flt)
while ($row = $result->FetchRow())
{
//collecting data for output, for details see above (question type "N")
-
+
//we have one input field for each answer
$myfield2 = "Q".$myfield."$row[0]";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t
"
." \n";
-
+
/*
* when hoovering the speaker symbol we show the whole question
*
@@ -1223,13 +1222,13 @@ foreach ($filters as $flt)
*/
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
-
+
//for debugging only:
//$statisticsoutput .= $fquery;
-
+
//creating form
$statisticsoutput .= "\t\t\t\t\n\t\t\t\t
\n";
$counter2++;
-
+
//add fields to main array
}
@@ -1277,7 +1276,7 @@ foreach ($filters as $flt)
{
//adjust layout depending on counter
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t
\n\t\t\t\t
\n"; $counter=0;}
-
+
//myfield is the SGQ identifier
//myfield2 is just used as comment in HTML like "R40X34X1721-1"
$myfield2 = "R" . $myfield . $i . "-" . strlen($i);
@@ -1285,19 +1284,19 @@ foreach ($filters as $flt)
$statisticsoutput .= "\n"
."\t\t\t\t
"
." \n"
."\t\t\t\t\n\t\t\t\t
\n";
$counter2++;
-
+
//add averything to main array
}
@@ -1374,7 +1373,7 @@ foreach ($filters as $flt)
//check if there is a dualscale_headerA/B
$dshquery = "SELECT value FROM ".db_table_name("question_attributes")." WHERE qid={$flt[0]} AND attribute='dualscale_headerA'";
$dshresult = db_execute_num($dshquery) or safe_die ("Couldn't get dualscale header! $dshquery ".$connect->ErrorMsg());
-
+
//get header
while($dshrow=$dshresult->FetchRow())
{
@@ -1393,7 +1392,7 @@ foreach ($filters as $flt)
$statisticsoutput .= " /> "
.showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle)
." \n";
-
+
/* get labels
* table "labels" contains
* - lid
@@ -1402,7 +1401,7 @@ foreach ($filters as $flt)
* - sortorder
* - language
*/
-
+
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' and scale_id=0 ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
@@ -1430,7 +1429,7 @@ foreach ($filters as $flt)
//----------------- LABEL 2 ---------------------
-
+
//myfield2 = answer code
$myfield2 = $myfield . "$row[0]#1";
@@ -1460,7 +1459,7 @@ foreach ($filters as $flt)
//check if there is a dualsclae_headerA/B
$dshquery2 = "SELECT value FROM ".db_table_name("question_attributes")." WHERE qid={$flt[0]} AND attribute='dualscale_headerB'";
$dshresult2 = db_execute_num($dshquery2) or safe_die ("Couldn't get dualscale header! $dshquery2 ".$connect->ErrorMsg());
-
+
//get header
while($dshrow2=$dshresult2->FetchRow())
{
@@ -1481,7 +1480,7 @@ foreach ($filters as $flt)
$statisticsoutput .= " /> "
.showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle2)
." \n";
-
+
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' and scale_id=1 ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
@@ -1552,10 +1551,10 @@ foreach ($filters as $flt)
while ($row=$result->FetchRow())
{
$statisticsoutput .= "\t\t\t\t\t\t
\n";
diff --git a/include/limesurvey/question.php b/include/limesurvey/question.php
index 5df7e5b9..10339f50 100644
--- a/include/limesurvey/question.php
+++ b/include/limesurvey/question.php
@@ -675,14 +675,13 @@ if($thissurvey['allowjumps']=='Y' && !$bIsGroupDescrPage)
}
echo '';
-
- echo "\n";
- echo "\n";
+ echo "\n";
+ echo "\n";
}
if (isset($conditions) && is_array($conditions) && count($conditions) != 0)
diff --git a/include/limesurvey/replacements.php b/include/limesurvey/replacements.php
index da954f0e..cfcecfe4 100644
--- a/include/limesurvey/replacements.php
+++ b/include/limesurvey/replacements.php
@@ -64,6 +64,15 @@ function templatereplace($line, $replacements=array(), $anonymized=false)
{
$surveyformat = "";
}
+ /*if (isset($thissurvey['allowjumps']) && $thissurvey['allowjumps']=="Y" && $surveyformat!="allinone" && (isset($_SESSION['step']) && $_SESSION['step']>0)){
+ $surveyformat .= " withindex";
+ }*/
+ if (isset($thissurvey['showprogress']) && $thissurvey['showprogress']=="Y"){
+ $surveyformat .= " showprogress";
+ }
+ if (isset($thissurvey['showqnumcode'])){
+ $surveyformat .= " showqnumcode-".$thissurvey['showqnumcode'];
+ }
// real survey contact
if (isset($surveylist['contact']))
{
diff --git a/include/limesurvey/scripts/jquery/lime-slider.js b/include/limesurvey/scripts/jquery/lime-slider.js
index dc5c0ae8..5b9884b9 100644
--- a/include/limesurvey/scripts/jquery/lime-slider.js
+++ b/include/limesurvey/scripts/jquery/lime-slider.js
@@ -19,7 +19,7 @@ $(document).ready(function(){
// call the init slider routine for each element of the .multinum-slider class
$(".multinum-slider").each(function(i,e) {
var basename = e.id.substr(10);
-
+ $('#answer'+basename).hide();
$(this).prev('label').addClass('slider-label'); //3796 TP - add a class to the labels in slider questions to facilitate styling
//$("#slider-"+basename).addClass('ui-slider-2');
diff --git a/include/limesurvey/scripts/survey_runtime.js b/include/limesurvey/scripts/survey_runtime.js
index 1bd82f40..3399cb01 100644
--- a/include/limesurvey/scripts/survey_runtime.js
+++ b/include/limesurvey/scripts/survey_runtime.js
@@ -110,6 +110,14 @@ $(document).ready(function()
});
}
}
+ /*replacement for inline javascript for #index */
+ /*
+ $("#index").parents(".outerframe").addClass("withindex");
+ if ($("#index").size() && $("#index .row.current").size()){
+ var idx = $("#index");
+ var row = $("#index .row.current");
+ idx.scrollTop(row.position().top - idx.height() / 2 - row.height() / 2);
+ */
});
gmaps = new Object;