]> git.plutz.net Git - busy/blobdiff - Wiki.page
globalized wiki engine
[busy] / Wiki.page
index 5effa39776e13d0c6c3e8ef2564ecebc523b760f..490966367705b8b8d744062aa4e6aa007612c0a3 100755 (executable)
--- a/Wiki.page
+++ b/Wiki.page
@@ -25,10 +25,9 @@ if [ -n "$edit" -a -r "Wiki/$edit" ]; 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="RIGHT"></div>
       <div id="LEFT">
        Editing <b>$title</b><br>
-        <input type="submit">
+        <input type="submit" value="Submit">
         <input type="submit" name="cancel" value="Cancel">
        <hr>
       </div>
@@ -39,6 +38,14 @@ if [ -n "$edit" -a -r "Wiki/$edit" ]; then
         </div>
       </div>
     </form>
+    <div id="RIGHT">
+    $(stat -c '' Wiki/${edit}.comment.<0000000000-9999999999>_<000-999> && for each in $(ls -c Wiki/${edit}.comment.<0000000000-9999999999>_<000-999>); do
+      author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
+      echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
+      tail -n+2 $each |_wiki
+      echo '</div></div>'
+    done)
+    </div>
 WikiEND
 
 elif [ -n "$info" -a -r "Wiki/${info}${rev}" ]; then
@@ -81,10 +88,10 @@ elif [ -n "$info" -a -r "Wiki/${info}${rev}" ]; then
       <hr>
     </div>
     <div id="MAIN">
-      <div class="wiki">
+      <div class="wiki"><div class="wikitext">
         <h1>$title</h1>
         $(_wiki Wiki/"${info}${rev}")
-      </div>
+      </div></div>
     </div>
 WikiEND
 
@@ -95,16 +102,16 @@ $LOGIN && cat <<WikiEND
         <form action="/write/wikimeta.cgi?i=$info" method="post" accept-charset="UTF-8">
           <b>Comment:</b><br>
           <textarea name="comm" rows="6" style="width:99%;"></textarea><br>
-          <input type="submit">
+          <input type="submit" value="Submit">
           <a class="function" href="#" onclick="javascript:hide_screen('comment');show_screen('comment_button');">Cancel</a>
         </form>
       </div>
 WikiEND
   stat -c '' Wiki/${info}.comment.<0000000000-9999999999>_<000-999> && for each in $(ls -c Wiki/${info}.comment.<0000000000-9999999999>_<000-999>); do
     author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
-    echo "<div class="comment"><h1>$author wrote:</h1>"
-    tail -n-1 $each
-    echo '</div>'
+    echo "<div class='comment'><h1>$author wrote:</h1><div class='wikitext'>"
+    tail -n+2 $each |_wiki
+    echo '</div></div>'
   done
   echo '</div>'
   
@@ -136,7 +143,7 @@ WikiEND
        <input type="text" name="title" placeholder="Fill in a title"><br>
         <b>Description:</b><br>
         <textarea name="desc" rows="6" ></textarea><br>
-        <input type="submit">
+        <input type="submit" value="Submit">
         <a class="function" href="#" onclick="javascript:hide_screen('add_page');show_screen('addp_button');">Cancel</a>
       </form>
     </div>
@@ -155,7 +162,7 @@ WikiEND
         <a name="$info" href="/?p=Wiki&amp;i=$info"><h1>$title</h1></a>
         $description<br><br>
         <a class="function" href="/?p=Wiki&amp;i=$info">View</a> 
-        $($LOGIN && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Title</a>")
+        $($LOGIN && echo "<a class='function' href='#' onclick=\"javascript:show_screen('change_$info');hide_screen('display_$info');\">Change Info</a>")
       </div>
 WikiEND
     $LOGIN && cat <<WikiEND
@@ -164,7 +171,7 @@ WikiEND
          <b>Title:</b> <input type="text" name="title" value="$title"><br>
          <b>Description:</b><br>
          <textarea name="desc" rows="6" style="width:100%;">$description</textarea><br>
-         <input type="submit">
+         <input type="submit" value="Submit">
           <a class="function" href="#" onclick="javascript:hide_screen('change_$info');show_screen('display_$info');">Cancel</a>
        </form>
       </div>