X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=e9e9d73f195466c6bfcf2433dfe0dcb8767aab60;hb=7af38aed3e2f4d019b371da3ec58a41457173248;hp=0d60fb34a4144846925a50dbc54ebd716381e602;hpb=78a94a774fa0f9317b469995a9389551e0501a75;p=shellwiki diff --git a/themes/default.sh b/themes/default.sh index 0d60fb3..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.')
@@ -57,13 +56,10 @@ theme_page(){ } theme_editor(){ - local page="$1" title + 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 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" @@ -75,9 +71,10 @@ theme_editor(){ $(HTML "${title}") $(theme_header) -
+
- +
@@ -86,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" ""