changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > werc / changeset: Dirdir wiki engine updates, cleaned up some code, now one can save from preview page.

changeset 332: efef7a0b7940
parent 331: cda581014f22
child 333: 050598174cc8
author: uriel@engel.se.cat-v.org
date: Sat, 17 Jan 2009 09:43:31 +0100
files: apps/dirdir/app.rc lib/_apps/dirdir/edit.tpl
description: Dirdir wiki engine updates, cleaned up some code, now one can save from preview page.
     1.1--- a/apps/dirdir/app.rc	Sat Jan 17 09:42:24 2009 +0100
     1.2+++ b/apps/dirdir/app.rc	Sat Jan 17 09:43:31 2009 +0100
     1.3@@ -5,10 +5,10 @@
     1.4 
     1.5 fn dirdir_controls {
     1.6     # Display 'Edit', 'History', etc, links
     1.7-    echo '<div><form action="/_apps/dirdir/edit" method="POST">'
     1.8+    echo '<form action="/_apps/dirdir/edit" method="POST">'
     1.9     echo '<input type="hidden" name="edit_wiki_page" value="'^$req_path^'" />'
    1.10     echo '<input type="submit" name="" value="Edit page" />'
    1.11-    echo '</form></div>'
    1.12+    echo '</form>'
    1.13 
    1.14 
    1.15 }
     2.1--- a/lib/_apps/dirdir/edit.tpl	Sat Jan 17 09:42:24 2009 +0100
     2.2+++ b/lib/_apps/dirdir/edit.tpl	Sat Jan 17 09:43:31 2009 +0100
     2.3@@ -5,36 +5,10 @@
     2.4 # This is a start, but should be way more careful
     2.5 edit_file = `{echo $sitedir/$edit_wiki_page.md|sed 's/\.\.*/./g'}
     2.6 
     2.7-if(! ~ $"edit_preview '') {
     2.8+if (~ $"edit_save '') {
     2.9 %}
    2.10-            <H2>Preview:</H2>
    2.11-            <div id="preview">
    2.12-%               echo $edit_text | $formatter
    2.13-            </div>
    2.14-            <hr /><hr />
    2.15-%{
    2.16-}
    2.17-if not if (! ~ $"edit_save '') {
    2.18-    dirdir_dir = $edit_file^'_werc/dirdir/'
    2.19-
    2.20-    if(! test -d  $dirdir_dir)
    2.21-        mkdir -p $dirdir_dir
    2.22-
    2.23-    dirdir_verdir = $dirdir_dir/`{date -n}^/
    2.24-    mkdir $dirdir_verdir
    2.25-
    2.26-    echo $loggin_user > $dirdir_verdir/author
    2.27-    echo $edit_text > $dirdir_verdir/data 
    2.28-    echo $edit_text > $edit_file
    2.29-%}
    2.30-<h1>Saved <a href="%($edit_wiki_page%)">%($edit_wiki_page%)!</a></h1>
    2.31-%{
    2.32-}
    2.33-if not {
    2.34-%}
    2.35-
    2.36 <div>
    2.37-    <h1>Editing %($req_path%)</h1>
    2.38+    <h1>Editing %($edit_wiki_page%)</h1>
    2.39     <br />
    2.40     <form action="/_apps/dirdir/edit" method="post">
    2.41         <input type="hidden" name="edit_wiki_page" value="%($edit_wiki_page%)"
    2.42@@ -54,3 +28,27 @@
    2.43 </div>
    2.44 % }
    2.45 
    2.46+% if(! ~ $"edit_preview '') {
    2.47+            <H2>Preview:</H2>
    2.48+            <div id="preview">
    2.49+%               echo $edit_text | $formatter
    2.50+            </div>
    2.51+            <hr /><hr />
    2.52+% }
    2.53+% if not if(! ~ $"edit_save '') {
    2.54+%{
    2.55+    dirdir_dir = $edit_file^'_werc/dirdir/'
    2.56+
    2.57+    if(! test -d  $dirdir_dir)
    2.58+        mkdir -p $dirdir_dir
    2.59+
    2.60+    dirdir_verdir = $dirdir_dir/`{date -n}^/
    2.61+    mkdir $dirdir_verdir
    2.62+
    2.63+    echo $loggin_user > $dirdir_verdir/author
    2.64+    echo $edit_text > $dirdir_verdir/data 
    2.65+    echo $edit_text > $edit_file
    2.66+%}
    2.67+<h1>Saved <a href="%($edit_wiki_page%)">%($edit_wiki_page%)!</a></h1>
    2.68+% }
    2.69+