[bknr-cvs] ksprotte changed trunk/projects/bos/web/kml-handlers.lisp

BKNR Commits bknr at bknr.net
Thu Jul 24 14:43:28 UTC 2008


Revision: 3620
Author: ksprotte
URL: http://bknr.net/trac/changeset/3620

kml-upload-handler allows also for downloading the kml-root file
U   trunk/projects/bos/web/kml-handlers.lisp

Modified: trunk/projects/bos/web/kml-handlers.lisp
===================================================================
--- trunk/projects/bos/web/kml-handlers.lisp	2008-07-24 13:51:29 UTC (rev 3619)
+++ trunk/projects/bos/web/kml-handlers.lisp	2008-07-24 14:43:28 UTC (rev 3620)
@@ -55,9 +55,20 @@
                                                      line column)))))))))
                        ;; we want this after the processing
                        (:p (:format "last-change: ~A"                                
-                                    (format-date-time (store-object-last-change kml-root-data 0)))))))
+                                    (format-date-time (store-object-last-change kml-root-data 0)))
+                           (cmslink (format nil "/kml-upload?lang=~A&action=download" language)
+                             "download current version")))))
              (submit-button "upload" "upload"))))))
 
+(defmethod handle-form ((handler kml-upload-handler) (action (eql :download)))
+  (with-query-params (lang)
+    (setf (hunchentoot:header-out :content-type)
+          "application/binary"
+          (hunchentoot:header-out :content-disposition)
+          (format nil "attachment; filename=kml-root-~A.kml" lang))
+    (let ((kml-root-data (kml-root-data-with-language lang)))
+      (kml-string kml-root-data))))
+
 ;;; kml-format utils
 (defun kml-format-points (points stream)
   (mapc #'(lambda (point) (kml-format-point point stream)) points))




More information about the Bknr-cvs mailing list