Changeset 3771
- Timestamp:
- 09/02/08 16:36:21 (3 months ago)
- Files:
-
- trunk/projects/bos/m2/packages.lisp (modified) (1 diff)
- trunk/projects/bos/m2/poi.lisp (modified) (3 diffs)
- trunk/projects/bos/web/poi-handlers.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/m2/packages.lisp
r3759 r3771 211 211 #:poi-medium 212 212 #:poi-medium-poi 213 #:poi-medium-creation-time 213 214 #:make-poi-medium 214 215 #:poi-image trunk/projects/bos/m2/poi.lisp
r3759 r3771 61 61 (format stream "~D" (store-object-id object)))) 62 62 63 (defgeneric poi-medium-creation-time (medium) 64 (:method ((medium blob)) 65 (blob-timestamp medium))) 66 63 67 (defmethod destroy-object :before ((poi-medium poi-medium)) 64 68 (with-slots (poi) poi-medium … … 80 84 ;;; poi-movie 81 85 (defpersistent-class poi-movie (poi-medium) 82 ((url :accessor poi-movie-url :initarg :url :initform nil))) 86 ((url :accessor poi-movie-url :initarg :url :initform nil) 87 (created :initform (get-universal-time) :reader poi-medium-creation-time))) 83 88 84 89 ;;; poi … … 136 141 (defun poi-center-lon-lat (poi) 137 142 (geo-utm:utm-x-y-to-lon-lat (+ +nw-utm-x+ (poi-center-x poi)) (- +nw-utm-y+ (poi-center-y poi)) +utm-zone+ t)) 143 144 (defmethod (setf poi-media) :after (value (poi poi)) 145 (setf (slot-value poi 'media) (sort (slot-value poi 'media) #'> :key #'poi-medium-creation-time))) 138 146 139 147 ;;; POI media are stored in one list - for convenience we provide trunk/projects/bos/web/poi-handlers.lisp
r3769 r3771 105 105 (:tr (:td "icon") 106 106 (:td (icon-chooser "icon" (poi-icon poi)))) 107 (:tr (:td " sat images")107 (:tr (:td "images for sat-app") 108 108 (:td 109 109 ((:table) … … 154 154 (dolist (medium (poi-media poi)) 155 155 (html (:tr (:td (:princ-safe (medium-pretty-type-string medium))) 156 (:td (:table (medium-handler-preview medium :small t) 157 (:tr (:td) 158 (:td (cmslink (format nil "/edit-poi-medium/~D?poi=~D" 159 (store-object-id medium) (store-object-id poi)) 160 "edit")))))))))))) 156 (:td (:table 157 (:colgroup ((:col :width "80")) ((:col :width "400"))) 158 (:tr (:td) 159 (:td (:b (:princ-safe (slot-string medium 'title language "[no title]")))) 160 (:td (:princ-safe (format-date-time (poi-medium-creation-time medium))))) 161 (:tr (:td ((:p :style "text-align:center;") 162 (cmslink (format nil "/edit-poi-medium/~D?poi=~D" 163 (store-object-id medium) (store-object-id poi)) 164 "edit")) 165 ((:p :style "text-align:center;") 166 (cmslink (format nil "/edit-poi-medium/~D?action=delete&ask-for-confirmation=on&poi=~D" 167 (store-object-id medium) (store-object-id poi)) 168 "delete"))) 169 ((:td :colspan "2") (medium-handler-preview medium :small t)))))))))))) 161 170 162 171 (defmethod handle-object-form ((handler edit-poi-handler) … … 202 211 (cmslink (edit-object-url (poi-medium-poi medium)) "Back to POI") 203 212 (content-language-chooser) 204 (:table ( medium-handler-preview medium)213 (:table (:tr (:td) (:td (medium-handler-preview medium))) 205 214 (:tr ((:td :colspan "2" :height "10"))) 206 215 ((:form :method "post" :enctype "multipart/form-data") … … 227 236 228 237 (defgeneric medium-pretty-type-string (medium) 229 (:method ((medium poi-image)) " POIImage")230 (:method ((medium poi-panorama)) "P OI Panorama")231 (:method ((medium poi-airal)) " POIAiral")232 (:method ((medium poi-movie)) " POIMovie"))238 (:method ((medium poi-image)) "Image") 239 (:method ((medium poi-panorama)) "Panorama") 240 (:method ((medium poi-airal)) "Airal") 241 (:method ((medium poi-movie)) "Movie")) 233 242 234 243 (defgeneric medium-handler-preview (medium &key small) 235 (:method ((medium t) &key small)244 (:method ((medium poi-medium) &key small) 236 245 (declare (ignore small)) 237 (html ((:tr :colspan "2") "No preview")))246 (html "No preview")) 238 247 (:method ((medium store-image) &key small) 239 248 "The default method for store-images." 240 249 (html 241 (:tr (:td "thumbnail") 242 (:td ((:a :href (format nil "/image/~A" (store-object-id medium)) 243 :target "_blank") 244 ((:img :src (format nil "/image/~A/thumbnail,,55,55" (store-object-id medium))))))) 250 ((:a :href (format nil "/edit-poi-medium/~A?poi=~A" 251 (store-object-id medium) (store-object-id (poi-medium-poi medium)))) 252 ((:img :src (format nil "/image/~A/thumbnail,,70,70" (store-object-id medium))))) 245 253 (unless small 246 254 (html 247 (:tr (:td "full image") 248 (:td ((:img :src (format nil "/image/~A" (store-object-id medium)))))))))) 255 (:p "Full size:" 256 (:br) 257 ((:img :src (format nil "/image/~A" (store-object-id medium))))))))) 249 258 (:method ((medium poi-panorama) &key small) 250 (html 251 (:tr (:td "thumbnail") 252 (:td (if small 253 (html 254 ((:a :href (format nil "/image/~A" (store-object-id medium)) 255 :target "_blank") 256 ((:img :src (format nil "/image/~A/thumbnail,,500,100" (store-object-id medium)))))) 257 (html 258 ((:applet :archive "/static/ptviewer.jar" 259 :code "ptviewer.class" 260 :width "300" 261 :height "150") 262 ((:param :name "file" 263 :value (format nil "/image/~A" (store-object-id medium)))) 264 ((:param :name "quality" :value "3"))))))))) 259 (if small 260 (html 261 ((:a :href (format nil "/edit-poi-medium/~A?poi=~A" 262 (store-object-id medium) (store-object-id (poi-medium-poi medium)))) 263 ((:img :src (format nil "/image/~A/thumbnail,,500,100" (store-object-id medium)))))) 264 (html 265 ((:applet :archive "/static/ptviewer.jar" 266 :code "ptviewer.class" 267 :width "300" 268 :height "150") 269 ((:param :name "file" 270 :value (format nil "/image/~A" (store-object-id medium)))) 271 ((:param :name "quality" :value "3")))))) 265 272 (:method ((medium poi-movie) &key small) 266 273 (if small 267 274 (call-next-method) 268 275 (html 269 (:tr (:td "movie") 270 (:td ((:embed :src (poi-movie-url medium) 271 :type "application/x-shockwave-flash" 272 :allowFullScreen "true" 273 :width "425" :height "344")))))))) 276 ((:embed :src (poi-movie-url medium) 277 :type "application/x-shockwave-flash" 278 :allowFullScreen "true" 279 :width "425" :height "344")))))) 274 280 275 281 (defgeneric medium-handler-validate-image-size (medium-or-type width height) … … 301 307 302 308 (defmethod handle-object-form ((handler edit-poi-medium-handler) (action (eql :delete)) (medium poi-medium)) 303 (let ((poi (poi-medium-poi medium)) 304 (type-string (medium-pretty-type-string medium))) 305 (delete-object medium) 306 (with-bos-cms-page (:title (format nil "~A has been deleted" type-string)) 307 (:h2 (format nil "The ~A has been deleted" type-string)) 308 "You may " (cmslink (edit-object-url poi) "continue editing the POI")))) 309 (with-query-params ((ask-for-confirmation nil boolean)) 310 (let ((poi (poi-medium-poi medium)) 311 (type-string (medium-pretty-type-string medium))) 312 (cond 313 (ask-for-confirmation 314 (with-bos-cms-page (:title (format nil "Really delete ~A?" type-string)) 315 (:h2 (format nil "Really delete ~A?" type-string)) 316 (:p "Yes, " (cmslink (format nil "/edit-poi-medium/~D?action=delete&poi=~D" 317 (store-object-id medium) (store-object-id poi)) 318 "delete it.")) 319 (:p "No, take me " (cmslink (edit-object-url poi) "back to the POI")))) 320 (t 321 (delete-object medium) 322 (with-bos-cms-page (:title (format nil "~A has been deleted" type-string)) 323 (:h2 (format nil "The ~A has been deleted" type-string)) 324 "You may " (cmslink (edit-object-url poi) "continue editing the POI"))))))) 309 325 310 326 (defmethod handle-object-form ((handler edit-poi-medium-handler) (action (eql :upload)) medium)
