]> git.plutz.net Git - lobster/commitdiff
enable support for phone number types
authorpaul <paul@plutz.net>
Sat, 27 Feb 2016 16:20:54 +0000 (16:20 +0000)
committerpaul <paul@plutz.net>
Sat, 27 Feb 2016 16:20:54 +0000 (16:20 +0000)
svn path=/trunk/; revision=88

actions/update_card.sh
pages/cards.sh
templates/attendees.css.sh
templates/edit_client.sh
templates/text_cards.sh
templates/text_courses.sh
templates/view_client.sh

index a810476a5ca3e6d66d71915d246852cd3f8e0977..f18c9ee3e659832c2da4e568a967385188220bf9 100755 (executable)
@@ -47,9 +47,10 @@ UID:${_POST[UID]}
 $(
 for field in $VCF_FIELDS; do
   for key in $field $field{0..100}; do
-    [ -z "$_POST[$key]" ] && break
+    [ -z "${_POST[$key]+x}" ] && break
     value="$(printf %s "$_POST[$key]" |sed -r ':a;N;$!ba;s:\n:\\n:g;s:\r:\\r:g')"
-    printf '%s:%s\n' "${field}" "$value"
+    [ "${key%%[0-9]*}" = TEL ] && tag="TYPE=${_POST[phonetype${key#TEL}]}" || tag=''
+    [ -n "$value" ] && printf '%s:%s\n' "${field}${tag:+;$tag}" "$value"
   done
 done
 [ "${_POST[action]}" = addfield ] && printf '%s:\n' "${_POST[newfield]}"
index d1170b0ada1f5cb767e4f04af476b2fcc6b6029d..50fee63b76c70040b1a776172e19d3385337b5f4 100755 (executable)
@@ -19,6 +19,9 @@
 
 [ -z "${_GET[order]}" ] && _GET[order]="firstname"
 
+BR='
+'
+
 listcourses() {
   ls -1 ${_DATA}/ical/*ics |while read file; do
     icstime="$(sed -rn 's:^DTSTART\:(TZID=.*\:)?([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z?\r$:\2-\3-\4 \5\:\6\:\7:p' "$file")"
@@ -115,7 +118,7 @@ vcf_parse() {
     case "$line" in
       key=*) printf %s\\n "$line"
        ;;
-      value=*) printf %s\\n "$line"
+      value=*) printf %s\\n "${line}"
        ;;
       tag=*) ot=''
             printf %s "$line" \
@@ -154,7 +157,7 @@ view_card() {  #Parameter: Cardfile
           if [ -z "$key" ]; then
             eval "$line"
           else
-            values[$key]="$value"
+            values[$key]="${value//\\r\\n/$BR}"
             for t in ${(k)tag}; do
               tags[${key}_$t]="$tag[$t]"
             done
@@ -192,7 +195,7 @@ edit_card() {  #Parameter: Cardfile
         if [ -z "$key" ]; then
           eval "$line"
         else
-          [ -n "$value" ] && values[$key]="$value" || values[$key]='\r'
+          [ -n "$value" ] && values[$key]="${value//\\r\\n/$BR}" || values[$key]='\r'
           for t in ${(k)tag}; do
             tags[${key}_$t]="$tag[$t]"
           done
index 036ad0428c66226337fb33a38f5d9d5def0b7d46..b7c800ebd3a9b20cda73231581301727bf699139 100755 (executable)
@@ -134,6 +134,35 @@ cat <<EOF
   margin-top: 0;
 }
 
+.card .section .item {
+  display: block;
+  max-width: 100%;
+  word-wrap: break-word;
+}
+.card .section .item label {
+  font-weight: bold;
+}
+
+.card .section textarea.NOTE {
+  min-height: 6em;
+}
+.card .section textarea.ADR {
+  min-height: 4em;
+}
+
+.card .section .PHOTO {
+  width: 100%;
+  max-height: 10em;
+}
+.card .section .GENDER { display: inline-block; padding-right: .5ex;}
+.card .section .BDAY { display: inline-block;}
+
+.card .section select {
+  display: block;
+  background-color: #FFF;
+  border: 1px solid black;
+}
+
 .card .section.attendance ul { margin: 0; padding: 0; }
 .card .section.attendance ul li {
   display: block;
@@ -188,31 +217,10 @@ form.card .insurance input[type=radio]:checked + label + input + label + select,
 form.card .insurance input[type=radio]:checked + label + select + input {
   display: block;
   border: 1px solid black;
+  background-color: #FFF;
   border-width: 0 1px 1px 1px;
   padding: .25ex 0;
   margin-top: -1px;
-  background-color: #FFF;
-}
-
-.card .section .item {
-  display: block;
-  max-width: 100%;
-  word-wrap: break-word;
-}
-.card .section .item label {
-  font-weight: bold;
-}
-
-.card .section textarea.NOTE {
-  min-height: 6em;
-}
-.card .section textarea.ADR {
-  min-height: 4em;
-}
-
-.card .section .PHOTO {
-  width: 100%;
-  max-height: 10em;
 }
 
 EOF
index 586fa697b074d2d1502f79807ae175ae2438a64b..2b0c004bf07e0daeb5728f9c032c02b86a9c0320 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
+setchecked() {
+  printf 'checked="checked"'
+}
+setselected() {
+  printf 'selected="selected"'
+}
 check_gen() {
-  [ "$values[GENDER]" = "$1" ] && echo 'selected="selected"'
+  [ "$values[GENDER]" = "$1" ] && setselected
 }
 check_a() {
-  egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && echo 'checked="checked"'
+  egrep -q "^${1}.${id}$" "$_DATA/mappings/attendance" && setchecked
+}
+teltype() {
+  cat <<-EOF
+       <select class="item phonetype" name="phonetype">
+         <option value="" disabled="disabled" $([ -z "$1" ] && setselected )>$(l10n phone_typeselect)</option>
+         <option value=""></option>
+         <option value="HOME" $([ "$1" = HOME ] && setselected)>$(l10n phone_home)</option>
+         <option value="CELL" $([ "$1" = CELL ] && setselected)>$(l10n phone_cell)</option>
+         <option value="WORK" $([ "$1" = WORK ] && setselected)>$(l10n phone_work)</option>
+         <option value="FAX"  $([ "$1" = FAX  ] && setselected)>$(l10n phone_fax )</option>
+       </select>
+       EOF
 }
 
 n_last="$(printf %s "$values[N]" |sed -rn 's:^([^;]*;){0} *([^;]*).*$:\2:p')"
@@ -85,13 +103,13 @@ cat <<END_HTML
 
   <div class="section phone">
     <h3>$(l10n TEL)</h3>
-    <input class="item TEL" name="TEL" value="$values[TEL]" />
+    $(teltype "${tags[TEL_TYPE]}")<input class="item TEL" name="TEL" value="$values[TEL]" />
     $(for n in TEL{0..10}; do
-      echo "${values[$n]:+<input class="item TEL" name="TEL" value="'$values[$n]'" />}"
+      printf "${values[$n]:+$(teltype "${tags[$n_TYPE]}")<input class="item TEL" name="TEL" value="'$values[$n]'" />}"
     done)
     ${values[EMAIL]:+<h3>$(l10n EMAIL)</h3>}
     $(for n in EMAIL EMAIL{0..10}; do
-      echo "${values[$n]:+<input class="item EMAIL" name="EMAIL" value="$values[$n]" />}"
+      printf "${values[$n]:+<input class="item EMAIL" name="EMAIL" value="$values[$n]" />}"
     done)
     ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
     $(for n in IMPP IMPP{0..10}; do
index 53d8489a4d1d504a7824b2ca93cac72f5f6e9891..be2efa77541bfb214d04add7d1c5e23cf34734e2 100755 (executable)
@@ -37,6 +37,16 @@ item_name[ANNIVERSARY]="Jubiläum"
 item_name[BDAY]="Geburtstag"
 item_name[EMAIL]="E-Mail"
 item_name[TEL]="Telefon"
+item_name[phone_typeselect]="Typ"
+item_name[phone_home]="Privat"
+item_name[phone_cell]="Mobil"
+item_name[phone_work]="Büro"
+item_name[phone_fax]="Fax"
+item_name[tHOME]="Privat:"
+item_name[tWORK]="Büro:"
+item_name[tCELL]="Mobil:"
+item_name[tFAX]="Fax:"
+item_name[tVOICE]=""
 item_name[IMPP]="Chat"
 item_name[ADR]="Anschrift"
 item_name[URL]="Webseite"
index fd92dddfb2df8f1379f0091a9b93db592137e77c..b86240aa2bd00c215d1030d4348c3289fcd7e745 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014 Paul Hänsch
+# Copyright 2014, 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -58,7 +58,3 @@ item_name[t_eternal]="ewig"
 item_name[t_times]="mal"
 item_name[t_until]="Bis"
 item_name[t_oclock]="Uhr"
-
-l10n() {
-  [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1"
-}
index 4b06268260d2dcd5de483967dd50ffc1f7877052..bbcc09196844497e7cb6b8ef540907be1e9f1ccf 100755 (executable)
@@ -29,57 +29,57 @@ hi_status="$(printf %s "${values[X-HEALTH-INSURANCE]}" |cut -d\; -f3)"
 cat <<END_HTML
   <div class="section basic">
     <h2 class="item FN">$fullname</h2>
-    ${values[GENDER]:+<span class="item GENDER">$(l10n $values[GENDER])</span>}
+    ${values[GENDER]:+<span class="\""item GENDER"\"">$(l10n $values[GENDER])</span>}
 
     $(for n in NICKNAME NICKNAME{0..10}; do
-      echo "${values[$n]:+<span class="item NICKNAME">aka. $values[$n]</span>}"
+      echo "${values[$n]:+<span class="\""item NICKNAME"\"">aka. $values[$n]</span>}"
     done)
 
-    ${values[BDAY]:+<span class="item BDAY"><label>*:</label> ${values[BDAY]}</span>}
-    ${values[SOUND]:+<audio controls="controls" class="item SOUND"><source type="audio/ogg" src="data:audio/ogg;base64,$values[SOUND]" /></audio>}
-    ${values[PHOTO]:+<img class="item PHOTO" src="data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]" />}
-    ${values[LOGO]:+<img class="item LOGO" src="data:image/$tags[LOGO_TYPE];base64,$values[LOGO]" />}
+    ${values[BDAY]:+<span class="\""item BDAY"\""><label>*:</label> ${values[BDAY]}</span>}
+    ${values[SOUND]:+<audio controls="controls" class="\""item SOUND"\""><source type="audio/ogg" src="\""data:audio/ogg;base64,$values[SOUND]"\"" /></audio>}
+    ${values[PHOTO]:+<img class="\""item PHOTO"\"" src="\""data:image/$tags[PHOTO_TYPE];base64,$values[PHOTO]"\"" />}
+    ${values[LOGO]:+<img class="\""item LOGO"\"" src="\""data:image/$tags[LOGO_TYPE];base64,$values[LOGO]"\"" />}
 
     <h3>$(l10n ADR)</h3>
     $(for n in ADR ADR{0..10}; do
-      echo "${values[$n]:+<span class="item ADR">$values[$n]</span>}"
+      echo "${values[$n]:+<span class="\""item ADR"\"">$values[$n]</span>}"
     done)
     ${values[URL]:+<h3>$(l10n URL)</h3>}
     $(for n in URL URL{0..10}; do
-      echo "${values[$n]:+<span class="item URL"><a href="$values[$n]">$values[$n]</a></span>}"
+      echo "${values[$n]:+<span class="\""item URL"\""><a href="\""$values[$n]"\"">$values[$n]</a></span>}"
     done)
   </div><!--
 
   --><div class="section phone">
     <h3>$(l10n TEL)</h3>
     $(for n in TEL TEL{0..10}; do
-      echo "${values[$n]:+<span class="item TEL">$tags[${n}_TYPE] $values[$n]</span>}"
+      echo "${values[$n]:+<span class="\""item TEL"\"">$(l10n t${tags[${n}_TYPE]}) $values[$n]</span>}"
     done)
     ${values[EMAIL]:+<h3>$(l10n EMAIL)</h3>}
     $(for n in EMAIL EMAIL{0..10}; do
-      echo "${values[$n]:+<span class="item EMAIL"><a href="mailto:$values[$n]">$values[$n]</a></span>}"
+      echo "${values[$n]:+<span class="\""item EMAIL"\""><a href="\""mailto:$values[$n]"\"">$values[$n]</a></span>}"
     done)
     ${values[IMPP]:+<h3>$(l10n IMPP)</h3>}
     $(for n in IMPP IMPP{0..10}; do
-      echo "${values[$n]:+<span class="item IMPP">$tags[${n}_TYPE] <a href="$values[$n]">$values[$n]</a></span>}"
+      echo "${values[$n]:+<span class="\""item IMPP"\"">$tags[${n}_TYPE] <a href="\""$values[$n]"\"">$values[$n]</a></span>}"
     done)
   </div><!--
 
   --><div class="section insurance">
     <h3>$(l10n X-HEALTH-INSURANCE)</h3>
-    ${hi_company:+<span class="item hi_comapany">${hi_company}</span>}
-    ${hi_number:+<span class="item hi_number"><label>$(l10n hi_number):</label> ${hi_number}</span>}
-    ${hi_status:+<span class="item hi_status"><label>$(l10n hi_status):</label> ${hi_status}</span>}
+    ${hi_company:+<span class="\""item hi_comapany"\"">${hi_company}</span>}
+    ${hi_number:+<span class="\""item hi_number"\""><label>$(l10n hi_number):</label> ${hi_number}</span>}
+    ${hi_status:+<span class="\""item hi_status"\""><label>$(l10n hi_status):</label> ${hi_status}</span>}
   </div><!--
 
   --><div class="section note">
     ${values[NOTE]:+<h3>$(l10n NOTE)</h3>}
     $(for n in NOTE NOTE{0..10}; do
-      echo "${values[$n]:+<span class="item NOTE">$values[$n]</span>}"
+      echo "${values[$n]:+<span class="\""item NOTE"\"">$values[$n]</span>}"
     done)
     ${values[X-CLIENT-REFERRAL]:+<h3>$(l10n X-CLIENT-REFERRAL)</h3>}
     $(for n in X-CLIENT-REFERRAL X-CLIENT-REFERRAL{0..10}; do
-      echo "${values[$n]:+<span class="item X-CLIENT-REFERRAL">$values[$n]</span>}"
+      echo "${values[$n]:+<span class="\""item X-CLIENT-REFERRAL"\"">$values[$n]</span>}"
     done)
   </div><!--