close to prerelase
This commit is contained in:
parent
e55fbb5b67
commit
31022358ed
181 changed files with 2118 additions and 141 deletions
19
werc/apps/dirdir/README.md
Normal file
19
werc/apps/dirdir/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# RisingThumb's build of dirdir
|
||||
|
||||
dirdir is werc's directory management tool.
|
||||
|
||||
## Features
|
||||
|
||||
This adds a few features to dirdir.
|
||||
|
||||
- Ability to edit larger text files
|
||||
- Ability to edit template files
|
||||
- Ability to upload files(optionally under a different name)
|
||||
- Ability to delete a page
|
||||
- Ability to delete a folder
|
||||
|
||||
## Roadmap
|
||||
|
||||
- Ideally take some filetype info for making new pages. Would be nice to make tpl files this way.
|
||||
- User permissioning around editing template files (default config off?)
|
||||
- Possibly allowing different markdown/formatters to be used.
|
|
@ -2,6 +2,9 @@ fn conf_enable_wiki {
|
|||
enable_wiki=yes
|
||||
wiki_editors_groups=$*
|
||||
conf_enable_app dirdir
|
||||
|
||||
if(~ $"conf_dirdir_index_type '')
|
||||
conf_dirdir_index_type='md'
|
||||
}
|
||||
|
||||
fn dirdir_init {
|
||||
|
@ -11,16 +14,34 @@ fn dirdir_init {
|
|||
# maybe it should, but for now we can fix it up here.
|
||||
if(~ $lp */)
|
||||
lp=$lp^'index'
|
||||
dirdir_file=$lp.md
|
||||
dirdir_file=$lp.^$"conf_dirdir_index_type
|
||||
if (test -f $lp.tpl) {
|
||||
dirdir_file=$lp.tpl
|
||||
}
|
||||
dirdir_dir=$dirdir_file^'_werc/dirdir/'
|
||||
|
||||
if(~ 1 $#post_arg_dirdir_edit $#post_arg_dirdir_preview)
|
||||
handler_body_main=(tpl_handler `{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl})
|
||||
|
||||
if not if(~ 1 $#post_arg_dirdir_delete && ! ~ $#post_arg_dirdir_delete_yes 1)
|
||||
handler_body_main=(tpl_handler `{get_lib_file dirdir/delete_sure.tpl apps/dirdir/delete_sure.tpl})
|
||||
if not if(~ 1 $#post_arg_dirdir_delete_folder && ! ~ $#post_arg_dirdir_delete_yes 1)
|
||||
handler_body_main=(tpl_handler `{get_lib_file dirdir/delete_sure.tpl apps/dirdir/delete_sure.tpl})
|
||||
if not if(~ 1 $#post_arg_dirdir_delete && ! ~ $#post_arg_dirdir_delete_yes 0)
|
||||
rm $dirdir_file
|
||||
if not if(~ 1 $#post_arg_dirdir_delete_folder && ! ~ $#post_arg_dirdir_delete_yes 0)
|
||||
rm -rf `{dirname $dirdir_file}
|
||||
if not if(~ 1 $#post_arg_dirdir_add_child_file && ! ~ $#post_arg_dirdir_search 0)
|
||||
touch `{dirname $dirdir_file}^'/'^$post_arg_dirdir_search^'.md'
|
||||
if not if(~ 1 $#post_arg_dirdir_add_child_folder! ~ $#post_arg_dirdir_search 0)
|
||||
mkdir `{dirname $dirdir_file}^'/'^$post_arg_dirdir_search
|
||||
if not if(~ 1 $#post_arg_dirdir_upload_file_pressed && ! ~ $#post_arg_dirdir_file_name 0 && ! ~ $post_arg_dirdir_file_name "" && ! ~ $#post_arg_dirdir_upload_file 0)
|
||||
mv /tmp/werc_file.*.data `{dirname $dirdir_file}^'/'^$post_arg_dirdir_file_name
|
||||
if not if(~ 1 $#post_arg_dirdir_upload_file_pressed && ! ~ $#post_arg_dirdir_upload_file 0)
|
||||
mv /tmp/werc_file.*.data `{dirname $dirdir_file}^'/'^$post_arg_dirdir_upload_file
|
||||
if not if(! ~ '' $"post_arg_dirdir_save $"post_arg_edit_text)
|
||||
save_page
|
||||
|
||||
if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $local_path.md})
|
||||
if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $local_path.md} || {~ $REQUEST_METHOD GET && test -f $local_path.tpl} )
|
||||
ll_add handlers_bar_left tpl_handler apps/dirdir/sidebar_controls.tpl
|
||||
}
|
||||
}
|
||||
|
@ -32,9 +53,7 @@ fn save_page {
|
|||
|
||||
# XXX Use a tmp file and mv(1) to ensure updates are atomic?
|
||||
echo $logged_user > $dirdir_verdir/author
|
||||
echo $post_arg_edit_text > $dirdir_verdir/data
|
||||
echo $post_arg_edit_text > $dirdir_file
|
||||
|
||||
echo $post_arg_edit_text | dos2unix > $dirdir_verdir/data
|
||||
echo $post_arg_edit_text | dos2unix > $dirdir_file
|
||||
post_redirect $base_url^$req_path
|
||||
#notify_notes='Saved <a href="'$"req_path'">'$"req_path'</a>!'
|
||||
}
|
||||
|
|
9
werc/apps/dirdir/delete_sure.tpl
Executable file
9
werc/apps/dirdir/delete_sure.tpl
Executable file
|
@ -0,0 +1,9 @@
|
|||
<form action="" method="POST">
|
||||
|
||||
% if(~ 1 $#post_arg_dirdir_delete ) {
|
||||
% echo '<input type="hidden" name="dirdir_delete" value="Delete page" />' }
|
||||
% if(~ 1 $#post_arg_dirdir_delete_folder ) {
|
||||
% echo '<input type="hidden" name="dirdir_delete_folder" value="Delete folder" />' }
|
||||
|
||||
<input type="submit" name="dirdir_delete_yes" value="Are you sure you want to delete?" />
|
||||
</form>
|
|
@ -1,9 +1,10 @@
|
|||
<div>
|
||||
<h1>Editing: <a href="%($req_path%)">%($req_path%)</a></h1>
|
||||
<br>
|
||||
<form action="" method="POST">
|
||||
<form action="" method="POST" enctype="multipart/form-data">
|
||||
<textarea name="edit_text" id="edit_text" cols="80" rows="43">%{
|
||||
# FIXME Extra trailing new lines get added to the content somehow, should avoid it.
|
||||
echo $dirdir_search
|
||||
if(~ $#post_arg_edit_text 0 && test -f $dirdir_file)
|
||||
cat $dirdir_file | escape_html
|
||||
if not
|
||||
|
@ -20,6 +21,6 @@
|
|||
% if(! ~ $"post_arg_dirdir_preview '') {
|
||||
<h2>Preview:</h2>
|
||||
<div id="preview">
|
||||
% echo $post_arg_edit_text | $formatter
|
||||
% echo $post_arg_edit_text | dos2unix | $formatter
|
||||
</div>
|
||||
% }
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
<form action="" method="POST">
|
||||
<input type="submit" name="dirdir_edit" value="Edit page" />
|
||||
<input type="submit" name="dirdir_edit" value="Edit page" /><br/>
|
||||
</form>
|
||||
<form action="" method="POST">
|
||||
<input type="search" id="test-search" name="dirdir_search" placeholder="Page or folder to add"/><br/>
|
||||
<input type="submit" name="dirdir_add_child_file" value="New Page" />
|
||||
<input type="submit" name="dirdir_add_child_folder" value="New Folder" /><hr />
|
||||
</form>
|
||||
<form action="" method="POST">
|
||||
<hr style="color: red"/><input type="submit" name="dirdir_delete_folder" value="Delete folder" />
|
||||
</form>
|
||||
<form action="" method="POST">
|
||||
<input type="submit" name="dirdir_delete" value="Delete page" /><hr style="color: red"/>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue