]> git.plutz.net Git - confetti/blobdiff - cards/main.cgi
modular design
[confetti] / cards / main.cgi
index 6cdc8f21a4498bcd8d37c9011ee1ab37a82e5c7c..899388d994e07d68d304890a268d7435de5d5604 100755 (executable)
@@ -1,36 +1,28 @@
 #!/bin/sh
 
-if [ "$ITEM" = "cards/cards.css" ]; then
+if [ "$_PATH" = "/cards/cards.css" ]; then
   . $_EXEC/cgilite/file.sh
   FILE $_EXEC/cards/cards.css
   return 0
-elif [ "$(GET action)" = filter_card ]; then
-  . $_EXEC/cards/filter_card.sh
-  exit 0
 fi
 
 . $_EXEC/pdiread.sh
 . $_EXEC/cards/l10n.sh
 . $_EXEC/cards/widgets.sh
+. $_EXEC/cards/list.sh
 
-filter="$(GET filter)"
-order="$(GET order)"
+filter="$(GET f)"
+order="$(GET o)"
+edit="$(GET e)"
+[ "$order" ] || order=firstname
 
-printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'
+{ w_filter_diag
 
-$_EXEC/cgilite/html-sh.sed <<EOF
-[!DOCTYPE HTML]
-[html [head
-  [title Cards]
-  [link rel="stylesheet" type="text/css" href="/style.css"]
-  [link rel="stylesheet" type="text/css" href="/cards/cards.css"]
-][body
-  $(W_NAVIGATION)
-  $(w_filter_diag)
+  printf '
+  [form class="newcard" action="cards/new_card.sh" method="POST"
+    [button type="submit" %s]
+  ]' "$(l10n newcard)"
 
-  [form class="newcard" action="?action=new_card" method="POST"
-    [button type="submit" $(l10n newcard)]
-  ]
-
-]]
-EOF
+  [ "$edit" ] && edit_card "$edit"
+  list_cards
+} | yield_page cards /cards/cards.css