Moodle

automatic short course links and 404 handling

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: General, Usability
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

External sites should be able to link to courses by course code (shortname). I also want a very fast way to jump to any course for administration.
I've coded a 404 page which directs a URL of the form
[yoursite]/course_shortname
straight to the course if there is a unique match. If not it will go to course search results for the term.
If the URL is to a subdirectory page which doesn't exist (i.e. has extra slash(es) in URL), it will print a tidy 404 page.

Requires server 404 redirect to this file (in root of site).

To prevent a docs link to non-existant page, it needs a hack to footer around the echo docs link...
7a8,9
> GLOBAL $dontdodocs;
> if(empty($dontdodocs)) { 10a13 > }

Probably should prevent it from finding hidden courses but moodle shouldn't let people into them anyhow.
Comments?

Activity

Hide
Bruce Webster added a comment -

Also needs the string
$string['invalidURL'] = 'The requested URL \"$a\" was not found.';
in lang/../error.php

Show
Bruce Webster added a comment - Also needs the string $string['invalidURL'] = 'The requested URL \"$a\" was not found.'; in lang/../error.php
Hide
Jose Cedeno added a comment -

adding a link to the forum discussion:
http://moodle.org/mod/forum/discuss.php?d=124931

Show
Jose Cedeno added a comment - adding a link to the forum discussion: http://moodle.org/mod/forum/discuss.php?d=124931
Hide
Martin Dougiamas added a comment -

Note also that course/view.php has always supported shortnames like this:

http://moodle.org/course/view.php?name=Lounge

Show
Martin Dougiamas added a comment - Note also that course/view.php has always supported shortnames like this: http://moodle.org/course/view.php?name=Lounge
Hide
Mike Worth added a comment -

I didn't know about the name option for view.php, it is documented anywhere? It looks quite useful

Show
Mike Worth added a comment - I didn't know about the name option for view.php, it is documented anywhere? It looks quite useful

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: