#cardlist {}
.cardlist .card {
- margin: 4px 10%;
+ margin: 4px 5%;
border-width: 1px;
border-style: solid;
- padding: .5em 1em 1em 120px;
+ padding: 0;
overflow: auto;
- min-height: 160px;
+ width:130ex;
display: block;
}
-.cardlist .card .PHOTO {
- float: left;
- position: relative;
- left: -110px;
- border-width: 1px;
- border-style: solid;
- padding: 1px;
- margin: 1em -110px 1em .5em;
- width: 96px;
- max-height: 144px;
+.cardlist .card .section {
+ float:left;
+ display: inline-block;
+ width: 20ex;
+ margin: .125em .5ex .5ex .5ex;
+ background: #EEE;
+ padding: 0 .2em .2em .2em;
+}
+.cardlist .card .control {
+ float: right;
+ background: #EEF;
+ text-align: right;
+ margin-right: 0;
+}
+.cardlist .card .control .item {
+ margin-right: 1ex;
+ border-style: solid double solid solid;
+ border-width: 1px 3px 1px 1px;
+ background: #FFF;
+ padding: .1em 1ex;
+ min-width: 10ex;
+ margin-top: .2em;
+ border-color: #000;
}
-
-.cardlist .card .item {
+.cardlist .card .control .item:hover{
+ border-width: 1px 1px 1px 1px;
+}
+
+.cardlist .card .section .sectitle {
display: block;
- white-space: nowrap;
- height: 1.2em;
+ font-weight: bold;
+ margin: .2em .2em .2em .2em;
}
-.cardlist .card .KEY {
- display: inline;
- margin: 0px;
- font: normal bold 1em sans-serif;
+.cardlist .card .section .item {
+ max-width: 20ex;
+ display: block;
+ word-wrap: break-word;
}
-.cardlist .card .VALUE {
- display: inline;
- margin: 0px;
- font: normal normal 1em sans-serif;
+.cardlist .card .section .PHOTO {
+ width: 20ex;
+ max-heigth: 30ex;
}
-.cardlist .card .FN {
- margin: .25em .5em 1em 0px;
- font: normal bold 2em sans-serif;
+.cardlist .card .section .FN {
+ font-weight: bold;
+ font-size: 1.2em;
}
EOF
-view_card_item() {
- case "$key" in
- BEGIN|VERSION|END|N|NICKNAME);;
- PHOTO)
- echo "<img class=\"PHOTO\" src=\"data:image/$tag[TYPE];base64,$value\"/>"
- ;;
- FN)
- echo "<h2 CLASS=\"FN\">$value</h2>"
- ;;
- *)
- echo -n "<span class=\"item\"><span class=\"KEY $key\">$(l10n "$key")"
- [ -n "$tag[TYPE]" ] && echo -n "($tag[TYPE])"
- echo ":</span>"
- ;|
- EMAIL)
- echo "<a href=\"mailto:$value\" class=\"VALUE $key\">$value</a></span>"
- ;;
- IMPP)
- echo "<a href=\"$value\" class=\"VALUE $key\">"$(echo "$value" |cut -d: -f2-)"</a></span>"
- ;;
- *)
- echo "<span class=\"VALUE $key\">$value</span></span>"
- ;;
- esac
+print_card() {
+ echo ' <div class="section basic">'
+ echo ' <span class="item FN">'$values[FN]'</span>'
+ [ -n "$value[GENDER]" ] && \
+ echo ' <span class="item GENDER">'$(l10n $values[GENDER])'</span>'
+ for n in NICKNAME NICKNAME{0..10}; do [ -n "$values[$n]" ] &&\
+ echo ' <span class="item NICKNAME">aka. '$values[$n]'</span>'
+ done
+ [ -n "$values[BDAY]" ] &&\
+ echo ' <span class="item BDAY"><b>*:</b> '$values[BDAY]'</span>'
+ 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 ' </audio>'
+ fi
+ [ -n "$values[PHOTO]" ] &&\
+ echo ' <img class="item PHOTO" src="data:image/'$tags[PHOTO_TYPE]';base64,'$values[PHOTO]'" />'
+ [ -n "$values[LOGO]" ] &&\
+ echo ' <img class="item LOGO" src="data:image/'$tags[LOGO_TYPE]';base64,'$values[LOGO]'" />'
+ echo ' </div>'
+ 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>'
+ 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>'
+ 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>'
+ 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>'
+ 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>'
+ 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>'
+ done
+ echo ' </div>'
+ echo ''
+ echo ' <div class="section control">'
+ echo ' <a class="item control" href="?page=attendees&edit='${id}'#'${id}'">'$(l10n edit)'</a>'
+ echo ' <a class="item control" href="?export=vcard&card='${id}'">'$(l10n vcf_export)'</a>'
+ echo ' </div>'
}
view_attendee() { #Parameter: Cardfile
- cardfile="vcard/$1"
- cachefile="cache/${1}.cache"
+ id="$1"
+ cardfile="vcard/$id"
+ cachefile="cache/${id}.cache"
unset key
- [ "$cachefile" -nt "$cardfile" ] && cat "$cachefile" \
- || vcf_parse "$cardfile" |while read -r line; do
- declare -A tag
- case "$line" in
- value*) eval "$line";;
- tag*) eval "$line";;
- key*)
- if [ -z "$key" ]; then
- eval "$line"
- else
- view_card_item
- eval "$line"
- unset value
- unset tag
- fi
- ;;
- esac
- done |tee "$cachefile"
+ if [ "$cachefile" -nt "$cardfile" ]; then
+ cat "$cachefile"
+ else
+ declare -A tags
+ declare -A values
+ vcf_parse "$cardfile" |while read -r line; do
+ declare -A tag
+ case "$line" in
+ value*) eval "$line";;
+ tag*) eval "$line";;
+ key*)
+ if [ -z "$key" ]; then
+ eval "$line"
+ else
+ values[$key]="$value"
+ for t in ${(k)tag}; do
+ tags[${key}_$t]="$tag[$t]"
+ done
+ eval "$line"
+ if [ -n "$values[$key]" ]; then
+ n=0
+ while [ -n "$values[$key$n]" ]; do n=$(($n + 1)); done
+ key=$key$n
+ fi
+ unset value
+ unset tag
+ fi
+ ;;
+ esac
+ done
+ print_card |tee "$cachefile"
+ fi
}