# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/blocks/navigation/block_navigation.php
--- moodle/blocks/navigation/block_navigation.php Base (1.10)
+++ moodle/blocks/navigation/block_navigation.php Locally Modified (Based On 1.10)
@@ -180,9 +180,12 @@
         $arguments = array($this->instance->id, array('expansions'=>$expandable, 'instance'=>$this->instance->id, 'candock'=>$this->instance_can_be_docked(), 'courselimit'=>$limit));
         $this->page->requires->js_init_call('M.block_navigation.init_add_tree', $arguments, false, $module);
 
+        $options = array();
+        $options['linkcategories'] = (!empty($this->config->linkcategories) && $this->config->linkcategories == 'yes');
+        
         // Grab the items to display
         $renderer = $this->page->get_renderer('block_navigation');
-        $this->content->text = $renderer->navigation_tree($navigation, $expansionlimit);
+        $this->content->text = $renderer->navigation_tree($navigation, $expansionlimit, $options);
 
         // Set content generated to true so that we know it has been done
         $this->contentgenerated = true;
Index: moodle/blocks/navigation/edit_form.php
--- moodle/blocks/navigation/edit_form.php Base (1.4)
+++ moodle/blocks/navigation/edit_form.php Locally Modified (Based On 1.4)
@@ -39,7 +39,7 @@
         global $CFG;
         $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
 
-        $mods = array('enabledock'=>'yes');
\ No newline at end of file
+        $mods = array('enabledock'=>'yes', 'linkcategories'=>'no');
\ No newline at end of file
         $yesnooptions = array('yes'=>get_string('yes'), 'no'=>get_string('no'));
         foreach ($mods as $modname=>$default) {
             $mform->addElement('select', 'config_'.$modname, get_string($modname.'desc', $this->block->blockname), $yesnooptions);
Index: moodle/blocks/navigation/lang/en/block_navigation.php
--- moodle/blocks/navigation/lang/en/block_navigation.php Base (1.4)
+++ moodle/blocks/navigation/lang/en/block_navigation.php Locally Modified (Based On 1.4)
@@ -30,6 +30,7 @@
 $string['courseactivities'] = 'Categories, courses, and course Activities';
 $string['enabledockdesc'] = 'Allow the user to dock this block';
 $string['expansionlimit'] = 'Generate navigation for the following';
+$string['linkcategoriesdesc'] = 'Display categories as links';
 $string['pluginname'] = 'Navigation';
 $string['trimmode'] = 'Trim mode';
 $string['trimmoderight'] = 'Trim characters from the right';
Index: moodle/blocks/navigation/renderer.php
--- moodle/blocks/navigation/renderer.php Base (1.8)
+++ moodle/blocks/navigation/renderer.php Locally Modified (Based On 1.8)
@@ -2,16 +2,16 @@
 
 class block_navigation_renderer extends plugin_renderer_base {
 
-    public function navigation_tree(global_navigation $navigation, $expansionlimit) {
+    public function navigation_tree(global_navigation $navigation, $expansionlimit, array $options = array()) {
         $navigation->add_class('navigation_node');
-        $content = $this->navigation_node(array($navigation), array('class'=>'block_tree list'), $expansionlimit);
+        $content = $this->navigation_node(array($navigation), array('class'=>'block_tree list'), $expansionlimit, $options);
         if (isset($navigation->id) && !is_numeric($navigation->id) && !empty($content)) {
             $content = $this->output->box($content, 'block_tree_box', $navigation->id);
         }
         return $content;
     }
 
-    protected function navigation_node($items, $attrs=array(), $expansionlimit=null, $depth=1) {
+    protected function navigation_node($items, $attrs=array(), $expansionlimit=null, array $options = array(), $depth=1) {
 
         // exit if empty, we don't want an empty ul element
         if (count($items)==0) {
@@ -41,14 +41,6 @@
                 continue;
             }
 
-            if ($item->action instanceof action_link) {
-                //TODO: to be replaced with something else
-                $link = $item->action;
-                if ($item->hidden) {
-                    $link->add_class('dimmed');
-                }
-                $content = $this->output->render($link);
-            } else if ($item->action instanceof moodle_url) {
                 $attributes = array();
                 if ($title !== '') {
                     $attributes['title'] = $title;
@@ -56,18 +48,17 @@
                 if ($item->hidden) {
                     $attributes['class'] = 'dimmed_text';
                 }
+            if (is_string($item->action) || empty($item->action) || ($item->type === navigation_node::TYPE_CATEGORY && empty($options['linkcategories']))) {
+                $content = html_writer::tag('span', $content, $attributes);
+            } else if ($item->action instanceof action_link) {
+                //TODO: to be replaced with something else
+                $link = $item->action;
+                $link->attributes = array_merge($link->attributes, $attributes);
+                $content = $this->output->render($link);
+                $linkrendered = true;
+            } else if ($item->action instanceof moodle_url) {
                 $content = html_writer::link($item->action, $content, $attributes);
-
-            } else if (is_string($item->action) || empty($item->action)) {
-                $attributes = array();
-                if ($title !== '') {
-                    $attributes['title'] = $title;
                 }
-                if ($item->hidden) {
-                    $attributes['class'] = 'dimmed_text';
-                }
-                $content = html_writer::tag('span', $content, $attributes);
-            }
 
             // this applies to the li item which contains all child lists too
             $liclasses = array($item->get_css_type(), 'depth_'.$depth);
@@ -100,7 +91,7 @@
             if (!empty($item->id)) {
                 $divattr['id'] = $item->id;
             }
-            $content = html_writer::tag('p', $content, $divattr) . $this->navigation_node($item->children, array(), $expansionlimit, $depth+1);
\ No newline at end of file
+            $content = html_writer::tag('p', $content, $divattr) . $this->navigation_node($item->children, array(), $expansionlimit, $options, $depth+1);
\ No newline at end of file
             if (!empty($item->preceedwithhr) && $item->preceedwithhr===true) {
                 $content = html_writer::empty_tag('hr') . $content;
             }
Index: moodle/lib/navigationlib.php
--- moodle/lib/navigationlib.php Base (1.208)
+++ moodle/lib/navigationlib.php Locally Modified (Based On 1.208)
@@ -1284,7 +1284,7 @@
         if (!$categorynode) {
             $category = $cat['category'];
             $url = new moodle_url('/course/category.php', array('id'=>$category->id));
-            $categorynode = $parent->add($category->name, null, self::TYPE_CATEGORY, $category->name, $category->id);
+            $categorynode = $parent->add($category->name, $url, self::TYPE_CATEGORY, $category->name, $category->id);
             if (empty($category->visible)) {
                 if (has_capability('moodle/category:viewhiddencategories', get_system_context())) {
                     $categorynode->hidden = true;
