Fixes bug MDL-6548 "blog_menu block should use lists"

- also blocks: rss_client, admin_bookmark.
 - also fixed &/& validation error in rss_client footer.
This commit is contained in:
nfreear 2006-09-22 15:15:48 +00:00
parent 778326bef8
commit fd2339cfd6
3 changed files with 32 additions and 19 deletions

View File

@ -40,14 +40,19 @@ class block_admin_bookmarks extends block_base {
$bookmarks = explode(',',$USER->preference['admin_bookmarks']);
// hmm... just a liiitle (potentially) processor-intensive
// (recall that $adminroot->locate is a huge recursive call... and we're calling it repeatedly here
/// Accessibility: markup as a list.
$this->content->text .= '<ol class="list">'."\n";
foreach($bookmarks as $bookmark) {
$temp = $adminroot->locate($bookmark);
if (is_a($temp, 'admin_settingpage')) {
$this->content->text .= '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $bookmark . '">' . $temp->visiblename . '</a>' . '<br />';
$this->content->text .= '<li><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $bookmark . '">' . $temp->visiblename . "</a></li>\n";
} elseif (is_a($temp, 'admin_externalpage')) {
$this->content->text .= '<a href="' . $temp->url . '">' . $temp->visiblename . '</a>' . '<br />';
$this->content->text .= '<li><a href="' . $temp->url . '">' . $temp->visiblename . "</a></li>\n";
}
}
$this->content->text .= "</ol>\n";
} else {
$bookmarks = array();
}

View File

@ -70,6 +70,7 @@ class block_blog_menu extends block_base {
$canviewblogs = has_capability('moodle/blog:view', $curcontext);
/// Accessibility: markup as a list.
if ( (isloggedin() && !isguest()) && $incoursecontext
&& $CFG->bloglevel >= BLOG_COURSE_LEVEL && $canviewblogs) {
@ -77,8 +78,8 @@ class block_blog_menu extends block_base {
$coursearg = '&amp;courseid='.$course->id;
// a course is specified
$courseviewlink = '<a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&amp;filterselect='. $course->id .'">';
$courseviewlink .= get_string('viewcourseentries', 'blog') .'</a><br />';
$courseviewlink = '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&amp;filterselect='. $course->id .'">';
$courseviewlink .= get_string('viewcourseentries', 'blog') ."</a></li>\n";
}
$blogmodon = false;
@ -89,19 +90,19 @@ class block_blog_menu extends block_base {
// show Add entry link - moderation is off, or moderation is on and the user is viewing the block within the context of a course
if (has_capability('moodle/blog:create', $curcontext)) {
$addentrylink = '<a href="'. $CFG->wwwroot. '/blog/edit.php?userid='.
$addentrylink = '<li><a href="'. $CFG->wwwroot. '/blog/edit.php?userid='.
$userBlog->userid . $coursearg .'">'.
get_string('addnewentry', 'blog') .'</a><br />';
get_string('addnewentry', 'blog') ."</a></li>\n";
}
// show View my entries link
$addentrylink .= '<a href="'. $CFG->wwwroot .'/blog/index.php?userid='.
$addentrylink .= '<li><a href="'. $CFG->wwwroot .'/blog/index.php?userid='.
$userBlog->userid.'">'.get_string('viewmyentries', 'blog').
'</a><br />';
"</a></li>\n";
// show link to manage blog prefs
$addentrylink .= '<a href="'. $CFG->wwwroot. '/blog/preferences.php?userid='.
$addentrylink .= '<li><a href="'. $CFG->wwwroot. '/blog/preferences.php?userid='.
$userBlog->userid . $coursearg .'">'.
get_string('blogpreferences', 'blog').'</a><br />';
get_string('blogpreferences', 'blog')."</a></li>\n";
$output = $addentrylink;
$output .= $courseviewlink;
@ -109,25 +110,25 @@ class block_blog_menu extends block_base {
// show View site entries link
if ($CFG->bloglevel >= BLOG_SITE_LEVEL && $canviewblogs) {
$output .= '<a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=site&amp;">';
$output .= get_string('viewsiteentries', 'blog').'</a><br />';
$output .= '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=site&amp;">';
$output .= get_string('viewsiteentries', 'blog')."</a></li>\n";
}
if (isloggedin() && !isguest()
&& (has_capability('moodle/blog:manageofficialtags', $sitecontext)
|| has_capability('moodle/blog:managepersonaltags', $curcontext))) {
$output .= link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'), 400, 500, 'Popup window', 'none', true);
$output .= '<li>'. link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'), 400, 500, 'Popup window', 'none', true) ."</li>\n";
}
// show Help with blogging link
//$output .= '<a href="'. $CFG->wwwroot .'/help.php?module=blog&amp;file=user.html">';
//$output .= get_string('helpblogging', 'blog') .'</a>';
//$output .= '<li><a href="'. $CFG->wwwroot .'/help.php?module=blog&amp;file=user.html">';
//$output .= get_string('helpblogging', 'blog') ."</a></li>\n";
//} else {
// $output = ''; //guest users and users who are not logged in do not get menus
//}
$this->content->text = $output;
$this->content->text = '<ul class="list">'. $output ."</ul>\n";
return $this->content;
}
}

View File

@ -200,7 +200,7 @@
isset($this->config->block_rss_client_show_channel_image) &&
$this->config->block_rss_client_show_channel_image &&
isset($rss->image) && isset($rss->image['link']) && isset($rss->image['title']) && isset($rss->image['url']) ) {
$returnstring .= '<div class="image"><a href="'. $rss->image['link'] .'"><img src="'. $rss->image['url'] .'" title="'. $rss->image['title'] .'" alt="'. $rss->image['title'] .'"/></a></div>';
$returnstring .= '<div class="image" title="'. $rss->image['title'] .'"><a href="'. $rss->image['link'] .'"><img src="'. $rss->image['url'] .'" alt="'. $rss->image['title'] .'"/></a></div>';
}
if ($showtitle) {
@ -215,6 +215,9 @@
return '';
}
/// Accessibility: markup as a list.
$returnstring .= '<ul class="list">'."\n";
foreach ($rss->items as $item) {
if ($item['title'] == '') {
// no title present, use portion of description
@ -229,17 +232,21 @@
$item['link'] = str_replace('&', '&amp;', $item['link']);
$returnstring .= '<div class="link"><a href="'. $item['link'] .'" target="_blank">'. $item['title'] . '</a></div>' ."\n";
$returnstring .= '<li><div class="link"><a href="'. $item['link'] .'" target="_blank">'. $item['title'] . "</a></div>\n";
if ($display_description && !empty($item['description'])) {
$item['description'] = break_up_long_words($item['description'], 30);
$returnstring .= '<div class="description">'.
format_text($item['description'], FORMAT_MOODLE, $formatoptions, $this->courseid) .
'</div>' ."\n";
'</div>';
}
$returnstring .= "</li>\n";
}
$returnstring .= "</ul>\n";
if (!empty($rss->channel['link'])) {
$rss->channel['link'] = str_replace('&', '&amp;', $rss->channel['link']);
if (!empty($this->config) && isset($this->config->block_rss_client_show_channel_link) && $this->config->block_rss_client_show_channel_link) {
$this->content->footer = '<a href="'. $rss->channel['link'] .'">'. get_string('clientchannellink', 'block_rss_client') .'</a>';
}