From 0096f20a6044dec3d84fb9b196e90dee1ce05838 Mon Sep 17 00:00:00 2001 From: paul <paul@plutz.net> Date: Wed, 10 Aug 2011 14:54:35 +0000 Subject: [PATCH] implemented version restoring svn path=/trunk/; revision=8 --- Wiki.page | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Wiki.page b/Wiki.page index 4909663..6aaf32e 100755 --- a/Wiki.page +++ b/Wiki.page @@ -21,7 +21,7 @@ else lock="$(cut -d: -f1 "$lock")" fi -if [ -n "$edit" -a -r "Wiki/$edit" ]; then +if [ -n "$edit" -a -r "Wiki/${edit}${rev}" ]; then title="$(egrep -x 'title=.+' "Wiki/$edit.meta" |cut -d= -f2- || echo '(Untitled)')" cat <<WikiEND <form class="edit" action="write/scriptedit.cgi?i=$edit" method="post" accept-charset="UTF-8"> @@ -34,7 +34,7 @@ if [ -n "$edit" -a -r "Wiki/$edit" ]; then <div id="MAIN"> <div class="wiki"> <h1>$title</h1> - <textarea name="page" rows=30 cols=40>$(cat "Wiki/$edit")</textarea> + <textarea name="page" rows=30 cols=40>$(cat "Wiki/${edit}${rev}")</textarea> </div> </div> </form> @@ -67,8 +67,9 @@ elif [ -n "$info" -a -r "Wiki/${info}${rev}" ]; then rno=$(($rno+1)) done) <a class='rev' href='?p=Wiki&i=$info'>Latest</a><br> <hr> - $($LOGIN && [ -z "$rev" ] && if [ -z "$lock" ]; then - echo "<a class='function' href='write/lock.cgi?p=Wiki&e=$info'>edit this page</a>" + $($LOGIN && if [ -z "$lock" ]; then + [ -z "$rev" ] && echo "<a class='function' href='write/lock.cgi?p=Wiki&e=$info'>edit this page</a>" + [ -n "$rev" ] && echo "Click <a class='function' href='write/lock.cgi?p=Wiki&e=${info}&r=${rev:s/.//}'>edit</a> to derive a new page revision from this one." else echo "<b>This page is currently being edited by $lock</b><a class='function' href='write/lock.cgi?p=Wiki&e=$info'>edit anyway</a>" fi @@ -126,7 +127,7 @@ elif [ -z "$info" ]; then <hr> WikiEND if [ -n "$search" ]; then - echo "<h1>Search results for: $search</h1>" + echo "<h1>Wiki search results for: $search</h1>" for each in $(grep -ile "$search" Wiki/<0000000000-9999999999>_<000-999>); do echo "<div class='search'><a href='?p=Wiki&i=${each:t}'><h2>$(grep '^title=' "$each.meta" |cut -d= -f2-)</h2></a>" grep -C1 -ie "$search" "$each" |sed "s:$search:<b>&</b>:g;s:$:<br>:g" -- 2.39.5