]> git.plutz.net Git - lobster/commitdiff
rename attendees section to more generic "cards" to allow alternate views for vcards
authorpaul <paul@plutz.net>
Sun, 10 Jan 2016 23:15:40 +0000 (23:15 +0000)
committerpaul <paul@plutz.net>
Sun, 10 Jan 2016 23:15:40 +0000 (23:15 +0000)
svn path=/trunk/; revision=76

16 files changed:
actions/edit_card.sh [moved from actions/edit_attendee.sh with 91% similarity]
actions/filter_card.sh [moved from actions/filter_attendee.sh with 87% similarity]
actions/generate_courselist.sh
actions/new_card.sh [moved from actions/new_attendee.sh with 92% similarity]
actions/update_card.sh [moved from actions/update_attendee.sh with 86% similarity]
globals.sh
pages/cards.sh [moved from pages/attendees.sh with 97% similarity]
templates/attendees.html.sh
templates/cards.css.sh [new file with mode: 0755]
templates/cards.html.sh [new file with mode: 0755]
templates/course_print.sh
templates/edit_attendee.sh
templates/text_cards.sh [moved from templates/text_attendees.sh with 97% similarity]
templates/text_frame.sh
templates/view_attendee.sh
templates/view_course.sh

similarity index 91%
rename from actions/edit_attendee.sh
rename to actions/edit_card.sh
index 22525829324ddbf31c218b7774a9104e2650abf4..f90b326d2cca3a38dfa6b668fe3bc689c7556a9b 100755 (executable)
@@ -24,4 +24,4 @@ filter="&filter=${_REF[filter]}"
 filtertype="&filtertype=${_REF[filtertype]}"
 order="&order=${_REF[order]}"
 
-echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n"
+echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n"
similarity index 87%
rename from actions/filter_attendee.sh
rename to actions/filter_card.sh
index cb620d5124387236dd7698cc63419a76aefc1704..9de02886d428b5d7261608d0f67b12adc9ce50a0 100755 (executable)
@@ -24,9 +24,9 @@ case "${_POST[choice]}"; in
     filter="${_POST[filter]}"
     filtertype="${_POST[filtertype]}"
     order="${_POST[order]}"
-    echo -n "Location: ?p=attendees&filter=$filter&filtertype=$filtertype&order=$order\n\n"
+    echo -n "Location: ?p=cards&filter=$filter&filtertype=$filtertype&order=$order\n\n"
     ;;
   *)
-    echo -n "Location: ?p=attendees\n\n"
+    echo -n "Location: ?p=cards\n\n"
     ;;
 esac
index 6ea6d438e71aa67601760fe88235b0918a40adc2..f6fdda7dadb473e3933e59ad2805dc8448779db6 100755 (executable)
@@ -24,7 +24,7 @@ fromdate=$(date -d "$fromdate" +%s)
 [ -z "$fromdate" ] && fromdate=$(date +%s)
 
 . ${_EXEC}/pages/courses.sh loadfunctions
-. ${_EXEC}/pages/attendees.sh loadfunctions
+. ${_EXEC}/pages/card.sh loadfunctions
 
 tex_clean() { #in dire need for improvement
   echo "$*" |tr -d '{&}\'
similarity index 92%
rename from actions/new_attendee.sh
rename to actions/new_card.sh
index 0b9b70e1f92df86902f633eb4fedfaa009602105..2d6c39b3ff4200f0952697e051e43a7b73e37107 100755 (executable)
@@ -42,4 +42,4 @@ UID:$uid
 END:VCARD
 EOF
 
-echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n"
+echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n"
similarity index 86%
rename from actions/update_attendee.sh
rename to actions/update_card.sh
index 4bdd6ba6a7e8bfe16ea6bf437693ad4f0735063e..2250f1967abc5edb8a66c4b83ddc73527b27b437 100755 (executable)
@@ -54,7 +54,7 @@ case "${_POST[action]}" in
   addfield)
     echo "${_POST[newfield]}:\r" >>"$tempfile"
     echo "END:VCARD\r" >>"$tempfile"
-    echo -n "Location: ?p=attendees${filter}${filtertype}${order}&edit=$card\n\n"
+    echo -n "Location: ?p=cards${filter}${filtertype}${order}&edit=$card\n\n"
     ;;
   update)
     attendance=()
@@ -74,16 +74,16 @@ case "${_POST[action]}" in
 
     echo "END:VCARD\r" >>"$tempfile"
     mv "$tempfile" "$cardfile"
-    echo -n "Location: ?p=attendees${filter}${filtertype}${order}#$card\n\n"
+    echo -n "Location: ?p=cards${filter}${filtertype}${order}#$card\n\n"
     ;;
   cancel)
     rm "$tempfile"
     [ -f "$cardfile" ] \
