Index: lib/gradelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/gradelib.php,v
retrieving revision 1.120.2.31
diff --unified -r1.120.2.31 gradelib.php
--- lib/gradelib.php	30 Apr 2009 19:04:51 -0000	1.120.2.31
+++ lib/gradelib.php	8 May 2009 16:55:46 -0000
@@ -773,7 +773,8 @@
     }
     $cats = array();
     foreach ($categories as $category) {
-        $cats[$category->id] = $category->get_name();
+        /* Loop through the parents collecting the names to build up a full structure.
+         * The code purposely misses off the top level as this is the course name, so
+         * it's the same for every category, and redundant putting it in the dropdown */
+        $nametoappend = '/'.$category->get_name();
+        $categoryparent = $category->get_parent_category();
+        $categorytext = '';
+        do {
+            $categorytext = $nametoappend.$categorytext; // Append the name of the previous category
+            $nametoappend = '/'.$categoryparent->get_name(); // Store the name of this category
+            $categoryparent = $categoryparent->get_parent_category(); // Get this categories parent
+        } while ($categoryparent != false);
+
+        $cats[$category->id] = substr($categorytext,1); // Drop the initial slash and add the rest to the dropdown
+     }
     asort($cats, SORT_LOCALE_STRING);
 
