Moodle
  1. Moodle
  2. MDL-42617

Moodle Mobile Show advanced button missing

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.2, 2.6
    • Fix Version/s: 2.4.7, 2.5.3, 2.6
    • Component/s: Administration
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as an admin and go to Settings > Site administration > Plugins > Web Services > External services
      2. Check Enable mobile web service and Save
      3. Click the 'Edit' link for 'Moodle mobile web service'
      4. Click 'Show advanced' and uncheck 'Can download files'. Click 'Saves changes'.
        It worked? All good
      Show
      Log in as an admin and go to Settings > Site administration > Plugins > Web Services > External services Check Enable mobile web service and Save Click the 'Edit' link for 'Moodle mobile web service' Click 'Show advanced' and uncheck 'Can download files'. Click 'Saves changes'. It worked? All good
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      MDLQA-5740 Smartphone users can use the Moodle Mobile app to download files. Step 5 of the test requires 'Show advanced' to be clicked, but it is missing. There is only an Enabled and Authorised users only checkboxes.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Michael de Raadt added a comment -

            Thanks for creating this issue, AL.

            Juan Leyva It would be good if you could determine if this is a real issue or if the test instructions need to be updated.

            Show
            Michael de Raadt added a comment - Thanks for creating this issue, AL. Juan Leyva It would be good if you could determine if this is a real issue or if the test instructions need to be updated.
            Hide
            Juan Leyva added a comment - - edited

            Well, it seems that there is a javascript error in the page that display the form that prevents display the Show Advanced buttons (I've reproduced the same error in 2.5 and in current 2.6)

            selector = {
                select: null,
                input: null,
                button: null,
             
                filter_init: function(strsearch, selectinputid) {
             
            ....
             
                div.appendChild(label);
               div.appendChild(input);
               selector.select.parentNode.insertBefore(div, selector.select); <--- Uncaught TypeError: Cannot read property 'parentNode' of null
            

            These errors prevent the rest of the javascript page to be loaded (including navigation tree and also the show advanced buttons)

            That function is called at the bottom of the page with the following parameters:

            selector.filter_init("Search", "id_requiredcapability");

            Looking at the source code of the page created there is not element called "id_requiredcapability" or "requiredcapability"

            But in the Moodle PHP code this element is created using quickforms:

                    $mform->addElement('searchableselector', 'requiredcapability',
                            get_string('requiredcapability', 'webservice'), $capabilitychoices);
                    $mform->addHelpButton('requiredcapability', 'requiredcapability', 'webservice');
                    $mform->setAdvanced('requiredcapability');
                    $mform->setType('requiredcapability', PARAM_RAW);
            

            $capabilitychoices is a huge array with all the system capabilities, maybe the problem is the size of the array

            Conclusion: Is an error related to the moodle_forms searchableselector type, that is not displaying the html code

            Show
            Juan Leyva added a comment - - edited Well, it seems that there is a javascript error in the page that display the form that prevents display the Show Advanced buttons (I've reproduced the same error in 2.5 and in current 2.6) selector = { select: null , input: null , button: null ,   filter_init: function (strsearch, selectinputid) {   ....   div.appendChild(label); div.appendChild(input); selector.select.parentNode.insertBefore(div, selector.select); <--- Uncaught TypeError: Cannot read property 'parentNode' of null These errors prevent the rest of the javascript page to be loaded (including navigation tree and also the show advanced buttons) That function is called at the bottom of the page with the following parameters: selector.filter_init("Search", "id_requiredcapability"); Looking at the source code of the page created there is not element called "id_requiredcapability" or "requiredcapability" But in the Moodle PHP code this element is created using quickforms: $mform->addElement('searchableselector', 'requiredcapability', get_string('requiredcapability', 'webservice'), $capabilitychoices); $mform->addHelpButton('requiredcapability', 'requiredcapability', 'webservice'); $mform->setAdvanced('requiredcapability'); $mform->setType('requiredcapability', PARAM_RAW); $capabilitychoices is a huge array with all the system capabilities, maybe the problem is the size of the array Conclusion: Is an error related to the moodle_forms searchableselector type, that is not displaying the html code
            Hide
            Juan Leyva added a comment - - edited

            Well,

            I've found that the problem is in the function:

            admin/webservice/forms.php

            $mform->hardFreeze('name,requiredcapability,restrictedusers');

            If we delete the "requiredcapability" from that function the form works correctly, seems that this type of element doesn't support well "hardFreeze"

            Show
            Juan Leyva added a comment - - edited Well, I've found that the problem is in the function: admin/webservice/forms.php $mform->hardFreeze('name,requiredcapability,restrictedusers'); If we delete the "requiredcapability" from that function the form works correctly, seems that this type of element doesn't support well "hardFreeze"
            Hide
            Juan Leyva added a comment - - edited

            Well,

            in my local environment I have patched lib/form/searchableselectorform.php

            I changed:
            if ($this->_hiddenLabel)

            by:

            if ($this->_hiddenLabel || $this->_flagFrozen){

            So no javascript is included and the page where the element is hidden or frozen, and it seems work correctly

            Michael, who should do the peer-review?

            Regards

            Show
            Juan Leyva added a comment - - edited Well, in my local environment I have patched lib/form/searchableselectorform.php I changed: if ($this->_hiddenLabel) by: if ($this->_hiddenLabel || $this->_flagFrozen){ So no javascript is included and the page where the element is hidden or frozen, and it seems work correctly Michael, who should do the peer-review? Regards
            Hide
            Juan Leyva added a comment -

            Requested peer review to Jerome since it's the original author of the form field

            Show
            Juan Leyva added a comment - Requested peer review to Jerome since it's the original author of the form field
            Hide
            Jérôme Mouneyrac added a comment -

            Reviewed, thanks Juan, sent to integration.

            Show
            Jérôme Mouneyrac added a comment - Reviewed, thanks Juan, sent to integration.
            Hide
            Marina Glancy added a comment -

            Thanks Juan, integrated in 2.4, 2.5 and 2.6.
            I tested on 2.6 - works like charm!

            Show
            Marina Glancy added a comment - Thanks Juan, integrated in 2.4, 2.5 and 2.6. I tested on 2.6 - works like charm!
            Hide
            Andrew Nicols added a comment -

            Works as described Passing

            Show
            Andrew Nicols added a comment - Works as described Passing
            Hide
            Damyon Wiese added a comment -

            Here lies 52 bugs.
            All fixed or swept under a rug.
            If they come back one day,
            To our dismay,
            We all will feel quite un-smug.

            Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.

            Show
            Damyon Wiese added a comment - Here lies 52 bugs. All fixed or swept under a rug. If they come back one day, To our dismay, We all will feel quite un-smug. Thanks for the reporting/fixing/testing on this issue. It has been sent upstream.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: