From badf769c566295e6ceaf9a9d80de664c227666a4 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 30 Sep 2015 16:18:20 +0000 Subject: [PATCH] adaptions to updated shcgi svn path=/trunk/; revision=71 --- actions/update_attendee.sh | 10 ++++----- constants.sh => globals.sh | 3 +++ pages/attendees.sh | 18 ++------------- pages/courses.sh | 16 +------------- pages/email.sh | 16 +------------- templates/email.html.sh | 2 -- templates/frame.html.sh | 15 ++++++++----- pages/error.sh => templates/text_frame.sh | 27 +++++++++-------------- 8 files changed, 33 insertions(+), 74 deletions(-) rename constants.sh => globals.sh (92%) rename pages/error.sh => templates/text_frame.sh (72%) diff --git a/actions/update_attendee.sh b/actions/update_attendee.sh index 4d2157f..4bdd6ba 100755 --- a/actions/update_attendee.sh +++ b/actions/update_attendee.sh @@ -29,11 +29,11 @@ tempfile="$_DATA/temp/$card" cardfile="$_DATA/vcard/$card" attfile="$_DATA/mappings/attendance" -_POST[0N]="${(echo "$_POST[0N]}" |sed 's:;: :')" -_POST[1N]="${(echo "$_POST[1N]}" |sed 's:;: :')" -_POST[2N]="${(echo "$_POST[2N]}" |sed 's:;: :')" -_POST[3N]="${(echo "$_POST[3N]}" |sed 's:;: :')" -_POST[4N]="${(echo "$_POST[4N]}" |sed 's:;: :')" +_POST[0N]="$(echo "${_POST[0N]}" |sed 's:;: :')" +_POST[1N]="$(echo "${_POST[1N]}" |sed 's:;: :')" +_POST[2N]="$(echo "${_POST[2N]}" |sed 's:;: :')" +_POST[3N]="$(echo "${_POST[3N]}" |sed 's:;: :')" +_POST[4N]="$(echo "${_POST[4N]}" |sed 's:;: :')" echo "BEGIN:VCARD\r" >"$tempfile" echo "VERSION:4.0\r" >>"$tempfile" diff --git a/constants.sh b/globals.sh similarity index 92% rename from constants.sh rename to globals.sh index c526da4..aac6dc9 100755 --- a/constants.sh +++ b/globals.sh @@ -22,6 +22,9 @@ data_dirs vcard ical cache temp mappings VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED X-ZACK-JOINDATE X-ZACK-LEAVEDATE) +[ -z "$NAVIGATION" ] && NAVIGATION=(attendees courses) +PAGE="${_GET[p]:-$PAGE}" + uuidgenerator(){ head -c16 /dev/urandom |sha1sum - |cut -c1-32 } diff --git a/pages/attendees.sh b/pages/attendees.sh index 9cc387e..0a1f88d 100755 --- a/pages/attendees.sh +++ b/pages/attendees.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh # Copyright 2014, 2015 Paul Hänsch # @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -[ -z "${_GET[order]}" ] && _GET[order]=firstname +[ -z "${_GET[order]}" ] && _GET[order]="firstname" listcourses() { ls -1 ${_DATA}/ical/*ics |while read file; do @@ -279,17 +279,3 @@ edit_attendee() { #Parameter: Cardfile done . ${_EXEC}/templates/edit_attendee.sh } - -case "$1" in - title) - echo "Teilnehmende" - ;; - css) - . ${_EXEC}/templates/attendees.css.sh - ;; - body) - . ${_EXEC}/templates/text_attendee.sh - . ${_EXEC}/templates/attendees.html.sh - ;; -esac - diff --git a/pages/courses.sh b/pages/courses.sh index 14d1713..ad92ae7 100755 --- a/pages/courses.sh +++ b/pages/courses.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh # Copyright 2014 Paul Hänsch # @@ -174,17 +174,3 @@ edit_course() { #Parameter: Calendarfile done . ${_EXEC}/templates/edit_course.sh } - -case "$1" in - title) - echo "Kurse" - ;; - css) - . ${_EXEC}/templates/courses.css.sh - ;; - body) - . ${_EXEC}/templates/text_courses.sh - . ${_EXEC}/templates/courses.html.sh - ;; -esac - diff --git a/pages/email.sh b/pages/email.sh index 817d5c6..c79876f 100755 --- a/pages/email.sh +++ b/pages/email.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh # Copyright 2014 Paul Hänsch # @@ -32,17 +32,3 @@ listcourses() { echo "$(date -d "$icstime" "+%u %H%M%S")\t$file" done |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:' } - -case "$1" in - title) - echo "Email" - ;; - css) - . ${_EXEC}/templates/email.css.sh - ;; - body) - . ${_EXEC}/templates/text_email.sh - . ${_EXEC}/templates/email.html.sh - ;; -esac - diff --git a/templates/email.html.sh b/templates/email.html.sh index 6061a8a..7f93893 100755 --- a/templates/email.html.sh +++ b/templates/email.html.sh @@ -51,8 +51,6 @@ cat <
-$( -)
EOF diff --git a/templates/frame.html.sh b/templates/frame.html.sh index 27d9466..738ec29 100755 --- a/templates/frame.html.sh +++ b/templates/frame.html.sh @@ -1,4 +1,6 @@ -# Copyright 2014 Paul Hänsch +#!/bin/zsh + +# Copyright 2014, 2015 Paul Hänsch # # This file is part of Confetti. # @@ -15,12 +17,15 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . +. "${_EXEC}/templates/text_frame.sh" +[ -x "${_EXEC}/templates/text_${PAGE}.sh" ] && . "${_EXEC}/templates/text_${PAGE}.sh" + cat < - $($PAGE title) + $(l10n p_${PAGE}) - $(. $PAGE body) + $(debug BODY; [ -x "${BODY}" ] && . "${BODY}" || printf %s 'Error') EOF diff --git a/pages/error.sh b/templates/text_frame.sh similarity index 72% rename from pages/error.sh rename to templates/text_frame.sh index c42df35..b76b584 100755 --- a/pages/error.sh +++ b/templates/text_frame.sh @@ -1,6 +1,4 @@ -#!/bin/sh - -# Copyright 2014 Paul Hänsch +# Copyright 2014, 2015 Paul Hänsch # # This file is part of Confetti. # @@ -17,16 +15,13 @@ # You should have received a copy of the GNU Affero General Public License # along with Confetti. If not, see . -case "$1" in - title) - ;; - css) - ;; - body) -cat < -Quoth the server: 404 -EOF - ;; -esac - +declare -A item_name + +item_name[p_attendees]="Teilnehmende" +item_name[p_courses]="Kurse" +item_name[p_email]="Email" +item_name[p_error]="Fehler" + +l10n() { + [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1" +} -- 2.39.2