Implement file creation for dirdir.

This commit is contained in:
Uriel 2009-03-04 03:12:54 +01:00
parent 547f98328f
commit 6c88960330

View file

@ -5,12 +5,39 @@ fn conf_enable_wiki {
} }
fn dirdir_init { fn dirdir_init {
if(! ~ $#enable_wiki 0 && check_user $wiki_editors_groups && test -f $local_path.md) { if(! ~ $#enable_wiki 0 && check_user $wiki_editors_groups) {
dirdir_file=$local_path.md dirdir_file=$local_path.md
dirdir_dir=$dirdir_file^'_werc/dirdir/' dirdir_dir=$dirdir_file^'_werc/dirdir/'
if(~ $#post_arg_dirdir_save 1 && ! ~ $"post_arg_edit_text '') { if(test -f $local_path.md) {
if(~ $#post_arg_dirdir_save 1 && ! ~ $"post_arg_edit_text '')
save_page
if not 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(! ~ $REQUEST_METHOD POST)
ll_add handlers_bar_left tpl_handler \
apps/dirdir/sidebar_controls.tpl
}
if not if(~ 1 $#post_arg_dirdir_edit)
handler_body_main=(tpl_handler \
`{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl})
if not if(~ 1 $#post_arg_dirdir_save) {
mkdir -p `{basename -d $local_path}
save_page
}
if not
ll_add handlers_bar_left tpl_handler \
apps/dirdir/sidebar_controls.tpl
}
}
fn save_page {
dirdir_verdir=$dirdir_dir/^`{date -n}^/ dirdir_verdir=$dirdir_dir/^`{date -n}^/
mkdir -p $dirdir_verdir mkdir -p $dirdir_verdir
@ -22,10 +49,3 @@ fn dirdir_init {
post_redirect $base_url^$req_path post_redirect $base_url^$req_path
#notify_notes='Saved <a href="'$"req_path'">'$"req_path'</a>!' #notify_notes='Saved <a href="'$"req_path'">'$"req_path'</a>!'
} }
if not if(~ $#post_arg_dirdir_edit 1 || ~ $#post_arg_dirdir_preview 1)
handler_body_main=(tpl_handler `{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl} )
if not if(! ~ $REQUEST_METHOD POST)
ll_add handlers_bar_left tpl_handler apps/dirdir/sidebar_controls.tpl
}
}