]> git.mjollnir.org Git - moodle.git/commitdiff
IMPORTANT NEW FEATURE FOR CSS
authormoodler <moodler>
Tue, 25 Jan 2005 11:05:23 +0000 (11:05 +0000)
committermoodler <moodler>
Tue, 25 Jan 2005 11:05:23 +0000 (11:05 +0000)
print_header now produces a unique CSS class and id for each page,
allowing targeting of styles for any module or page.

lib/setup.php
lib/weblib.php

index a934908a67b4ff0282e9831f9965a1ad2566a0d4..ca2995f74e39019319668d8465a98b7fa2d57a87 100644 (file)
@@ -358,7 +358,7 @@ global $THEME;
         }
     }
 
-    if ($CFG->theme == 'standardxhtml') {    // Temporary measure to help with XHTML validation
+    if (stripos($CFG->theme, 'xhtml') !== false ) {    // Temporary measure to help with XHTML validation
         if (empty($_SESSION['USER'])) {      // Allow W3CValidator in as user called w3cvalidator (or guest)
             if ((strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) or 
                 (strpos($_SERVER['HTTP_USER_AGENT'], 'Cynthia') !== false )) {
index d1f38640a09182a04a6d10fe171a40c438a3f623..d1406fc3e13aab9421a3a94af1712ef5b85c5d74 100644 (file)
@@ -1491,7 +1491,7 @@ function highlightfast($needle, $haystack) {
 function print_header ($title='', $heading='', $navigation='', $focus='', $meta='',
                        $cache=true, $button='&nbsp;', $menu='', $usexml=false, $bodytags='') {
 
-    global $USER, $CFG, $THEME, $SESSION;
+    global $USER, $CFG, $THEME, $SESSION, $ME;
 
     global $course;                // This is a bit of an ugly hack to be gotten rid of later
     if (!empty($course->lang)) {
@@ -1623,9 +1623,30 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta=
         }
     }
 
+    // Clean up the title
+
     $title = str_replace('"', '&quot;', $title);
     $title = strip_tags($title);
 
+    // Create class and id for this page
+
+    $path = str_replace($CFG->wwwroot.'/', '', $ME);
+    $path = str_replace('.php', '', $path);
+    if (substr($path, -1) == '/') {
+        $path .= 'index';
+    }
+    if (empty($path)) {
+        $pageid    = 'index';
+        $pageclass = 'course-view';
+    } else {
+        $pageid    = str_replace('/', '-', $path);
+        $pageclass = explode('-', $pageid);
+        array_pop($pageclass);
+        $pageclass = implode('-', $pageclass);
+    }
+
+    $bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
+    
     include ($CFG->dirroot .'/theme/'. $CFG->theme .'/header.html');
 
     echo message_popup_window();
@@ -3105,7 +3126,8 @@ function emoticonhelpbutton($form, $field) {
 
     $SESSION->inserttextform = $form;
     $SESSION->inserttextfield = $field;
-    $imagetext = '<img src="' . $CFG->pixpath . '/s/smiley.gif" border="0" align="middle" width="15" height="15" alt="" />';
+    $imagetext = '<img src="' . $CFG->pixpath . '/s/smiley.gif" border="0" align="middle" width="15" height="15" alt=""
+    style="margin-left: 7px" />';
 
     helpbutton('emoticons', get_string('helpemoticons'), 'moodle', true, true, '', false, $imagetext);
 }