[bknr-cvs] ksprotte changed trunk/projects/bos/web/

BKNR Commits bknr at bknr.net
Mon Sep 1 13:39:00 UTC 2008


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

removed POI handlers that are not needed anymore
U   trunk/projects/bos/web/poi-handlers.lisp
U   trunk/projects/bos/web/webserver.lisp

Modified: trunk/projects/bos/web/poi-handlers.lisp
===================================================================
--- trunk/projects/bos/web/poi-handlers.lisp	2008-09-01 13:11:09 UTC (rev 3759)
+++ trunk/projects/bos/web/poi-handlers.lisp	2008-09-01 13:39:00 UTC (rev 3760)
@@ -177,88 +177,6 @@
                          "continue editing the POI") "."))))
 
 (defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :upload-airal))
-                               (poi poi))
-  (let ((uploaded-file (request-uploaded-file "image-file")))
-    (unless uploaded-file
-      (error "no file uploaded in upload handler"))
-    (with-image-from-upload* (uploaded-file)
-      (cond
-        ((and (eql (cl-gd:image-width) *poi-image-width*)
-              (eql (cl-gd:image-height) *poi-image-height*))
-         (with-transaction ("set airals")
-           (push (import-image uploaded-file :class-name 'store-image) (poi-airals poi)))
-         (redirect (format nil "/edit-poi/~D"
-                           (store-object-id poi))))
-        (t
-         (with-bos-cms-page (:title "Invalid image size")
-           (:h2 "Invalid image size")
-           (:p "The image needs to be "
-               (:princ-safe *poi-image-width*) " pixels wide and "
-               (:princ-safe *poi-image-height*) " pixels high.  Your uploaded image is "
-               (:princ-safe (cl-gd:image-width)) " pixels wide and "
-               (:princ-safe (cl-gd:image-height)) " pixels high.  Please use an image editor "
-               "to resize the image and upload it again.")
-           (:p (cmslink (edit-object-url poi) "Back to POI"))))))))
-
-(defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :delete-airal))
-                               (poi poi))
-  (with-query-params (airal-id)
-    (let ((airal (find-store-object (parse-integer airal-id))))
-      (with-transaction ("delete poi-airal")
-        (alexandria:deletef (poi-airals poi) airal))
-      (delete-object airal)))
-  (redirect (format nil "/edit-poi/~D"
-                    (store-object-id poi))))
-
-
-(defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :add-movie))
-                               (poi poi))
-  (with-query-params (movie-url)
-    (with-transaction ("add poi movie")
-      (push (make-object 'poi-movie :poi poi :url movie-url)
-            (poi-movies poi)))
-    (redirect (format nil "/edit-poi/~D" (store-object-id poi)))))
-
-
-(defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :delete-movie))
-                               (poi poi))
-  (with-query-params (movie-id)
-    (let ((movie (find-store-object (parse-integer movie-id))))
-      (with-transaction ("delete poi-movie")
-        (alexandria:deletef (poi-movies poi) movie))
-      (delete-object movie)))
-  (redirect (format nil "/edit-poi/~D"
-                    (store-object-id poi))))
-
-(defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :upload-panorama))
-                               (poi poi))
-  (let ((uploaded-file (request-uploaded-file "image-file")))
-    (unless uploaded-file
-      (error "no file uploaded in upload handler"))
-    ;; just open the image to make sure that gd can process it
-    (with-image-from-upload* (uploaded-file))
-    (with-transaction ("add poi-panorama")
-      (push (import-image uploaded-file :class-name 'store-image) (poi-panoramas poi))))
-  (redirect (format nil "/edit-poi/~D"
-                    (store-object-id poi))))
-
-(defmethod handle-object-form ((handler edit-poi-handler)
-                               (action (eql :delete-panorama))
-                               (poi poi))
-  (with-query-params (panorama-id)
-    (let ((panorama (find-store-object (parse-integer panorama-id))))
-      (with-transaction ("delete poi-panorama")
-        (alexandria:deletef (poi-panoramas poi) panorama))
-      (delete-object panorama)))
-  (redirect (format nil "/edit-poi/~D"
-                    (store-object-id poi))))
-
-(defmethod handle-object-form ((handler edit-poi-handler)
                                (action (eql :delete)) (poi poi))
   (delete-object poi)
   (with-bos-cms-page (:title "POI has been deleted")
@@ -376,98 +294,6 @@
                           (store-object-id new-medium)
                           (store-object-id poi)))))))
 
