View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
04429Bug reportsSurvey editingpublic2010-07-06 11:22
ReporterDenniz Assigned Tomdekker  
PriorityhighSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.90RC1 
Fixed in Version1.90RC2 
Summary04429: Replacement Field Properties loading non-stop
Description

Replacement Field Properties keep loading and doesn't show the content.

Steps To Reproduce

click on replacement field properties icon on the FCKeditor

TagsNo tags attached.
Attached Files
replacementfields.diff (5,040 bytes)   
### Eclipse Workspace Patch 1.0
#P limesurvey
Index: admin/fck_LimeReplacementFields.php
===================================================================
--- admin/fck_LimeReplacementFields.php	(revision 8856)
+++ admin/fck_LimeReplacementFields.php	(working copy)
@@ -215,6 +215,7 @@
     //TO AVOID NATURAL SORT ORDER ISSUES,
     //FIRST GET ALL QUESTIONS IN NATURAL SORT ORDER
     //, AND FIND OUT WHICH NUMBER IN THAT ORDER THIS QUESTION IS
+    /*
     $qquery = "SELECT * "
     ."FROM {$dbprefix}questions, "
     ."{$dbprefix}groups "
@@ -227,17 +228,19 @@
     $qrows = $qresult->GetRows();
     // Perform a case insensitive natural sort on group name then question title (known as "code" in the form) of a multidimensional array
     usort($qrows, 'GroupOrderThenQuestionOrder');
+    */
+    $fieldmap = createFieldMap($surveyid, 'full');
 
 
-
     $surveyInfo = getSurveyInfo($surveyid);
     $surveyformat = $surveyInfo['format'];// S, G, A
     $prevquestion=null;
     $previouspagequestion = true;
     //Go through each question until we reach the current one
     //error_log(print_r($qrows,true));
-    foreach ($qrows as $qrow)
+    foreach ($fieldmap as $field)
     {
+        if (empty($field['qid'])) continue;
         $AddQuestion=True;
         switch ($action)
         {
@@ -248,7 +251,7 @@
             case 'editgroup':
                 if (empty($gid)) {die("No GID provided.");}
 
-                if ($qrow['gid'] == $gid)
+                if ($field['gid'] == $gid)
                 {
                     $AddQuestion=False;
                 }
@@ -259,7 +262,7 @@
 
                 if ( !is_null($prevquestion) &&
                 $prevquestion['gid'] == $gid &&
-                $qrow['gid'] != $gid)
+                $field['gid'] != $gid)
                 {
                     $AddQuestion=False;
                 }
@@ -271,8 +274,8 @@
                 if (empty($gid)) {die("No GID provided.");}
                 if (empty($qid)) {die("No QID provided.");}
 
-                if ($qrow['gid'] == $gid &&
-                $qrow['qid'] == $qid)
+                if ($field['gid'] == $gid &&
+                $field['qid'] == $qid)
                 {
                     $AddQuestion=False;
                 }
@@ -285,8 +288,7 @@
                 die("No Action provided.");
                 break;
         }
