Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Developing a question theme - Issues with saving and rendering

  • Mindflow
  • Mindflow's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194537 by Mindflow
Hi there,

I am currently implementing a question theme that should extend the multiple choice question such that the user checks the answers by clicking on elements in an SVG drawing. A JS-callback for the onclick-event in the SVG will check the hidden answers.

So far, I can select the question theme and the additional attribute (A URL to the SVG File) is correctly shown in the advanced settings. However, I encountered some problems:

- While the custom attribute is correctly saved to the database, it is not retrieved while loading the settings, leaving the field blank

- The answer.twig file of my theme is not used to while rendering the question, instead, LS uses the original multiplechoice template. I tried emptying the cache without luck.


- I cannot uninstall a User Theme (the console says TypeError: settings is undefined).



I'm running LS Version 4.1.7+200224
The source code of the question theme is available at github.com/florianheller/LimeSurvey_SVG_Selection


If somebody could give me some advice on how to trace down the error, help is highly appreciated.

Kind regards,

Florian
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194574 by tpartner
I don't see anything wrong.

In version 4.1.7, I was able to import the question theme downloaded from your GitHub repository via the theme management interface. I extracted the svgselection folder from the GitHub download, zipped it and then imported the resulting .zip folder.

I do see the file path in the question editor after saving the question (first screenshot below) and I see both of your twig files being used (2nd and 3rd screenshots).







I don't have a suitable .svg file to test fully but one suggestion I would make is to give the svg object a question-specific ID so you could place several of these questions on the same page.


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Mindflow
  • Mindflow's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194581 by Mindflow
Hi Tony,
thanks for your reply and check. I just re-installed LS 4.17 from scratch, but no luck, same problem as before (Both Firefox and Chrome). I will try a different environment as soon as possible and post the results here.

Good pointer with the ID, I'll work on that and the documentation as soon as I get my LS installation to accept my theme :)
The topic has been locked.
More
4 years 1 month ago #194590 by jelo

Mindflow wrote: but no luck, same problem as before (Both Firefox and Chrome).

Are you logged in as a superadmin? I don't understand the issue, but if the SVG file is important, it might be the XSS protection (blocks SVG cause Javascript can be embedded).
I can be totally wrong, but when I read SVG it's like a trigger.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • Mindflow
  • Mindflow's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194596 by Mindflow
Hi,
yes, I'm logged in as a super-admin. Yes, indeed, SVG can trigger XSS protection, but I'm struggeling with a problem before even getting to embed an SVG. Apparently, the theme works well on Tony's LS installation, but not on mine (LS 4.1.7+200224). The additional attribute is shown in the advanced settings, and when I hit save, the data is correctly stored to the DB, but when the question editor reloads, the field is set back to the placeholder value. On the view side, my theme's twig isn't used (again, on Tony's installation this seems to work).
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194610 by DenisChenu
No,

Link to a svg are not checked by LimeSurvey, only upload of SVG currently.

But saving Question Attribute value have some error and fix.
Maybe try to reset assets ? Can you de-activate debug mode ?

Personaly : i check on last version : seems not saved too ... debug mode at 2.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • Mindflow
  • Mindflow's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194627 by Mindflow
Hi,
I just ran a test on a different fresh installation in a virtual machine (LS 4.1.7+200224) and ran into the same problem. Turning debug mode on/off did not help (checked with the frontend/backend settings + the one in config.php). Both installations were running a recent LAMP stack.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194630 by tpartner
That's the weirdest thing - see screen-cast here - screencast-o-matic.com/watch/cYntI7wPcM

Debug mode makes no difference.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194644 by DenisChenu
One dev working , 2 other didn't working :).

But if i remind : no real difference between our server @tparner :)

My opinion : need to be reported.

Another thing : in my opinion : it's best to have QuetsionTheme directly in their won directory :
See github.com/tpartner/LimeSurvey-Adjustabl...c-Differential-Array
or gitlab.com/SondagesPro/QuestionTheme/really_hidden_equation

Then : we can just do

cd upload/theme/question
git clone repourl NameOfDirectory

Here : need to rename the directory :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago - 4 years 1 month ago #194645 by DenisChenu
Screencast
[img

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 1 month ago by DenisChenu.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194647 by tpartner

But if i remind : no real difference between our server @tparner

I am testing on XAMPP:

- Database: mysqlnd 5.0.12
- Server OS: Windows 10
- Webserver: Apache/2.4.39 (Win64)
- PHP Version: 7.3.7

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
4 years 1 month ago - 4 years 1 month ago #194659 by jelo
Too many people running 5.0.12 ;-)

tpartner wrote: - Database: mysqlnd 5.0.12


That is the connector version, not the MySQL version used.
The systeminfo via the LimeSurvey version number is lacking that info too.
Only the connector is reported.

That is a common issue in a lot of bugtickets too.
We're lucky that MySQL is seldom the root cause of issues.


www.php.net/manual/en/mysqli.get-server-info.php
Code:
 
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
 
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
 
/* print server version */
printf("Server version: %s\n", mysqli_get_server_info($link));
 
/* close connection */
mysqli_close($link);
?>
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Last edit: 4 years 1 month ago by jelo.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose