Skip to content

Commit

Permalink
Dev Merged fixes that were done before we set the new 'fix in both br…
Browse files Browse the repository at this point in the history
…anches' rule

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9757 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Feb 9, 2011
1 parent 81ddf26 commit 1eb11f8
Show file tree
Hide file tree
Showing 41 changed files with 23,319 additions and 20,495 deletions.
2 changes: 1 addition & 1 deletion admin/activate.php
Expand Up @@ -30,7 +30,7 @@

// Check consistency for groups and questions
$failedgroupcheck = checkGroup($postsid);
$failedcheck = checkQestions($postsid, $surveyid, $qtypes);
$failedcheck = checkQuestions($postsid, $surveyid, $qtypes);

//IF ANY OF THE CHECKS FAILED, PRESENT THIS SCREEN
if ((isset($failedcheck) && $failedcheck) || (isset($failedgroupcheck) && $failedgroupcheck))
Expand Down
22 changes: 4 additions & 18 deletions admin/activate_functions.php
Expand Up @@ -100,7 +100,7 @@ function checkGroup($postsid)
* @param <type> $surveyid
* @return array $faildcheck
*/
function checkQestions($postsid, $surveyid, $qtypes)
function checkQuestions($postsid, $surveyid, $qtypes)
{
global $dbprefix, $connect, $clang;

Expand Down Expand Up @@ -293,13 +293,8 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php',$simulate =
$fieldmap=createFieldMap($surveyid);
foreach ($fieldmap as $j=>$arow) //With each question, create the appropriate field(s)
{
// don't include time fields
if ($arow['type'] != "answer_time" && $arow['type'] != "page_time" && $arow['type'] != "interview_time")
{
if ($createsurvey!='') {$createsurvey .= ",\n";}
$createsurvey .= " `{$arow['fieldname']}`";
}

$createsurvey .= " ".db_quote_id($arow['fieldname']);
$createsurveybkup = $createsurvey;
$createsurvey = '';
switch($arow['type'])
Expand Down Expand Up @@ -385,11 +380,6 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php',$simulate =
$createsurvey .= " C(36)";
}
break;
case "page_time":
case "answer_time":
case "interview_time":
$createsurveytimings .= " `{$arow['fieldname']}` I(11) DEFAULT '0',\n";
break;
default:
$createsurvey .= " C(5)";
}
Expand All @@ -401,11 +391,8 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php',$simulate =
$type = substr($tempTrim,0,2);
$arrSim[] = array($type);
}
else{
$type = substr($tempTrim,0,$brackets);
$len = substr($tempTrim,$brackets+1,strrpos($tempTrim,')')-2);
$arrSim[] = array($type,$len);
}
$timingsfieldmap = createTimingsFieldMap($surveyid);
$createsurveytimings .= join(" F DEFAULT '0',\n",array_keys($timingsfieldmap)) . " F DEFAULT '0'";

}

