Relative Linking within Moodle using the HTML Editor

Relative Linking within Moodle using the HTML Editor

par Chris Simpson,
Nombre de réponses : 3

At Swansea College, all our systems use a SSO (using LDAP).  This means that on our Moodle installation we require both an internal http://swanvle/moodle plus a https://vle.swancoll.ac.uk .  We have set Moodle up to distinguish which route access is made and defines the $CFG->wwwroot variable in config.php as required.

This works for general Moodle use, but unfortunately any internal links to resources using the HTML Editor causes issues, as Moodle automatically prefixes all relative addresses with http://swanvle/moodle . Does anybody have any ideas of any method of resolving this issue?  The links then become unavailable when Moodle is accessed externally using the https://vle.swancoll.ac.uk address.

Any advice would be greatly appreciated.

Thanks

Chris Simpson

Moyenne des évaluations  -
En réponse à Chris Simpson

Re: Relative Linking within Moodle using the HTML Editor

par David Sturrock,

Dirty fix idea. Hack a filter to check current domain and change link accordingly. e.g. If domain is https://vle.swancoll.ac.uk the filter rewrites the domain of any http://swanvle/moodle links to https://vle.swancoll.ac.uk.

I got the Catalyst IT team to do something similar for us to automatically add an ezproxy prefix to links to research databases like ProQuest or Ebsco.

En réponse à David Sturrock

Re: Relative Linking within Moodle using the HTML Editor

par Chris Simpson,

I have already added similar code to the config.php file to set the cfg->wwwroot. 

Do you know which file(s) and which function(s) needs to be altered for your suggested fix?  Your suggestion sounds great! 

Many thanks!

En réponse à Chris Simpson

Re: Relative Linking within Moodle using the HTML Editor

par David Sturrock,

Copy, paste and rename an existing filter folder like censor or activitynames as a starting point. You'll need to know some php & reg expressions to get the specifics - sorry can't be much help there. Have attached the original hacked filter I got an IT tutor to do for me. We've since moved onto a more advanced solution but the principles should be similar to your requirements.

The filter has the following logic:

  1. Check for urls
  2. Check if the URL already has the the ezproxy prefix
  3. Loop thru the text checking for the defined domains and adding the ezproxy prefix where necessary
  4. Array of domains we are interested in
  5. Identify URLs with expired ezproxy domains (foundincorrect)
  6. Substitute a correct domain for the incorrect one (changeincorrect)