moodle-an-hochschulen / moodle-local_staticpage

Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
GNU General Public License v3.0
46 stars 28 forks source link

Use of Javascript on page #63

Closed richardschwarz closed 2 years ago

richardschwarz commented 2 years ago

Hi!

I'm trying to do up an easy page for my teaching staff to delete their course, after being reminded to back it up. The idea is that they would access it via a link in a drop-down in the Custom Menu (like "Delete this course") which then goes to this page. The page can detect the course page it came from (using javascript in the head section on load), but I can't then put that value into buttons for backing up or for deleting...

Head section:

Then at base of page:

NOTE: I tried to have it in the head section as well, but that obviously doesn't work...

It just creates the link as: https://moodle.fcc.qld.edu.au/backup/backup.php?id=${lastSegment}, which is interesting as it's using the JS at the base of the page to put that in, but not the variable?

Picture of Code: code picture

Picture of URL: moodle picture

Any ideas?

abias commented 2 years ago

Hi @richardschwarz ,

I am impressed by what you try to achieve with this plugin, but this issue feels like a duplicate of #40 which can be summarized as "there is no reliable support for JavaScript code in local_staticpage pages' content and there is no real plan to add it".

There is another plugin on https://moodle.org/plugins/local_pages which does similar things than this one but which I have never tried. Maybe you want to have a look if it supports JavaScript like you expect it.

Cheers, Alex