2009-02-07 17:22:46 -07:00
|
|
|
fn conf_enable_wiki {
|
|
|
|
enable_wiki=yes
|
|
|
|
wiki_editors_group=$*
|
|
|
|
conf_enable_app dirdir
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-16 19:43:36 -07:00
|
|
|
fn dirdir_init {
|
2009-02-07 17:22:46 -07:00
|
|
|
if(! ~ $#enable_wiki 0 && check_user $wiki_editors_group) {
|
2009-01-25 19:37:47 -07:00
|
|
|
if(test -f $local_path.md)
|
|
|
|
ll_add handlers_bar_left dirdir_controls
|
|
|
|
|
|
|
|
if(~ $req_path */dirdir_edit && ~ $REQUEST_METHOD POST) {
|
|
|
|
get_post_args edit_wiki_page edit_text edit_preview edit_save
|
|
|
|
# XXX SECURITY! should sanitize input and ensure we only edit files
|
|
|
|
# we are allowed. This is a start, but should be way more careful
|
|
|
|
edit_file = `{echo $sitedir/$edit_wiki_page|sed -e 's/\.\.*/./g' -e 's,/$,/index,' | sed 's/$/.md/'}
|
|
|
|
tpl=`{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl}
|
|
|
|
handler_body_main=(tpl_handler $tpl)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-01-16 19:43:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn dirdir_controls {
|
|
|
|
# Display 'Edit', 'History', etc, links
|
2009-01-25 19:37:47 -07:00
|
|
|
echo '<form action="dirdir_edit" method="POST">'
|
2009-01-16 19:43:36 -07:00
|
|
|
echo '<input type="hidden" name="edit_wiki_page" value="'^$req_path^'" />'
|
|
|
|
echo '<input type="submit" name="" value="Edit page" />'
|
2009-01-17 01:43:31 -07:00
|
|
|
echo '</form>'
|
2009-01-16 19:43:36 -07:00
|
|
|
}
|