1 # Copyright 2014, 2015 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]="$(uuidgenerator)"
36 <form id="$id" class="card" action="?action=update_card" method="POST">
37 <input type="hidden" name="card" value="${id}"/>
38 <div class="section basic">
40 <input class="item N" name="3N" placeholder="$(l10n n_pre)" value="$n_pre" />
41 <input class="item N" name="1N" placeholder="$(l10n n_first)" value="$n_first" />
42 <input class="item N" name="2N" placeholder="$(l10n n_middle)" value="$n_middle" />
43 <input class="item N" name="0N" placeholder="$(l10n n_last)" value="$n_last" />
44 <input class="item N" name="4N" placeholder="$(l10n n_post)" value="$n_post" />
46 <select class="item GENDER" name="GENDER">
47 <option value="" disabled="disabled">$(l10n GENDER)</option>
48 <option value="female" $(check_gen female)>$(l10n gender_female)</option>
49 <option value="male" $(check_gen male)>$(l10n gender_male)</option>
50 <option value="other" $(check_gen other)>$(l10n gender_other)</option>
51 <option value="none" $(check_gen none)>$(l10n gender_none)</option>
54 $(for n in NICKNAME NICKNAME{0..10}; do
55 echo "${values[$n]:+<input class="item NICKNAME" name="NICKNAME" placeholder="$(l10n NICKNAME)" value="$values[$n]" />}"
59 <input class="item BDAY" name="BDAY" value="$values[BDAY]" />
61 <h3>$(l10n X-ZACK-JOINDATE)</h3>
62 <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 ' <h3>'$(l10n X-ZACK-LEAVEDATE)'</h3>'
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 ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
74 ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
77 <div class="section phone">
79 <input class="item TEL" name="TEL" value="$values[TEL]" />
80 $(for n in TEL{0..10}; do
81 echo "${values[$n]:+<input class="item TEL" name="TEL" value="'$values[$n]'" />}"
85 <div class="section message">
86 <h3>$(l10n EMAIL)</h3>
87 <input class="item EMAIL" name="EMAIL" value="$values[EMAIL]" />
88 $(for n in EMAIL{0..10}; do
89 echo "${values[$n]:+<input class="item EMAIL" name="EMAIL" value="$values[$n]" />}"
91 ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
92 $(for n in IMPP IMPP{0..10}; do
93 echo "${values[$n]:+<input class="item IMPP" name="IMPP" value="$values[$n]" />}"
97 <div class="section address">
99 <textarea class="item ADR" name="ADR">$values[ADR]</textarea>
100 $(for n in ADR{0..10}; do
101 echo "${values[$n]:+<textarea class="item ADR" name="ADR">$values[$n]</textarea>}"
103 ${values[URL]:+<h3>$(l10n URL)</h3>}
104 $(for n in URL URL{0..10}; do
105 echo "${values[$n]:+<input class="item URL" name="URL" value="$values[$n]" />}"
109 <div class="section note">
110 <h3>$(l10n NOTE)</h3>
111 <textarea class="item NOTE" name="NOTE">$values[NOTE]</textarea>
112 $(for n in NOTE{0..10}; do
113 echo "${values[$n]:+<textarea class="item NOTE" name="NOTE">$values[$n]</textarea>}"
117 <div class="section attendance">
118 <h3>$(l10n course_attendance)</h3>
119 $(listcourses |while read each; do
120 cname="$(sed -rn 's:^SUMMARY\:(.*)$:\1:p' "$_DATA/ical/$each")"
121 echo '<label><input type="checkbox" name="attendance" value="'$each'" '$(check_a "$each")'/>'$cname'</label>'
125 <div class="control">
126 <select class="item" name="newfield">
127 <option value="" disabled="disabled" selected="selected">$(l10n edit_addfieldtext)</option>
128 $(for f in $SUP_FIELDS; do echo "<option value=\"$f\">$(l10n $f)</option>"; done)
130 ><button class="item" type="submit" name="action" value="addfield">$(l10n edit_addfield)</button>
131 <button class="item" type="submit" name="action" value="update">$(l10n edit_update)</button>
132 <button class="item" type="submit" name="action" value="delete">$(l10n edit_delete)</button>
133 <button class="item" type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
135 <input type="hidden" name="UID" value="$values[UID]"/>