View Issue Details

This bug affects 1 person(s).
 22
IDProjectCategoryView StatusLast Update
15224Bug reportsPluginspublic2021-02-02 15:20
ReporterDenisChenu Assigned Top_teichmann  
PriorityhighSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.0.0-RC4 
Fixed in Version4.3.16 
Summary15224: newQuestionAttributes deprecated : need a replacer
Description

newQuestionAttributes still here, but new attributes are not shown in Question editor

Steps To Reproduce

https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion
Install , and look at any question

Additional Information

newQuestionAttributes event are really a great solution …
need a replacement

Manual page for redesign: https://manual.limesurvey.org/Question_attributes_redesign

TagsNo tags attached.
Attached Files
Bug heat22
Complete LimeSurvey version number (& build)4.0.0 github RC3 fcaab028d4
I will donate to the project if issue is resolvedNo
Browserff
Database type & versionmariadb
Server OS (if known)fedora/linux
Webserver software & version (if known)nginx
PHP Versionphp7.2

Relationships

related to 15543 closed Bug reports Document changes in plugin API for question attributes 
related to 15776 new Feature requests Allow cleaner options system for options in question attributes 
parent of 17049 closedollehar Bug reports newQuestionAttributes event didn't add attribute 
has duplicate 16675 closedcdorin Bug reports Array Type:F: Question attributes are not saved 
related to 14248 acknowledged Feature requests Allow survey theme to add (and use) question attribute 
related to 16669 closedgabrieljenik Bug reports getQuestionAttributes function don't get the plugins attribute 

Users monitoring this issue

DenisChenu

Activities

DenisChenu

DenisChenu

2019-10-16 12:29

developer   ~54061

Still no way to add an attribute in core Question ?
Still no way to have a replacer (or fix current plugin settings).

on last git version.

ollehar

ollehar

2019-10-22 14:49

administrator   ~54142

My suggestion: Add the same event.

Mazi

Mazi

2019-10-23 10:41

updater   ~54170

Not sure if I got the bug report right but being able to add your own question attributes by a plugin is essential for plugin development!

DenisChenu

DenisChenu

2019-10-23 15:11

developer   ~54192

Last edited: 2019-10-23 15:12

@Mazi : I think you understand the issue here : no way to have Custom Question attributes by plugins in current develop :).

You can add QuestionAttribute : but it don't show any input in admin GUI part.

ollehar

ollehar

2019-11-06 16:16

administrator   ~54433

Looks like there's no "single point of entry" to fetch question attributes anymore. Sucks ass.

ollehar

ollehar

2019-11-06 16:48

administrator   ~54441

Found it. Event needs to be moved to getQuestionThemeAttributeValues in questionHelper.

Selection_910.png (12,225 bytes)   
Selection_910.png (12,225 bytes)   
ollehar

ollehar

2019-11-06 16:57

administrator   ~54442

Re-added the event, but needs more testing and fixing (attributes are not saved, etc).

ollehar

ollehar

2019-11-07 15:33

administrator   ~54463

Your plugin needs to be updated to LS4 requirements to display advanced options properly. Would be nice to have it documented... E.g., the switch input type needs option array.

DenisChenu

DenisChenu

2019-11-07 15:47

developer   ~54464

No default on switch ?
Easy to fix :)

I look at it tomorrow : you can assign it to me for test :)

ollehar

ollehar

2019-11-07 15:52

administrator   ~54465

I guess switch can be sometimes Y/N, sometimes 1/0, and there's no point doing a default then.

DenisChenu

DenisChenu

2019-11-07 16:05

developer   ~54467

In 3.X : seems there are a default 0/1 .

But i can send it in 4.X, not a problem (maybe need to update manaul …)

Mazi

Mazi

2019-11-07 18:26

updater   ~54474

RE "Your plugin needs to be updated to LS4 requirements ": I am not sure about the details, but shouldn't plugins be compatible between v3.x and 4.x?

Is there some documentation for plugin developers regarding "LS4 requirements"?

DenisChenu

DenisChenu

2019-11-08 07:44

developer   ~54479

shouldn't plugins be compatible between v3.x and 4.x?

API update, then unsure. But best is to have manual about this :)

ollehar

ollehar

2019-11-08 15:08

administrator   ~54483

Too many functions, code not clear:

getQuestionAttributesForEM
getQuestionAttributeValue
getQuestionAttributeData (ajax controller method)
getQuestionAttributes
getQuestionAttributesSettings
getQuestionAttribute
getQuestionAttributes
getQuestionThemeAttributeValues
ajaxquestionattributes (not used??)

