]> git.plutz.net Git - confetti/commitdiff
visual updates, allow ordering of vcards
authorpaul <paul@plutz.net>
Sun, 1 Dec 2013 03:44:35 +0000 (03:44 +0000)
committerpaul <paul@plutz.net>
Sun, 1 Dec 2013 03:44:35 +0000 (03:44 +0000)
svn path=/trunk/; revision=27

actions/new_attendee.sh
actions/update_attendee.sh
pages/attendees.sh
templates/attendees.css.sh
templates/attendees.html.sh
templates/text_attendee.sh

index d2091913dc0f7589b6ca1e2900f5351ac36f5957..b7242bf61b665f2347e10e2d5649c3847b2c7f05 100644 (file)
@@ -5,10 +5,7 @@ cgi_post
 uid=$(dbus-uuidgen)
 card="${uid}.vcf"
 
-cardfile="vcard/$card"
-tempfile="temp/$card"
-
-touch "$cardfile"
+tempfile="$_DATA/temp/$card"
 
 cat >"$tempfile" <<EOF
 BEGIN:VCARD
index fee91fc3d0f405a652e4a2315f46953ccb58c7d1..6bfbe8822315d4f666a4850dd8fd2abde2491e1c 100644 (file)
@@ -33,7 +33,9 @@ case "$_POST[\"action\"]" in
     ;;
   cancel)
     rm "$tempfile"
-    echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n"
+    [ -f "$cardfile" ] \
+      && echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n" \
+      || echo -n "Location: http://$HTTP_HOST/?page=attendees\n\n"
     ;;
   delete)
     rm "$tempfile" "$cardfile"
