Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-4050

Add support for media-specific stylesheets in themes

    Details

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

      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.

        Gliffy Diagrams

          Activity

          Hide
          dougiamas 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
          dougiamas 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
          urshunkler Urs Hunkler added a comment -

          Not needed.

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

          Re-opened issue.

          Show
          lukehudson Luke Hudson added a comment - Re-opened issue.
          Hide
          lukehudson 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
          lukehudson 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
          lukehudson Luke Hudson added a comment -

          Patch, against MOODLE_19_STABLE.

          Show
          lukehudson Luke Hudson added a comment - Patch, against MOODLE_19_STABLE.
          Hide
          stronk7 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
          stronk7 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
          lukehudson 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
          lukehudson 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
          dougiamas Martin Dougiamas added a comment -

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

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

          Well, should I go ahead and commit?

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

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

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

          We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible.

          ==BLK2YIMP20141121==

          Show
          marina Marina Glancy added a comment - We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible. ==BLK2YIMP20141121==

            People

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

              Dates

              • Created:
                Updated:
                Resolved: