Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Filter enable/disable by context.

Development:Filter enable/disable by context

From MoodleDocs
Revision as of 03:29, 12 March 2009 by Tim Hunt (talk | contribs) (New page: {{Moodle 2.0}} We want to make configuration of filters more flexible, so, for example, you can do things like * Disable the glossary auto-linking filter in a quiz. * Enable the TeX filte...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Moodle 2.0

We want to make configuration of filters more flexible, so, for example, you can do things like

  • Disable the glossary auto-linking filter in a quiz.
  • Enable the TeX filter only in the Maths course category.

Overview

Filters will still be configured at the top level, administrators will still be able to choose which ones are enabled at all for the whole site. Also, any filter settings (for example which media types for the multimedia filter, and the paths for the TeX filter) will also still be set globally for the whole site.

However, in addition to the overall on/off switch for each filter, we will store a separate active/inactive state for each filter in each context. (Don't worry, we don't actually store the state for each context, mostly we use inheritance.)

This proposal relies on some of the proposed navigation changes for Moodle 2.0. Without them, it is not easy to add a new 'Text filtering' settings page for each context.

Detailed design

Changes to the filter admin screen

On Administration ► Plugins ► Filters ► Manage filters, the existing Disable/Enable column will be split into two.

  • Enabled? will control whether this filter can be used at all on this site.
  • Active? controls whether this filter is in use globally. (If the plugin in not enabled, you cannot activate it.)


New settings screen in each context

There will be a new settings screen in each context

New capability moodle/filter:manage

This controls access to the Text filtering settings page.

By default Administrators, Course creators and Teachers will have this capability.

...

One of the Navigation 2.0 changes is that each page will be linked to a specific context. (That is, $PAGE->context will always to set to something sensible.)

Text will be filtered according to the page it appears on, not the context it belongs to. This is normally fine. For example, we want question text to be filtered according to the quiz that the question appears in.

The one place that might be strange is in the recent activity report in the user's profile, which will be filtered according to the filter settings for the user context. (And these will almost certainly inherit unmodified from the System context.) That would be strange if the TeX filter was only enabled in the Maths course. However, there is the identity crises that certain profile pages have, where the are linked to both the user's profile and the course. Perhaps we associate those profile pages to the course context. On the other hand, if the parent looking at their child's recent activity does not have access to the course, it is good that they do not see the effects of the glossary auto-linking filter, which would like them to glossary entries they do not have permission to see.


Database table filter_active

Need to clean up rows here whenever a context is deleted.

We will not delete data from here when a filter is disabled globally.

Retrieving the active filters for a page

Changes to text caching

The md5key used in the cache_text table will be changed to user the contextid, rather than the courseid, in $hashstr. See format_text in weblib.php.

See also