# this program is supposed to be symlinked into a http root directory
# we will use the http root as object storage (data directory) and call sub
# programs from the directory in which the real executable resides
-# therefore we need to identify the code and data directories _EXEC and _STOR
+# therefore we need to identify the code and data directories _EXEC and _DATA
call=$0
real=$call
while [ -L "$real" ]; do
done
_EXEC="$(dirname "$real")" #execution directory
-_STOR="$(dirname "$call")" #storage directory
+_DATA="$(dirname "$call")" #storage directory
debug "Execution dir: $_EXEC"
-debug "Storage dir: $_STOR"
+debug "Storage dir: $_DATA"
-[ -w "$_EXEC" ] && [ -d "$_EXEC" ] || die "storage directory must be writable"
+[ -w "$_DATA" ] && [ -d "$_DATA" ] || die "storage directory must be writable"
# create directories for object storage
-for each in "$_STOR"/{vcard,mappings,courses}; do
+for each in "$_DATA"/{vcard,mappings,courses}; do
[ ! -e "$each" ] && mkdir "$each"
[ -w "$each" ] && [ -d "$each" ] || die "storage $each must be a writable directory"
done
#!/bin/sh
+listcards() {
+ ls -1 ${_DATA}/vcard/*vcf
+}
+
+vcf_parse() {
+ tr -d '\n' <"$1" |sed -r 's:\r ::g;s:\r:\n:g' \
+ | sed -r 's:^([^;]+)(;[^"]+|;"[^"]+")*\:(.*)$:key=\1\nvalue=\3\ntag=\2:g'
+}
+
case "$1" in
title)
echo "Teilnehmende"
;;
css)
+ . ${_EXEC}/templates/attendees.css.sh
;;
body)
+ . ${_EXEC}/templates/attendees.html.sh
;;
esac
--- /dev/null
+cat <<EOF
+<div class="filter">
+<form action="/" method="GET">
+ <div class="search">
+ <span class="label">Filter:</span>
+ <input type="hidden" name="page" value="attendees"/>
+ <input type="text" name="filter"/>
+ <input type="radio" name="filtertype" value="any" checked="checked">Alles</input>
+ <input type="radio" name="filtertype" value="name">Name</input>
+ <input type="radio" name="filtertype" value="street">Straße</input>
+ <input type="radio" name="filtertype" value="zip">PLZ.</input>
+ <input type="radio" name="filtertype" value="telephone">Telefon</input>
+ <input type="radio" name="filtertype" value="birth">Geburtsjahr</input>
+ <input type="radio" name="filtertype" value="course">Kurs</input>
+ <button type="submit" name="action" value="new_filter">Filtern</button>
+ <button type="submit" name="action" value="del_filter">Filter löschen</button>
+ </div>
+</form>
+</div>
+
+<div class="newcard">
+<h2>Neuer Eintrag</h2>
+<form action="actions/newcard.cgi" method="POST">
+ <span class="label">Name:</span>
+ <input type="text" name="name"/>
+ <button type="submit">Anlegen</button>
+</form>
+</div>
+
+<div class="cardlist">
+ $(listcards |while read card; do
+ echo '<div class="card">'
+ vcf_parse "$card" |sed -r '
+ s:^key=(.+)$: <span class="label">\1</span>:g
+ s:^value=(.*)$:<span class="value">\1</span>:g
+ s:^tag=(.*)$: <span class="tag" >\1</span>:g
+ '
+ echo '</div>'
+ done)
+</div>
+
+EOF
+
+# vi:set filetype=html:
$(NAVIGATION |sed -r 's:^([^ ]+) (.+)$:<a href="\1">\2</a>:g')
</div>
<div class="MAIN">
- $($PAGE body)
+ $(. $PAGE body)
</div>
</body>
</html>