options for card editor, framework for editing actions
authorpaul <paul@plutz.net>
Sun, 17 Nov 2013 19:16:45 +0000 (19:16 +0000)
committerpaul <paul@plutz.net>
Sun, 17 Nov 2013 19:16:45 +0000 (19:16 +0000)
svn path=/trunk/; revision=17

action.sh [new file with mode: 0755]
index.cgi
pages/attendees.sh
templates/attendees.html.sh
templates/edit_attendee.sh
templates/text_attendee.sh

diff --git a/action.sh b/action.sh
new file mode 100755 (executable)
index 0000000..f8fef05
--- /dev/null
+++ b/action.sh
@@ -0,0 +1,7 @@
+#!/bin/zsh
+
+ACTION="$(echo "$_GET[\"action\"]" |egrep '^[a-zA-Z0-9_-]+$')"
+ACTION="${_EXEC}/actions/${ACTION}.sh"
+[ -x "$ACTION" ] || echo -n "Location: http://$HTTP_HOST/?page=error"
+
+. $ACTION
index def6da0..277f7ae 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -48,4 +48,4 @@ EOF
 cgi_get
 debug "$_GET"
 
-. "$_EXEC/page.sh"
+[ -n "$_GET[\"action\"]" ] && . "$_EXEC/action.sh" || . "$_EXEC/page.sh"
index 1a34b8b..2d06f6b 100755 (executable)
@@ -28,6 +28,8 @@ listcards() {
   esac
 }
 
+FIELDLIST="$(echo PHOTO LOGO FN NICKNAME SOUND GENDER KIND TITLE ROLE ORG MEMBER CATEGORIES ANNIVERSARY BDAY EMAIL TEL IMPP ADR URL LANG NOTE RELATED |tr ' ' '\n')"
+
 vcf_parse() {
   tr -d '\n' <"$1" |sed -r 's:\r ::g;s:\r:\n:g' \
   | sed -rn '
@@ -35,8 +37,8 @@ vcf_parse() {
     s:^X-MS-CARDPICTURE:001 PHOTO:p;
     s:^LOGO:002 LOGO:p;
     s:^FN:003 FN:p;
-    s:^NICKNAME:005 NICKNAME:p;
     s:^N:004 N:p
+    s:^NICKNAME:005 NICKNAME:p;
     s:^SOUND:006 SOUND:p;
     s:^GENDER:007 GENDER:p;
     s:^X-GENDER:007 GENDER:p;
index c97bc46..92e4d91 100644 (file)
@@ -40,10 +40,14 @@ $(listcards |while read card; do
   id="vcf_$card"
   if [ "$_GET[\"edit\"]" = "$id" ]; then cat <<x_EOF
   <div id="${id}" class="card">
-    <form action="/?page=attendees#${id}" method="POST">
-      <input type="hidden" name="page" value="attendees"/>
+    <form action="/?action=update_attendee" method="POST">
       <input type="hidden" name="card" value="${id}"/>
       $(edit_attendee "$card")
+      <br /><select name="newfield">
+       <option value="" disabled="disabled" selected="selected">$(l10n edit_addfieldtext)</option>
+       $(echo $FIELDLIST |while read f; do echo "<option value=\"$f\">$(l10n $f)</option>"; done)
+      </select>
+      <button type="submit" name="action" value="addfield">$(l10n edit_addfield)</button>
       <br /><button type="submit" name="action" value="update">$(l10n edit_update)</button>
       <br /><button type="submit" name="action" value="cancel">$(l10n edit_cancel)</button>
     </form>
index f2acb9f..3d7ad04 100755 (executable)
@@ -11,6 +11,7 @@ edit_card_item() {
       ;|
     *)
       echo "<input class=\"VALUE\" name=\"$key\" value=\"$value\" /></item>"
+      echo "<button name=\"deletefield\" value=\"$key $value\">$(l10n edit_deletefield)</button>"
       ;;
   esac
 }
index 6ce0466..6a90192 100755 (executable)
@@ -3,6 +3,7 @@ declare -A item_name
 item_name[PHOTO]="Foto"
 item_name[LOGO]="Logo"
 item_name[FN]="Voller Name"
+item_name[NICKNAME]="Spitzname"
 item_name[SOUND]="Aussprache"
 item_name[GENDER]="Geschlecht"
 item_name[KIND]="Typ"
@@ -44,6 +45,11 @@ item_name[VERSION]=""
 item_name[XML]=""
 
 item_name[edit]="Bearbeiten"
+item_name[edit_update]="Daten Übernehmen"
+item_name[edit_cancel]="Abbrechen"
+item_name[edit_addfieldtext]="Feld hinzufügen"
+item_name[edit_addfield]="+"
+item_name[edit_deletefield]="X"
 item_name[filter_all]="Alles"
 item_name[filter_name]="Name"
 item_name[filter_street]="Straße"