-      && echo -n "Location: ?p=attendees${filter}${filtertype}${order}#$card\n\n" \
-      || echo -n "Location: ?p=attendees${filter}${filtertype}${order}\n\n"
+      && echo -n "Location: ?p=cards${filter}${filtertype}${order}#$card\n\n" \
+      || echo -n "Location: ?p=cards${filter}${filtertype}${order}\n\n"
     ;;
   delete)
     rm "$tempfile" "$cardfile"
-    echo -n "Location: ?p=attendees${filter}${filtertype}${order}\n\n"
+    echo -n "Location: ?p=cards${filter}${filtertype}${order}\n\n"
     ;;
 esac
index aac6dc9e92bbc5ae662b747a3f0a366253dd6798..5a9d9feee27252122f0806c4e51a02f7a58d3b9b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
-# Copyright 2014,2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
 export LC_ALL=de_DE.UTF-8
-data_dirs vcard ical cache temp mappings
+PROFILE=$(validate "$PROFILE" 'medical|circus' circus )
 
-VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED X-ZACK-JOINDATE X-ZACK-LEAVEDATE)
-
-[ -z "$NAVIGATION" ] && NAVIGATION=(attendees courses)
 PAGE="${_GET[p]:-$PAGE}"
 
 uuidgenerator(){
   head -c16 /dev/urandom |sha1sum - |cut -c1-32
 }
+
+VCF_FIELDS=(PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED X-ZACK-JOINDATE X-ZACK-LEAVEDATE)
+
+case "${PROFILE}" in
+medical)
+;;
+circus)
+  data_dirs vcard ical cache temp mappings
+  [ -z "$NAVIGATION" ] && NAVIGATION=(cards courses)
+;;
+esac
similarity index 97%
rename from pages/attendees.sh
rename to pages/cards.sh
index 0a1f88df2ec0d9935b3d3eb696299a98f78c76d2..f2675ba0f7a9301baa88852376c9943791d2335b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/zsh
 
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -204,7 +204,7 @@ vcf_parse() {
   | sed -r 's:[\\$`]:\\&:g'
 }
 