-;;; edit-poi-image-handler
-(defclass edit-poi-image-handler (editor-only-handler edit-object-handler)
-  ()
-  (:default-initargs :object-class 'poi-image))
-
-(defmethod handle-object-form ((handler edit-poi-image-handler) action (object (eql nil)))
-  (with-query-params (poi)
-    (with-bos-cms-page (:title "Upload new POI image")
-      (html
-       (:h2 "Upload new image")
-       ((:form :method "POST" :enctype "multipart/form-data"))
-       ((:input :type "hidden" :name "poi" :value poi))
-       (:p "Choose a file: " ((:input :type "file" :name "image-file")))
-       (:p (submit-button "upload" "upload"))))))
-
-(defmethod handle-object-form ((handler edit-poi-image-handler) (action (eql :upload)) poi-image)
-  (with-query-params (poi)
-    (setq poi (find-store-object (parse-integer poi) :class 'poi))
-    (let ((uploaded-file (request-uploaded-file "image-file")))
-      (unless uploaded-file
-        (error "no file uploaded in upload handler"))
-      (bknr.web:with-image-from-upload* (uploaded-file)
-        (unless (and (eql (cl-gd:image-width) *poi-image-width*)
-                     (eql (cl-gd:image-height) *poi-image-height*))
-          (with-bos-cms-page (:title "Invalid image size")
-            (:h2 "Invalid image size")
-            (:p "The image needs to be "
-                (:princ-safe *poi-image-width*) " pixels wide and "
-                (:princ-safe *poi-image-height*) " pixels high.  Your uploaded image is "
-                (:princ-safe (cl-gd:image-width)) " pixels wide and "
-                (:princ-safe (cl-gd:image-height)) " pixels high.  Please use an image editor "
-                "to resize the image and upload it again.")
-            (:p (cmslink (edit-object-url poi) "Back to POI")))
-          (return-from handle-object-form t)))
-      (if poi-image
-          (blob-from-file poi-image uploaded-file)
-          (setq poi-image (import-image uploaded-file
-                                        :class-name 'poi-image
-                                        :initargs `(:poi ,poi))))
-      (redirect (format nil "/edit-poi-image/~D?poi=~D"
-                        (store-object-id poi-image)
-                        (store-object-id poi))))))
-
-(defmethod handle-object-form ((handler edit-poi-image-handler) action poi-image)
-  (with-query-params (language poi)
-    (unless language (setq language (request-language)))
-    (with-bos-cms-page (:title "Edit POI Image")
-      (html
-       (cmslink (edit-object-url (poi-image-poi poi-image)) "Back to POI")
-       (content-language-chooser)
-       ((:form :method "post" :enctype "multipart/form-data")
-        ((:input :type "hidden" :name "poi" :value poi))
-        (:table (:tr (:td "thumbnail")
-                     (:td ((:img :src (format nil "/image/~A/thumbnail,,55,55" (store-object-id poi-image))))))
-                (:tr (:td "full image")
-                     (:td ((:img :src (format nil "/image/~A" (store-object-id poi-image))))))
-                (:tr (:td "upload new image")
-                     (:td ((:input :type "file" :name "image-file"))
-                      :br
-                      (submit-button "upload" "upload")))
-                (:tr (:td "title")
-                     (:td (text-field "title"
-                                      :value (slot-string poi-image 'title language))))
-                (:tr (:td "subtitle")
-                     (:td (text-field "subtitle"
-                                      :value (slot-string poi-image 'subtitle language))))
-                (:tr (:td "description")
-                     (:td (textarea-field "description"
-                                          :value (slot-string poi-image 'description language)
-                                          :rows 5
-                                          :cols 40)))
-                (:tr (:td (submit-button "save" "save")
-                          (submit-button "delete" "delete" :confirm "Really delete the image?")))))))))
-
-(defmethod handle-object-form ((handler edit-poi-image-handler) (action (eql :save)) poi-image)
-  (with-query-params (title subtitle description language)
-    (unless language (setq language (request-language)))
-    (update-poi-image poi-image language
-                      :title title
-                      :subtitle subtitle
-                      :description description)
-    (with-bos-cms-page (:title "POI image has been updated")
-      (:h2 "The POI image information has been updated")
-      "You may " (cmslink (edit-object-url poi-image) "continue editing the POI image"))))
-
-(defmethod handle-object-form ((handler edit-poi-image-handler) (action (eql :delete)) poi-image)
-  (let ((poi (poi-image-poi poi-image)))
-    (delete-object poi-image)
-    (with-bos-cms-page (:title "POI image has been deleted")
-      (:h2 "The POI image has been deleted")
-      "You may " (cmslink (edit-object-url poi) "continue editing the POI"))))
-
 ;;; poi-javascript-handler
 (defclass poi-javascript-handler (page-handler)
   ())
@@ -498,44 +324,6 @@
           (:princ (format nil "parent.last_sponsors([~{~A~^,~%~}]);"
                           (mapcar #'contract-js last-paid-contracts)))))))))
 
-;;; poi-image-handler
-(defclass poi-image-handler (object-handler)
-  ()
-  (:default-initargs :object-class 'poi :query-function #'find-poi))
-
-(defmethod handle-object ((handler poi-image-handler) (poi (eql nil)))
-  (error "poi not found"))
-
-(defmethod handle-object ((handler poi-image-handler) poi)
-  (destructuring-bind (poi-name image-index-string &rest imageproc-arguments)
-      (multiple-value-list (parse-handler-url handler))
-    (declare (ignore poi-name))
-    (let ((image-index (1- (parse-integer image-index-string))))
-      (if (and (not (minusp image-index))
-               (< image-index (length (poi-sat-images poi))))
-          (redirect (format nil "/image/~D~@[~{/~a~}~]"
-                            (store-object-id (nth image-index (poi-sat-images poi)))
-                            imageproc-arguments))
-          (error "image index ~a out of bounds for poi ~a" image-index poi)))))
-
-;;; poi-movie-handler
-(defclass poi-movie-handler (admin-only-handler object-handler)
-  ()
-  (:default-initargs :object-class 'poi-movie))
-
-(defmethod handle-object ((handler poi-movie-handler) (poi-movie (eql nil)))
-  (error "poi-movie not found"))
-
-(defmethod handle-object ((handler poi-movie-handler) poi-movie)
-  (with-bos-cms-page (:title "POI movie preview")
-    (:p (cmslink (edit-object-url (poi-movie-poi poi-movie)) "Back to POI"))
-    ((:object :width "425" :height "344")
-     ((:param :name "movie" :value (poi-movie-url poi-movie)))
-     ((:param :name "allowFullScreen" :value "true"))
-     ((:embed :src (poi-movie-url poi-movie) :type "application/x-shockwave-flash"
-                                             :allowFullScreen "true"
-                                             :width "425" :height "344")))))
-
 ;;; poi-xml-handler
 (defun write-poi-xml (poi language)
   "Writes the poi xml format for one specific language.  This is used

Modified: trunk/projects/bos/web/webserver.lisp
===================================================================
--- trunk/projects/bos/web/webserver.lisp	2008-09-01 13:11:09 UTC (rev 3759)
+++ trunk/projects/bos/web/webserver.lisp	2008-09-01 13:39:00 UTC (rev 3760)
@@ -156,8 +156,7 @@
 
   (make-instance 'bos-website
                  :name "create-rainforest.org CMS"
-                 :handler-definitions `(("/edit-poi-image" edit-poi-image-handler)
-                                        ("/edit-poi-medium" edit-poi-medium-handler)
+                 :handler-definitions `(("/edit-poi-medium" edit-poi-medium-handler)
                                         ("/edit-poi" edit-poi-handler)
                                         ("/edit-sponsor" edit-sponsor-handler)
                                         ("/kml-upload" kml-upload-handler)
@@ -175,8 +174,6 @@
                                         ("/complete-transfer" complete-transfer-handler)
                                         ("/edit-news" edit-news-handler)
                                         ("/make-poi" make-poi-handler)
-                                        ("/poi-image" poi-image-handler)
-                                        ("/poi-movie" poi-movie-handler)
                                         ("/poi-xml" poi-xml-handler)
                                         ("/poi-kml-all" poi-kml-all-handler)
                                         ("/poi-kml" poi-kml-handler)




More information about the Bknr-cvs mailing list