From 41083d642a4468fbec3146c3b1c71dc9c1179fe2 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 12 Mar 2014 19:21:23 +0000 Subject: [PATCH] alphabetic ordering of course attendees svn path=/trunk/; revision=43 --- pages/courses.sh | 24 ++++++++++++++++++++++++ templates/view_course.sh | 14 ++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/pages/courses.sh b/pages/courses.sh index ea708e9..f604515 100755 --- a/pages/courses.sh +++ b/pages/courses.sh @@ -33,6 +33,30 @@ listcourses() { esac |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:' } +list_attendance() { + id="$1" + sed -rn 's:'$id'\t(.+)$:\1:p' "$_DATA/mappings/attendance" |while read each; do + n_last="$( sed -rn 's:^N(;.+)*\:([^;]*;){0} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" + n_first="$( sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" + n_middle="$(sed -rn 's:^N(;.+)*\:([^;]*;){2} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" + n_pre="$( sed -rn 's:^N(;.+)*\:([^;]*;){3} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" + n_post="$( sed -rn 's:^N(;.+)*\:([^;]*;){4} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" + byear="$( sed -rn 's:^BDAY(;.+)*\:([0-9]{4})(-[0-9][0-9]){2}.*$:\2:p' "$_DATA/vcard/$each")" + #aname="${n_pre} ${n_first} ${n_middle} ${n_last} ${n_post} (*${byear})" + aname="${n_pre} ${n_first} ${n_middle} ${n_last} ${n_post}" + echo "$each $aname" |tr -d '\r' + done +} + +course_mail() { + id="$1" + coursemail="" + sed -rn 's:'$id'\t(.+)$:\1:p' "$_DATA/mappings/attendance" |while read each; do + coursemail="$coursemail$(sed -rn 's:^EMAIL(;.+)*\:(.+)\r$:\2,:p' "$_DATA/vcard/$each")" + done + echo "$coursemail" +} + ics_parse() { tr -d '\n' <"$1" |sed -r 's:\r ::g;s:\r:\n:g' |tr -d '\r' \ | sed -r 's:^([^;\:]+)(;[^"\:]+|;"[^"]+")*\:(.*)$:key="\1"\nvalue="\3"\ntag=\2:g' \ diff --git a/templates/view_course.sh b/templates/view_course.sh index 1e6b92d..107fc79 100755 --- a/templates/view_course.sh +++ b/templates/view_course.sh @@ -71,23 +71,13 @@ echo ' ' echo '
' echo ' '$(l10n course_attendance)'' -sed -rn 's:'$id'\t(.+)$:\1:p' "$_DATA/mappings/attendance" |while read each; do - n_last="$( sed -rn 's:^N(;.+)*\:([^;]*;){0} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" - n_first="$( sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" - n_middle="$(sed -rn 's:^N(;.+)*\:([^;]*;){2} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" - n_pre="$( sed -rn 's:^N(;.+)*\:([^;]*;){3} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" - n_post="$( sed -rn 's:^N(;.+)*\:([^;]*;){4} *([^;]*).*$:\3:p' "$_DATA/vcard/$each")" - aname="${n_pre} ${n_first} ${n_middle} ${n_last} ${n_post}" - echo ' '$aname'' - - coursemail="$coursemail$(sed -rn 's:^EMAIL(;.+)*\:(.+)\r$:\2,:p' "$_DATA/vcard/$each")" -done +list_attendance "$id" |sort -k 2 |sed -r 's:^([^ ]+) (.*)$:\2:' echo '
' echo '
' echo ' '$(l10n edit)'' echo ' '$(l10n ics_export)'' -echo ' '$(l10n course_mail)'' +echo ' '$(l10n course_mail)'' echo '
' echo '' echo '' -- 2.39.2