]> git.plutz.net Git - lobster/commitdiff
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 def6da0b4c8f72797bab10e7af5cc7bc03ff5e27..277f7ae0517f4c7eeb01edc08c67fb4fbb236ba3 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 1a34b8b2e4780abc28422ccdd6fc3bf9a660d180..2d06f6b9561ca6e5d6189a98d3888534ce14b122 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 c97bc463e7c13183759c0d06c123be44a173a57c..92e4d91ab4d053fbc94c9368f5db3a7d6e69bce8 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 f2acb9f6a7f0b84678545bb18a9a7494bd01feb6..3d7ad0457eff8d21e795d3fea609906ffc6acb3b 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 6ce0466f430cae2c99ce75b74bf7bb13b40f81d2..6a90192c69f7ed365ff31aa4d9e8c7cb55e436d7 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"