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">
<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>
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
<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"