Changeset 3708
- Timestamp:
- 07/31/08 11:36:07 (4 months ago)
- Files:
-
- trunk/projects/bos/m2/poi.lisp (modified) (1 diff)
- trunk/projects/bos/web/poi-handlers.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/m2/poi.lisp
r3706 r3708 149 149 ;;; (nth (1+ index) (poi-sat-images poi)). 150 150 (deftransaction poi-sat-images-exchange-neighbours (poi index) 151 (check-type index ( integer 0 4))151 (check-type index (mod 6)) 152 152 (multiple-value-bind (images positions) 153 153 (poi-images poi) 154 154 (declare (ignore images)) 155 155 (let ((media-index-a (nth index positions)) 156 (media-index-b (nth ( 1+ index) positions)))156 (media-index-b (nth (mod (1+ index) 6) positions))) 157 157 (rotatef (nth media-index-a (poi-media poi)) 158 158 (nth media-index-b (poi-media poi)))))) trunk/projects/bos/web/poi-handlers.lisp
r3707 r3708 53 53 (defmethod handle-object-form ((handler edit-poi-handler) 54 54 action (poi poi)) 55 (with-query-params (language shift shift- by)55 (with-query-params (language shift shift-id) 56 56 (unless language (setq language (request-language))) 57 57 (when shift 58 ;; change image order 59 (setq shift (find-store-object (parse-integer shift))) 60 (setq shift-by (parse-integer shift-by)) 61 (let* ((new-images (poi-sat-images poi)) 62 (old-position (position shift new-images)) 63 (tmp (nth old-position new-images))) 64 (assert (and (< -1 old-position (length new-images)) 65 (< -1 (+ shift-by old-position) (length new-images)))) 66 (setf (nth old-position new-images) (nth (+ shift-by old-position) new-images)) 67 (setf (nth (+ shift-by old-position) new-images) tmp) 68 (with-transaction ("setf poi-sat-images") 69 (setf (poi-sat-images poi) new-images)))) 58 (let ((shift (parse-integer shift)) 59 (shift-id (parse-integer shift-id))) 60 ;; only if this exchange has not already happened 61 (when (= shift-id (store-object-id (nth shift (poi-sat-images poi)))) 62 (poi-sat-images-exchange-neighbours poi shift)))) 70 63 (with-bos-cms-page (:title "Edit POI") 71 64 (content-language-chooser) … … 111 104 (:tr 112 105 (loop for image in (poi-sat-images poi) 113 for index from 1 by 1106 for index upfrom 0 114 107 do (html (:td ((:a :href (format nil "/edit-poi-image/~a?poi=~A" (store-object-id image) (store-object-id poi))) 115 108 ((:img :border "0" :src (format nil "/image/~a/thumbnail,,55,55" (store-object-id image))))) 116 109 :br 117 (if ( eql index 1)110 (if (zerop index) 118 111 (html ((:img :src "/images/trans.gif" :width "16"))) 119 (html ((:a :href (format nil "/edit-poi/~A?shift=~ A&shift-by=-1"120 (store-object-id poi) 121 (store-object-id image)))112 (html ((:a :href (format nil "/edit-poi/~A?shift=~D&shift-id=~D" 113 (store-object-id poi) (1- index) 114 (store-object-id (nth (1- index) (poi-sat-images poi))))) 122 115 ((:img :border "0" :src "/images/pfeil-l.gif"))))) 123 116 ((:img :src "/images/trans.gif" :width "23")) 124 117 (unless (eql index (length (poi-sat-images poi))) 125 (html ((:a :href (format nil "/edit-poi/~A?shift=~ A&shift-by=1"126 (store-object-id poi) 118 (html ((:a :href (format nil "/edit-poi/~A?shift=~D&shift-id=~D" 119 (store-object-id poi) index 127 120 (store-object-id image))) 128 121 ((:img :border "0" :src "/images/pfeil-r.gif"))))))))))
