Closed bjimenez-lallemand closed 5 years ago
Hi bjimenez-lallemand,
I have just tried to reproduce this bug report and have added these links to staticpages as custom nodes:
Imprint|/local/staticpage/view.php?page=imprint
Maintenance|/local/staticpage/view.php?page=maintenance
In my setup, the highlighting of both pages works as expected.
However, I have to admit that highlighting of nodes might have some side effects in Moodle and local_boostnavigation only can do its best.
Can you send me your custom nodes configuration so that I can have a look at what you are doing?
Thanks, Alex
Hi,
I think I have the same problem, but it has nothing to do with Static Pages (I don't use that plugin). I have two custom nodes that point to manually running scheduled tasks, and when I select the lower one, the higher one is highlighted. Here is the custom node coniguration (for admins): All courses|https://_my.site.de_?redirect=0 Tags|/tag/search.php Calculate completion|/admin/tool/task/schedule_task.php?task=core\task\completion_regular_task Index search|/admin/tool/task/schedule_task.php?task=core\task\search_index_task Purge caches|/admin/purgecaches.php
When I click on Calculate completion, it highlights (see first screenshot), but when I click on Index search, it goes to the proper page, but highlights Calculate completion (see second screenshot).
Not a huge issue, but definitely annoying. I'm using Moodle 3.5.2 and Boost navigation fumbling v3.5-r2.
Thanks, Aaron
Hi @amjohnson46 ,
I was able to reproduce your problem and dug into the Moodle core code which is detecting and setting the active navigation node. I had to see that Moodle only checks the URL base on https://github.com/moodle/moodle/blob/master/lib/navigationlib.php#L640 and ignores the URL parameters. That's why your "Calculate completion" always is the active node because its URL base matches first.
There's no easy way which I know of to overwrite this function from a plugin to change URL_MATCH_BASE to URL_MATCH_PARAMS. And more worse, when I hacked the function temporarily to use URL_MATCH_PARAMS, no node at all was active as there seems to be another problem even more down below in the Moodle navigation code.
The only way I could think of to solve this was to set the active node myself in the plugin if possible. This is now done in https://github.com/moodleuulm/moodle-local_boostnavigation/commit/aaa521fba8db494e91071a4b875f3e076b3d8240 and worked in my tests.
I think that this also solves the problem by @bjimenez-lallemand.
A new version with the patch will be published to the Moodle plugin repo soon.
Cheers, Alex
Thanks, Alex. That works perfect. Aaron
I've installed both this plugin and Static Pages (https://moodle.org/plugins/local_staticpage) but i have encountered a glitch: I've created two static pages (no mod_rewrite) and then added them to the nav drawer. However, when i click on the links, they don't get the correct "active" state in the drawer, but instead all of them mark the first page added by default. For example: pages created: help - goes to help and on the nav drawer appears help selected terms - goes to terms but on the nav drawer appears help selected
I post it here because i think it pertains more to this plug than to the other, also mantained by you.
Thanks