brendanheywood / moodle-local_cleanurls

Lets drag Moodle's url structure into this century...
37 stars 24 forks source link

My Overview Block's Tabs Don't Work #106

Open nyanginator opened 7 years ago

nyanginator commented 7 years ago

On the newly revamped Moodle 3.3 Dashboard, the "myoverview" block is now used in place of "courseoverview". There are tabs for Courses, Timeline, Sort by Date, Sort by Courses, In Progress, Future, and Past. None of these tabs are working when Clean URLs is enabled. Nothing happens when they are clicked, except in Chrome, where this browser error shows sometimes:

jquery-3.1.0.min.js:1 Uncaught Error: Syntax error, unrecognized expression: http://localhost/cleanmoodle/my/#myoverview_timeline_courses
    at Function.ga.error (jquery-3.1.0.min.js:1)
    at ga.tokenize (jquery-3.1.0.min.js:1)
    at ga.select (jquery-3.1.0.min.js:1)
    at Function.ga [as find] (jquery-3.1.0.min.js:1)
    at r.fn.init.find (jquery-3.1.0.min.js:1)
    at r.fn.init (jquery-3.1.0.min.js:1)
    at r (jquery-3.1.0.min.js:1)
    at HTMLDivElement.<anonymous> ((index):1077)
    at HTMLDivElement.dispatch (jquery-3.1.0.min.js:1)
    at HTMLDivElement.q.handle (jquery-3.1.0.min.js:1)

I tried searching for the error, resulting in this thread https://moodle.org/mod/forum/discuss.php?d=344183#p1391626, which mentions removing the # to make the error go away. Ignoring links with # is how I did the quick fix in https://github.com/brendanheywood/moodle-local_cleanurls/issues/104#issuecomment-317938511.

For this My Overview block case, I couldn't find any # signs in the $this->originalurl link, so my quick fix for this involved cleaning only course and mod URLs on the Dashboard page in /local/cleanurls/classes/local/cleaner/cleaner.php:

private function execute() {

    if (strpos($PAGE->pagetype, 'my-index') !== false) {
        $url = $this->originalurl->raw_out(false);
        if (strpos($url, '/course/') == false && strpos($url, '/mod/') == false) {
            return;
        }
    }

   ...

Hope this info is helpful in pinpointing the underlying issue.

brendanheywood commented 7 years ago

I think we found the same issue on the admin search tabs and have fixed this. @nyanginator can you please re-test with the latest code in git?

nyanginator commented 7 years ago

just re-downloaded, still same problem. Admin tabs work fine, but not Dashboard.

brendanheywood commented 7 years ago

Ah sorry, can you retry using this branch:

https://github.com/brendanheywood/moodle-local_cleanurls/tree/development

nyanginator commented 7 years ago

yup, looks like it's working now!

brendanheywood commented 7 years ago

ok just a heads up that we have a long running dev branch with some fairly major changes in it. We will merge back once it is all stable probably a couple weeks away. Feel free to use at your own risk :)