Added the visualisation of the old revisions of a page.
This commit is contained in:
parent
8eb5715656
commit
d9ffac099f
@ -134,13 +134,28 @@ class IDF_Views_Wiki
|
||||
throw new Pluf_HTTP_Error404($request);
|
||||
}
|
||||
$page = $pages[0];
|
||||
$oldrev = false;
|
||||
// We grab the old revision if requested.
|
||||
if (isset($request->GET['rev']) and preg_match('/^[0-9]+$/', $request->GET['rev'])) {
|
||||
$oldrev = Pluf_Shortcuts_GetObjectOr404('IDF_WikiRevision',
|
||||
$request->GET['rev']);
|
||||
if ($oldrev->wikipage != $page->id) {
|
||||
throw new Pluf_HTTP_Error404($request);
|
||||
}
|
||||
}
|
||||
$title = $page->title;
|
||||
$revision = $page->get_current_revision();
|
||||
$db = $page->getDbConnection();
|
||||
$false = Pluf_DB_BooleanToDb(false, $db);
|
||||
$revs = $page->get_revisions_list(array('order' => 'creation_dtime DESC',
|
||||
'filter' => 'is_head='.$false));
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/wiki/view.html',
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'page' => $page,
|
||||
'oldrev' => $oldrev,
|
||||
'rev' => $revision,
|
||||
'revs' => $revs,
|
||||
'tags' => $page->get_tags_list(),
|
||||
),
|
||||
$request);
|
||||
|
@ -56,7 +56,7 @@
|
||||
</tr>{/if}
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="{trans 'Preview'}" name="preview" /> <input type="submit" value="{trans 'Update Page'}" name="submit" /> | <a href="{url 'IDF_Views_Wiki::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
||||
<td><input type="submit" value="{trans 'Preview'}" name="preview" /> <input type="submit" value="{trans 'Update Page'}" name="submit" /> | <a href="{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}">{trans 'Cancel'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1,10 +1,24 @@
|
||||
{extends "idf/wiki/base.html"}
|
||||
{block extraheader}{if $oldrev}<meta name="ROBOTS" content="NOINDEX" />{/if}{/block}
|
||||
{block docclass}yui-t3{assign $inView=true}{/block}
|
||||
{block body}
|
||||
|
||||
{if $oldrev}
|
||||
{assign $submitter = $oldrev.get_submitter()}{aurl 'url', 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}
|
||||
<div class="old-rev">
|
||||
<p>{blocktrans}You are looking at an old revision of the page
|
||||
<a href="{$url}">{$page.title}</a>. This revision was created
|
||||
by {$submitter}.{/blocktrans}</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p class="desc">{$page.summary}</p>
|
||||
|
||||
{if !$oldrev}
|
||||
{markdown $rev.content, $request}
|
||||
{else}
|
||||
{markdown $oldrev.content, $request}
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
@ -19,4 +33,10 @@
|
||||
<span class="label"><strong>{$tag.class}:</strong>{$tag.name}</span><br />
|
||||
{/foreach}
|
||||
</p>{/if}
|
||||
{if $revs.count() > 0}
|
||||
<p><strong>{trans 'Old Revisions'}</strong></p>
|
||||
<ul>{foreach $revs as $old}
|
||||
<li><a href="{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title), array('rev'=>$old.id)}">{$old.summary}</a></li>
|
||||
{/foreach}</ul>
|
||||
{/if}
|
||||
{/block}
|
||||
|
@ -589,3 +589,12 @@ p.desc {
|
||||
padding: 4px;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
div.old-rev {
|
||||
padding: 1em 1em 0.1em 1em;
|
||||
margin-bottom: 1em;
|
||||
background-color: #bbe394;
|
||||
width: 40%;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user