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);
|
throw new Pluf_HTTP_Error404($request);
|
||||||
}
|
}
|
||||||
$page = $pages[0];
|
$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;
|
$title = $page->title;
|
||||||
$revision = $page->get_current_revision();
|
$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',
|
return Pluf_Shortcuts_RenderToResponse('idf/wiki/view.html',
|
||||||
array(
|
array(
|
||||||
'page_title' => $title,
|
'page_title' => $title,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
|
'oldrev' => $oldrev,
|
||||||
'rev' => $revision,
|
'rev' => $revision,
|
||||||
|
'revs' => $revs,
|
||||||
'tags' => $page->get_tags_list(),
|
'tags' => $page->get_tags_list(),
|
||||||
),
|
),
|
||||||
$request);
|
$request);
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</tr>{/if}
|
</tr>{/if}
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,10 +1,24 @@
|
|||||||
{extends "idf/wiki/base.html"}
|
{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 docclass}yui-t3{assign $inView=true}{/block}
|
||||||
{block body}
|
{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>
|
<p class="desc">{$page.summary}</p>
|
||||||
|
|
||||||
|
{if !$oldrev}
|
||||||
{markdown $rev.content, $request}
|
{markdown $rev.content, $request}
|
||||||
|
{else}
|
||||||
|
{markdown $oldrev.content, $request}
|
||||||
|
{/if}
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
{block context}
|
{block context}
|
||||||
@ -19,4 +33,10 @@
|
|||||||
<span class="label"><strong>{$tag.class}:</strong>{$tag.name}</span><br />
|
<span class="label"><strong>{$tag.class}:</strong>{$tag.name}</span><br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</p>{/if}
|
</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}
|
{/block}
|
||||||
|
@ -589,3 +589,12 @@ p.desc {
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
width: 60%;
|
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