1 # Copyright 2014 Paul Hänsch
3 # This file is part of Confetti.
5 # Confetti is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # Confetti is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Confetti. If not, see <http://www.gnu.org/licenses/>.
19 [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"'
22 egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"'
25 n_last="$(echo "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
26 n_first="$(echo "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')"
27 n_middle="$(echo "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')"
28 n_pre="$(echo "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
29 n_post="$(echo "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
31 SUP_FIELDS=(N NICKNAME GENDER BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE EMAIL TEL IMPP ADR URL NOTE)
33 [ -z "$values[UID]" ] && values[UID]="$(dbus-uuidgen)"
35 echo '<div id="'${id}'" class="card">'
36 echo '<form action="/?action=update_attendee" method="POST">'
37 echo '<input type="hidden" name="card" value="'${id}'"/>'
38 echo ' <div class="section basic">'
39 echo ' <span class="sectitle">'$(l10n N)'</span>'
40 echo ' <input class="item N" name="3N" placeholder="'$(l10n n_pre)'" value="'$n_pre'" />'
41 echo ' <input class="item N" name="1N" placeholder="'$(l10n n_first)'" value="'$n_first'" />'
42 echo ' <input class="item N" name="2N" placeholder="'$(l10n n_middle)'" value="'$n_middle'" />'
43 echo ' <input class="item N" name="0N" placeholder="'$(l10n n_last)'" value="'$n_last'" />'
44 echo ' <input class="item N" name="4N" placeholder="'$(l10n n_post)'" value="'$n_post'" />'
46 echo ' <select class="item GENDER" name="GENDER">'
47 echo ' <option value="" disabled="disabled">'$(l10n GENDER)'</option>'
48 echo ' <option value="female" '$(check_gen female)'>'$(l10n gender_female)'</option>'
49 echo ' <option value="male" '$(check_gen male)'>'$(l10n gender_male)'</option>'
50 echo ' <option value="other" '$(check_gen other)'>'$(l10n gender_other)'</option>'
51 echo ' <option value="none" '$(check_gen none)'>'$(l10n gender_none)'</option>'
54 for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\
55 echo ' <input class="item NICKNAME" name="NICKNAME" placeholder="'$(l10n NICKNAME)'" value="'$values[$n]'" />'
58 echo ' <span class="sectitle">'$(l10n BDAY)'</span>'
59 echo ' <input class="item BDAY" name="BDAY" value="'$values[BDAY]'" />'
61 echo ' <span class="sectitle">'$(l10n X-ZACK-JOINDATE)'</span>'
62 echo ' <input class="item X-ZACK-LEAVEDATE" name="X-ZACK-JOINDATE" value="'$values[X-ZACK-JOINDATE]'" />'
63 if [ -n "$values[X-ZACK-LEAVEDATE]" ]; then
64 echo ' <span class="sectitle">'$(l10n X-ZACK-LEAVEDATE)'</span>'
65 echo ' <input class="item X-ZACK-LEAVEDATE" name="X-ZACK-LEAVEDATE" value="'$values[X-ZACK-LEAVEDATE]'" />'
68 if [ -n "$values[SOUND]" ]; then
69 echo ' <audio controls="controls" class="item SOUND">'
70 echo ' <source type="audio/ogg" src="data:audio/ogg;base64,'$values[SOUND]'" />'
73 [ -n "$values[PHOTO]" ] &&\
74 echo ' <img class="item PHOTO" src="data:image/'$tags[PHOTO_TYPE]';base64,'$values[PHOTO]'" />'
75 [ -n "$values[LOGO]" ] &&\
76 echo ' <img class="item LOGO" src="data:image/'$tags[LOGO_TYPE]';base64,'$values[LOGO]'" />'
79 echo ' <div class="section phone">'
80 echo ' <span class="sectitle">'$(l10n TEL)'</span>'
81 echo ' <input class="item TEL" name="TEL" value="'$values[TEL]'" />'
82 for n in TEL{0..10}; do [ -n "$values[$n]" ] &&\
83 echo ' <input class="item TEL" name="TEL" value="'$values[$n]'" />'
87 echo ' <div class="section message">'
88 echo ' <span class="sectitle">'$(l10n EMAIL)'</span>'
89 echo ' <input class="item EMAIL" name="EMAIL" value="'$values[EMAIL]'" />'
90 for n in EMAIL{0..10}; do [ -n "$values[$n]" ] &&\
91 echo ' <input class="item EMAIL" name="EMAIL" value="'$values[$n]'" />'
93 [ -n "$values[IMPP]" ] && \
94 echo ' <span class="sectitle">'$(l10n IMPP)'</span>'
95 for n in IMPP IMPP{0..10}; do [ -n "$values[$n]" ] &&\
96 echo ' <input class="item IMPP" name="IMPP" value="'$values[$n]'" />'
100 echo ' <div class="section address">'
101 echo ' <span class="sectitle">'$(l10n ADR)'</span>'
102 echo ' <textarea class="item ADR" name="ADR">'$values[ADR]'</textarea>'
103 for n in ADR{0..10}; do [ -n "$values[$n]" ] &&\
104 echo ' <textarea class="item ADR" name="ADR">'$values[$n]'</textarea>'
106 [ -n "$values[URL]" ] && \
107 echo ' <span class="sectitle">'$(l10n URL)'</span>'
108 for n in URL URL{0..10}; do [ -n "$values[$n]" ] &&\
109 echo ' <input class="item URL" name="URL" value="'$values[$n]'" />'
113 echo ' <div class="section note">'
114 echo ' <span class="sectitle">'$(l10n NOTE)'</span>'
115 echo ' <textarea class="item NOTE" name="NOTE">'$values[NOTE]'</textarea>'
116 for n in NOTE{0..10}; do [ -n "$values[$n]" ] &&\
117 echo ' <textarea class="item NOTE" name="NOTE">'$values[$n]'</textarea>'
121 echo ' <div class="section attendance">'
122 echo ' <span class="sectitle">'$(l10n course_attendance)'</span>'
123 listcourses |while read each; do
124 cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")"
125 echo ' <span class="check attendance"><input type="checkbox" name="attendance" value="'$each'" '$(check_a "$each")'/>'$cname'</span>'
129 echo ' <div class="section control">'
130 echo ' <button class="item control" type="submit" name="action" value="addfield">'$(l10n edit_addfield)'</button>'
131 echo ' <select class="item control" name="newfield">'
132 echo ' <option value="" disabled="disabled" selected="selected">'$(l10n edit_addfieldtext)'</option>'
133 for f in $SUP_FIELDS; do echo "<option value=\"$f\">$(l10n $f)</option>"; done
135 echo ' <button class="item control" type="submit" name="action" value="update">'$(l10n edit_update)'</button>'
136 echo ' <button class="item control" type="submit" name="action" value="delete">'$(l10n edit_delete)'</button>'
137 echo ' <button class="item control" type="submit" name="action" value="cancel">'$(l10n edit_cancel)'</button>'
139 echo '<input type="hidden" name="UID" value="'$values[UID]'"/>'