diff --git a/src/IDF/Views/Wiki.php b/src/IDF/Views/Wiki.php index 91ef650..4d0333e 100644 --- a/src/IDF/Views/Wiki.php +++ b/src/IDF/Views/Wiki.php @@ -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); diff --git a/src/IDF/templates/idf/wiki/update.html b/src/IDF/templates/idf/wiki/update.html index 3b44194..3fa6af5 100644 --- a/src/IDF/templates/idf/wiki/update.html +++ b/src/IDF/templates/idf/wiki/update.html @@ -56,7 +56,7 @@ {/if}   -   | {trans 'Cancel'} +   | {trans 'Cancel'} diff --git a/src/IDF/templates/idf/wiki/view.html b/src/IDF/templates/idf/wiki/view.html index 60b7e5e..4d457eb 100644 --- a/src/IDF/templates/idf/wiki/view.html +++ b/src/IDF/templates/idf/wiki/view.html @@ -1,10 +1,24 @@ {extends "idf/wiki/base.html"} +{block extraheader}{if $oldrev}{/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)} +
+

{blocktrans}You are looking at an old revision of the page +{$page.title}. This revision was created +by {$submitter}.{/blocktrans}

+
+{/if} +

{$page.summary}

+{if !$oldrev} {markdown $rev.content, $request} +{else} +{markdown $oldrev.content, $request} +{/if} {/block} {block context} @@ -19,4 +33,10 @@ {$tag.class}:{$tag.name}
{/foreach}

{/if} +{if $revs.count() > 0} +

{trans 'Old Revisions'}

+ +{/if} {/block} diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index c1c3db3..2335c09 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -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; +}