[Fencommits] fenserve: use file upload form on import page

Benja Fallenstein benja.fallenstein at gmail.com
Sun Jul 1 21:43:37 EEST 2007


Sun Jul  1 03:45:02 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * use file upload form on import page
diff -rN -u old-fenserve/fendata/HTML.hs new-fenserve/fendata/HTML.hs
--- old-fenserve/fendata/HTML.hs	2007-07-01 21:43:37.000000000 +0300
+++ new-fenserve/fendata/HTML.hs	2007-07-01 21:43:37.000000000 +0300
@@ -93,8 +93,10 @@
 
 link href = tag "a" [P "href" href]
 
-formG href = tag "form" [P "action" href, P "method" "GET"]
-formP href = tag "form" [P "action" href, P "method" "POST"]
+formG  href = tag "form" [P "action" href, P "method" "GET"]
+formP  href = tag "form" [P "action" href, P "method" "POST"]
+formP' href = tag "form" [P "action" href, P "method" "POST",
+                          P "enctype" "multipart/form-data"]
 
 br = HTML "<br>"; hr = HTML "<hr>"; para x = tag "p" [] x
 
@@ -105,6 +107,7 @@
 textfield name value = input "text" name value
 textarea name (rows::Int) (cols::Int) x = 
     tag "textarea" [P "name" name, P "rows" rows, P "cols" cols] x
+fileUpload name = input "file" name ""
 button x = tag "button" [P "style" buttonStyle] x
 button' name value x = tag "button" [P "name" name, P "value" value,
                                      P "style" buttonStyle] x
diff -rN -u old-fenserve/fendata/Main.hs new-fenserve/fendata/Main.hs
--- old-fenserve/fendata/Main.hs	2007-07-01 21:43:37.000000000 +0300
+++ new-fenserve/fendata/Main.hs	2007-07-01 21:43:37.000000000 +0300
@@ -92,10 +92,9 @@
       
   , page ["import"] "Import"
       ( h2 "Import CSV"
-      , formP ""
+      , formP' ""
           ( para $ "Category name: " & textfield "catName" ""
-          , para "Paste CSV here:"
-          , para $ textarea "csv" 10 80 ""
+          , para ( "Upload CSV here: ", fileUpload "csv" )
           , submit "Submit" ) )
           
   , runPost ["import"] $ do




More information about the Fencommits mailing list