From cc4f60b02927d7da41ad5ef202dc33f5df42faf8 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 20 Jan 2009 11:44:14 -0600 Subject: [PATCH] add imagebin so i can work on it from another computer --- extra/webapps/imagebin/authors.txt | 1 + extra/webapps/imagebin/imagebin.factor | 38 +++++++++++++++++++++++ extra/webapps/imagebin/upload-image.xml | 17 ++++++++++ extra/webapps/imagebin/uploaded-image.xml | 7 +++++ 4 files changed, 63 insertions(+) create mode 100644 extra/webapps/imagebin/authors.txt create mode 100644 extra/webapps/imagebin/imagebin.factor create mode 100644 extra/webapps/imagebin/upload-image.xml create mode 100644 extra/webapps/imagebin/uploaded-image.xml diff --git a/extra/webapps/imagebin/authors.txt b/extra/webapps/imagebin/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/extra/webapps/imagebin/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/extra/webapps/imagebin/imagebin.factor b/extra/webapps/imagebin/imagebin.factor new file mode 100644 index 0000000000..cab5d91952 --- /dev/null +++ b/extra/webapps/imagebin/imagebin.factor @@ -0,0 +1,38 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel furnace.actions html.forms +http.server.dispatchers db db.tuples db.types urls +furnace.redirection multiline http namespaces ; +IN: webapps.imagebin + +TUPLE: imagebin < dispatcher ; + +TUPLE: image id path ; + +image "IMAGE" { + { "id" "ID" INTEGER +db-assigned-id+ } + { "path" "PATH" { VARCHAR 256 } +not-null+ } +} define-persistent + +: ( -- action ) + + { imagebin "uploaded-image" } >>template ; + +SYMBOL: my-post-data +: ( -- action ) + + { imagebin "upload-image" } >>template + [ + request get post-data>> my-post-data set-global + ! image new + ! "file" value + ! insert-tuple + ! "uploaded-image" + ] >>submit ; + +: ( -- responder ) + imagebin new-dispatcher + "" add-responder + "upload-image" add-responder + "uploaded-image" add-responder ; + diff --git a/extra/webapps/imagebin/upload-image.xml b/extra/webapps/imagebin/upload-image.xml new file mode 100644 index 0000000000..ed6704fc93 --- /dev/null +++ b/extra/webapps/imagebin/upload-image.xml @@ -0,0 +1,17 @@ + + +Upload + +
+ + + + + + +
Image:
Image:
Image:
Text:
+ +

+
+ + diff --git a/extra/webapps/imagebin/uploaded-image.xml b/extra/webapps/imagebin/uploaded-image.xml new file mode 100644 index 0000000000..903be5cca4 --- /dev/null +++ b/extra/webapps/imagebin/uploaded-image.xml @@ -0,0 +1,7 @@ + + +Uploaded + +hi from uploaded-image + +