From: Paul Hänsch Date: Sat, 6 Feb 2021 22:55:37 +0000 (+0100) Subject: remove obsolte sections X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=40eb3d2b20ea87bc832fcf60e013c6a214354cd0;p=lobster remove obsolte sections --- diff --git a/categories/edit_categories.sh b/categories/edit_categories.sh deleted file mode 100755 index 7ee6f36..0000000 --- a/categories/edit_categories.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/zsh - -# Copyright 2015 - 2016 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -catfile="${_DATA}/mappings/categories" - -remove="$(POST remove)" -newcat="$(POST newcat)" - -if [ "$(POST add)" = "add" ]; then - categories="$( { - cat "$catfile" - printf %s\\n "$newcat" - } |sort -u )" - printf %s\\n "$categories" >"$catfile" -elif [ "$remove" ]; then - sed -E -i '/^'"${remove}"'$/d' "$catfile" -fi - -REDIRECT "/categories/" diff --git a/categories/index.cgi b/categories/index.cgi deleted file mode 100755 index 236b1e3..0000000 --- a/categories/index.cgi +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# Copyright 2015, 2017, 2018, 2021 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -. $_EXEC/pdiread.sh -. $_EXEC/categories/l10n.sh - -catfile="${_DATA}/mappings/categories" - -list_categories() { - grep -vxE '[ ]*' "$catfile" |sort -u -} - -list_catsel(){ - local vcf="$1" card="$2" n=1 cats="${BR}" - while cats="${cats}${BR}$(pdi_value "$vcf" CATEGORIES $n)"; do n=$((n + 1)); done - - list_categories |while read cat; do - printf '[li [label [input %s type="checkbox" name="%s" value="%s"] %s]]' \ - "$([ "${cats%*${BR}${cat}${BR}*}" != "$cats" ] && printf checked=checked)" \ - "$(HTML "$card")" "$(HTML "$cat")" "$(HTML "$cat")" - done -} - -cat <. - -l10n(){ - local word - [ $# -eq 0 ] && read -r word || word="$*" - case $word in - cat_remove) printf %s "-";; - cat_add) printf %s "+";; - cat_newlabel) printf %s "neue Kategorie";; - cat_update) printf %s "Zuweisungen übernehmen";; - categories_label) printf %s "Kategorien";; - - *) l10n_global "$word";; - esac -} diff --git a/categories/update_categories.sh b/categories/update_categories.sh deleted file mode 100755 index 108c5d5..0000000 --- a/categories/update_categories.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# Copyright 2016, 2021 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -. "$_EXEC"/cgilite/storage.sh -. "$_EXEC"/pdiread.sh - -catfile="${_DATA}/mappings/categories" - -for card in "${_DATA}"/vcard/*.vcf; do - n='' postcats='' cardcats='' - vcf="$(pdi_load "$card")" - - n=1; while postcats="${postcats}${postcats:+,}$(POST "${card##*/}" $n)"; do n=$((n+1)); done - n=1; while cardcats="${cardcats}${cardcats:+,}$(pdi_value "$vcf" CATEGORIES $n)"; do n=$((n+1)); done - - if [ "${postcats}" != "${cardcats}" ] && LOCK "$card"; then - sed -E -i ' - /^CATEGORIES[;:]/d - /^END;?:VCARD *\r?$/iCATEGORIES:'"${postcats%,}"'\r - ' "${card}" - RELEASE "$card" - fi -done - -REDIRECT /categories/ diff --git a/courses/edit_course.sh b/courses/edit_course.sh deleted file mode 100755 index 3c0c54f..0000000 --- a/courses/edit_course.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# Copyright 2014, 2019, 2020 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -locktimeout=900 -. "$_EXEC"/session_lock.sh - -course="$(GET course |PATH)" -coursefile="$_DATA/ical/${course##*/}" - -if tempfile="$(SLOCK "$coursefile" "$locktimeout")"; then - REDIRECT "/courses/?e=${course}" -elif [ -f "$tempfile" ]; then - SET_COOKIE session message="SESSLOCK" - REDIRECT "/courses/#${course}" -else - SET_COOKIE session message="EDITLOCK" - REDIRECT "/courses/#${course}" -fi diff --git a/courses/export_ical.sh b/courses/export_ical.sh deleted file mode 100755 index 3649ed5..0000000 --- a/courses/export_ical.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/zsh - -# Copyright 2014,2015,2021 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -course="$(GET course |PATH)" -coursefile="$_DATA/ical/${course##*/}" - -. $_EXEC/pdiread.sh -. $_EXEC/cgilite/file.sh - -printf 'Content-Disposition: inline; filename="%s.ics"\r\n' "$(pdi_value "$(pdi_load "$coursefile")" SUMMARY)" - -FILE "$coursefile" "text/calendar; charset=utf-8" diff --git a/courses/export_pdf.sh b/courses/export_pdf.sh deleted file mode 100755 index 62bb69e..0000000 --- a/courses/export_pdf.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh - -. "${_EXEC}/pdiread.sh" -. "$_EXEC/cards/l10n.sh" - -coursefile="${_DATA}/ical/$(GET course)" - -if [ ! -r "$coursefile" ]; then - SET_COOKIE 0 message="Cannot read course file" - REDIRECT /courses/ - return 0 -elif ! mkdir -p "$_DATA/export"; then - SET_COOKIE 0 message="Cannot create export directory" - REDIRECT /courses/ - return 0 -fi - -ics="$(pdi_load "$coursefile")" -htmlfile="${_DATA}/export/$(pdi_value "$ics" SUMMARY |unescape |tr \\n/ __).html" -pdffile=${htmlfile%.html}.pdf - -pdi_date() { - local pdt y m d H M S Z - [ $# -eq 0 ] && read pdt || pdt="$*" - - case $pdt in - *T*Z) - Z=UTC; pdt="${pdt%Z}";; - TZID=*:*T*) - Z="${pdt%%:*}"; Z=${Z#TZID=}; pdt=${pdt#TZID=*:};; - esac - - y="${pdt%%????T*}" pdt=${pdt#????} - m="${pdt%%??T*}" pdt=${pdt#??} - d="${pdt%%T*}" pdt=${pdt#??T} - H="${pdt%%????}" pdt=${pdt#??} - M="${pdt%%??}" pdt=${pdt#??} - S="${pdt}" pdt='' - - case Z in - UTC) date -d "${y}-${m}-${d} ${H}:${M}:${S} UTC" +%s;; - '') date -d "${y}-${m}-${d} ${H}:${M}:${S}" +%s;; - *) date -d "TZ=\"${Z}\" ${y}-${m}-${d} ${H}:${M}:${S}" +%s;; - esac -} - -get_dates() { - local dts_date rrule rr_int rr_freq rec today="$(date +%Y%m%d)" - - dts_date="$(pdi_value "$ics" DTSTART || printf %s "$today")" - dts_date="${dts_date#TZID=*:}" dts_date="${dts_date%%T*}" - rrule="$(pdi_value "$ics" RRULE)" - rr_int="${rrule##*INTERVAL=}" rr_int="${rr_int%%;*}" - rr_freq="${rrule##*FREQ=}" rr_freq="${rr_freq%%;*}" - - [ "$rr_int" -ge 0 ] || rr_int=1 2>/dev/null - case "$rr_freq" in - YEARLY) rec="$rr_int year";; - MONTHLY) rec="$rr_int month";; - DAILY) rec="$rr_int day";; - WEEKLY) rec="$rr_int week";; - *) rec="$rr_int week";; - esac - - while [ "$dts_date" -lt "$today" ]; do dts_date="$(date -d "${dts_date} + ${rec}" +%Y%m%d)"; done - for n in 1 2 3 4 5 6 7 8 9 10; do - LANG=de_DE.UTF-8 date -d "$dts_date" +"%d. %b." - dts_date="$(date -d "${dts_date} + ${rec}" +%Y%m%d)" - done -} - -# some table styles need to be inline, because this is how libreoffice works -style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"' - -"$_EXEC/cgilite/html-sh.sed" <<-EOF >"$htmlfile" - -[html [head - [meta http-equiv="content-type" content="text/html; charset=utf-8"] - [title] - [meta name="generator" content="Confetti"] - [meta name="created" content="$(date +%FT%T)"] - [meta name="changed" content="$(date +%FT%T)"] - [style type="text/css" - @page { size: 29.7cm 21cm; margin: 1.5cm; } - * { background: inherit; } - body { background: transparent; font-family: Liberation Sans, Sans-Serif; } - - th { white-space: pre; } - th, td { text-align: left; } - ] -][body lang="de_DE" - [table width="100%" style="page-break-after: always;" - [col width=10*] [col width=5*] [col width=10*] [col width=15*] - [thead - [tr [th $style_td . $(l10n N)] [th $style_td . $(l10n BDAY)] [th $style_td . $(l10n TEL)] [th $style_td . $(l10n NOTE)]] - ][tbody - $(grep -F "${coursefile##*/} " "$_DATA/mappings/attendance" |while read discard each; do - vcf="$(pdi_load "$_DATA/vcard/$each")" - tel="$( seq 1 $(pdi_count "$vcf" TEL) |while read n; do - type="$(pdi_attrib "$vcf" TEL $n TYPE)" - [ "$type" ] && type="$(l10n "TYPE=$type"):" - printf '%s %s
' "$type" "$(pdi_value "$vcf" TEL $n)" - done )" - printf '[tr valign=top [td %s .N . %s] [td %s .BDAY . %s] [td %s .TEL . %s] [td %s .NOTE . %s]]\n' \ - "$style_td" "$(pdi_value "$vcf" FN |unescape |HTML)" \ - "$style_td" "$(pdi_value "$vcf" BDAY |unescape |HTML)" \ - "$style_td" "$tel" \ - "$style_td" "$(pdi_value "$vcf" NOTE |unescape |HTML)" - done |sort)] - ] - [table width="100%" - [col width=30*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] [col width=10*] - [thead - [tr [th $style_td ] $(get_dates |xargs -d\\n printf "[th $style_td . %s]")] - ][tbody - $(grep -F "${coursefile##*/} " "$_DATA/mappings/attendance" |while read discard each; do - vcf="$(pdi_load "$_DATA/vcard/$each")" - printf '[tr [td %s .N . %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s] [td %s]]\n' \ - "$style_td" "$(pdi_value "$vcf" FN |unescape |HTML)" \ - "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" "$style_td" - done |sort)] - ] -]] -EOF - -export HOME="$_DATA" -export XDG_CONFIG_HOME="$_DATA/xdg_config" -export XDG_CACHE_HOME="$_DATA/xdg_cache" -export XDG_DATA_HOME="$_DATA/xdg_local" - -lowriter --convert-to pdf --outdir "$_DATA/export/" "$htmlfile" >/dev/null -REDIRECT "$(URL "/export/${pdffile##*/}")" diff --git a/courses/index.cgi b/courses/index.cgi deleted file mode 100755 index 7ff426f..0000000 --- a/courses/index.cgi +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -. $_EXEC/pdiread.sh -. $_EXEC/courses/l10n.sh -. $_EXEC/courses/widgets.sh -. $_EXEC/courses/list.sh - -upcase=' y;abcdefghijklmnopqrstuvwxyzäöüé;ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉ;; ' - -order="$(GET o |grep -m1 -xE 'DOW|TOD')" -edit="$(GET e |PATH)" - -[ "$order" ] || order=DOW -edit="${edit##*/}" - -{ w_sort_courses - printf ' - [form .newcourses action="/courses/new_course.sh" method="POST" - [button type="submit" %s] - ]' "$(l10n newcourse)" - - [ "$edit" ] && edit_course "$edit" - printf '[div .courselist\n' - list_courses - printf ']' -} | yield_page courses #/courses/courses.css diff --git a/courses/l10n.sh b/courses/l10n.sh deleted file mode 100755 index f98529f..0000000 --- a/courses/l10n.sh +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2014, 2016, 2019 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -l10n(){ - local word - [ $# -eq 0 ] && read -r word || word="$*" - - case $word in - newcourse) printf "Neuen Kurs anlegen";; - time) printf "Uhrzeit";; - - edit_dtscal) printf "✓";; - edit) printf "Bearbeiten";; - ics_export) printf "ICal exportieren";; - courselist) printf "Kursliste (PDF)";; - - course_mail) printf "Mail an Teilnehmende";; - - sort_order) printf "Sortierung";; - order_DOW) printf "Wochentag";; - order_TOD) printf "Uhrzeit";; - order_apply) printf "Sortieren";; - - t_every) printf "Alle";; - t_eternal) printf "ewig";; - t_times) printf "mal";; - t_until) printf "Bis";; - t_oclock) printf "Uhr";; - - "Mon Tue Wed Thu Fri Sat Sun") printf "Mo Di Mi Do Fr Sa So";; - "January February March April May June July August September October November December") - printf "Januar Februar März April Mai Juni Juli August September Oktober November Dezember";; - - *) l10n_global "$word";; - esac -} diff --git a/courses/list.sh b/courses/list.sh deleted file mode 100755 index e9ae7bc..0000000 --- a/courses/list.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh - -. "${_EXEC}"/pdiread.sh - -SUP_FIELDS="COMMENT" - -edit_course(){ - local coursefile="$_DATA/ical/$1" - local tempfile course - - . $_EXEC/session_lock.sh - - if ! tempfile="$(CHECK_SLOCK "$coursefile")"; then - printf '[div .message %s]' "$(l10n "This course is not set up for editing within this session.")" - else - course="$(pdi_load "$tempfile")" - cat <<-EOF - [form .course #${coursefile##*/} action="/courses/update_course.sh" method="POST" - [input type="hidden" name="course" value="${coursefile##*/}"] - [input type="hidden" name="tid" value="$(transid ${tempfile})"] - [div .section .basic . $( - edit_item "$course" SUMMARY COMMENT - )] - [div .section .dtstart . $( - edit_item "$course" DTSTART - )] - [div .section .recur . $( - edit_item "$course" RRULE - )] - [div .section .attendance . $( - edit_item "$course" attendance - )] - [div .control - [!-- select .item name=newfield - [option disabled="disabled" selected . $(l10n edit_addfieldtext)] - $(for f in $SUP_FIELDS; do printf '[option value="%s" . %s]\n' "$f" "$(l10n "$f")"; done) - ] - [button .item type="submit" name="action" value="addfield" . $(l10n edit_addfield) --] - [button .item type="submit" name="action" value="update" . $(l10n edit_update)] - [button .item type="submit" name="action" value="cancel" . $(l10n edit_cancel)] - [div .item .delete label="$(l10n edit_delete)" - [input type="checkbox" #delete] - [label for="delete" $(l10n edit_delete)] - [button type="submit" name="action" value="delete" $(l10n edit_delete)] - ] - ] - ] - EOF - fi -} - -print_course(){ - local coursefile="$1" - local course="$(pdi_load "$coursefile")" - cat <<-EOF - [div .course #${coursefile##*/} - [div .section .basic . $( - cal_item "$course" SUMMARY DTSTART RRULE - )] - [div .section .COMMENT . $(cal_item "$course" COMMENT)] - [div .section .attendance [h3 $(l10n course_attendance) ] [ul . - $(grep -F "${coursefile##*/} " "$_DATA/mappings/attendance" |while read discard each; do - printf '[li [a .item .attendance href="/cards/#%s" . %s]]\n' \ - "$each" \ - "$(pdi_value "$(pdi_load "$_DATA/vcard/$each")" FN |unescape |HTML)" - done |sort -k7)] - ] - [div .control - [a .item href="/courses/edit_course.sh?course=${coursefile##*/}" $(l10n edit)] - [a .item href="/courses/export_pdf.sh?course=${coursefile##*/}" target="blank" $(l10n courselist)] - [a .item href="/courses/export_ical.sh?course=${coursefile##*/}" $(l10n ics_export)] - [a .item href="mailto:zack@vuesch.org?bcc=$(course_mail "${coursefile##*/}" |HTML)" $(l10n course_mail)] - ] - ] - EOF -} - -course_mail() { - course="$1" - grep -F "${course} " "$_DATA/mappings/attendance" |while read junk card; do - cat "${_DATA}/vcard/${card}" - done \ - | pdi_load - \ - | sed -nE 's;^EMAIL(\;[^:]*)*:(.+)\r?$;\2,;p' \ - | tr -d \\n \ - | unescape -} - -print_courses(){ - local calfile cachefile date size name ldate=0 lsize lname - - while read calfile; do - cachefile="${_DATA}/cache/${calfile##*/}.cache" - if [ -s "$cachefile" -a "$cachefile" -nt "$calfile" ]; then - cat "$cachefile" - else - print_course "$calfile" |tee "$cachefile" - fi - done -} - -order_courses() { - local calfile course - - while read calfile; do - icstime="$(pdi_value "$(pdi_load "$calfile")" DTSTART |cal_date)" - case $order in - DOW) printf '%s %s\n' "$(date -d "$icstime" "+%u %H:%M:%S")" "$calfile";; - TOD) printf '%s %s\n' "$(date -d "$icstime" "+%H:%M:%S")" "$calfile";; - esac - done \ - | sort \ - | sed -E 's;^.*\t;;g' -} - -list_courses(){ - printf '%s\n' ${_DATA}/ical/*.ics \ - | order_courses \ - | print_courses -} diff --git a/courses/new_course.sh b/courses/new_course.sh deleted file mode 100755 index 362752d..0000000 --- a/courses/new_course.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# Copyright 2014, 2021 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -locktimeout=900 -. "$_EXEC"/session_lock.sh - -uid="$(timeid)$(randomid)" # 32 Octets UID, starting with timestamp -course="${uid}.ics" - -tzid="$(cat /etc/timezone)" -tstamp="$(TZ="$tzid" date +%Y%m%dT%H%M%S)" - -coursefile="$_DATA/ical/$course" - -if tempfile="$(SLOCK "$coursefile")"; then - cat >"$tempfile" <<-EOF - BEGIN:VCALENDAR - VERSION:2.0 - PRODID:Berlin RAW Confetti - BEGIN:VEVENT - UID:$uid - DTSTAMP:TZID=${tzid}:${tstamp} - DTSTART:TZID=${tzid}:${tstamp} - DURATION: - RRULE: - SUMMARY: - COMMENT: - END:VEVENT - END:VCARD - EOF - REDIRECT "/courses/?e=${course}" -else - SET_COOKIE session message="EDITLOCK" - REDIRECT "/courses/" -fi diff --git a/courses/update_course.sh b/courses/update_course.sh deleted file mode 100755 index 4abdbe7..0000000 --- a/courses/update_course.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/sh - -# Copyright 2014, 2015, 2020, 2021 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -. "$_EXEC/pdiread.sh" -. "$_EXEC/session_lock.sh" -. "$_EXEC/cgilite/storage.sh" - -unset coursefile attfile tempfile - -course="$(POST course |PATH)"; course="${course##*/}" -coursefile="$_DATA/ical/$course" -attfile="$_DATA/mappings/attendance" - -if ! tempfile="$(CHECK_SLOCK "$coursefile")"; then - SET_COOKIE 0 message="NO VALID FILE LOCK" - REDIRECT "/courses/?e=${course}" - exit 0 -elif [ "$(POST tid)" != "$(transid "$tempfile")" ]; then - SET_COOKIE 0 message="INVALID TRANSACTION ID" - REDIRECT "/courses/?e=${course}" - exit 0 -fi - -vcf_escape(){ - for each in "$@"; do - printf %s\\n "$each" \ - | sed -E ':X;$!{N;bX}; s;\r\n;\n;g; s;([;,\\]);\\\1;g; s;\n;\\n;g;' - done \ - | sed -E ':X;$!{N;bX}; s;\n;\;;g' -} - -ics="$(pdi_load "$tempfile")" - -tzid=$(cat /etc/timezone) - -ics="$(pdi_update_attrib "$ics" DTSTAMP 1 "TZID=${tzid}")" -ics="$(pdi_update_value "$ics" DTSTAMP 1 "$(TZ="$tzid" date +%Y%m%dT%H%M%S)")" - -dts_year="$( POST DTS_YEAR |grep -m1 -xE '[0-9]{4}' || date +%Y)" -dts_month="$( POST DTS_MONTH |grep -m1 -xE '0[1-9]|1[012]' || date +%m)" -dts_day="$( POST DTS_DAY |grep -m1 -xE '0[1-9]|[12][0-9]|3[01]' || date +%d)" -dts_hour="$( POST DTS_HOUR |grep -m1 -xE '[0-9]|1[0-9]|2[0-3]' || date +%H)" -dts_minute="$(POST DTS_MINUTE |grep -m1 -xE '[0-9]|[1-5][0-9]' || date +%M)" -[ ${#dts_hour} -eq 1 ] && dts_minute="0$dts_hour" -[ ${#dts_minute} -eq 1 ] && dts_minute="0$dts_minute" -DTSTART="${dts_year}${dts_month}${dts_day}T${dts_hour}${dts_minute}00" - -ics="$(pdi_update_attrib "$ics" DTSTART 1 "TZID=${tzid}")" -ics="$(pdi_update_value "$ics" DTSTART 1 "$DTSTART")" - -rr_int=$( POST RRULE_INTERVAL |grep -m1 -xE '[0-9]+' || printf 1) -rr_count=$(POST RRULE_COUNT |grep -m1 -xE '[0-9]+' || printf 1) -rr_freq=$( POST RRULE_FREQ |grep -m1 -xE 'DAILY|WEEKLY|MONTHLY|YEARLY' || printf MONTHLY) -rr_uy=$( POST RRULE_UYEAR |grep -m1 -xE '[0-9]{4}' || date +%Y) -rr_um=$( POST RRULE_UMONTH |grep -m1 -xE '[1-9]|1[012]' || date +%m) -rr_ud=$( POST RRULE_UDAY |grep -m1 -xE '[1-9]|[12][0-9]|3[01]' || date +%d) -[ ${#rr_um} -eq 1 ] && rr_um="0$rr_um" -[ ${#rr_ud} -eq 1 ] && rr_ud="0$rr_ud" - -case $(POST RRULE_LIMIT) in - COUNT) RRULE="FREQ=$rr_freq;INTERVAL=$rr_int;COUNT=$rr_count";; - UNTIL) RRULE="FREQ=$rr_freq;INTERVAL=$rr_int;UNTIL=${rr_uy}${rr_um}${rr_ud}T000000Z";; - ETERN|*) RRULE="FREQ=$rr_freq;INTERVAL=$rr_int";; -esac - -ics="$(pdi_update_value "$ics" RRULE 1 "$RRULE")" - -for field in $(POST_KEYS |grep -xE '[A-Z][A-Z0-9-]*'); do - for cnt in $(seq 1 $(POST_COUNT "$field")); do - case "$field" in - *) - ics="$(pdi_update_value "$ics" "$field" "$cnt" "$(vcf_escape "$(POST "$field" "$cnt")")")" - ;; - esac -done; done - -# delete fields, first mark for deletion using delete_key -# this way the field enumeration is preserved during the process -# finally filter marked lines -delete_key="$(randomid)" -for delete in $(POST_KEYS |grep -xE '[A-Z][A-Z0-9-]*_delete_[0-9]+'); do - f="${delete%%_*}"; c="${delete##*_}"; - [ "$(POST "$delete")" = "true" ] && ics="$(pdi_update_value "$ics" "$f" "$c" "delete=${delete_key}")" -done -ics="$(printf '%s\n' "$ics" |sed -E "/^[^:]+:delete=${delete_key}\$/d")" - -case "$(POST action)" in - addfield) - newfield="$(POST newfield |grep -m 1 -xE '[A-Z][A-Z0-9-]*')" - ics="$(pdi_update_value "$ics" "$newfield" $(( $(pdi_count "$ics" "$newfield") + 1 )) '')" - printf '%s' "$ics" |grep -vx '' >"$tempfile" - REDIRECT "/courses/?e=${course}" - ;; - addfield\ [A-Z]*) - newfield="$(POST action |sed -nE '1s;^addfield ([A-Z][A-Z0-9-]*)$;\1;p')" - ics="$(pdi_update_value "$ics" "$newfield" $(( $(pdi_count "$ics" "$newfield") + 1 )) '')" - printf '%s' "$ics" |grep -vx '' >"$tempfile" - REDIRECT "/courses/?e=${course}" - ;; - update) - if LOCK "$attfile"; then - grep -F "${course} " "$attfile" |while read junk card; do - touch "$_DATA/vcard/${card}" - done - sed -E -i "/^${course} .+\$/d" "$attfile" - seq 1 $(POST_COUNT attendance) |while read n; do - printf '%s %s\n' "$course" "$(POST attendance $n)" - done >>"$attfile" - grep -F "${course} " "$attfile" |while read junk card; do - touch "$_DATA/vcard/${card}" - done - RELEASE "$attfile" - else - SET_COOKIE 0 message="COULD NOT UPDATE COURSE MAPPINGS" - fi - - printf '%s' "$ics" |grep -vx '' >"${tempfile}.cp" - mv "${tempfile}.cp" "$coursefile" - RELEASE_SLOCK "$coursefile" - REDIRECT "/courses/#${course}" - ;; - cancel) - RELEASE_SLOCK "$coursefile" - [ -f "$coursefile" ] \ - && REDIRECT "/courses/#${course}" \ - || REDIRECT "/courses/" - ;; - delete) - rm "$coursefile" - RELEASE_SLOCK "$coursefile" - REDIRECT "/courses/" - ;; - *) - printf '%s' "$ics" |grep -vx '' >"$tempfile" - REDIRECT "/courses/?e=${course}" - ;; -esac diff --git a/courses/widgets.sh b/courses/widgets.sh deleted file mode 100755 index 5b5288c..0000000 --- a/courses/widgets.sh +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright 2014, 2019, 2020 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -check(){ - [ "$1" = "$2" ] && printf 'checked="checked"' -} - -edit="$(GET e)" -order="$(GET o |grep -m1 -xE 'DOW|TOD')" - -w_sort_courses(){ - cat <<-EOF - [form .sort .search action="?" method="GET" - [fieldset .order [legend $(l10n sort_order):] - [radio "order" "DOW" $(check $order DOW) $(l10n order_DOW)] - [radio "order" "TOD" $(check $order TOD) $(l10n order_TOD)] - ] - [submit "" "" $(l10n order_apply)] - ] - EOF -} - -cal_date(){ - { [ $# -eq 0 ] && cat || printf %s "$*"; } |sed -nE ' - 2q - s/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$/\1-\2-\3 \4:\5:\6 UTC/p;t - s/^TZID=(.+)\:([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})$/TZ="\1" \2-\3-\4 \5:\6:\7/p;t - s/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})$/\1-\2-\3 \4:\5:\6/p;t - ' -} - -cal_item(){ - local course="$1" - local item cnt c - shift 1 - - for item in $@; do - cnt="$(pdi_count "$course" "$item")" - - case $item in - SUMMARY) - printf '[h2 ­%s]' "$(pdi_value "$course" SUMMARY)" - ;; - DTSTART) - printf '[span .text .DTSTART %s %s ]' \ - "$(LANG=de_DE.UTF-8 date -d "$(pdi_value "$course" DTSTART |cal_date)" '+%A, %d. %B %Y - %H:%M')" \ - "$(l10n t_oclock)" - ;; - RRULE) - dts_date="$(pdi_value "$course" DTSTART |cal_date)" - rrule=" $(pdi_value "$course" RRULE)" - rr_int="${rrule##*INTERVAL=}"; rr_int="${rr_int%%;*}" - rr_count="${rrule##*COUNT=}"; rr_count="${rr_count%%;*}" - rr_freq="${rrule##*FREQ=}"; rr_freq="${rr_freq%%;*}" - rr_until="${rrule##*UNTIL=}"; rr_until="${rr_until%%;*}" - rr_until="$(cal_date "${rr_until}")" - - [ "$rr_int" -eq 1 ] \ - && printf '[span .text .RRULE %s]' "$(l10n "s$rr_freq")" \ - || printf '[span .text .RRULE %s %s %s]' "$(l10n t_every)" "${rr_int}" "$(l10n $rr_freq)" - case "$rrule $rr_freq" in - *COUNT*DAILY*) - printf '[span .text %s %s]' "$(l10n t_until)" "$(date -d "$dts_date + $((rr_int * rr_count)) day" "+%A %B %d, %Y - %H:%M")" - ;; - *COUNT*WEEKLY*) - printf '[span .text %s %s]' "$(l10n t_until)" "$(date -d "$dts_date + $((rr_int * rr_count)) week" "+%A %B %d, %Y - %H:%M")" - ;; - *COUNT*MONTHLY*) - printf '[span .text %s %s]' "$(l10n t_until)" "$(date -d "$dts_date + $((rr_int * rr_count)) month" "+%A %B %d, %Y - %H:%M")" - ;; - *COUNT*YEARLY*) - printf '[span .text %s %s]' "$(l10n t_until)" "$(date -d "$dts_date + $((rr_int * rr_count)) year" "+%A %B %d, %Y - %H:%M")" - ;; - *UNTIL*) - printf '[span .text %s %s]' "$(l10n t_until)" "$(date -d "$rr_until" "+%A %B %d, %Y - %H:%M")" - ;; - esac - ;; - attendance);; - COMMENT)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")" - seq 1 $cnt |while read c; do - printf '[p .item .%s . %s]' "$item" \ - "$(pdi_value "$course" "$item" $c |unescape |HTML)" - done - ;; - *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")" - seq 1 $cnt |while read c; do - printf '[span .item .%s . %s]' "$item" \ - "$(pdi_value "$course" "$item" $c |unescape |HTML)" - done - ;; - esac - done -} - -edit_item(){ - local course="$1" - local item cnt c - shift 1 - - for item in $@; do - cnt="$(pdi_count "$course" "$item")" - [ "$cnt" -lt 1 ] && cnt=1 - - case $item in - DTSTART) - local dtstart="$(pdi_value "$course" DTSTART |cal_date)" - local ystart="${dtstart%%-*}"; ystart="${ystart##* }" - local mstart="${dtstart#*-}"; mstart="${mstart%%-*}" - local dstart="${dtstart##*-}"; dstart="${dstart%% *}" - local hhstart="${dtstart##* }"; hhstart="${hhstart%%:*}" - local mmstart="${dtstart##* }"; mmstart="${mmstart#*:}"; mmstart="${mmstart%:*}" - local m mn cdow d - - cat <<-EOF - [h3 . $(l10n DTSTART)] - [input type="number" name="DTS_YEAR" value="${ystart}" placeholder="$(l10n YYYY)"] - [select name="DTS_MONTH" onchange="this.form.submit();" - $(m=1; for mn in $(l10n January February March April May June July August September October November December); do - printf ' [option value="%02i" %s . %s]\n' $m "$(selected $m $mstart)" "$mn" - m=$((m+1)) - done) - ][submit "DTS" "update" . $(l10n edit_dtscal)] - [table .dtscalt - [tr $(printf '[th . %s]' $(l10n Mon Tue Wed Thu Fri Sat Sun))] - [tr $( - local cdow d - cdow="$(date -d ${ystart}-${mstart}-1 +%u)" - seq 2 $cdow |xargs -n1 printf '[td .padding .%s]' - d=1; while [ "$d" -lt 29 ] || [ "$(date -d ${ystart}-${mstart}-${d} +%m)" -eq "$mstart" ]; do - [ $cdow -eq 1 -a $d -ne 1 ] && printf ']\n [tr ' - printf '[td [input type="radio" name="DTS_DAY" #DTSCAL_%i value="%02i" %s][label for="DTSCAL_%i" %i]]' \ - $d $d "$(checked $d $dstart)" $d $d - d=$((d + 1)); cdow=$(((cdow + 1) % 7)) - done 2>/dev/null - )] - ] - [label .DTSTIME $(l10n time):] - [input type="number" name="DTS_HOUR" value="$hhstart" min="0" max="23"]:[input type="number" name="DTS_MINUTE" value="$mmstart" min="0" max="59"] - EOF - ;; - RRULE) - local dtstart="$(pdi_value "$course" DTSTART |cal_date)" - local ystart="${dtstart%%-*}"; ystart="${ystart##* }" - local mstart="${dtstart#*-}"; mstart="${mstart%%-*}" - local dstart="${dtstart##*-}"; dstart="${dstart%% *}" - - local rrule="$(pdi_value "$course" RRULE)" - local rr_int="$(printf %s "$rrule" |sed -nE 's;^(.*\;[ ]*)?INTERVAL=([0-9]+)(\;.*)?$;\2;p')" - local rr_count="$(printf %s "$rrule" |sed -nE 's;^(.*\;[ ]*)?COUNT=([0-9]+)(\;.*)?$;\2;p')" - local rr_freq="$(printf %s "$rrule" |sed -nE 's;^(.*\;[ ]*)?FREQ=(DAILY|WEEKLY|MONTHLY|YEARLY)(\;.*)?$;\2;p')" - local rr_until="$(printf %s "$rrule" |sed -nE 's;^(.*\;[ ]*)?UNTIL=([0-9]{8}T[0-9]{6}Z)(\;.*)?$;\2;p')" - local rr_uyear="${rr_until%????T??????Z}" - local rr_umonth=${rr_until#????}; rr_umonth="${rr_umonth%??T??????Z}" - local rr_uday=${rr_until#??????}; rr_uday="${rr_uday%T??????Z}" - local rr_limit="ETERN" - [ "$rr_count" ] && [ "$rr_count" -ge 0 ] && rr_limit="COUNT" - [ "$rr_uyear" ] && [ "$rr_uyear" -ge 0 ] && rr_limit="UNTIL" - - cat <<-EOF - [h3 . $(l10n "$item")] - [span .item . $(l10n t_every) - [input type="number" .RRULE .INTERVAL name="RRULE_INTERVAL" placeholder="#N" value="${rr_int:-1}" min="1"] - [select .RRULE .FREQ name="RRULE_FREQ" - $(for f in DAILY WEEKLY MONTHLY YEARLY; do - printf ' [option value="%s" %s . %s]\n' "$f" "$(selected $f "$rr_freq")" "$(l10n $f)" - done) - ]] - [label .item [input type="radio" name="RRULE_LIMIT" value="ETERN" $(checked "$rr_limit" ETERN)] $(l10n t_eternal)] - [label .item - [input type="radio" name="RRULE_LIMIT" value="COUNT" $(checked "$rr_limit" COUNT)] - [input type="number" .RRULE .COUNT name="RRULE_COUNT" placeholder="#N" value="${rr_count:-1}" min="1"] $(l10n t_times) - ] - [label .item - [input type="radio" name="RRULE_LIMIT" value="UNTIL" $(checked "$rr_limit" UNTIL)] $(l10n t_until) - [input type="number" .RRULE .UYEAR name="RRULE_UYEAR" placeholder="$(l10n YYYY)" value="${rr_uyear:-$ystart}" min="$ystart"] - [input type="number" .RRULE .UMONTH name="RRULE_UMONTH" placeholder="$(l10n MM)" value="${rr_umonth:-$mstart}" min="1" max="12"] - [input type="number" .RRULE .UDAY name="RRULE_UDAY" placeholder="$(l10n DD)" value="${rr_uday:-$dstart}" min="1" max="31"] - ] - EOF - ;; - COMMENT) - printf '[h3 %s]' "$(l10n "$item")" - seq 1 $cnt |while read c; do - printf '[checkbox "%s_delete_%i" "true" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \ - "$item" $c "$item" $c "$item" $c "$(l10n delete)" - printf '' \ - "$item" "$item" "$(pdi_value "$course" "$item" $c |unescape |HTML)" - done - printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)" - ;; - attendance) - printf '[h3 %s]' "$(l10n course_attendance)" - printf '[div .attendance\n' - for vcf in "$_DATA"/vcard/*.vcf; do - fn="$(pdi_value "$(pdi_load "$vcf")" FN)" - printf '%s/%s\n' "${vcf##*/}" "$fn" - done \ - | sort -t/ -k2 \ - | while IFS=/ read -r vcf fn; do - printf '[span .item [input type="checkbox" id="att%s" name="attendance" value="%s" %s][label for="att%s" . %s]]' \ - "$vcf" "$vcf" "$(grep -qxF "${coursefile##*/} $vcf" "$_DATA/mappings/attendance" && printf 'checked="checked"')" "$vcf" "$fn" - done - printf ']' - ;; - SUMMARY) - printf '[h3 %s]' "$(l10n "$item")" - printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \ - "$item" "$item" "$(pdi_value "$course" "$item" |unescape |HTML)" "$(l10n "$item")" - ;; - *) - printf '[h3 %s]' "$(l10n "$item")" - seq 1 $cnt |while read c; do - printf '[checkbox "%s_delete_%i" "true" .delete #%s_delete_%i][label for="%s_delete_%i" %s]' \ - "$item" $c "$item" $c "$item" $c "$(l10n delete)" - printf '[input .item .%s name="%s" value="%s" placeholder="%s"]' \ - "$item" "$item" "$(pdi_value "$course" "$item" $c |unescape |HTML)" "$(l10n "$item")" - done - printf '[button type="submit" name="action" value="addfield %s" %s ]' "$item" "$(l10n edit_addfield)" - ;; - esac - done -} diff --git a/email/email.css b/email/email.css deleted file mode 100644 index e935189..0000000 --- a/email/email.css +++ /dev/null @@ -1,157 +0,0 @@ -/* -# Copyright 2014 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . -*/ - -.filter { - display: block; - width: 128ex; - border-width: 1px; - border-style: solid; - border-radius: 4px 4px 0 0; - margin: .5em auto .25em auto; - padding: .25em 1ex .25em 1ex; - background: #EFF; -} - -.filter > .label { - display: block; - font-weight: bold; - font-size: 1.2em; - border-style: none none solid none; - border-width: 1px; - margin: 0em 0ex .5em 0ex; - background: #EEF; -} - -.filter .search { - margin: 0em 2ex .5em 2ex; -} -.filter .search .label { - display: inline-block; - width: 12ex; - font-weight: bold; - margin-top: .5em; -} -.filter .search input[type="radio"] { - margin-top: .5em; - margin-left: 1ex; -} -.filter .search button { - margin-top: .5em; -} - -.filter .search input[type="text"] { - width: 124ex; -} - -.newcard { - display: block; - width: 126ex; - border-width: 1px; - border-style: solid; - border-radius: 0 0 4px 4px; - margin: .25em auto 1em auto; - padding: .25em 2ex .25em 2ex; - background: #EFF; -} - -.cardlist .card { - display: block; - width: 130ex; - border-style: solid; - border-width: 1px; - margin: .25em auto; - padding: 0; - overflow: auto; - background: #FFF; -} - -.cardlist .card .section { - display: inline-block; - float:left; - width: 20ex; - margin: .125em .25ex .5ex .25ex; - padding: 0 .2em .2em .2em; - background: #EEE; -} -.cardlist .card .section a.attendance { - display: inline-block; - margin-right: 1ex; - word-wrap: break-word; -} - -.cardlist .card .attendance { - width: 83.5ex; -} -.cardlist .card .attendance .check { - display: inline-block; - width: 27ex; -} - -.cardlist .card .control { - float: right; - text-align: right; - margin-right: 0; - background: #EEF; -} -.cardlist .card .control .item { - color: #008; - margin-top: .2em; - margin-right: 1ex; -} -.cardlist .card .control a.item { - min-width: 10ex; - border-style: solid double solid solid; - border-width: 1px 3px 1px 1px; - border-color: #000; - padding: .1em 1ex; - background: #FFF; -} -.cardlist .card .control a.item:hover{ - border-width: 1px 1px 1px 1px; -} - -.cardlist .card .section .sectitle { - display: block; - font-weight: bold; - margin: .2em .2em .2em .2em; -} - -.cardlist .card .section .item { - display: block; - max-width: 20ex; - word-wrap: break-word; -} - -.cardlist .card .section textarea.NOTE { - min-height: 6em; -} -.cardlist .card .section textarea.ADR { - min-height: 4em; -} - -.cardlist .card .section .PHOTO { - width: 20ex; - max-heigth: 30ex; -} - -.cardlist .card .section .FN { - font-weight: bold; - font-size: 1.2em; -} - diff --git a/email/email.html.sh b/email/email.html.sh deleted file mode 100755 index 7f93893..0000000 --- a/email/email.html.sh +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2014 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -cat < - $(l10n filter_label) - - - -
-
-EOF - -# vi:set filetype=html: diff --git a/email/email.sh b/email/email.sh deleted file mode 100755 index c79876f..0000000 --- a/email/email.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/zsh - -# Copyright 2014 Paul Hänsch -# -# This file is part of Confetti. -# -# Confetti is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Confetti is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with Confetti. If not, see . - -[ -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() { - ls -1 ${_DATA}/ical/*ics |while read file; do - icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")" - echo "$(date -d "$icstime" "+%u %H%M%S")\t$file" - done |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:' -}