We need:

A single point of entry to get the STRUCTURE of all attributes (general, advanced, XML, plugin), and another single point of entry to get the VALUE of all attributes.

ollehar

ollehar

2019-11-08 15:10

administrator   ~54484

I will put this task in backlog, and Patrick will have a look to see if he can clean it later.

DenisChenu

DenisChenu

2019-11-11 12:05

developer   ~54514

Arg … unable to check
Starting by uncaught exception: Object and finally ReferenceError: LS is not defined develop:60:12

ollehar

ollehar

2019-11-11 14:07

administrator   ~54516

Hm, yeah, but those JS errors didn't affect the display of the extra attributes when I tested. But don't test now, Patric has to clean the code anyway.

DenisChenu

DenisChenu

2019-11-11 15:19

developer   ~54521

Yes, maybe when you tested, but here : i can not load it. let me deactuvate my broken plugin maybe (and check with debug=0)

lime_release_bot

lime_release_bot

2019-11-12 10:24

administrator   ~54533

Fixed in Release 4.0.0-RC7+191111

ollehar

ollehar

2019-11-12 10:26

administrator   ~54534

In fact not fixed, just in prototype state.

DenisChenu

DenisChenu

2019-11-13 15:37

developer   ~54565

  1. Current situation :Broken with debug>1 if there are a lack of an option : must have $eventAttributes[$name] = array_merge($defaultQuestionAttributeValues, $attribute); somewhere (question XML have it)
  2. Must send [options][option][[value=>0][text=>"Text"]] , but seems Question user theme xml can send array directmy (think it' sthe best option
  3. Value not saved (even for textarea)

For 2 :

        $scriptAttributes['scriptActivate']['options']= array(
            0=>gT("No"),
             1=>gT("Yes"),
        );

is broken, need

        $scriptAttributes['scriptActivate']['options']= array(
          'option'=> array(
            array('value'=>0, 'text'=> gT("No")),
            array('value'=>1, 'text'=> gT("Yes")),
          ),
        );

But seems question user theme XML is OK with

            <options>
                <default>Default</default>
                <lg>Large</lg>
                <sm>Small</sm>
                <xs>Extra small</xs>
            </options>

https://github.com/LimeSurvey/LimeSurvey/blob/93f3d162d9751090f2e518c080271ab8801dcbdc/themes/question/bootstrap_buttons/survey/questions/answer/listradio/config.xml#L56-L61

DenisChenu

DenisChenu

2020-01-15 07:54

developer   ~55248

@cdorin : someone work globally on question attribute management ?
Else : i do a quick fix to have something … (create new function to call it just before reading/save question attribute )

ollehar

ollehar

2020-01-15 10:27

administrator   ~55252

@DeniChenu, it's on Patrick's list, but he didn't get time to work on it yet. We have a refactor sprint first (to reduce complexity, was the goal).

You can do a quick fix if you want, if it's not too much hassle.

DenisChenu

DenisChenu

2020-01-15 10:29

developer   ~55253

to reduce complexity, was the goal

Ouf … …

DenisChenu

DenisChenu

2020-01-25 22:01

developer   ~55469

https://github.com/LimeSurvey/LimeSurvey/pull/1376/files

cdorin

cdorin

2020-01-28 14:53

reporter   ~55497

@ollehar and @p_teichmann , any thoughts on the last PR from Denis?

ollehar

ollehar

2020-01-28 15:04

administrator   ~55499

Yeah. I feel like I want to rip the entire system out with regard to question attributes and start from scratch. Design from TOP which domain objects we have and how they correspond to active record classes etc. I'm not sure what happened - the code was clear in LS3, and now complex and super-hard to follow in LS4. We need to take a step back. It's not acceptable that NEW code is more complex than OLD. If we keep going in that direction, LS will die, because no one will be able to understand it.

ollehar

ollehar

2020-01-28 15:05

administrator   ~55500

E.g., what's the difference between a question attribute in the database, and a question attribute in a question theme XMl file? Shouldn't they correspond to two different classes?

p_teichmann

p_teichmann

2020-01-28 15:07

administrator   ~55501

Looks good so far i ll test it locally again. In the old event it was allways applying the question attribute to all question types. Should there also be an option to assign it to a specific questiontype or theme?

DenisChenu

DenisChenu

2020-01-28 15:10

developer   ~55502

@ollehar : yes, but here : i just add a simple function … and use it when seems needed.

For information : without this event :

ollehar

ollehar

2020-01-28 15:12

administrator   ~55503

It's better if it's broken than accepting we have code no one can understand. Just don't upgrade yet! I can take time next week to try to clean it

DenisChenu

DenisChenu

2020-01-28 15:32

developer   ~55509

Just don't upgrade yet! I can take time next week to try to clean it

OK :) week or nexwt month is OK. I'm afraid of more …

