[ -z "$_GET[\"order\"]" ] && _GET["order"]=DOW
+listcards() {
+ ls -1 ${_DATA}/vcard/*vcf 2>/dev/null |while read file; do
+ fn=$(sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$file")
+ echo "$fn\t$file"
+ done |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:'
+}
+
+
listcourses() {
case "$_GET[\"filtertype\"]" in
*) ls -1 ${_DATA}/ical/*ics 2>/dev/null
echo ' </select>'
echo ' </div>'
+echo ' <div class="section select_attendance">'
+echo ' <span class="sectitle">'$(l10n course_attendance)'</span>'
+echo ' <select class="item attendance" name="attendance" multiple="multiple">'
+listcards |while read card; do
+ cfile="$_DATA/vcard/$card"
+ aname=$(sed -rn 's:^N(;[^"\:]+|;"[^"]+")*\:([^;]*)(\;[^;]*)(\;[^;]*)?(\;[^;]*)?(\;[^;]*)?$:\5 \3 \4 \2 \6:p' "$cfile" \
+ |sed -r 's:,: :;s:\;: :g;s: +: :g' \
+ |tr -d '\r'
+ )
+ selected=$(sed -rn "s:^$id\t$card\$:selected=\"selected\":p" $_DATA/mappings/attendance)
+ echo ' <option value="'$card'" '$selected'>'$aname'</option>'
+done
+echo ' </select>'
+echo ' </div>'
+
echo ' <div class="section control">'
echo ' <button class="item control" type="submit" name="action" value="addfield">'$(l10n edit_addfield)'</button>'
echo ' <select class="item control" name="newfield">'