catalyst / moodle-auth_outage

Planned, graduated user and admin friendly moodle outages
https://moodle.org/plugins/auth_outage
17 stars 33 forks source link

Allow more nuanced theming of the maintenance page #220

Open brendanheywood opened 3 years ago

brendanheywood commented 3 years ago

Some clients want a high level of control over the exact html, ie they don't want a 'moodle themed' page.

There are a couple of ways of approaching it:

1) the simple cheat kinda way, have an admin setting with the entire html into it. This could fast get messy as this needs to contain placeholders and other bits of logic so I suspect this is not that viable.

2) employ a combination of a theme layout and a theme renderers so that the prebaked maintenance page can be cleanly extended in the client theme

Core already has a page layout specifically for maintenance:

$PAGE->set_pagelayout('maintenance');

However this should probably NOT be used because if this is this will override a whole bunch of other pages which we don't want affected such as some error pages. I think we want a new custom layout, and when we render the page we need to test if the current theme supports this layout before we use it.

The new layout will be be the 'outside' of the page, and we'll use a normal renderer for the 'insides'

dmitriim commented 3 years ago

HI @brendanheywood why do you think (1) needs placeholders and any logic? In our 2 last cases the html page had an html page with everything hardcoded (including js scripts and images).

dmitriim commented 3 years ago

I feel like we need to implement 1 and 2 to cover all needs.

brendanheywood commented 3 years ago

In your specific case you might get away with a completely static file but not in the general case, ie you want full control over the theme of the outage page but still have the outage manager inject some of the other dynamic variables such as the countdown timer and the per-outage message etc

dmitriim commented 3 years ago

I don't think an outage page has a countdown at all. Injection to a static html page can be done on form submission. We won't use html file, but you paste html code with placeholders and on form submission we can replace them with an actual data. Then we use this static html when the site is in outage.

dmitriim commented 3 years ago

Core has always supported an outage template page: dataroot/climaintenance.template.html

If this file exists then the outage manage should use it.