View Issue Details

IDProjectCategoryView StatusLast Update
05409User patchesSurvey designpublic2012-06-21 14:23
Reporterronvdburg Assigned Toc_schmitz  
Status closedResolutionfixed 
Product Version1.91+ 
Fixed in Version1.91+ 
Summary05409: Show attributes for question

If you display a question as designer (admin interface), the attributes are not shown.

Attached is a piece of code that does show the attributes.

Additional Information

1) The output is a matter of taste. So if you like the code, but have another taste, please tell me and I will change the code snippet / patch.

2) I used a <font color="red"> to emphasize that a question is hidden (since <strong> is already used).
If you wish, I can move that to a css, although I may use a hint or two and a suggestion for a proper name.

TagsNo tags attached.
Complete LimeSurvey version number (& build)10746




2011-08-18 18:33


html.php.diff-u.txt (2,034 bytes)   
---	2011-08-10 16:41:18.000000000 +0200
+++ html.php	2011-08-18 18:27:21.000000000 +0200
@@ -1331,6 +1331,47 @@
             $questionsummary .= "</td></tr>";
+        $qattributes = getQuestionAttributes($qid,$qrrow['type']);
+        if (!empty($qattributes))
+        {
+            // Show header for the ATTRIBUTES
+            $questionsummary .= "<tr>&nbsp</tr><td>&nbsp</td><td><strong>" . $clang->gT("ATTRIBUTES") . "</strong></td>\n";
+            foreach ($qattributes as $qattribute => $qattributevalue)
+            {
+                switch ($qattribute)
+                {
+                    case 'hidden':
+                        // Hidden is only shown if true
+                        if ($qattributevalue == 1) {
+                            $questionsummary .= "<tr>"
+                            . "<td align='right' valign='top'><strong><font color=\"red\">"
+                            . $clang->gT($qattribute)."</font></strong></td></tr>\n";
+                        }
+                        break;
+                    default:
+                        $questionsummary .= "<tr>"
+                        . "<td align='right' valign='top'><strong>"
+                        . $clang->gT($qattribute).":</strong></td>\n"
+                        . "<td align='left'>";
+                        if ($qattributevalue == 0)
+                        {
+                            $questionsummary .= $clang->gT("No");
+                        }
+                        elseif ($qattributevalue == 1)
+                        {
+                            $questionsummary .= $clang->gT("Yes");
+                        }
+                        else
+                        {
+                            $questionsummary .= $qattributevalue;
+                        }
+                        $questionsummary .= "</td></tr>\n";
+                        break;
+                }
+            }
+        }
         $questionsummary .= "</table>";
html.php.diff-u.txt (2,034 bytes)   


2011-08-19 10:11

developer   ~16105


Maybe it can be interestion, but if i see good, actually you have only YES/NO and attribute can have different combinaison (number, text etc ...).

Maybe put an option for user section ( show attribute in question page )

And please, find another think for font color=\"red\". I think you have some .info class for example.



2011-08-25 12:10

reporter   ~16145

Shnoulle, you are right. The suggested code was a bit clumsy.

Basic idea was: if advanced attributes are possible in the "edit" mode, why don't you show it in the "view" / "show" mode?

I had an immediate need for showing hidden questions in the designer view for questions that I do want to remove, but am not willing to delete them. Now, my users may think they are removed but I am capable to 'magically' get the questions back including their answers from previous years.

So I coded the "show advanced attributes", explicitly translating the hidden value in a nice and readable form.

But you are right, I didn't translate the other advanced attributes in a nice and readable form, except the "yes/no" attributes (since they are the majority).

However, I coded a switch case so that anybody can separate other attributes from the default case very easy. So I was hoping that this code was good enough for a starter. We are talking about an admin interface, not a user interface.

Now, since we are elaborating on the advanced attributes, you may consider upgrading the requirement before accepting my suggestion:
1) We could hide the advanced attributes behind an "advanced attributes" button; similar to the "edit" mode. I was hesitating to implement this option, because my html knowledge is not too sound.
2) But if you ask me seriously, my opinion is that as soon as the advanced attributes came into existence, the code shouln't have been limited to the "edit" mode only. So the proper way to do this would be to revise the "advanced attributes" code in a way to cope with two subactions: "view/show" and "edit". But again, I was hesitating to implement this option because I wasn't sure what this would mean for my time spending (working as a consultant with a customer paying for my hours).

Concluding: I am willing to change the code in a way you want, as long as the amount of work is limited.
I will look at moving the color to a css but have to understand a bit of css first... An example of a revision where such a move was implemente would help me a lot.





2011-09-05 13:31

reporter   ~16229

After having looked at the code another time, I think that the advanced attributes should be handled in "view" mode exactly like the "edit" mode.

Currently, the advanced attributes are only visible in "edit" mode using ajax code.

So, i.m.h.o., this issue is NOT a user patch, but a bug, or an incomplete implementation at least. Furthermore, I think the ajax code should be amended to show the advanced attributes also in "view" mode.

Currently, the ajax code is too difficult for me to adapt from "edit" to "view". If you can hint me to a short explanation / good example, I can make a patch to add an "advanced attribute" button in "view" mode.



2011-09-18 09:44

administrator   ~16290

This will be implement in v 2.0.
Please note: We do not accept feature patches for the stable version. If you want to contribute new functions please use the limesurvey_ci branch from subversion.

Issue History

Date Modified Username Field Change
2011-08-18 18:33 ronvdburg New Issue
2011-08-18 18:33 ronvdburg File Added: html.php.diff-u.txt
2011-08-19 10:11 DenisChenu Note Added: 16105
2011-08-19 13:26 c_schmitz Project Bug reports => User patches
2011-08-25 12:10 ronvdburg Note Added: 16145
2011-09-05 13:31 ronvdburg Note Added: 16229
2011-09-18 09:44 c_schmitz Note Added: 16290
2011-09-18 09:44 c_schmitz Status new => resolved
2011-09-18 09:44 c_schmitz Fixed in Version => 2.00
2011-09-18 09:44 c_schmitz Resolution open => fixed
2011-09-18 09:44 c_schmitz Assigned To => c_schmitz
2012-06-21 14:23 c_schmitz Status resolved => closed
2012-06-21 14:23 c_schmitz Fixed in Version 2.00 => 1.91+