-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note to MOODLE_405_STABLE release of surveypro #971
Open
kordan
wants to merge
3
commits into
master
Choose a base branch
from
MOODLE_405_STABLE
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…the last two months. Those three improvements can be described as follows: 1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item). This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics). I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me. In practice: the method, named in master "item_add_mandatory_base_fields" was renamed in the branch to "item_add_defaults_for_base_fields". By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name. I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem. 2. translation of the most frequent properties (among all item plugins) from the specific item plugin tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item). This second step is clearly the natural continuation of the previous one and, for this reason, I created this new branch (https://github.com/kordan/moodle-mod_surveypro/tree/others_to_base_property) on top of content_among_basics. 3. Once I had a clear idea of how the itemplugin attributes were managed, I finally proceeded to adapt surveypro to php8.2 by creating the php8.2 branch. Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless. The outcome of "content_among_basics" is described in (1). The outcome of "others_to_base_property" is described in (2). The outcome of "php8.2" is described in (3). ===================================================== (1) Content and contentformat moved among base fields As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address. The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item. There are two reflections related to this problem: - Theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned; I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform". The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.) I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform". So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table. The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR. - I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to: -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course; -- upgrade your surveypro; -- regenerate each usertemplate and each mastertemplate. obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one). ===================================================== (2) Each common propery is now saved to surveypro_item When "content_among_basics" (that saves content and contentformat to surveypro_item and no longer into db tables of item plugins) and this PR will land to mastwer, I hope all will be ready to start to modify surveypro to let it correctly run in php8.2 and 8.3. With this PR the situation of properties should be: ``` | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK | id (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | surveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | type (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | plugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | content | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO | contentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | required | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | indent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | position | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | customnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | hideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO | variable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | extranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | hidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | insearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | reserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | sortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | formpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | parentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | parentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | timecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | timemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– ``` All the properties in the first column are relative to a field of the table surveypro_item. All the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform. Not all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[<property>] = (false|true); If $this->insetupform[<property>] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database). Marked with (h) are properties hidden to user. In the next table the list of specific properties item per item. These properties are save in surveypro(field|format)_<plugin>. Yes, some of them coincide, but the number of plugins sharing the same property is too low and even the semantic is too specific of each single plugin so I decided to save these properties among the fields of the child table and not in surveypro_item. ``` | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK | –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth | | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel | | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue | | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat | | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound | | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound | | maximumrequired | | heightinrows | | differentrates | | adjustment | ``` ===================================================== (3) php8.2 This improvement makes surveypro compatible with php8.2. There is some small problem, however, that I don't understand and which, for this reason, I describe below. (a) I see a theoretical problem that I believe is closely related to my request for help in: https://moodle.org/mod/forum/discuss.php?d=457241 The problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it. One of the properties common to all surveypro items is "content" (alias, the content of the question) followed by the content_format. To define an item via the corresponding form at submission time, the HTML editor is processed through file_prepare_standard_editor that changes the content_editor property. When I pass the object $item to the file_prepare_standard_editor method, php8.2 raises an exception claiming that the content_editor property (that I must have defined previously) and that I have defined as protected cannot be modified because it is protected. I know it is a good practice to always define properties as protected so my question is: How should I behave? Do I have to make the property public? (b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker. ``` FILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php 93 | ERROR | [x] Member variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore) 1128 | ERROR | [x] Variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore) 1129 | ERROR | [x] Variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore) ``` (c) In php8.2 and moodle master, I frequently get the error "Javascript code and/or AJAX requests are not ready after 10 seconds". At my eyes, it seems related to TinyMCE editor. Executing a submission of the item_setupbaseform with values that inhibit the submission itself, when the form is reloaded it is impossible to paste something in the content textarea. (d) I'm having a problem with style sheets. Moodle 4.4 defines the style class: ``` .mb-3, .my-3 { margin-bottom: 1rem !important; } ``` To override this class I am forced to use: ``` .path-mod-surveypro #userentry .mb-3, .path-mod-surveypro #usersearch .mb-3 { margin-bottom: 0 !important; } ``` specifying NECESSARILY !important to be able to override the parent class. The "!important" specification, however, is classified by Grunt (in the context of the GHA) as an error: ``` mod/surveypro/styles.css 28:22 ✖ Unexpected !important declaration-no-important 348:24 ✖ Unexpected !important declaration-no-important 356:24 ✖ Unexpected !important declaration-no-important 361:24 ✖ Unexpected !important declaration-no-important 366:22 ✖ Unexpected !important declaration-no-important 374:22 ✖ Unexpected !important declaration-no-important 379:22 ✖ Unexpected !important declaration-no-important 384:24 ✖ Unexpected !important declaration-no-important 392:24 ✖ Unexpected !important declaration-no-important 397:24 ✖ Unexpected !important declaration-no-important 402:22 ✖ Unexpected !important declaration-no-important 409:22 ✖ Unexpected !important declaration-no-important 414:22 ✖ Unexpected !important declaration-no-important 419:24 ✖ Unexpected !important declaration-no-important 426:24 ✖ Unexpected !important declaration-no-important 431:24 ✖ Unexpected !important declaration-no-important 436:22 ✖ Unexpected !important declaration-no-important 443:22 ✖ Unexpected !important declaration-no-important 448:22 ✖ Unexpected !important declaration-no-important 453:25 ✖ Unexpected !important declaration-no-important 460:25 ✖ Unexpected !important declaration-no-important 465:25 ✖ Unexpected !important declaration-no-important 470:23 ✖ Unexpected !important declaration-no-important 477:23 ✖ Unexpected !important declaration-no-important 482:23 ✖ Unexpected !important declaration-no-important 487:25 ✖ Unexpected !important declaration-no-important 494:25 ✖ Unexpected !important declaration-no-important 499:25 ✖ Unexpected !important declaration-no-important 28 problems (28 errors, 0 warnings) ```
…the last two months. Those three improvements can be described as follows: 1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item). This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics). I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me. In practice: the method, named in master "item_add_mandatory_base_fields" was renamed in the branch to "item_add_defaults_for_base_fields". By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name. I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem. 2. translation of the most frequent properties (among all item plugins) from the specific item plugin tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item). This second step is clearly the natural continuation of the previous one and, for this reason, I created this new branch (https://github.com/kordan/moodle-mod_surveypro/tree/others_to_base_property) on top of content_among_basics. 3. Once I had a clear idea of how the itemplugin attributes were managed, I finally proceeded to adapt surveypro to php8.2 by creating the php8.2 branch. Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless. The outcome of "content_among_basics" is described in (1). The outcome of "others_to_base_property" is described in (2). The outcome of "php8.2" is described in (3). ===================================================== (1) Content and contentformat moved among base fields As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address. The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item. There are two reflections related to this problem: - Theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned; I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform". The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.) I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform". So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table. The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR. - I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to: -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course; -- upgrade your surveypro; -- regenerate each usertemplate and each mastertemplate. obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one). ===================================================== (2) Each common propery is now saved to surveypro_item When "content_among_basics" (that saves content and contentformat to surveypro_item and no longer into db tables of item plugins) and this PR will land to mastwer, I hope all will be ready to start to modify surveypro to let it correctly run in php8.2 and 8.3. With this PR the situation of properties should be: ``` | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK | id (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | surveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | type (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | plugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | content | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO | contentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | required | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | indent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | position | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | customnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO | hideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO | variable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | extranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO | hidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | insearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | reserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | sortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | formpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | parentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | parentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | timecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | timemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– ``` All the properties in the first column are relative to a field of the table surveypro_item. All the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform. Not all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[<property>] = (false|true); If $this->insetupform[<property>] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database). Marked with (h) are properties hidden to user. In the next table the list of specific properties item per item. These properties are save in surveypro(field|format)_<plugin>. Yes, some of them coincide, but the number of plugins sharing the same property is too low and even the semantic is too specific of each single plugin so I decided to save these properties among the fields of the child table and not in surveypro_item. ``` | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK | –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth | | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel | | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue | | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat | | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound | | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound | | maximumrequired | | heightinrows | | differentrates | | adjustment | ``` ===================================================== (3) php8.2 This improvement makes surveypro compatible with php8.2. There is some small problem, however, that I don't understand and which, for this reason, I describe below. (a) I see a theoretical problem that I believe is closely related to my request for help in: https://moodle.org/mod/forum/discuss.php?d=457241 The problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it. One of the properties common to all surveypro items is "content" (alias, the content of the question) followed by the content_format. To define an item via the corresponding form at submission time, the HTML editor is processed through file_prepare_standard_editor that changes the content_editor property. When I pass the object $item to the file_prepare_standard_editor method, php8.2 raises an exception claiming that the content_editor property (that I must have defined previously) and that I have defined as protected cannot be modified because it is protected. I know it is a good practice to always define properties as protected so my question is: How should I behave? Do I have to make the property public? (b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker. ``` FILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php 93 | ERROR | [x] Member variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore) 1128 | ERROR | [x] Variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore) 1129 | ERROR | [x] Variable "content_editor" must not contain underscores. | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore) ``` (c) In php8.2 and moodle master, I frequently get the error "Javascript code and/or AJAX requests are not ready after 10 seconds". At my eyes, it seems related to TinyMCE editor. Executing a submission of the item_setupbaseform with values that inhibit the submission itself, when the form is reloaded it is impossible to paste something in the content textarea. (d) I'm having a problem with style sheets. Moodle 4.4 defines the style class: ``` .mb-3, .my-3 { margin-bottom: 1rem !important; } ``` To override this class I am forced to use: ``` .path-mod-surveypro #userentry .mb-3, .path-mod-surveypro #usersearch .mb-3 { margin-bottom: 0 !important; } ``` specifying NECESSARILY !important to be able to override the parent class. The "!important" specification, however, is classified by Grunt (in the context of the GHA) as an error: ``` mod/surveypro/styles.css 28:22 ✖ Unexpected !important declaration-no-important 348:24 ✖ Unexpected !important declaration-no-important 356:24 ✖ Unexpected !important declaration-no-important 361:24 ✖ Unexpected !important declaration-no-important 366:22 ✖ Unexpected !important declaration-no-important 374:22 ✖ Unexpected !important declaration-no-important 379:22 ✖ Unexpected !important declaration-no-important 384:24 ✖ Unexpected !important declaration-no-important 392:24 ✖ Unexpected !important declaration-no-important 397:24 ✖ Unexpected !important declaration-no-important 402:22 ✖ Unexpected !important declaration-no-important 409:22 ✖ Unexpected !important declaration-no-important 414:22 ✖ Unexpected !important declaration-no-important 419:24 ✖ Unexpected !important declaration-no-important 426:24 ✖ Unexpected !important declaration-no-important 431:24 ✖ Unexpected !important declaration-no-important 436:22 ✖ Unexpected !important declaration-no-important 443:22 ✖ Unexpected !important declaration-no-important 448:22 ✖ Unexpected !important declaration-no-important 453:25 ✖ Unexpected !important declaration-no-important 460:25 ✖ Unexpected !important declaration-no-important 465:25 ✖ Unexpected !important declaration-no-important 470:23 ✖ Unexpected !important declaration-no-important 477:23 ✖ Unexpected !important declaration-no-important 482:23 ✖ Unexpected !important declaration-no-important 487:25 ✖ Unexpected !important declaration-no-important 494:25 ✖ Unexpected !important declaration-no-important 499:25 ✖ Unexpected !important declaration-no-important 28 problems (28 errors, 0 warnings) ```
kordan
force-pushed
the
MOODLE_405_STABLE
branch
from
October 21, 2024 12:30
2e4a42a
to
61d8565
Compare
kordan
force-pushed
the
MOODLE_405_STABLE
branch
from
October 24, 2024 08:25
61d8565
to
3319c9e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note!
Due to serious time constraints I am not able to ensure the compatibility of the MOODLE_405_STABLE version of surveypro with previous versions.
I am forced to continue the development of the product in order to
I can no longer postpone releasing the MOODLE_405_STABLE version of surveypro on github, because the 4.5 version of Moodle is already available, and the MOODLE_404_STABLE version of surveypro (which I never released in the hope of finding the time to make it backwards compatible) is starting to complain about code obsolescence when running on Moodle 4.5.
In the MOODLE_405_STABLE version of surveypro, I have changed the tables where many field attributes are stored.
Because of this:
So what?
I have hundreds of instances of surveypro on my servers and I haven't lost anything.
Here's how it works.
If you have surveypro instances with a version prior to MOODLE_405_STABLE, update the surveypro code and visit the notification page.
If you have a usertemplate that you use and want to keep, use it if you still have surveypro on your server with a version prior to MOODLE_405_STABLE to build a working surveypro instance. Update the surveypro code, visit the notification page and rebuild your UserTemplate from the surveypro instance that is now working with the MOODLE_405_STABLE version.
If you have a master template that you use and want to keep, install it and visit the notification page. Update your surveypro code, visit the notification page again and regenerate your master template from the surveypro instance that is now running MOODLE_405_STABLE. Finally, replace the master template you have in the mod/surveypro/template/ folder.
If you have a backup of a surveypro instance or a course that contains surveypro instances, update your surveypro code to MOODLE_405_STABLE and backup again. Discard the previous backup if you no longer wish to use older versions of surveypro.