index 35e790ec6d934bdcc0e83de4c8f3d7465c892fa1..e3e27c2d9d0b9c5d0ffd3aaf4491f67e906b92ac 100755 (executable)
@@ -2,7 +2,7 @@
 
 [ "$_GET[\"choice\"]" = "del_filter" ] && _GET["filter"]="" && _GET["filtertype"]="" 
 listcards() {
-  case "$_GET["filtertype"]" in
+  case "$_GET[\"filtertype\"]" in
     any)
        grep -il "$_GET[\"filter\"]" ${_DATA}/vcard/*vcf
       ;;
@@ -25,7 +25,29 @@ listcards() {
       ;;
     *) ls -1 ${_DATA}/vcard/*vcf
       ;;
-  esac |sed -r 's:^(.*/)([^/]+)$:\2:'
+  esac |case "$_GET[\"order\"]" in
+    firstname)
+      while read file; do
+        fn=$(sed -rn 's:^N(;.+)*\:([^;]*;){1} *([^;]*).*$:\3:p' "$file")
+       echo "$fn\t$file"
+      done
+      ;;
+    lastname)
+      while read file; do
+        ln=$(sed -rn 's:^N(;.+)*\:([^;]*;){0} *([^;]*).*$:\3:p' "$file")
+       echo "$ln\t$file"
+      done
+      ;;
+    bdate)
+      while read file; do
+        bd=$(sed -rn 's:^BDAY(;.+)*\:(.*)$:\2:p' "$file")
+       echo "$bd\t$file"
+      done
+      ;;
+    *)
+      sed -r 's:^.*$:x\t&:'
+      ;;
+  esac |sort |sed -r 's:^.*\t(.*/)([^/]+)$:\2:'
 }
 
 vcf_parse() {
index b86985c01ae57cc58085b18509a8ced8abacdb9e..955e89e1ce00379845b822c4f011e78c4911510c 100644 (file)
@@ -1,45 +1,91 @@
 cat <<EOF
 
-#filter {}
-#newcard {}
+.filter {
+  display: block;
+  width: 128ex;
+  border-width: 1px;
+  border-style: solid;
+  margin: 2em 5% .5em 5%;
+  padding: .25em 1ex .25em 1ex;
+  background: #EFF;
+}
 
-#cardlist {}
+.filter > .label {
+  display: block;
+  font-weight: bold;
+  font-size: 1.2em;
+  border-style: none none solid none;
+  border-width: 1px;
+  margin: 0em 0ex .5em 0ex;
+  background: #EEF;
+}
 
-.cardlist .card {
-  margin: 4px 5%;
+.filter .search {
+  margin: 0em 2ex .5em 2ex;
+}
+.filter .search .label {
+  display: inline-block;
+  width: 12ex;
+  font-weight: bold;
+  margin-top: .5em;
+}
+.filter .search input[type="radio"] {
+  margin-top: .5em;
+  margin-left: 1ex;
+}
+.filter .search button {
+  margin-top: .5em;
+}
+
+.filter .search input[type="text"] {
+  width: 124ex;
+}
+
+.newcard {
+  display: block;
+  width: 126ex;
   border-width: 1px;
   border-style: solid;
+  margin: .5em 5% 1em 5%;
+  padding: .25em 2ex .25em 2ex;
+  background: #EFF;
+}
+
+.cardlist .card {
+  display: block;
+  width: 130ex;
+  border-style: solid;
+  border-width: 1px;
+  margin: 4px 5%;
   padding: 0;
   overflow: auto;
-  width:130ex;
-  display: block;
 }
 
 .cardlist .card .section {
-  float:left;
   display: inline-block;
+  float:left;
   width: 20ex;
   margin: .125em .5ex .5ex .5ex;
-  background: #EEE;
   padding: 0 .2em .2em .2em;
+  background: #EEE;
 }
 .cardlist .card .control {
   float: right;
-  background: #EEF;
   text-align: right;
   margin-right: 0;
+  background: #EEF;
 }
 .cardlist .card .control .item {
-  margin-right: 1ex;
   margin-top: .2em;
+  margin-right: 1ex;
 }
 .cardlist .card .control a.item {
+  min-width: 10ex;
   border-style: solid double solid solid;
   border-width: 1px 3px 1px 1px;
-  background: #FFF;
-  padding: .1em 1ex;
-  min-width: 10ex;
   border-color: #000;
+  padding: .1em 1ex;
+  background: #FFF;
 }
 .cardlist .card .control a.item:hover{
   border-width: 1px 1px 1px 1px;
@@ -52,8 +98,8 @@ cat <<EOF
 }
 
 .cardlist .card .section .item {
-  max-width: 20ex;
   display: block;
+  max-width: 20ex;
   word-wrap: break-word;
 }
 
index 86605d2db81b1f7383220cff1c27e4be1fb1b364..b4ca0b8e9455dd3da93f7d80390507245848da5a 100644 (file)
@@ -1,28 +1,38 @@
-check(){
+check_type(){
   [ "$_GET[\"filtertype\"]" = "$1" ] && echo 'checked="checked"'
 }
+check_order(){
+  [ "$_GET[\"order\"]" = "$1" ] && echo 'checked="checked"'
+}
 
 edit="$_GET[\"edit\"]"
-[ -z "$_GET[\"filtertype\"]" ] && _GET[filtertype]="any"
+[ -z "$_GET[\"filtertype\"]" ] && _GET["filtertype"]="any"
+[ -z "$_GET[\"order\"]" ] && _GET["order"]="firstname"
 
 cat <<EOF
 <div class="filter">
-<form action="/" method="GET">
-  <div class="search">
-    <span class="label">Filter:</span>
+  <span class="label">$(l10n filter_label)</span>
+  <form class="search" action="/" method="GET">
     <input type="hidden" name="page" value="attendees"/>
-    <input type="text" name="filter" value="$_GET["filter"]"/><br/>
-    <input type="radio" name="filtertype" value="any" $(check any)>$(l10n filter_all)</input>
-    <input type="radio" name="filtertype" value="name" $(check name)>$(l10n filter_name)</input>
-    <input type="radio" name="filtertype" value="street" $(check street)>$(l10n filter_street)</input>
-    <input type="radio" name="filtertype" value="zip" $(check zip)>$(l10n filter_zip)</input>
-    <input type="radio" name="filtertype" value="telephone" $(check telephone)>$(l10n filter_phone)</input>
-    <input type="radio" name="filtertype" value="birth" $(check birth)>$(l10n filter_birthyear)</input>
-    <input type="radio" name="filtertype" value="course" $(check course)>$(l10n filter_course)</input><br/>
+    <input type="text" name="filter" value="$_GET["filter"]" placeholder="$(l10n filter_placeholder)"/>
+    <br />
+    <span class="label">$(l10n filter_type):</span>
+    <input type="radio" name="filtertype" value="any" $(check_type any)>$(l10n filter_all)</input>
+    <input type="radio" name="filtertype" value="name" $(check_type name)>$(l10n filter_name)</input>
+    <input type="radio" name="filtertype" value="street" $(check_type street)>$(l10n filter_street)</input>
+    <input type="radio" name="filtertype" value="zip" $(check_type zip)>$(l10n filter_zip)</input>
+    <input type="radio" name="filtertype" value="telephone" $(check_type telephone)>$(l10n filter_phone)</input>
+    <input type="radio" name="filtertype" value="birth" $(check_type birth)>$(l10n filter_birthyear)</input>
+    <input type="radio" name="filtertype" value="course" $(check_type course)>$(l10n filter_course)</input>
+    <br />
+    <span class="label">$(l10n filter_order):</span>
+    <input type="radio" name="order" value="firstname" $(check_order firstname)>$(l10n filter_firstname)</input>
+    <input type="radio" name="order" value="lastname" $(check_order lastname)>$(l10n filter_lastname)</input>
+    <input type="radio" name="order" value="bdate" $(check_order bdate)>$(l10n filter_bdate)</input>
+    <br>
     <button type="submit" name="choice" value="new_filter">$(l10n filter_apply)</button>
     <button type="submit" name="choice" value="del_filter">$(l10n filter_cancel)</button>
-  </div>
-</form>
+  </form>
 </div>
 
 <div class="newcard">
index 714ac615e1ffc5925569295fd4a1d821713a2ea1..5efbb8030d1794d8607bdb92049f68d5fd5c566a 100755 (executable)
@@ -59,12 +59,19 @@ item_name[edit_delete]="Eintrag löschen"
 item_name[edit_addfieldtext]="Neues Feld"
 item_name[edit_addfield]="+"
 item_name[edit_deletefield]="X"
+item_name[filter_label]="Filter"
+item_name[filter_placeholder]="Begriffe zur Eingrenzung eingeben"
+item_name[filter_type]="Filtertyp"
+item_name[filter_order]="Sortierung"
 item_name[filter_all]="Alles"
 item_name[filter_name]="Name"
+item_name[filter_firstname]="Vorname"
+item_name[filter_lastname]="Nachname"
 item_name[filter_street]="Straße"
 item_name[filter_zip]="PLZ."
 item_name[filter_phone]="Telefon"
 item_name[filter_birthyear]="Geburtsjahr"
+item_name[filter_bdate]="Geburtsdatum"
 item_name[filter_course]="Kurs"
 item_name[filter_apply]="Filtern"
 item_name[filter_cancel]="Filter löschen"