what's the difference between a question attribute in the database, and a question attribute in a question theme XMl file?

In the database : it's ONLY the value saved , in QuestionAttribute model.

XML file (or plugin) give the «definition» : utf8 or not, options list, default values etc …

In the old event it was allways applying the question attribute to all question types. Should there also be an option to assign it to a specific questiontype or theme?

Before we read it one time at start for ALL question type. Now we read X times for each question type. Unsure of the better solution.

My opinion : we must save in a specific Cache the definitions of the QuestionAttribute.

There are other mantis related to this, becaus ein my opinion : all QuestionAttribute MUST not come from QuestionTheme …

For example

  • CSS Class : it's clearly a Survey theme related attribute
  • Subquestion or Question Logic : seems related to core for me
  • Timer attribute : my opinion : muts be a plugin (or another solution) but clearly not a QuestionTheme attribute.
ollehar

ollehar

2020-01-28 16:08

administrator   ~55521

Last edited: 2020-01-28 16:08

OK, I'll create a new manual page we can use as a workboard for a new class design.

Mazi

Mazi

2020-01-28 16:11

updater   ~55522

@ollehar, you should consider if it is worth the effort to completely re-build that part now for LS4 if we have to completely re-buils lots of code for LS5 anyway!

ollehar

ollehar

2020-01-28 16:30

administrator   ~55523

@Mazi, LS5 is not going to happen soon, I sincerely hope. Yeah, we're doing some refactoring right now, but the goal is to not break anything. Reduce complexity and weird stuff, keep same functionality.

ollehar

ollehar

2020-01-28 16:33

administrator   ~55524

https://manual.limesurvey.org/Question_attributes_redesign

lime_release_bot

lime_release_bot

2020-02-03 14:57

administrator   ~55660

Fixed in Release 4.0.0-RC7+191111

DenisChenu

DenisChenu

2020-02-03 16:09

developer   ~55673

Why close this issue ?

There are NO WORKING WAY to add question attribute in 4.X

ollehar

ollehar

2020-02-03 16:22

administrator   ~55674

Yeah, this should not have been closed. Guess we had a related commit and it was closed by our bot. :|

DenisChenu

DenisChenu

2020-09-15 14:01

developer   ~59811

Seems saved OK :+1:

But :
In beforeQuestionRender

$aAttributes = QuestionAttribute::model()->getQuestionAttributes($oEvent->get('qid')); didn't have javascript (empty or not)

We can use QuestionAttribute::model()->find('qid = :qid and attribute = attribute', ['qid'=> $oEvent->get('qid')),'attribute' => javascript]);

Maybe open another issue for QuestionAttribute::model()->getQuestionAttributes function difference ?

cdorin

cdorin

2020-09-15 15:01

reporter   ~59812

Hey @DenisChenu, about the last issue - could you please open another ticket about it ? So that we mark this one closed since is old and we forgot about it

DenisChenu

DenisChenu

2020-09-15 15:31

developer   ~59818

https://bugs.limesurvey.org/view.php?id=16669

cdorin

cdorin

2020-12-30 19:27

reporter   ~61342

fixed in 4.4.0 rc1

Issue History

