### Eclipse Workspace Patch 1.0
#P 19stable
Index: blocks/course_list/block_course_list.php
===================================================================
RCS file: /cvsroot/moodle/moodle/blocks/course_list/block_course_list.php,v
retrieving revision 1.46.2.6
diff -u -r1.46.2.6 block_course_list.php
--- blocks/course_list/block_course_list.php	29 Aug 2008 04:23:38 -0000	1.46.2.6
+++ blocks/course_list/block_course_list.php	17 Jul 2009 02:02:57 -0000
@@ -64,9 +64,22 @@
         if ($categories) {   //Check we have categories
             if (count($categories) > 1 || (count($categories) == 1 && count_records('course') > 200)) {     // Just print top level category links
                 foreach ($categories as $category) {
-                    $linkcss = $category->visible ? "" : " class=\"dimmed\" ";
-                    $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">" . format_string($category->name) . "</a>";
-                    $this->content->icons[]=$icon;
+                    $courses = get_courses($category->id);
+                    if (count($courses)>1) {   
+                        
+                        $linkcss = $category->visible ? "" : " class=\"dimmed\" ";
+                        $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">" . format_string($category->name) . "</a>";
+                        $this->content->icons[]=$icon;
+                    } else { //just one course so print the link to it
+                        $course= array_shift($courses);
+                        $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
+
+                        $this->content->items[]="<a $linkcss title=\""
+                                   . format_string($course->shortname)."\" ".
+                                   "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" 
+                                   .  format_string($course->fullname) . "</a>";
+                        $this->content->icons[]=$icon;
+                    }
                 }
             /// If we can update any course of the view all isn't hidden, show the view all courses link
                 if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