Expand All @@ -420,7 +407,6 @@ function activateSurvey($postsid,$surveyid, $scriptname='admin.php',$simulate =

// If last question is of type MCABCEFHP^QKJR let's get rid of the ending coma in createsurvey
$createsurvey = rtrim($createsurvey, ",\n")."\n"; // Does nothing if not ending with a comma
$createsurveytimings = rtrim($createsurveytimings, ",\n")."\n"; // Does nothing if not ending with a comma

$tabname = "{$dbprefix}survey_{$postsid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL)

Expand Down
5 changes: 1 addition & 4 deletions admin/admin_functions.php
Expand Up @@ -105,12 +105,9 @@ function bHasFileUploadQuestion($surveyid) {
$fieldmap = createFieldMap($surveyid);

foreach ($fieldmap as $field) {
foreach ($field as $key => $value) {
if ($value == "|")
return true;
if (isset($field['type']) && $field['type'] === '|') return true;
}
}
}

/**
* Returns true if a user has global permission for a certain action. Available permissions are
Expand Down
22 changes: 14 additions & 8 deletions admin/browse.php
Expand Up @@ -254,7 +254,9 @@
{
$browseoutput .= "<img align='left' hspace='0' border='0' src='$imageurl/delete_disabled.png' alt='".$clang->gT("You don't have permission to delete this entry.")."'/>";
}
if (bHasFileUploadQuestion($surveyid)) {

if (bHasFileUploadQuestion($surveyid))
{
$browseoutput .= "<a href='#' title='".$clang->gTview("Download files for this entry")."' onclick=\" ".get2post($scriptname.'?action=browse&amp;subaction=all&amp;downloadfile='.$id.'&amp;sid='.$surveyid)."\" >"
."<img align='left' hspace='0' border='0' src='$imageurl/download.png' alt='".$clang->gT("Download files for this entry")."' /></a>\n";
}
Expand Down Expand Up @@ -368,7 +370,8 @@
if ($field['type'] == "|" && strpos($field['fieldname'], "_filecount") == 0)
$fuqtquestions[] = $field['fieldname'];
}

if (count($fuqtquestions)>0)
{
if (!empty($fuqtquestions)) {
// find all responses (filenames) to the fuqt questions
$query="SELECT " . implode(", ", $fuqtquestions) . " FROM $surveytable where id={$_POST['deleteanswer']}";
Expand Down Expand Up @@ -730,7 +733,10 @@

//LETS COUNT THE DATA
$dtquery = "SELECT count(*) FROM $sql_from $sql_where";

if ($sql_where!="")
{
$dtquery .=" WHERE $sql_where";
}
$dtresult=db_execute_num($dtquery) or safe_die("Couldn't get response data<br />$dtquery<br />".$connect->ErrorMsg());
while ($dtrow=$dtresult->FetchRow()) {$dtcount=$dtrow[0];}

Expand Down Expand Up @@ -1001,19 +1007,19 @@
}
}

$fields=createFieldMap($surveyid,'full');
$fields=createTimingsFieldMap($surveyid,'full');

foreach ($fields as $fielddetails)
{
// headers for answer id and time data
if ($fielddetails['type']=='id')
$fnames[]=array($fielddetails['fieldname'],$fielddetails['question']);
if ($fielddetails['type']=='interview_time')
$fnames[]=array($fielddetails['fieldname'],"Interview time");
$fnames[]=array($fielddetails['fieldname'],$clang->gT('Total time'));
if ($fielddetails['type']=='page_time')
$fnames[]=array($fielddetails['fieldname'],"Page ".$fielddetails['gid']." time");
$fnames[]=array($fielddetails['fieldname'],$clang->gT('Group').": ".$fielddetails['group_name']);
if ($fielddetails['type']=='answer_time')
$fnames[]=array($fielddetails['fieldname'],"Question ".$fielddetails['qid']." time");
$fnames[]=array($fielddetails['fieldname'],$clang->gT('Question').": ".$fielddetails['title']);
}
$fncount = count($fnames);

Expand All @@ -1023,7 +1029,7 @@
else {$tableheader .= "<table class='browsetable'>\n";}
$tableheader .= "\t<thead><tr valign='top'>\n"
. "<th><input type='checkbox' id='selectall'></th>\n"
. "<th>Actions</th>\n";
. "<th>".$clang->gT('Actions')."</th>\n";
foreach ($fnames as $fn)
{
if (!isset($currentgroup)) {$currentgroup = $fn[1]; $gbc = "oddrow";}
Expand Down
2 changes: 2 additions & 0 deletions admin/database.php
Expand Up @@ -177,6 +177,7 @@ function get_max_question_order($gid)
$connect->Execute("DELETE FROM {$dbprefix}answers WHERE qid={$row['qid']}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}questions WHERE qid={$row['qid']} or parent_qid={$row['qid']}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}defaultvalues WHERE qid={$row['qid']}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}quota_members WHERE qid={$qid}");
}
}
$query = "DELETE FROM ".db_table_name('assessments')." WHERE sid=$surveyid AND gid=$gid";
Expand Down Expand Up @@ -805,6 +806,7 @@ function get_max_question_order($gid)
$connect->Execute("DELETE FROM {$dbprefix}answers WHERE qid={$qid}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}questions WHERE qid={$qid} or parent_qid={$qid}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}defaultvalues WHERE qid={$qid}"); // Checked
$connect->Execute("DELETE FROM {$dbprefix}quota_members WHERE qid={$qid}");
fixsortorderQuestions($gid, $surveyid);

$qid="";
Expand Down
4 changes: 4 additions & 0 deletions admin/dataentry.php
Expand Up @@ -613,8 +613,12 @@
}
break;
case "D": //DATE
$thisdate='';
if ($idrow[$fname['fieldname']]!='')
{
$datetimeobj = new Date_Time_Converter($idrow[$fname['fieldname']] , "Y-m-d H:i:s");
$thisdate=$datetimeobj->convert($dateformatdetails['phpdate']);
}
$dataentryoutput .= "\t<input type='text' class='popupdate' size='12' name='{$fname['fieldname']}' value='{$thisdate}' />\n";
break;
case "G": //GENDER drop-down list
Expand Down
1 change: 1 addition & 0 deletions admin/editansweroptions.php
Expand Up @@ -116,6 +116,7 @@
var strCantDeleteLastAnswer='".$clang->gT('You cannot delete the last answer option.','js')."';
var lsbrowsertitle='".$clang->gT('Label set browser','js')."';
var quickaddtitle='".$clang->gT('Quick-add answers','js')."';
var sAssessmentValue='".$clang->gT('Assessment value','js')."';
var duplicateanswercode='".$clang->gT('Error: You are trying to use duplicate answer codes.','js')."';
var langs='".implode(';',$anslangs)."';</script>\n";

Expand Down
34 changes: 17 additions & 17 deletions admin/export_structure_quexml.php
Expand Up @@ -591,7 +591,7 @@ function create_subQuestions(&$question,$qid,$varname,$use_answers = false)
//no comment - this should be a separate question
break;
case "R": //RANKING STYLE
create_subQuestions(&$question,$qid,$RowQ['title'],true);
create_subQuestions($question,$qid,$RowQ['title'],true);
$Query = "SELECT COUNT(*) as sc FROM {$dbprefix}answers WHERE qid = $qid AND language='$quexmllang' ";
$QRE = db_execute_assoc($Query);
//$QRE = mysql_query($Query) or die ("ERROR: $QRE<br />".mysql_error());
Expand All @@ -601,20 +601,20 @@ function create_subQuestions(&$question,$qid,$varname,$use_answers = false)
$question->append_child($response);
break;
case "M": //Multiple choice checkbox
create_multi(&$question,$qid,$RowQ['title'],false,false,$other);
create_multi($question,$qid,$RowQ['title'],false,false,$other);
break;
case "P": //Multiple choice with comments checkbox + text
//Not yet implemented
create_multi(&$question,$qid,$RowQ['title'],false,false,$other);
create_multi($question,$qid,$RowQ['title'],false,false,$other);
//no comments added
break;
case "Q": //MULTIPLE SHORT TEXT
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(create_free("text",get_length($qid,"maximum_chars","10"),""));
$question->append_child($response);
break;
case "K": //MULTIPLE NUMERICAL
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(create_free("integer",get_length($qid,"maximum_chars","10"),""));
$question->append_child($response);
break;
Expand Down Expand Up @@ -643,40 +643,40 @@ function create_subQuestions(&$question,$qid,$varname,$use_answers = false)
$question->append_child($response);
break;
case "A": //ARRAY (5 POINT CHOICE) radio-buttons
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5)));
$question->append_child($response);
break;
case "B": //ARRAY (10 POINT CHOICE) radio-buttons
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5,"6" => 6,"7" => 7,"8" => 8,"9" => 9,"10" => 10)));
$question->append_child($response);
break;
case "C": //ARRAY (YES/UNCERTAIN/NO) radio-buttons
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("Yes" => 1,"Uncertain" => 2,"No" => 3)));
$question->append_child($response);
break;
case "E": //ARRAY (Increase/Same/Decrease) radio-buttons
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("Increase" => 1,"Same" => 2,"Decrease" => 3)));
$question->append_child($response);
break;
case "F": //ARRAY (Flexible) - Row Format
//select subQuestions from answers table where QID
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(create_fixed($qid,false,false,0,$other));
$question->append_child($response);
//select fixed responses from
break;
case "H": //ARRAY (Flexible) - Column Format
create_subQuestions(&$question,$RowQ['qid'],$RowQ['title']);
create_subQuestions($question,$RowQ['qid'],$RowQ['title']);
$response->append_child(create_fixed($qid,true,false,0,$other));
$question->append_child($response);
break;
case "1": //Dualscale multi-flexi array
//select subQuestions from answers table where QID
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
$response = $dom->create_element("response");
$response->append_child(create_fixed($qid,false,false,0,$other));
$response2 = $dom->create_element("response");
Expand All @@ -686,22 +686,22 @@ function create_subQuestions(&$question,$qid,$varname,$use_answers = false)
$question->append_child($response2);
break;
case ":": //multi-flexi array numbers
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
//get multiflexible_checkbox - if set then each box is a checkbox (single fixed response)
$mcb = get_length($qid,'multiflexible_checkbox',-1);
if ($mcb != -1)
create_multi(&$question,$qid,$RowQ['title'],1);
create_multi($question,$qid,$RowQ['title'],1);
else
{
//get multiflexible_max - if set then make boxes of max this width
$mcm = strlen(get_length($qid,'multiflexible_max',1));
create_multi(&$question,$qid,$RowQ['title'],1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
}
break;
case ";": //multi-flexi array text
create_subQuestions(&$question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$RowQ['title']);
//foreach question where scale_id = 1 this is a textbox
create_multi(&$question,$qid,$RowQ['title'],1,array('f' => 'text', 'len' => 10, 'lab' => ''));
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'text', 'len' => 10, 'lab' => ''));
break;
case "^": //SLIDER CONTROL - not supported
$response->append_child(fixed_array(array("NOT SUPPORTED:$type" => 1)));
Expand Down
15 changes: 8 additions & 7 deletions admin/fck_LimeReplacementFields.php
Expand Up @@ -143,6 +143,7 @@
// but not email-reg for the moment
$replFields[]=array('EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('OPTOUTURL',$clang->gT("URL for a respondent to opt-out this survey"));
case 'email-reg':
$replFields[]=array('FIRSTNAME',$clang->gT("Firstname from token"));
$replFields[]=array('LASTNAME',$clang->gT("Lastname from token"));
Expand Down Expand Up @@ -212,7 +213,7 @@
}
if ($isInstertansEnabled===true)
{
if (empty($surveyid)) {die("No SID provided.");}
if (empty($surveyid)) {safe_die("No SID provided.");}

//2: Get all other questions that occur before this question that are pre-determined answer types
$fieldmap = createFieldMap($surveyid, 'full');
Expand All @@ -237,7 +238,7 @@
case 'editgroup':
case 'editgroup_desc':
case 'translategroup':
if (empty($gid)) {die("No GID provided.");}
if (empty($gid)) {safe_die("No GID provided.");}

if ($field['gid'] == $gid)
{
Expand All @@ -246,7 +247,7 @@
break;

case 'addquestion':
if (empty($gid)) {die("No GID provided.");}
if (empty($gid)) {safe_die("No GID provided.");}

if ( !is_null($prevquestion) &&
$prevquestion['gid'] == $gid &&
Expand All @@ -261,21 +262,21 @@
case 'editquestion':
case 'translatequestion':
case 'translateanswer':
if (empty($gid)) {die("No GID provided.");}
if (empty($qid)) {die("No QID provided.");}
if (empty($gid)) {safe_die("No GID provided.");}
if (empty($qid)) {safe_die("No QID provided.");}

if ($field['gid'] == $gid &&
$field['qid'] == $qid)
{
$AddQuestion=False;
}
break;
case 'tokens':
case 'emailtemplates':
// this is the case for email-conf
$AddQuestion=True;
break;
default:
die("No Action provided.");
safe_die("No Action provided.");
break;
}
if ( $AddQuestion===True)
Expand Down
2 changes: 1 addition & 1 deletion admin/html_functions.php
Expand Up @@ -139,7 +139,7 @@ function browsemenubar($title='')
if (bHasSurveyPermission($surveyid,'responses','delete') && $thissurvey['anonymized'] == 'N' && $thissurvey['tokenanswerspersistence'] == 'Y')
{
$browsemenubar .= "<a href='$scriptname?action=iteratesurvey&amp;sid=$surveyid' title=\"".$clang->gTview("Iterate survey")."\" >"
."<img src='$imagefiles/iterate.png' title='' alt='".$clang->gT("Iterate survey")."' /></a>\n";
."<img src='$imageurl/iterate.png' title='' alt='".$clang->gT("Iterate survey")."' /></a>\n";
}
$browsemenubar .= "</div>\n"
. "\t</div>\n"
Expand Down

0 comments on commit 1eb11f8

Please sign in to comment.