Date Modified Username Field Change
2019-09-04 15:08 DenisChenu New Issue
2019-09-04 15:08 DenisChenu Status new => assigned
2019-09-04 15:08 DenisChenu Assigned To => markusfluer
2019-10-11 17:02 DenisChenu Assigned To markusfluer => cdorin
2019-10-16 12:29 DenisChenu Note Added: 54061
2019-10-22 14:49 ollehar Note Added: 54142
2019-10-22 16:04 DenisChenu Relationship added related to 14248
2019-10-23 10:41 Mazi Note Added: 54170
2019-10-23 15:11 DenisChenu Note Added: 54192
2019-10-23 15:12 DenisChenu Note Edited: 54192
2019-11-06 16:16 ollehar Note Added: 54433
2019-11-06 16:48 ollehar File Added: Selection_910.png
2019-11-06 16:48 ollehar Note Added: 54441
2019-11-06 16:57 ollehar Note Added: 54442
2019-11-07 10:55 DenisChenu Issue Monitored: DenisChenu
2019-11-07 15:33 ollehar Note Added: 54463
2019-11-07 15:38 ollehar Relationship added related to 15543
2019-11-07 15:47 DenisChenu Note Added: 54464
2019-11-07 15:52 ollehar Note Added: 54465
2019-11-07 16:05 DenisChenu Note Added: 54467
2019-11-07 18:26 Mazi Note Added: 54474
2019-11-08 07:44 DenisChenu Note Added: 54479
2019-11-08 15:08 ollehar Note Added: 54483
2019-11-08 15:10 ollehar Note Added: 54484
2019-11-08 15:34 ollehar Assigned To cdorin => p_teichmann
2019-11-11 12:05 DenisChenu File Added: Capture d’écran du 2019-11-11 12-03-04.png
2019-11-11 12:05 DenisChenu Note Added: 54514
2019-11-11 14:07 ollehar Note Added: 54516
2019-11-11 15:19 DenisChenu Note Added: 54521
2019-11-12 10:24 lime_release_bot Note Added: 54533
2019-11-12 10:24 lime_release_bot Status assigned => closed
2019-11-12 10:24 lime_release_bot Resolution open => fixed
2019-11-12 10:25 ollehar Status closed => new
2019-11-12 10:25 ollehar Resolution fixed => reopened
2019-11-12 10:26 ollehar Note Added: 54534
2019-11-13 15:37 DenisChenu Note Added: 54565
2020-01-14 10:08 cdorin Assigned To p_teichmann => cdorin
2020-01-15 07:54 DenisChenu Note Added: 55248
2020-01-15 10:27 ollehar Note Added: 55252
2020-01-15 10:29 DenisChenu Note Added: 55253
2020-01-25 22:01 DenisChenu Note Added: 55469
2020-01-25 22:07 DenisChenu Relationship added related to 15776
2020-01-28 14:53 cdorin Note Added: 55497
2020-01-28 15:04 ollehar Note Added: 55499
2020-01-28 15:05 ollehar Note Added: 55500
2020-01-28 15:07 p_teichmann Note Added: 55501
2020-01-28 15:10 DenisChenu Note Added: 55502
2020-01-28 15:12 ollehar Note Added: 55503
2020-01-28 15:32 DenisChenu Note Added: 55509
2020-01-28 16:08 ollehar Note Added: 55521
2020-01-28 16:08 ollehar Note Edited: 55521
2020-01-28 16:11 Mazi Note Added: 55522
2020-01-28 16:30 ollehar Note Added: 55523
2020-01-28 16:33 ollehar Additional Information Updated
2020-01-28 16:33 ollehar Note Added: 55524
2020-02-03 14:57 lime_release_bot Note Added: 55660
2020-02-03 14:57 lime_release_bot Status new => closed
2020-02-03 14:57 lime_release_bot Resolution reopened => fixed
2020-02-03 16:09 DenisChenu Status closed => feedback
2020-02-03 16:09 DenisChenu Resolution fixed => reopened
2020-02-03 16:09 DenisChenu Note Added: 55673
2020-02-03 16:22 ollehar Note Added: 55674
2020-02-17 12:58 cdorin Priority none => high
2020-09-10 17:19 JHoeck Assigned To cdorin => JHoeck
2020-09-15 14:01 DenisChenu Note Added: 59811
2020-09-15 14:01 DenisChenu Status feedback => assigned
2020-09-15 15:01 cdorin Note Added: 59812
2020-09-15 15:02 DenisChenu Assigned To JHoeck => p_teichmann
2020-09-15 15:02 DenisChenu Status assigned => resolved
2020-09-15 15:02 DenisChenu Resolution reopened => fixed
2020-09-15 15:02 DenisChenu Fixed in Version => 4.3.16
2020-09-15 15:29 DenisChenu Relationship added related to 16669
2020-09-15 15:31 DenisChenu Note Added: 59818
2020-09-19 12:32 DenisChenu Relationship added has duplicate 16675
2020-12-30 19:27 cdorin Note Added: 61342
2020-12-30 19:27 cdorin Status resolved => closed
2021-02-02 15:20 DenisChenu Relationship added parent of 17049
2021-08-02 17:18 guest Bug heat 20 => 22