Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16583 Clean up JavaScript usage in HEAD
  3. MDL-14542

Modification to improve javascript and css header insertion for blocks, modules and filters

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.0
    • Blocks, Filters
    • None

    Description

      Currently Moodle does not provide blocks, filters or modules with an effective way of inserting javascript or css into the html header.

      It is possible to insert javascript by adding javascript.php to the root folder of a block,filter or module. However, the file is included as raw text - it is not parsed PHP.

      I have developed a modification to moodle which enables blocks, filters and modules to insert javascript / css into the html header whilst taking account of user permissions, browser version and edit mode. This has the following advantages:

      1) Standards compliance - all linked css and scripts should be in the head of the document, not the body

      2) Because css and javascript are included in the head according to user permissions, there is no wasted bandwidth for users who should not 'see' such css or javascript (way better than the current lib/javascript-mod.php which simply includes everything)

      3) Security - users should not be aware of javascript that is not relevant to them based on their permissions. This is not a major security risk but every little helps!

      Please visit the following screen cast for more info (I recommend the high quality link)

      High quality link:

      http://ossett.schools.wakefield.gov.uk/web/media/video/moodle_mod_screencast_hq

      Low quality link:

      http://ossett.schools.wakefield.gov.uk/web/media/video/moodle_mod_screencast

      Attachments

        Activity

          People

            timhunt Tim Hunt
            brudinie guy thomas
            Petr Skoda Petr Skoda
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            8 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              24/Nov/10