Finally save pagerevision and resourcerevision relations when a new page

revision is created; fix a couple of bugs and streamline the view logic
for viewPage and viewResource.
This commit is contained in:
Thomas Keller
2011-12-06 02:16:27 +01:00
parent 8fde1e4762
commit 3f0c7c23d2
6 changed files with 43 additions and 20 deletions

View File

@@ -130,8 +130,10 @@ class IDF_Template_Markdown extends Pluf_Template_Tag
if (isset($this->request->GET['rev']) and preg_match('/^[0-9]+$/', $this->request->GET['rev'])) {
$pageRevision = Pluf_Shortcuts_GetObjectOr404('IDF_Wiki_PageRevision',
$this->request->GET['rev']);
if ($pageRevision->wikipage != $pages[0]->id) {
return '<span title="'.__('This revision of the resource is no longer available.').'">'.$match.'</span>';
// this is actually an invariant since we came so far looking at
// and rendering the old revision already
if ($pageRevision == null) {
throw new Exception('page revision with id '.$this->request->GET['rev'].' not found');
}
}
@@ -140,6 +142,9 @@ class IDF_Template_Markdown extends Pluf_Template_Tag
$resourceRevision = Pluf::factory('IDF_Wiki_ResourceRevision')->getOne(
array('filter' => $sql->gen(), 'view' => 'join_pagerevision'));
if ($resourceRevision == null) {
return '<span title="'.__('This revision of the resource is no longer available.').'">'.$match.'</span>';
}
}
$validOpts = array(