Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34175

incorrect JS include and other problems when /admin/ folder renamed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Roles / Access
    • Labels:
      None

      Description

      In Site Administration/Users/Permissions/Define Roles/.

      When you click on a Role, you will see the error message "Coding error detected, it must be fixed by a programmer: Attempt to require a JavaScript file that does not exist."

      I also get this error message in "Check System Permissions" and "Assign System Roles".

      I am using Moodle 2.3+ (Build: 20120701)

        Gliffy Diagrams

          Attachments

          1. define_roles.jpg
            define_roles.jpg
            63 kB
          2. edit_roles.jpg
            edit_roles.jpg
            115 kB
          3. edit_student_role.jpg
            edit_student_role.jpg
            94 kB
          4. Profile-send_message.jpg
            Profile-send_message.jpg
            69 kB
          5. send_message.jpg
            send_message.jpg
            38 kB

            Activity

            Hide
            skodak Petr Skoda added a comment -

            Hello,

            I have tried it and it works fine for me, I also verified the code and I can not see any broken JS includes theres.

            It looks like you are missing some of the JS files in your install, or there is a problem with some contrib plugin or a theme.

            Sorry, can not reproduce. Please try it again in a new git branch from latest MOODLE_23_STABLE.

            Petr

            Show
            skodak Petr Skoda added a comment - Hello, I have tried it and it works fine for me, I also verified the code and I can not see any broken JS includes theres. It looks like you are missing some of the JS files in your install, or there is a problem with some contrib plugin or a theme. Sorry, can not reproduce. Please try it again in a new git branch from latest MOODLE_23_STABLE. Petr
            Hide
            cprudhoe Clarence Prudhoe added a comment -

            Hello Petr,

            Thanks for helping me with this problem.

            I downloaded and installed Moodle 2.3+ (Build: 20120701) as a .zip file again as you suggested. I uploaded moodle-latest-23.zip to my dedicated server and unziped it there.

            I logged in as Admin and opened /Site Administration/Users/Permissions/Define roles/ and selected "Student" from the Roles column. I get the same error message "Coding error detected, it must be fixed by a programmer: Attempt to require a JavaScript file that does not exist." SEE attached screenshot – define_roles.png

            I can't find any link to list the roles and edit the permissions. In the Moodle Docs it says:

            To edit a role:

            Go to Settings > Site administration > Users > Permissions > Define roles.
            Click the edit icon opposite the role you want to edit e.g. student.
            On the edit role page, change permissions as required for each capability.

            If I follow these instructions, I get the same coding error message and it doesn't list the permissions. SEE attached screenshot – edit_student_role.png

            Some time ago I edited the Student permissions so they could not send messages to each other. I have changed my mind about this and need to change the messaging permissions. Now I can't find a way to edit the permissions.

            In /Site Administration/Users/Permissions/Define roles/Student/ I clicked the EDIT tab but it doesn't list the permissions for the Student Role. SEE attached screenshot – edit_roles.png

            I tried to reset the Student permissions to the defaults but it doesn't change the messaging permission either.

            From /My home/My profile/Messages/ I see the users in my contact list. When I click on the user's name, it doesn't open the Message window to write a message. SEE attached screenshot – send_message.png. The "Send Message"

            When I click a user's name in the Online Users block, it opens the user's profile but it doesn't show the "Send Message" button. SEE attached screenshot – Profile-send_message.png. The "Send Message"

            I assume this missing JavaScript file is the problem.

            Please let me know if you can suggest a solution to this problem.

            Thanks,
            Clarence Prudhoe

            Show
            cprudhoe Clarence Prudhoe added a comment - Hello Petr, Thanks for helping me with this problem. I downloaded and installed Moodle 2.3+ (Build: 20120701) as a .zip file again as you suggested. I uploaded moodle-latest-23.zip to my dedicated server and unziped it there. I logged in as Admin and opened /Site Administration/Users/Permissions/Define roles/ and selected "Student" from the Roles column. I get the same error message "Coding error detected, it must be fixed by a programmer: Attempt to require a JavaScript file that does not exist." SEE attached screenshot – define_roles.png I can't find any link to list the roles and edit the permissions. In the Moodle Docs it says: To edit a role: Go to Settings > Site administration > Users > Permissions > Define roles. Click the edit icon opposite the role you want to edit e.g. student. On the edit role page, change permissions as required for each capability. If I follow these instructions, I get the same coding error message and it doesn't list the permissions. SEE attached screenshot – edit_student_role.png Some time ago I edited the Student permissions so they could not send messages to each other. I have changed my mind about this and need to change the messaging permissions. Now I can't find a way to edit the permissions. In /Site Administration/Users/Permissions/Define roles/Student/ I clicked the EDIT tab but it doesn't list the permissions for the Student Role. SEE attached screenshot – edit_roles.png I tried to reset the Student permissions to the defaults but it doesn't change the messaging permission either. From /My home/My profile/Messages/ I see the users in my contact list. When I click on the user's name, it doesn't open the Message window to write a message. SEE attached screenshot – send_message.png. The "Send Message" When I click a user's name in the Online Users block, it opens the user's profile but it doesn't show the "Send Message" button. SEE attached screenshot – Profile-send_message.png. The "Send Message" I assume this missing JavaScript file is the problem. Please let me know if you can suggest a solution to this problem. Thanks, Clarence Prudhoe
            Hide
            cprudhoe Clarence Prudhoe added a comment -

            I forgot to mention this this test was done on Moodle right out of the box. There are no non-standard plugins and no code hacks. There are some modifications to the Theme Fusion.

            Thanks,
            Clarence

            Show
            cprudhoe Clarence Prudhoe added a comment - I forgot to mention this this test was done on Moodle right out of the box. There are no non-standard plugins and no code hacks. There are some modifications to the Theme Fusion. Thanks, Clarence
            Hide
            skodak Petr Skoda added a comment - - edited

            The latest zip package works fine for me, the problem is most probably in unzipping or somewhere in your server. Please use moodle.org support forums if you need help with this problem. You should also try the DEBUG_DEVELOPER mode, it should tell you which file exactly causes the problem.

            Show
            skodak Petr Skoda added a comment - - edited The latest zip package works fine for me, the problem is most probably in unzipping or somewhere in your server. Please use moodle.org support forums if you need help with this problem. You should also try the DEBUG_DEVELOPER mode, it should tell you which file exactly causes the problem.
            Hide
            cprudhoe Clarence Prudhoe added a comment -

            Thanks for the push to turn on Debug Mode.

            I found the bug.

            If you rename /moodle/admin/ to another folder name as recommended, the error occurs.

            In /moodle/lib/outputrequirementslib.php on line #462 you will find this code:

            case 'core_role':
            $module = array('name' => 'core_role',
            'fullpath' => '/admin/roles/module.js',
            'requires' => array('node', 'cookie'));
            break;

            /admin/roles/module.js is hard coded so it can't find /myadmin/roles/module.js because I renamed /admin/ as is recommended.

            Hope this helps,
            Clarence

            Show
            cprudhoe Clarence Prudhoe added a comment - Thanks for the push to turn on Debug Mode. I found the bug. If you rename /moodle/admin/ to another folder name as recommended, the error occurs. In /moodle/lib/outputrequirementslib.php on line #462 you will find this code: case 'core_role': $module = array('name' => 'core_role', 'fullpath' => '/admin/roles/module.js', 'requires' => array('node', 'cookie')); break; /admin/roles/module.js is hard coded so it can't find /myadmin/roles/module.js because I renamed /admin/ as is recommended. Hope this helps, Clarence
            Hide
            skodak Petr Skoda added a comment -

            ah! that would explain it, reopening

            Show
            skodak Petr Skoda added a comment - ah! that would explain it, reopening
            Hide
            skodak Petr Skoda added a comment -

            I did not backport this to older branches because most probably nobody else is using it otherwise they would have reported this already, all new installs and upgrades should use 2.3 - it should not cause problems when doing upgrade from 1.9->2.2->2.3

            Thanks for the report!

            Show
            skodak Petr Skoda added a comment - I did not backport this to older branches because most probably nobody else is using it otherwise they would have reported this already, all new installs and upgrades should use 2.3 - it should not cause problems when doing upgrade from 1.9->2.2->2.3 Thanks for the report!
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr, this has been integrated now. I partially cherry-picked to 22 as well as we do still support bug fixes there.

            Cheers
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr, this has been integrated now. I partially cherry-picked to 22 as well as we do still support bug fixes there. Cheers Sam
            Hide
            fred Frédéric Massart added a comment -

            Hi guys, I have tested this issue and the changes work fine. However, I accidentally clicked on another link and the site just crashed. I then grep'd for '/admin/' and noticed that it was used in many other places. Should this be fixed as part of this issue or a new one? (Waiting for your answer to finalize the test).

            Show
            fred Frédéric Massart added a comment - Hi guys, I have tested this issue and the changes work fine. However, I accidentally clicked on another link and the site just crashed. I then grep'd for '/admin/' and noticed that it was used in many other places. Should this be fixed as part of this issue or a new one? (Waiting for your answer to finalize the test).
            Hide
            skodak Petr Skoda added a comment -

            "site crashed" means what? yes, there are supposed to be tons of /admin/ in source code because it is automatically translated to $CFG->admin in moodle_url class

            Show
            skodak Petr Skoda added a comment - "site crashed" means what? yes, there are supposed to be tons of /admin/ in source code because it is automatically translated to $CFG->admin in moodle_url class
            Hide
            fred Frédéric Massart added a comment -

            Sorry, should have given more information. It actually fails because of a require() error. See /admin/mnet/peers.php

            Warning: require_once(/home/fred/www/repositories/testing_master/moodle/admin/mnet/peer_forms.php): failed to open stream: No such file or directory in /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php on line 33 Call Stack: 0.0006 794584 1. {main}() /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php:0 Fatal error: require_once(): Failed opening required '/home/fred/www/repositories/testing_master/moodle/admin/mnet/peer_forms.php' (include_path='/home/fred/www/repositories/testing_master/moodle/lib/zend:/home/fred/www/repositories/testing_master/moodle/lib/pear:.:/usr/share/php:/usr/share/pear') in /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php on line 33 Call Stack: 0.0006 794584 1. {main}() /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php:0 

            Show
            fred Frédéric Massart added a comment - Sorry, should have given more information. It actually fails because of a require() error. See /admin/mnet/peers.php Warning: require_once(/home/fred/www/repositories/testing_master/moodle/admin/mnet/peer_forms.php): failed to open stream: No such file or directory in /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php on line 33 Call Stack: 0.0006 794584 1. {main}() /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php:0 Fatal error: require_once(): Failed opening required '/home/fred/www/repositories/testing_master/moodle/admin/mnet/peer_forms.php' (include_path='/home/fred/www/repositories/testing_master/moodle/lib/zend:/home/fred/www/repositories/testing_master/moodle/lib/pear:.:/usr/share/php:/usr/share/pear') in /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php on line 33 Call Stack: 0.0006 794584 1. {main}() /home/fred/www/repositories/testing_master/moodle/bdmin/mnet/peers.php:0
            Hide
            skodak Petr Skoda added a comment -

            both branches updated, integrators please merge, thanks for the report

            Show
            skodak Petr Skoda added a comment - both branches updated, integrators please merge, thanks for the report
            Hide
            poltawski Dan Poltawski added a comment -

            I've merged the two fixes. thanks

            Show
            poltawski Dan Poltawski added a comment - I've merged the two fixes. thanks
            Hide
            fred Frédéric Massart added a comment - - edited

            Hi guys, I discovered a new issue. Going to the Registration page fails with an exception. I guess that'd be an inclusion error as the class exists.

            Coding error detected, it must be fixed by a programmer: Request for an unknown renderer class core_register_renderer
             
            More information about this error
            Stack trace:
             
                line 219 of /lib/outputfactories.php: coding_exception thrown
                line 1073 of /lib/outputlib.php: call to standard_renderer_factory->get_renderer()
                line 648 of /lib/pagelib.php: call to theme_config->get_renderer()
                line 39 of /fmcorz/registration/index.php: call to moodle_page->get_renderer()

            Show
            fred Frédéric Massart added a comment - - edited Hi guys, I discovered a new issue. Going to the Registration page fails with an exception. I guess that'd be an inclusion error as the class exists. Coding error detected, it must be fixed by a programmer: Request for an unknown renderer class core_register_renderer   More information about this error Stack trace:   line 219 of /lib/outputfactories.php: coding_exception thrown line 1073 of /lib/outputlib.php: call to standard_renderer_factory->get_renderer() line 648 of /lib/pagelib.php: call to theme_config->get_renderer() line 39 of /fmcorz/registration/index.php: call to moodle_page->get_renderer()
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Hmm that definitely looks like a separate issue to me.
            The changes Petr made didn't go near the registration area, did you spot anything else btw Fred or was that it.

            Thinking if that was it we can mark this passed and open an issue for the registration bug.

            Show
            samhemelryk Sam Hemelryk added a comment - Hmm that definitely looks like a separate issue to me. The changes Petr made didn't go near the registration area, did you spot anything else btw Fred or was that it. Thinking if that was it we can mark this passed and open an issue for the registration bug.
            Hide
            skodak Petr Skoda added a comment - - edited

            Registration is a separate problem, it uses hardcoded /admin/ also on the registration server which would need to be fixed/updated too, also at the same time it should be move to /admin/tool/ once the exact script location is sent to the server.

            +1 to create new issue for registration.

            Show
            skodak Petr Skoda added a comment - - edited Registration is a separate problem, it uses hardcoded /admin/ also on the registration server which would need to be fixed/updated too, also at the same time it should be move to /admin/tool/ once the exact script location is sent to the server. +1 to create new issue for registration.
            Hide
            fred Frédéric Massart added a comment -

            +1 too then.
            No other problems detected. Test can be passed!

            Show
            fred Frédéric Massart added a comment - +1 too then. No other problems detected. Test can be passed!
            Hide
            poltawski Dan Poltawski added a comment -

            Passing the test, as discussed.

            Show
            poltawski Dan Poltawski added a comment - Passing the test, as discussed.
            Hide
            poltawski Dan Poltawski added a comment -

            Congratulations!

            You've made it into the weekly release!

            Thanks for your contribution - here are some random drummers to keep you inspired for the next week!
            http://www.youtube.com/watch?v=_QhpHUmVCmY

            Show
            poltawski Dan Poltawski added a comment - Congratulations! You've made it into the weekly release! Thanks for your contribution - here are some random drummers to keep you inspired for the next week! http://www.youtube.com/watch?v=_QhpHUmVCmY

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/12