-edit_card() {
- n_last="$(echo "$values[N]" |sed -r 's:^([^;]*;){0} *([^;]*);.*$:\2:')"
- n_first="$(echo "$values[N]" |sed -r 's:^([^;]*;){1} *([^;]*);.*$:\2:')"
- n_middle="$(echo "$values[N]" |sed -r 's:^([^;]*;){2} *([^;]*);.*$:\2:')"
- n_pre="$(echo "$values[N]" |sed -r 's:^([^;]*;){3} *([^;]*);.*$:\2:')"
- n_post="$(echo "$values[N]" |sed -r 's:^([^;]*;){4} *([^;]*);*$:\2:')"
+check_gen() {
+ [ "$value[GENDER]" = "$1" ] && echo 'selected="selected"'
+}
+edit_card() {
+ n_last="$(echo "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
+ n_first="$(echo "$values[N]" |sed -rn 's:^([^;]*;){1} *([^;]*).*$:\2:p')"
+ n_middle="$(echo "$values[N]" |sed -rn 's:^([^;]*;){2} *([^;]*).*$:\2:p')"
+ n_pre="$(echo "$values[N]" |sed -rn 's:^([^;]*;){3} *([^;]*).*$:\2:p')"
+ n_post="$(echo "$values[N]" |sed -rn 's:^([^;]*;){4} *([^;]*)*$:\2:p')"
echo ' <div class="section basic">'
- echo ' <span class="sectitle">'$(l10n NAME)'</span>'
+ echo ' <span class="sectitle">'$(l10n N)'</span>'
echo ' <input class="item N" name="3N" placeholder="'$(l10n n_pre)'" value="'$n_pre'" />'
echo ' <input class="item N" name="1N" placeholder="'$(l10n n_first)'" value="'$n_first'" />'
echo ' <input class="item N" name="2N" placeholder="'$(l10n n_middle)'" value="'$n_middle'" />'
echo ' <input class="item N" name="0N" placeholder="'$(l10n n_last)'" value="'$n_last'" />'
echo ' <input class="item N" name="4N" placeholder="'$(l10n n_post)'" value="'$n_post'" />'
- [ -n "$value[GENDER]" ] && \
- echo ' <span class="item GENDER">'$(l10n $values[GENDER])'</span>'
+ if [ -n "$value[GENDER]" ]; then
+ echo ' <div class="section control">'
+ echo ' <select class="item control" name="newfield">'
+ echo ' <option value="" disabled="disabled">'$(l10n GENDER)'</option>'
+ echo ' <option value="female" disabled="disabled" '$(check_gen female)'>'$(l10n female)'</option>'
+ echo ' <option value="male" disabled="disabled" '$(check_gen male)'>'$(l10n male)'</option>'
+ echo ' <option value="other" disabled="disabled" '$(check_gen other)'>'$(l10n gender_other)'</option>'
+ echo ' </select>'
+ fi
for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item NICKNAME">aka. '$values[$n]'</span>'
+ echo ' <input class="item NICKNAME" name="NICKNAME" placeholder="'$(l10n NICKNAME)'" value="'$values[$n]'" />'
done
- [ -n "$values[BDAY]" ] &&\
- echo ' <span class="item BDAY"><b>*:</b> '$values[BDAY]'</span>'
+ if [ -n "$values[BDAY]" ]; then
+ echo ' <span class="sectitle">'$(l10n BDAY)'</span>'
+ echo ' <input class="item BDAY" name="BDAY" value="'$values[BDAY]'" />'
+ fi
if [ -n "$values[SOUND]" ]; then
echo ' <audio controls="controls" class="item SOUND">'
echo ' <source type="audio/ogg" src="data:audio/ogg;base64,'$values[SOUND]'" />'
echo ''
echo ' <div class="section phone">'
echo ' <span class="sectitle">'$(l10n TEL)'</span>'
- for n in TEL TEL{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item TEL">'$tags[${n}_TYPE]' '$values[$n]'</span>'
+ print -l ${(k)values} |egrep '^TEL[0-9]*$' |while read n; do
+ echo ' <input class="item TEL" name="TEL" value="'$values[$n]'" />'
done
echo ' </div>'
echo ''
echo ' <div class="section message">'
echo ' <span class="sectitle">'$(l10n EMAIL)'</span>'
for n in EMAIL EMAIL{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item EMAIL"><a href="mailto:'$values[$n]'">'$values[$n]'</a></span>'
+ echo ' <input class="item EMAIL" name="EMAIL" value="'$values[$n]'" />'
done
[ -n "$values[IMPP]" ] && \
echo ' <span class="sectitle">'$(l10n IMPP)'</span>'
for n in IMPP IMPP{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item IMPP">'$tags[${n}_TYPE]' <a href="'$values[$n]'">'$values[$n]'</a></span>'
+ echo ' <input class="item IMPP" name="IMPP" value="'$values[$n]'" />'
done
echo ' </div>'
echo ''
echo ' <div class="section address">'
echo ' <span class="sectitle">'$(l10n ADR)'</span>'
for n in ADR ADR{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item ADR">'$values[$n]'</span>'
+ echo ' <textarea class="item ADR" name="ADR">'$values[$n]'</textarea>'
done
[ -n "$values[URL]" ] && \
echo ' <span class="sectitle">'$(l10n URL)'</span>'
for n in URL URL{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item URL"><a href="'$values[$n]'">'$values[$n]'</a></span>'
+ echo ' <input class="item URL" name="URL" value="'$values[$n]'" />'
done
echo ' </div>'
echo ''
echo ' <div class="section note">'
echo ' <span class="sectitle">'$(l10n NOTE)'</span>'
for n in NOTE NOTE{0..10}; do [ -n "$values[$n]" ] &&\
- echo ' <span class="item IMPP">'$values[$n]'</span>'
+ echo ' <textarea class="item NOTE" name="NOTE">'$values[$n]'</textarea>'
done
echo ' </div>'
echo ''