From 98d2cd7f7a764078e5c6b2d63cad0fa03fb4c269 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 22 Apr 2008 05:55:34 +0000 Subject: [PATCH] MDL-8566 My addition, I fixed the navigation on the Permalink pages to show more information was: Site > Blogs now: Site > User > Blogs > Full blog title --- blog/header.php | 21 +++++++++++++-------- blog/index.php | 12 ++++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/blog/header.php b/blog/header.php index deb58421fc6..5b003a33103 100755 --- a/blog/header.php +++ b/blog/header.php @@ -188,19 +188,27 @@ $navlinks = array(); $navlinks[] = array('name' => "$tagstring: $taginstance->name", 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); - print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); - } else { $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); - print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); } + print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); } else { //in top view - if ($tagid || !empty($tag)) { + if ($postid) { + $navlinks[] = array('name' => fullname($user), + 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect", + 'type' => 'misc'); + $navlinks[] = array('name' => $blogstring, + 'link' => "index.php?filtertype=user&filterselect=$filterselect", + 'type' => 'misc'); + $navlinks[] = array('name' => format_string($postobject->subject), 'link' => null, 'type' => 'misc'); + $navigation = build_navigation($navlinks); + + } else if ($tagid || !empty($tag)) { $navlinks[] = array('name' => fullname($user), 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect", 'type' => 'misc'); @@ -210,17 +218,14 @@ $navlinks = array(); $navlinks[] = array('name' => "$tagstring: $taginstance->name", 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); - print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); - } else { $navlinks[] = array('name' => fullname($user), 'link' => "$CFG->wwwroot/user/view.php?id=$filterselect", 'type' => 'misc'); $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); - print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); - } + print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string()); } break; diff --git a/blog/index.php b/blog/index.php index f0b21b2a3a0..fa516928c53 100755 --- a/blog/index.php +++ b/blog/index.php @@ -40,8 +40,16 @@ if (empty($filtertype)) { $filtertype = 'user'; $filterselect = $userid; } else if (has_capability('moodle/blog:view', $sitecontext) and $CFG->bloglevel > BLOG_USER_LEVEL) { - $filtertype = 'site'; - $filterselect = ''; + if ($postid) { + $filtertype = 'user'; + if (!$postobject = get_record('post', 'module', 'blog', 'id', $postid)) { + error('No such blog entry'); + } + $filterselect = $postobject->userid; + } else { + $filtertype = 'site'; + $filterselect = ''; + } } else { // user might have capability to write blogs, but not read blogs at site level // users might enter this url manually without parameters