-
-        if ( $AddQuestion===True)
+        if ( $AddQuestion===True )
         {
             if ($surveyformat == "S")
             {
@@ -296,7 +298,7 @@
             {
                 if ($previouspagequestion === true)
                 { // Last question was on a previous page
-                    if ($qrow["gid"] == $gid)
+                    if ($field["gid"] == $gid)
                     { // This question is on same page
                         $previouspagequestion = false;
                     }
@@ -311,8 +313,8 @@
                 $previouspagequestion = true;
             }
 
-            $questionlist[]=Array( "qid" => $qrow["qid"], "previouspage" => $previouspagequestion);
-            $prevquestion=$qrow;
+            $questionlist[]=array_merge($field,Array( "previouspage" => $previouspagequestion));
+            $prevquestion=$field;
         }
         else
         {
@@ -329,7 +331,8 @@
     //		}
 
     $theserows=array();
-
+    $theserows = $questionlist;
+    /*
     if (isset($questionlist) && is_array($questionlist))
     {
         foreach ($questionlist as $ql)
@@ -368,8 +371,8 @@
             }
         }
     }
+    */
 
-
     $questionscount=count($theserows);
 
     if ($questionscount > 0)
@@ -381,9 +384,15 @@
 
         foreach($theserows as $rows)
         {
-            $shortquestion=$rows['title'].": ".FlattenText($rows['question']);
+            $question = $rows['question'];
+            
+            if (isset($rows['subquestion'])) $question = "[{$rows['subquestion']}] " . $question;
+            if (isset($rows['subquestion1'])) $question = "[{$rows['subquestion1']}] " . $question;
+            if (isset($rows['subquestion2'])) $question = "[{$rows['subquestion2']}] " . $question;
+            
+            $shortquestion=$rows['title'].": ".FlattenText($question);
 
-            if ($rows['type'] == "A" ||
+            /*if ($rows['type'] == "A" ||
             $rows['type'] == "B" ||
             $rows['type'] == "C" ||
             $rows['type'] == "E" ||
@@ -508,9 +517,9 @@
 
             }   //Answer multi scale
             else
-            {
-                $cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'],$rows['previouspage']);
-            } //else
+            {*/
+                $cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['fieldname'],$rows['previouspage']);
+            //} //else
         } //foreach theserows
     } //if questionscount > 0
 
replacementfields.diff (5,040 bytes)   
Bug heat2
Complete LimeSurvey version number (& build)8819
I will donate to the project if issue is resolved
Browser
Database type & versionMySQL 5.0.0
Server OS (if known)Linux
Webserver software & version (if known)Apache 2.2.15
PHP Version5.2.13

Users monitoring this issue

There are no users monitoring this issue.

Activities

mdekker

mdekker

2010-06-18 09:06

reporter   ~12257

Confirmed, admin\fck_LimeReplacementFields.php still uses lid/lid1 instead of the new subquestion structure resulting in an error:
Unknown column 'ls188questions.lid' in 'field list':SELECT ls188questions.qid, ls188questions.sid, ls188questions.gid, ls188questions.question, ls188questions.type, ls188questions.lid, ls188questions.lid1, ls188questions.title FROM ls188questions, ls188groups WHERE ls188questions.gid=ls188groups.gid AND ls188questions.qid=131 AND ls188questions.language='en' AND ls188groups.language='en'

mdekker

mdekker

2010-06-18 09:47

reporter   ~12258

Added a quick patch, commenting out code i think we don't need anymore. Since I am not familiar with the old behaviour please review. When ok i will remove the commented out code and commit the patch

mdekker

mdekker

2010-06-18 11:53

reporter   ~12260

Tested a little more and seems to be working ok. I will just commit the fix, please test.

Fixed in svn 8858

Issue History

Date Modified Username Field Change
2010-06-17 12:37 Denniz New Issue
2010-06-17 12:37 Denniz Status new => assigned
2010-06-17 12:37 Denniz Assigned To => user372
2010-06-17 16:52 c_schmitz Assigned To user372 => lemeur
2010-06-18 09:06 mdekker Note Added: 12257
2010-06-18 09:46 mdekker File Added: replacementfields.diff
2010-06-18 09:46 mdekker Assigned To lemeur => c_schmitz
2010-06-18 09:47 mdekker Note Added: 12258
2010-06-18 11:50 mdekker Assigned To c_schmitz => mdekker
2010-06-18 11:53 mdekker Note Added: 12260
2010-06-18 11:53 mdekker Status assigned => resolved
2010-06-18 11:53 mdekker Fixed in Version => 1.90RC2
2010-06-18 11:53 mdekker Resolution open => fixed
2010-07-06 11:22 c_schmitz Status resolved => closed
2010-10-25 00:17 c_schmitz Category Survey Design => Survey design
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing