From: paul Date: Tue, 30 Jul 2013 19:41:14 +0000 (+0000) Subject: page skeleton and rough component framework X-Git-Url: https://git.plutz.net/?p=confetti;a=commitdiff_plain;h=9d7c6eae1ee756c1ba53d80e7b134fa1f3a1f0b4 page skeleton and rough component framework svn path=/trunk/; revision=4 --- diff --git a/ifcomponent/frame.sh b/ifcomponent/frame.sh new file mode 100755 index 0000000..fa04fd6 --- /dev/null +++ b/ifcomponent/frame.sh @@ -0,0 +1,26 @@ +#!/bin/zsh + +cat < + + + + $TITLE + + + + +
+ $($PAGE body) +
+ + +EOF diff --git a/ifcomponent/page_attendees.sh b/ifcomponent/page_attendees.sh new file mode 100755 index 0000000..e4b8cd9 --- /dev/null +++ b/ifcomponent/page_attendees.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + title) + echo "Teilnehmende" + ;; + css) + ;; + body) + ;; +esac + diff --git a/ifcomponent/page_courses.sh b/ifcomponent/page_courses.sh new file mode 100755 index 0000000..1c69c66 --- /dev/null +++ b/ifcomponent/page_courses.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + title) + echo "Kurse" + ;; + css) + ;; + body) + ;; +esac + diff --git a/ifcomponent/page_email.sh b/ifcomponent/page_email.sh new file mode 100755 index 0000000..b37b62a --- /dev/null +++ b/ifcomponent/page_email.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + title) + echo "Email" + ;; + css) + ;; + body) + ;; +esac + diff --git a/ifcomponent/page_error.sh b/ifcomponent/page_error.sh new file mode 100755 index 0000000..d5f6053 --- /dev/null +++ b/ifcomponent/page_error.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +case "$1" in + title) + ;; + css) + ;; + body) +cat < +Quoth the server: 404 +EOF + ;; +esac + diff --git a/ifcomponent/view_attendee.sh b/ifcomponent/view_attendee.sh new file mode 100755 index 0000000..e69de29 diff --git a/ifcomponent/view_course.sh b/ifcomponent/view_course.sh new file mode 100755 index 0000000..e69de29 diff --git a/index.cgi b/index.cgi index 45602fc..4d050e8 100755 --- a/index.cgi +++ b/index.cgi @@ -46,3 +46,4 @@ EOF cgi_get debug "$_GET" +. "$_EXEC/page.sh" diff --git a/page.sh b/page.sh new file mode 100755 index 0000000..ef1cf4d --- /dev/null +++ b/page.sh @@ -0,0 +1,19 @@ +#!/bin/zsh + +echo "Content-Type: text/html\n\n" + +PAGE="$(echo "$_GET['page']" |egrep '^[a-zA-Z0-9_-]+$')" +PAGE="${_EXEC}/ifcomponent/page_${PAGE}.sh" +[ -x "$PAGE" ] || PAGE="${_EXEC}/ifcomponent/page_error.sh" + +TITLE=$($PAGE title) + +NAVIGATION() { + for each in "${_EXEC}/ifcomponent"/page_*.sh; do + link="$(echo "$each" |sed -r "s:^.*page_(.*)\.sh$:\1:")" + title="$($each title)" + echo "/?page=$link $title" + done +} + +. ${_EXEC}/ifcomponent/frame.sh