moodle-local_staticpage ======================= [![Moodle Plugin CI](https://github.com/moodle-an-hochschulen/moodle-local_staticpage/workflows/Moodle%20Plugin%20CI/badge.svg?branch=master)](https://github.com/moodle-an-hochschulen/moodle-local_staticpage/actions?query=workflow%3A%22Moodle+Plugin+CI%22+branch%3Amaster) Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme Requirements ------------ This plugin requires Moodle 4.3+ Motivation for this plugin -------------------------- We have seen Moodle installations where there was a need for displaying static information like an imprint, a faq or a contact page and this information couldn't be added everything to the frontpage. As Moodle doesn't have a "page" concept, admins started to create courses, place their information within these courses, open guest access to the course and link to this course from HTML blocks or the custom menu. We thought that this course overhead doesn't make sense, so we created this plugin. It is designed to deliver static HTML documents, enriched with Moodle layout and navigation as a standard Moodle page which exist outside any course. Static pages will be available on catchy URLs like http://www.yourmoodle.com/static/faq.html and can be linked from Moodle HTML blocks, from your Moodle theme footer and so on. Using this plugin, you can create information pages within moodle, but without misusing a whole course just for showing a textbox. It is not meant as a fully featured content management solution, especially as you have to work with raw HTML, but it is quite handy for experienced admins for creating some few static pages within Moodle. Installation ------------ Install the plugin like any other plugin to folder /local/staticpage See http://docs.moodle.org/en/Installing_plugins for details on installing Moodle plugins Usage & Settings ---------------- After installing the plugin, it does not do anything to Moodle yet. To configure the plugin and its behaviour, please visit: Site administration -> Static Pages. There, you find multiple settings pages: ### 1. Documents On this page, you upload the document files you want to serve as static pages. The filepicker accepts files with .html filename extensions. For each static page you want to serve, upload a HTML document, named as [pagename].html. local_staticpage then uses this filename as pagename. Example: You upload a file named faq.html. This file will be served as static page with the page name "faq". Valid filenames: Please note that not all symbols which are allowed in the filenames in the filepicker are supported / suitable for pagenames. Please make sure that your filenames only contain lowercase alphanumeric characters and the - (hypen) and _ (underscore) symbols. Please note that the filepicker on this settings page does not only allow you to upload .html files but also to upload .htm files due to the way the Moodle filepicker is built internally. local_staticpage does its best to change the suffix of a .htm file to .html after you save the settings page. ### 2. Settings On this page, you can configure several aspects of local_staticpage's behaviour. #### 2.1. Data source of document title By default, local_staticpage will use the first `

` tag as document title and document heading of the resulting static page. In this section, you can change this behaviour to using the first `` tag for each of these. Please note that if local_staticpage doesn't find the configured (`<h1>` or `<title>`) tag, it will derive the document title from the document filename. #### 2.2. Force Apache mod_rewrite With this setting, you can configure local_staticpage to only serve static pages on a clean URL, using Apache's mod_rewrite module. See "Apache mod_rewrite" section below for details. #### 2.3. Force login With this setting, you can configure local_staticpage to only serve static pages to logged in users or also to service static pages non-logged in visitors. This behaviour can be set specifically for static pages or can be set to respect Moodle's global forcelogin ($CFG->forcelogin) setting. #### 2.4. Process Content In this section, you can configure if Moodle filters should be processed when serving a static page's content. You can use local_staticpage completely without multilanguage or filter support. But when you need multilanguage or filter support, you can set this setting to yes and make use in your static page files of any Moodle filter which is enabled on system level. Please see https://docs.moodle.org/en/Filters or https://docs.moodle.org/en/Multi-language_content_filter for details. In this section, you can also configure if the static page's HTML code should be cleaned. If this setting is set to yes, local_staticpage will use a Moodle library function to remove unclean HTML code and special tags like `<iframe>`. If this setting is set to no, local_staticpage will trust the HTML code in your static page's file and will just pass it on to the browser. #### 2.5. Check availability In this section, you can configure if Moodle should check for static file availability on the list of static pages or not. ### 3. List of static pages On this page, there is a list which shows all static pages which have been uploaded into the static pages document area and their URLs. Additionally, the page list checks each static page if a browser is actually able to download and view it. If this isn't possible, the static page is marked with an error message in the page list. Capabilities ------------ This plugin also introduces these additional capabilities: ### local/staticpage:managedocuments By default, Moodle administrators and Moodle users with the moodle/site:config capability are allowed to manage static page documents and the static page plugin settings. As administrator, you can selectively grant users the ability to manage static page documents (but not to manage the static page plugin settings) by adding the local/staticpage:managedocuments capability in conjunction with the moodle/site:configview capability to an appropriate Moodle role. Creating static page documents ------------------------------ As local_staticpage's HTML reader (DOM parser) is quite dumb, there is a proposed structure for the html documents: ``` <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Imprint

Imprint

[Your content goes here] ``` Please note that the `` tag is neccessary if you want to use UTF-8 characters in your html document, otherwise they will become crippled when the document is parsed by local_staticpage. Styling static pages -------------------- If you want to style your static page with CSS in any special way, you can include a `