-view_attendee() {  #Parameter: Cardfile
+view_card() {  #Parameter: Cardfile
   id="$1"
   cardfile="$_DATA/vcard/${id}"
   cachefile="$_DATA/cache/${id}.cache"
@@ -239,11 +239,11 @@ view_attendee() {  #Parameter: Cardfile
         ;;
       esac
     done
-    . ${_EXEC}/templates/view_attendee.sh |tee "$cachefile"
+    . $view_card |tee "$cachefile"
   fi
 }
 
-edit_attendee() {  #Parameter: Cardfile
+edit_card() {  #Parameter: Cardfile
   id="$1"
   cardfile="$_DATA/vcard/$id"
   tempfile="$_DATA/temp/$id"
@@ -277,5 +277,5 @@ edit_attendee() {  #Parameter: Cardfile
       ;;
     esac
   done
-  . ${_EXEC}/templates/edit_attendee.sh
+  . $edit_card
 }
index fbc5fe50fbe582f0d4c7553164bf23d6f960ecb7..12f12265e9c0f40838a57964a452ab096e58ed08 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -23,13 +23,14 @@ check_order(){
 }
 
 edit="${_GET[edit]}"
+[ \! -f "vcard/$edit" -a \! -f "temp/$edit" ] && edit=''
 [ -z "${_GET[filtertype]}" ] && _GET[filtertype]="any"
 [ -z "${_GET[order]}" ] && _GET[order]="firstname"
 
 cat <<EOF
-<form class="filter" action="?action=filter_attendee" method="POST">
+<form class="filter" action="?action=filter_card" method="POST">
   <h1>$(l10n filter_label)</h1>
-  <input type="hidden" name="page" value="attendees"/>
+  <input type="hidden" name="page" value="cards"/>
   <input type="text" name="filter" value="$_GET["filter"]" placeholder="$(l10n filter_placeholder)"/>
   <br />
   <fieldset>
@@ -52,19 +53,25 @@ cat <<EOF
   <button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
 </form>
 
-<form class="newcard" action="?action=new_attendee" method="POST">
+<form class="newcard" action="?action=new_card" method="POST">
   <button type="submit">$(l10n newcard)</button>
 </form>
 
+${edit:+$(edit_card "$edit")}
+
 $(
-[ -f "vcard/$edit" -o -f "temp/$edit" ] &&  edit_attendee "$edit"
-if [ "$?" = 0 ]; then
-  listcards |grep -v "$edit"
-else
-  listcards
-fi |while read card; do
-  view_attendee "$card"
-done
+  listcards |grep ${edit:+-v} "$edit" \
+  | while read card; do
+    cat <<-ENDCARD
+       <div id="${card}" class="card">
+         $(view_card "$card")<!--
+         --><div class="control">
+           <a class="item" href="?action=edit_card&card=${card}">$(l10n edit)</a>
+           <a class="item" href="?action=export_vcard&card=${card}">$(l10n vcf_export)</a>
+         </div>
+       </div>
+       ENDCARD
+  done
 )
 EOF
 
diff --git a/templates/cards.css.sh b/templates/cards.css.sh
new file mode 100755 (executable)
index 0000000..6a8cef0
--- /dev/null
@@ -0,0 +1,7 @@
+case $PROFILE in
+medical)
+;;
+circus)
+  . ${0%/*}/attendees.css.sh
+;;
+esac
diff --git a/templates/cards.html.sh b/templates/cards.html.sh
new file mode 100755 (executable)
index 0000000..f1f039a
--- /dev/null
@@ -0,0 +1,9 @@
+case $PROFILE in
+medical)
+;;
+circus)
+  view_card=${0%/*}/view_attendee.sh
+  edit_card=${0%/*}/edit_attendee.sh
+  . ${0%/*}/attendees.html.sh
+;;
+esac
index 6f23b338f72ef1430d8d01bc8c637ef33356fa63..b9fd8402a4de06b26d493af701b8cef62f1820b2 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014 - 2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-. ${_EXEC}/templates/text_attendee.sh
+. ${_EXEC}/templates/text_cards.sh
 
 echo -E '
 \documentclass[landscape,10pt]{article}
index 5e472a814c61893d3988ba29b69f363515b27333..934023228bf7902532938abc74196a93747d746c 100755 (executable)
@@ -33,7 +33,7 @@ SUP_FIELDS=(N NICKNAME GENDER BDAY X-ZACK-JOINDATE X-ZACK-LEAVEDATE EMAIL TEL IM
 [ -z "$values[UID]" ] && values[UID]="$(uuidgenerator)"
 
 cat <<END_HTML
-<form id="$id" class="card" action="?action=update_attendee" method="POST">
+<form id="$id" class="card" action="?action=update_card" method="POST">
   <input type="hidden" name="card" value="${id}"/>
   <div class="section basic">
     <h3>$(l10n N)</h3>
similarity index 97%
rename from templates/text_attendees.sh
rename to templates/text_cards.sh
index 2ec576eb100888fc4ceeb4780a94c9d9821ea548..ec308ffb4427b73dd2003e8d04c94d4400a9bf45 100755 (executable)
@@ -109,7 +109,3 @@ item_name[female]="&#x2640;"
 item_name[male]="&#x2642;"
 item_name[other]="&#x26A5;"
 item_name[none]="&#x26AA;"
-
-l10n() {
-  [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1"
-}
index b76b58439baf3f9e35b012bcf0481f9cfd83720a..aa5858e5ec8252412954ebe712531b78480f7516 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2014, 2015 Paul Hänsch
+# Copyright 2014 - 2016 Paul Hänsch
 #
 # This file is part of Confetti.
 # 
 # You should have received a copy of the GNU Affero General Public License
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
-declare -A item_name
-
-item_name[p_attendees]="Teilnehmende"
+item_name[p_cards]="Teilnehmende"
 item_name[p_courses]="Kurse"
 item_name[p_email]="Email"
 item_name[p_error]="Fehler"
-
-l10n() {
-  [ -n "$item_name[$1]" ] && echo -n "$item_name[$1]" || echo -n "$1"
-}
index 0bc29f7d4cac3e8e77b55c7bb306275bc37329c6..e1b6530b49406a224763e1460128dd1a8b23d1b2 100755 (executable)
@@ -16,7 +16,6 @@
 # along with Confetti.  If not, see <http://www.gnu.org/licenses/>. 
 
 cat <<END_HTML
-<div id="${id}" class="card">
   <div class="section basic">
     <h2 class="item FN">$values[FN]</h2>
     ${values[GENDER]:+<span class="item GENDER">$(l10n $values[GENDER])</span>}
@@ -77,11 +76,5 @@ cat <<END_HTML
       echo '   <li><a class="item attendance" href="?p=courses#'$each'">'$cname'</a></li>'
     done)
     </ul>
-  </div><!--
-
-  --><div class="control">
-    <a class="item" href="?action=edit_attendee&card=${id}">$(l10n edit)</a>
-    <a class="item" href="?action=export_vcard&card=${id}">$(l10n vcf_export)</a>
   </div>
-</div>
 END_HTML
index f8e2f2cffb5aceb28bd1d928ae480eeb30edce10..23088f19e33edc83f5ead5a3bd15cdd67b5badbc 100755 (executable)
@@ -87,7 +87,7 @@ echo '  </div>'
 
 echo '  <div class="section attendance">'
 echo '    <h3>'$(l10n course_attendance)'</h3>'
-list_attendance "$id" |sort -k 2 |sed -r 's:^([^ ]+) (.*)$:<a class="attendance" href="?p=attendees#\1">\2</a>:'
+list_attendance "$id" |sort -k 2 |sed -r 's:^([^ ]+) (.*)$:<a class="attendance" href="?p=cards#\1">\2</a>:'
 echo '  </div>'
 
 echo '  <div class="control">'