Commit e29f0a13 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow editing of pages with misconfigured navigation block (bug #813204)



When rendering pages, only ArtefactNotFound exceptions are caught, but
navigation blocks can throw CollectionNotFound instead.  This change
catches all NotFound exceptions thrown when rendering block content and
block titles.

Change-Id: Ia52f2a8184e607dcb9868893a4acd6094d0dc35b
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 796798d9
...@@ -580,7 +580,13 @@ class BlockInstance { ...@@ -580,7 +580,13 @@ class BlockInstance {
$movecontrols = array(); $movecontrols = array();
$blocktypeclass = generate_class_name('blocktype', $this->get('blocktype')); $blocktypeclass = generate_class_name('blocktype', $this->get('blocktype'));
try {
$title = $this->get_title(); $title = $this->get_title();
}
catch (NotFoundException $e) {
log_debug('Cannot render block title. Original error follows: ' . $e->getMessage());
$title = get_string('notitle', 'view');
}
if ($configure) { if ($configure) {
list($content, $js) = array_values($this->build_configure_form($new)); list($content, $js) = array_values($this->build_configure_form($new));
...@@ -589,7 +595,7 @@ class BlockInstance { ...@@ -589,7 +595,7 @@ class BlockInstance {
try { try {
$content = call_static_method(generate_class_name('blocktype', $this->get('blocktype')), 'render_instance', $this, true); $content = call_static_method(generate_class_name('blocktype', $this->get('blocktype')), 'render_instance', $this, true);
} }
catch (ArtefactNotFoundException $e) { catch (NotFoundException $e) {
// Whoops - where did the image go? There is possibly a bug // Whoops - where did the image go? There is possibly a bug
// somewhere else that meant that this blockinstance wasn't // somewhere else that meant that this blockinstance wasn't
// told that the image was previously deleted. But the block // told that the image was previously deleted. But the block
...@@ -671,7 +677,7 @@ class BlockInstance { ...@@ -671,7 +677,7 @@ class BlockInstance {
try { try {
$content = call_static_method($classname, 'render_instance', $this); $content = call_static_method($classname, 'render_instance', $this);
} }
catch (ArtefactNotFoundException $e) { catch (NotFoundException $e) {
// Whoops - where did the image go? There is possibly a bug // Whoops - where did the image go? There is possibly a bug
// somewhere else that meant that this blockinstance wasn't // somewhere else that meant that this blockinstance wasn't
// told that the image was previously deleted. But the block // told that the image was previously deleted. But the block
...@@ -691,7 +697,14 @@ class BlockInstance { ...@@ -691,7 +697,14 @@ class BlockInstance {
&& !trim($content)) { && !trim($content)) {
return; return;
} }
$smarty->assign('title', $this->get_title()); try {
$title = $this->get_title();
}
catch (NotFoundException $e) {
log_debug('Cannot render block title. Original error follows: ' . $e->getMessage());
$title = get_string('notitle', 'view');
}
$smarty->assign('title', $title);
// If this block is for just one artefact, we set the title of the // If this block is for just one artefact, we set the title of the
// block to be a link to view more information about that artefact // block to be a link to view more information about that artefact
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment