X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=page.sh;h=f68df8e26b92445703aee85cbd83fe63ff3a82de;hp=ef9df2e3def9271c49ec455cf3d251df17ed4e68;hb=609086db135aac50ab83825aed16c9481c99715d;hpb=9b62da2cc5552e018fe8c48360c770446a9a6b55 diff --git a/page.sh b/page.sh index ef9df2e..f68df8e 100755 --- a/page.sh +++ b/page.sh @@ -1,6 +1,6 @@ #!/bin/zsh -# Copyright 2014,2015 Paul Hänsch +# Copyright 2014 - 2016 Paul Hänsch # # This file is part of shcgi. # @@ -17,18 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with shcgi. If not, see . -printf "Content-Type: text/html;charset=utf-8\n\n" +[ -z "$NAVIGATION" ] \ +&& NAVIGATION=($(printf %s\\n "${_EXEC}"/pages/*.sh |sed -r 's;^.*/([^/]*)\.sh$;\1;')) -PAGE="$(printf %s "${_GET[p]}" |egrep '^[a-zA-Z0-9_-]+$')" -PAGE="${_EXEC}/pages/${PAGE}.sh" -[ -x "$PAGE" ] || PAGE="${_EXEC}/pages/error.sh" +CSS="${CSS:-${_EXEC}/templates/${PAGE}.css.sh}" +BODY="${BODY:-${_EXEC}/templates/${PAGE}.html.sh}" -NAVIGATION() { - for each in "${_EXEC}"/pages/*.sh; do - link="$(printf %s "$each" |sed -r "s:^.*/([^/]*)\.sh$:\1:")" - title="$($each title)" - [ -n "$title" ] && printf '%s\n' "?p=$link $title" - done -} +. "${_EXEC}/pages/${PAGE}.sh" -. ${_EXEC}/templates/frame.html.sh +printf "Content-Type: text/html;charset=utf-8\r\n\r\n" +. "${_EXEC}/templates/frame.html.sh"