+. ${_EXEC}/templates/text_attendee.sh
. ${_EXEC}/templates/view_attendee.sh
+. ${_EXEC}/templates/edit_attendee.sh
check(){
[ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"'
<span class="label">Filter:</span>
<input type="hidden" name="page" value="attendees"/>
<input type="text" name="filter" value="$_GET["filter"]"/><br/>
- <input type="radio" name="filtertype" value="any" $(check any)>Alles</input>
- <input type="radio" name="filtertype" value="name" $(check name)>Name</input>
- <input type="radio" name="filtertype" value="street" $(check street)>Straße</input>
- <input type="radio" name="filtertype" value="zip" $(check zip)>PLZ.</input>
- <input type="radio" name="filtertype" value="telephone" $(check telephone)>Telefon</input>
- <input type="radio" name="filtertype" value="birth" $(check birth)>Geburtsjahr</input>
- <input type="radio" name="filtertype" value="course" $(check course)>Kurs</input><br/>
- <button type="submit" name="action" value="new_filter">Filtern</button>
- <button type="submit" name="action" value="del_filter">Filter löschen</button>
+ <input type="radio" name="filtertype" value="any" $(check any)>$(l10n filter_all)</input>
+ <input type="radio" name="filtertype" value="name" $(check name)>$(l10n filter_name)</input>
+ <input type="radio" name="filtertype" value="street" $(check street)>$(l10n filter_street)</input>
+ <input type="radio" name="filtertype" value="zip" $(check zip)>$(l10n filter_zip)</input>
+ <input type="radio" name="filtertype" value="telephone" $(check telephone)>$(l10n filter_phone)</input>
+ <input type="radio" name="filtertype" value="birth" $(check birth)>$(l10n filter_birthyear)</input>
+ <input type="radio" name="filtertype" value="course" $(check course)>$(l10n filter_course)</input><br/>
+ <button type="submit" name="action" value="new_filter">$(l10n filter_apply)</button>
+ <button type="submit" name="action" value="del_filter">$(l10n filter_cancel)</button>
</div>
</form>
</div>
</div>
<div class="cardlist">
- $(listcards |while read card; do
- id="vcf_$card"
- echo '<div id="'"$id"'" class="card">'
- if [ "$_GET[\"edit\"]" = "$id" ]; then
- debug "Edit: $card"
- edit_attendee "$card"
- else
- echo '<p class="control"><a href="?page=attendees&edit='"$id"'#'"$id"'">Bearbeiten</a></p>'
- view_attendee "$card"
- fi
- echo '</div>'
- done)
+$(listcards |while read card; do
+ id="vcf_$card"
+ if [ "$_GET[\"edit\"]" = "$id" ]; then cat <<x_EOF
+ <div id="${id}" class="card">
+ <form action="/?page=attendees#${id}" method="POST">
+ <input type="hidden" name="page" value="attendees"/>
+ <input type="hidden" name="card" value="${id}"/>
+ $(edit_attendee "$card")
+ <br /><button type="submit" name="action" value="update">$(l10n edit_update)</button>
+ <br /><button type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
+ </form>
+ </div>
+x_EOF
+ debug "Edit: $card"
+ else cat <<x_EOF
+ <div id="${id}" class="card">
+ <p class="control"><a href="?page=attendees&edit=${id}#${id}">$(l10n edit)</a></p>
+ $(view_attendee "$card")
+ </div>
+x_EOF
+ fi
+done)
</div>
EOF
--- /dev/null
+edit_card_item() {
+ case "$key" in
+ BEGIN|VERSION|END);;
+ PHOTO)
+ echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
+ ;;
+ *)
+ echo -n "<span class=\"item\"><span class=\"KEY\">$(l10n "$key")"
+ [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
+ echo ":</span>"
+ ;|
+ *)
+ echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
+ ;;
+ esac
+}
+
+edit_attendee() {
+ cardfile="$1"
+ unset key
+ vcf_parse "$cardfile" |while read -r line; do
+ declare -A tag
+ case "$line" in
+ value*) eval "$line";;
+ tag*) eval "$line";;
+ key*)
+ if [ -z "$key" ]; then
+ eval "$line"
+ else
+ edit_card_item
+ eval "$line"
+ unset value
+ unset tag
+ fi
+ ;;
+ esac
+ done
+}
--- /dev/null
+declare -A item_name
+
+item_name[PHOTO]="Foto"
+item_name[LOGO]="Logo"
+item_name[FN]="Voller Name"
+item_name[SOUND]="Aussprache"
+item_name[GENDER]="Geschlecht"
+item_name[KIND]="Typ"
+item_name[TITLE]="Beruf"
+item_name[ROLE]="Position"
+item_name[ORG]="Organisation"
+item_name[MEMBER]="Mitglied"
+item_name[CATEGORIES]="Kategorien"
+item_name[ANNIVERSARY]="Jubiläum"
+item_name[BDAY]="Geburtstag"
+item_name[EMAIL]="E-Mail"
+item_name[TEL]="Telefon"
+item_name[IMPP]="Chat"
+item_name[ADR]="Anschrift"
+item_name[URL]="Webseite"
+item_name[LANG]="Sprache"
+item_name[NOTE]="Notiz"
+
+item_name[RELATED]="Kontakte"
+
+item_name[BEGIN]=""
+item_name[CALADRURI]=""
+item_name[CALURI]=""
+item_name[CLASS]=""
+item_name[CLIENTPIDMAP]=""
+item_name[END]=""
+item_name[FBURL]=""
+item_name[GEO]=""
+item_name[MAILER]=""
+item_name[NAME]=""
+item_name[PRODID]=""
+item_name[PROFILE]=""
+item_name[REV]=""
+item_name[SORT-STRING]=""
+item_name[SOURCE]=""
+item_name[TZ]=""
+item_name[UID]=""
+item_name[VERSION]=""
+item_name[XML]=""
+
+item_name[edit]="Bearbeiten"
+item_name[filter_all]="Alles"
+item_name[filter_name]="Name"
+item_name[filter_street]="Straße"
+item_name[filter_zip]="PLZ."
+item_name[filter_phone]="Telefon"
+item_name[filter_birthyear]="Geburtsjahr"
+item_name[filter_course]="Kurs"
+item_name[filter_apply]="Filtern"
+item_name[filter_cancel]="Filter löschen"
+
+l10n() {
+ [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1"
+}
-declare -A item_name
-
-item_name[PHOTO]="Foto"
-item_name[LOGO]="Logo"
-item_name[FN]="Voller Name"
-item_name[SOUND]="Aussprache"
-item_name[GENDER]="Geschlecht"
-item_name[KIND]="Typ"
-item_name[TITLE]="Beruf"
-item_name[ROLE]="Position"
-item_name[ORG]="Organisation"
-item_name[MEMBER]="Mitglied"
-item_name[CATEGORIES]="Kategorien"
-item_name[ANNIVERSARY]="Jubiläum"
-item_name[BDAY]="Geburtstag"
-item_name[EMAIL]="E-Mail"
-item_name[TEL]="Telefon"
-item_name[IMPP]="Chat"
-item_name[ADR]="Anschrift"
-item_name[URL]="Webseite"
-item_name[LANG]="Sprache"
-item_name[NOTE]="Notiz"
-
-item_name[RELATED]="Kontakte"
-
-item_name[BEGIN]=""
-item_name[CALADRURI]=""
-item_name[CALURI]=""
-item_name[CLASS]=""
-item_name[CLIENTPIDMAP]=""
-item_name[END]=""
-item_name[FBURL]=""
-item_name[GEO]=""
-item_name[MAILER]=""
-item_name[NAME]=""
-item_name[PRODID]=""
-item_name[PROFILE]=""
-item_name[REV]=""
-item_name[SORT-STRING]=""
-item_name[SOURCE]=""
-item_name[TZ]=""
-item_name[UID]=""
-item_name[VERSION]=""
-item_name[XML]=""
-
-l10n() {
- [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1"
-}
-
view_card_item() {
case "$key" in
BEGIN|VERSION|END);;
esac
}
-edit_card_item() {
- case "$key" in
- BEGIN|VERSION|END);;
- PHOTO)
- echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
- ;;
- *)
- echo -n "<span class=\"item\"><span class=\"KEY\">$(l10n "$key")"
- [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
- echo ":</span>"
- ;|
- *)
- echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
- ;;
- esac
-}
-
view_attendee() { #Parameter: Cardfile
cardfile="$1"
cachefile="cache/vcf_$(basename "$cardfile").cache"
esac
done |tee "$cachefile"
}
-
-edit_attendee() {
- cardfile="$1"
- unset key
- vcf_parse "$cardfile" |while read -r line; do
- declare -A tag
- case "$line" in
- value*) eval "$line";;
- tag*) eval "$line";;
- key*)
- if [ -z "$key" ]; then
- eval "$line"
- else
- edit_card_item
- eval "$line"
- unset value
- unset tag
- fi
- ;;
- esac
- done
-}