3 . "${_EXEC}"/pdiread.sh
6 local coursefile="$_DATA/courses/$1"
9 . $_EXEC/session_lock.sh
11 if ! tempfile="$(CHECK_SLOCK "$coursefile")"; then
12 printf '[div .message %s]' "$(l10n "This course is not set up for editing within this session.")"
14 course="$(pdi_load "$tempfile")"
16 [form .course #${coursefile##*/} action="/cards/update_course.sh" method="POST"
17 [input type="hidden" name="tid" value="$(transid ${tempfile})"]
18 [div .section .basic $(
19 edit_item "$course" N GENDER
20 [ "$(pdi_count "$course" NICKNAME)" -gt 0 ] \
21 && edit_item "$card" NICKNAME
22 edit_item "$card" BDAY
23 edit_item "$card" X-ZACK-JOINDATE
24 [ "$(pdi_count "$card" X-ZACK-LEAVEDATE)" -gt 0 ] \
25 && edit_item "$card" X-ZACK-LEAVEDATE
26 card_item "$card" SOUND PHOTO LOGO
28 [div .section .phone $(edit_item "$card" TEL)]
29 [div .section .message $(
30 edit_item "$card" EMAIL
31 [ $(pdi_count "$card" IMPP) -gt 0 ] && edit_item "$card" IMPP
32 [ $(pdi_count "$card" URL ) -gt 0 ] && edit_item "$card" URL
34 [div .section .address $(edit_item "$card" ADR)]
35 [div .section .note $(edit_item "$card" NOTE)]
36 [div .section .attendance
37 [h3 $(l10n course_attendance) ] $(
38 for course in "$_DATA"/ical/*.ics; do
39 printf '[label [input type="checkbox" name="attendance" value="%s" %s] %s]' \
41 "$(grep -qF "${course##*/} ${cardfile##*/}" "$_DATA/mappings/attendance" \
42 && printf 'checked="checked"'
44 "$(pdi_value "$(pdi_load "$course")" SUMMARY |unescape |HTML)"
46 [h3 $(l10n CATEGORIES) ] $(
47 grep -xE '[^ ]+' "$_DATA"/mappings/categories |while read -r cat; do
48 printf '[label [input type="checkbox" name="attendance" value="%s" %s] %s]' \
50 "$(seq 1 $(pdi_count "$card" CATEGORIES) |while read c; do
51 pdi_value "$card" CATEGORIES $c |grep -qxF "$cat" \
52 && printf 'checked="checked"' && break
58 [select .item name="newfield"
59 [option value="" disabled="disabled" selected="selected" $(l10n edit_addfieldtext)]
60 $(for f in NICKNAME EMAIL TEL IMPP ADR URL NOTE; do
61 printf '[option value="%s" %s] ' "$f" "$(l10n "$f")"
63 ][button .item type="submit" name="action" value="addfield" $(l10n edit_addfield)]
64 [button .item type="submit" name="action" value="update" $(l10n edit_update)]
65 [input type="checkbox" #delete] [label .item for="delete" $(l10n edit_delete)]
66 [button .item type="submit" name="action" value="delete"]
67 [button .item type="submit" name="action" value="cancel" $(l10n edit_cancel)]
69 [input type="hidden" name="UID" value="$(pdi_value "$card" UID |HTML)"]
70 [input type="hidden" name="card" value="${cardfile##*/}"]
78 local course="$(pdi_load "$coursefile")"
80 [div .course #${coursefile##*/}
81 [div .section .basic ­$(
82 cal_item "$course" SUMMARY DTSTART RRULE
84 [div .section .COMMENT ­$(cal_item "$course" COMMENT)]
85 [div .section .attendance [h3 $(l10n course_attendance) ] [ul ­
86 $(grep -F " ${cardfile##*/}" "$_DATA/mappings/attendance" |while read each discard; do
87 printf '[li [a .item .attendance href="/courses#%s" ­%s]]' \
89 "$(pdi_value "$(pdi_load "$_DATA/ical/$each")" SUMMARY |unescape |HTML)"
93 [a .item href="/courses/edit_course.sh?course=${coursefile##*/}" $(l10n edit)]
94 [a .item href="/courses/export_pdf.sh?course=${coursefile##*/}" target="blank" $(l10n courselist)]
95 [a .item href="/courses/export_ical.sh?course=${coursefile##*/}" $(l10n ics_export)]
96 [a .item href="mailto:zack@vuesch.org?bcc=$(course_mail "${coursefile##*/}")" $(l10n course_mail)]
103 local calfile cachefile date size name ldate=0 lsize lname
105 while read calfile; do
106 cachefile="${_DATA}/cache/${calfile##*/}.cache"
107 if [ -s "$cachefile" -a "$cachefile" -nt "$calfile" ]; then
110 print_course "$calfile" |tee "$cachefile"
118 while read calfile; do
119 icstime="$(pdi_value "$(pdi_load "$calfile")" DTSTART |cal_date)"
121 DOW) printf '%s %s\n' "$(date -d "$icstime" "+%u %H:%M:%S")" "$calfile";;
122 TOD) printf '%s %s\n' "$(date -d "$icstime" "+%H:%M:%S")" "$calfile";;
126 | sed -E 's;^.*\t;;g'
130 printf '%s\n' ${_DATA}/courses/*.ics \