X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=e9e9d73f195466c6bfcf2433dfe0dcb8767aab60;hb=7af38aed3e2f4d019b371da3ec58a41457173248;hp=3c5f2a1819a000277c06dc31451a2013f1335812;hpb=12556f1bbca0a2a973c3cb305b191f3844f197cc;p=shellwiki diff --git a/themes/default.sh b/themes/default.sh index 3c5f2a1..e9e9d73 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -15,21 +15,25 @@ theme_header(){ } theme_footer(){ - printf '' "$(wiki '[wiki]/footer/' ||echo No footer)" + printf '' "$(wiki '[wiki]/footer/')" +} + +theme_pagemenu(){ + local page="$1" + + if acl_write "$page"; then + printf ' + ' + fi } theme_page(){ local page="$1" title title="${page%/}"; title="${title##*/}" - if [ ! "$(mdfile "$page")" ]; then - theme_error 404 - return 0 - elif ! acl_read "$page"; then - theme_error 403 - return 0 - fi - # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" @@ -41,12 +45,7 @@ theme_page(){ $(theme_header)
- $(acl_write "$page" && printf %s \ - '' - ) + $(theme_pagemenu)
$(wiki "$page" || printf 'Error while loading page
function "wiki" of index.sh returned with an error.')
@@ -60,11 +59,6 @@ theme_editor(){ local page="$1" template="$2" title title="${page%/}"; title="${title##*/}" - if ! acl_write "$page"; then - theme_error 403 - return 0 - fi - [ "$template" ] && acl_read "$template" || template="$page" # Important! Web Server response including newline @@ -89,17 +83,31 @@ theme_editor(){ EOF } -theme_attachments(){ +theme_revisions(){ local page="$1" title title="${page%/}"; title="${title##*/}" - if [ ! "$(mdfile "$page")" ]; then - theme_error 404 - return 0 - elif ! acl_read "$page"; then - theme_error 403 - return 0 - fi + # Important! Web Server response including newline + printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" + + cat <<-EOF + + + $(theme_head) + Revisions $(HTML "${title}") + + $(theme_header) +
+ $("$_EXEC/macros/revisions" "$page") +
+ $(theme_footer) + + EOF +} + +theme_attachments(){ + local page="$1" title + title="${page%/}"; title="${title##*/}" # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""