svn path=/trunk/; revision=15
<div class="cardlist">
$(listcards |while read card; do
- echo '<div class="card">'
- view_attendee "$card"
+ 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)
</div>
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
+}