Dirdir wiki engine updates, cleaned up some code, now one can save from preview page.
This commit is contained in:
parent
0c3e69ad8a
commit
cb73d98fd8
@ -5,10 +5,10 @@ fn dirdir_init {
|
||||
|
||||
fn dirdir_controls {
|
||||
# Display 'Edit', 'History', etc, links
|
||||
echo '<div><form action="/_apps/dirdir/edit" method="POST">'
|
||||
echo '<form action="/_apps/dirdir/edit" method="POST">'
|
||||
echo '<input type="hidden" name="edit_wiki_page" value="'^$req_path^'" />'
|
||||
echo '<input type="submit" name="" value="Edit page" />'
|
||||
echo '</form></div>'
|
||||
echo '</form>'
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,36 +5,10 @@ get_post_args edit_wiki_page edit_text edit_preview edit_save
|
||||
# This is a start, but should be way more careful
|
||||
edit_file = `{echo $sitedir/$edit_wiki_page.md|sed 's/\.\.*/./g'}
|
||||
|
||||
if(! ~ $"edit_preview '') {
|
||||
if (~ $"edit_save '') {
|
||||
%}
|
||||
<H2>Preview:</H2>
|
||||
<div id="preview">
|
||||
% echo $edit_text | $formatter
|
||||
</div>
|
||||
<hr /><hr />
|
||||
%{
|
||||
}
|
||||
if not if (! ~ $"edit_save '') {
|
||||
dirdir_dir = $edit_file^'_werc/dirdir/'
|
||||
|
||||
if(! test -d $dirdir_dir)
|
||||
mkdir -p $dirdir_dir
|
||||
|
||||
dirdir_verdir = $dirdir_dir/`{date -n}^/
|
||||
mkdir $dirdir_verdir
|
||||
|
||||
echo $loggin_user > $dirdir_verdir/author
|
||||
echo $edit_text > $dirdir_verdir/data
|
||||
echo $edit_text > $edit_file
|
||||
%}
|
||||
<h1>Saved <a href="%($edit_wiki_page%)">%($edit_wiki_page%)!</a></h1>
|
||||
%{
|
||||
}
|
||||
if not {
|
||||
%}
|
||||
|
||||
<div>
|
||||
<h1>Editing %($req_path%)</h1>
|
||||
<h1>Editing %($edit_wiki_page%)</h1>
|
||||
<br />
|
||||
<form action="/_apps/dirdir/edit" method="post">
|
||||
<input type="hidden" name="edit_wiki_page" value="%($edit_wiki_page%)"
|
||||
@ -54,3 +28,27 @@ if not
|
||||
</div>
|
||||
% }
|
||||
|
||||
% if(! ~ $"edit_preview '') {
|
||||
<H2>Preview:</H2>
|
||||
<div id="preview">
|
||||
% echo $edit_text | $formatter
|
||||
</div>
|
||||
<hr /><hr />
|
||||
% }
|
||||
% if not if(! ~ $"edit_save '') {
|
||||
%{
|
||||
dirdir_dir = $edit_file^'_werc/dirdir/'
|
||||
|
||||
if(! test -d $dirdir_dir)
|
||||
mkdir -p $dirdir_dir
|
||||
|
||||
dirdir_verdir = $dirdir_dir/`{date -n}^/
|
||||
mkdir $dirdir_verdir
|
||||
|
||||
echo $loggin_user > $dirdir_verdir/author
|
||||
echo $edit_text > $dirdir_verdir/data
|
||||
echo $edit_text > $edit_file
|
||||
%}
|
||||
<h1>Saved <a href="%($edit_wiki_page%)">%($edit_wiki_page%)!</a></h1>
|
||||
% }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user