Moodle
  1. Moodle
  2. MDL-4050

Add support for media-specific stylesheets in themes

    Details

    • Type: New Feature New Feature
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: Themes
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      3097

      Description

      After discussion with Urs, we came up with a scheme for adding media support.

      If we add this to config.php in the themes:

      $THEME->mediasheets['handheld'] = array(...);

      $THEME->mediasheets['screen'] = array(...);

      etc

      and if mediasheets is defined, then add an additional stylesheet link to a composite stylesheet which will be CSS just for that media type.

      In addition, we should add the parameter

      media=all

      to the existing stylesheets that we already have. This is assumed anyway but it's nice to make it explicit.

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Urs Hunkler (u.hunkler at elearningkontor.de) Tuesday, 15 November 2005, 06:28 PM:

        Martin I see more and more questions how to handle Moodle on a PDA. The decision to implement media specific themes is open. Do you or your colleagues have time to implement what we discussed?

        Show
        Martin Dougiamas added a comment - From Urs Hunkler (u.hunkler at elearningkontor.de) Tuesday, 15 November 2005, 06:28 PM: Martin I see more and more questions how to handle Moodle on a PDA. The decision to implement media specific themes is open. Do you or your colleagues have time to implement what we discussed?
        Hide
        Urs Hunkler added a comment -

        Not needed.

        Show
        Urs Hunkler added a comment - Not needed.
        Hide
        Luke Hudson added a comment -

        Re-opened issue.

        Show
        Luke Hudson added a comment - Re-opened issue.
        Hide
        Luke Hudson added a comment -

        I've found that I need to implement print-friendly CSS for a client, and I've come up with a patch for this issue.

        My version is a backwards-compatible patch to print_header() in lib/weblib.php

        Basically, I figured that $CFG->stylesheets would be interpreted as follows:

        • If a given element of the array is a string, then add the link as before, but with the media="all" attribute.
        • If the element is itself an array, then expect a hash as follows:
          array( 'href' => 'http://blah.../blah../blah.css', media => 'print' )

        I'll attach the patch soon.

        • Luke
        Show
        Luke Hudson added a comment - I've found that I need to implement print-friendly CSS for a client, and I've come up with a patch for this issue. My version is a backwards-compatible patch to print_header() in lib/weblib.php Basically, I figured that $CFG->stylesheets would be interpreted as follows: If a given element of the array is a string, then add the link as before, but with the media="all" attribute. If the element is itself an array, then expect a hash as follows: array( 'href' => 'http://blah.../blah../blah.css', media => 'print' ) I'll attach the patch soon. Luke
        Hide
        Luke Hudson added a comment -

        Patch, against MOODLE_19_STABLE.

        Show
        Luke Hudson added a comment - Patch, against MOODLE_19_STABLE.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Looks interesting and code and won't break anything IMO. Not sure if we'll end using it but at least it's one more option for themes (and developers)

        +1 for that (I think you need Urs/Martin vote too before implement, Luke).

        Thanks for sharing it! Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Looks interesting and code and won't break anything IMO. Not sure if we'll end using it but at least it's one more option for themes (and developers) +1 for that (I think you need Urs/Martin vote too before implement, Luke). Thanks for sharing it! Ciao
        Hide
        Luke Hudson added a comment -

        Thanks for the positive feedback.

        I'll wait and see about votes, and I can cvs-commit it if/when it is approved by the others.

        Cheers,

        • Luke
        Show
        Luke Hudson added a comment - Thanks for the positive feedback. I'll wait and see about votes, and I can cvs-commit it if/when it is approved by the others. Cheers, Luke
        Hide
        Martin Dougiamas added a comment -

        I'm curious: Urs, why do you think this isn't needed?

        Show
        Martin Dougiamas added a comment - I'm curious: Urs, why do you think this isn't needed?
        Hide
        Luke Hudson added a comment -

        Well, should I go ahead and commit?

        Show
        Luke Hudson added a comment - Well, should I go ahead and commit?
        Hide
        Tim Hunt added a comment -

        I don't understand the need for this. What is wrong with @media { } in the CSS?

        Show
        Tim Hunt added a comment - I don't understand the need for this. What is wrong with @media { } in the CSS?

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: