X-Git-Url: http://git.plutz.net/?p=invoices;a=blobdiff_plain;f=invoices.cgi;h=bec02be117a48964f1a14c5b2ddb17bd3f5973ab;hp=7e2f35193ae76bfd1012f3d91e0f62c7a40c3837;hb=82b730d7926c9d7141639c1305beaab3f843918a;hpb=de8eaf901067d4e0c72e5b0ca05f6dc12553fd79 diff --git a/invoices.cgi b/invoices.cgi index 7e2f351..bec02be 100755 --- a/invoices.cgi +++ b/invoices.cgi @@ -24,7 +24,16 @@ printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' EOF } -info="$(PATH "${PATH_INFO}")" +info="$(PATH "${PATH_INFO#http://*/}")" + +which git && [ ! -d .git ] && { + git init + mkdir -p clients/ invoices/ senders/ + printf 'export/ +serverkey' >.gitignore + git add clients/ invoices/ senders/ .gitignore + git commit -m 'initialisation of invoice repo' +} >&2 case $info in /invoices.css) @@ -44,7 +53,6 @@ case $info in /update_client) . "$_EXEC/clients.sh" update_client - REDIRECT /clients/ ;; /senders) . "$_EXEC/senders.sh" @@ -59,22 +67,25 @@ case $info in /update_sender) . "$_EXEC/senders.sh" update_sender - REDIRECT /senders/ ;; /invoices) . "$_EXEC/invoices.sh" - { list_invoices - printf '[a .new href="/invoice/%s" New]' "$(timeid)" + { printf '[a .new href="/invoices/%s" New]' "$(timeid)" + list_invoices } | yield_page invoices ;; - /invoice/*) + /invoices/*) . "$_EXEC/invoices.sh" - edit_invoice "${info#/invoice/}" |yield_page invoice + edit_invoice "${info#/invoices/}" |yield_page invoice ;; /update_invoice) . "$_EXEC/invoices.sh" update_invoice - REDIRECT "/invoice/$id" + ;; + /export/*.pdf/*) + . "$_EXEC/cgilite/file.sh" + file="${info%/*}" + FILE "${file#/}" application/pdf ;; *) REDIRECT /invoices ;;