Changeset 2644
- Timestamp:
- 03/03/08 09:54:57 (10 months ago)
- Files:
-
- trunk/projects/bos/m2/bos.m2.asd (modified) (1 diff)
- trunk/projects/bos/m2/geo-utm.lisp (modified) (7 diffs)
- trunk/projects/bos/m2/geometry.lisp (modified) (1 diff)
- trunk/projects/bos/m2/m2-pdf.lisp (modified) (1 diff)
- trunk/projects/bos/web/allocation-area-handlers.lisp (modified) (2 diffs)
- trunk/projects/bos/web/kml-handlers.lisp (modified) (5 diffs)
- trunk/projects/bos/web/map-handlers.lisp (modified) (2 diffs)
- trunk/projects/bos/web/news-tags.lisp (modified) (1 diff)
- trunk/projects/bos/web/packages.lisp (modified) (2 diffs)
- trunk/projects/bos/web/poi-handlers.lisp (modified) (2 diffs)
- trunk/projects/bos/web/reports-xml-handler.lisp (modified) (1 diff)
- trunk/projects/bos/web/sponsor-handlers.lisp (modified) (4 diffs)
- trunk/projects/bos/web/startup.lisp (modified) (1 diff)
- trunk/projects/bos/web/tags.lisp (modified) (4 diffs)
- trunk/projects/bos/web/web-macros.lisp (modified) (2 diffs)
- trunk/projects/bos/web/web-utils.lisp (modified) (3 diffs)
- trunk/projects/bos/web/webserver.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/m2/bos.m2.asd
r2559 r2644 2 2 3 3 (asdf:defsystem :bos.m2 4 :depends-on (:bknr.datastore :bknr.modules :cl-smtp :cl-mime :iconv :kmrcl :iterate :arnesi )4 :depends-on (:bknr.datastore :bknr.modules :cl-smtp :cl-mime :iconv :kmrcl :iterate :arnesi :cl-pdf) 5 5 :components ((:file "packages") 6 6 (:file "geo-utm" :depends-on ("packages")) trunk/projects/bos/m2/geo-utm.lisp
r2409 r2644 37 37 (setq alpha 38 38 (* (/ (+ sm-a sm-b) 2.0) 39 (+ (+ 1.0 (/ (expt n 2 .0) 4.0))40 (/ (expt n 4 .0) 64.0))))39 (+ (+ 1.0 (/ (expt n 2) 4.0)) 40 (/ (expt n 4) 64.0)))) 41 41 (setq beta 42 42 (+ 43 (+ (/ (* (- 3.0) n) 2.0) (/ (* 9.0 (expt n 3 .0)) 16.0))44 (/ (* (- 3.0) (expt n 5 .0)) 32.0)))43 (+ (/ (* (- 3.0) n) 2.0) (/ (* 9.0 (expt n 3)) 16.0)) 44 (/ (* (- 3.0) (expt n 5)) 32.0))) 45 45 (setq gamma 46 (+ (/ (* 15.0 (expt n 2 .0)) 16.0)47 (/ (* (- 15.0) (expt n 4 .0)) 32.0)))46 (+ (/ (* 15.0 (expt n 2)) 16.0) 47 (/ (* (- 15.0) (expt n 4)) 32.0))) 48 48 (setq delta 49 (+ (/ (* (- 35.0) (expt n 3 .0)) 48.0)50 (/ (* 105.0 (expt n 5 .0)) 256.0)))51 (setq epsilon (/ (* 315.0 (expt n 4 .0)) 512.0))49 (+ (/ (* (- 35.0) (expt n 3)) 48.0) 50 (/ (* 105.0 (expt n 5)) 256.0))) 51 (setq epsilon (/ (* 315.0 (expt n 4)) 512.0)) 52 52 (setq result 53 53 (* alpha … … 71 71 (setq alpha_ 72 72 (* (/ (+ sm-a sm-b) 2.0) 73 (+ (+ 1 (/ (expt n 2 .0) 4)) (/ (expt n 4.0) 64))))73 (+ (+ 1 (/ (expt n 2) 4)) (/ (expt n 4) 64)))) 74 74 (setq y_ (/ y alpha_)) 75 75 (setq beta_ 76 76 (+ 77 (+ (/ (* 3.0 n) 2.0) (/ (* (- 27.0) (expt n 3 .0)) 32.0))78 (/ (* 269.0 (expt n 5 .0)) 512.0)))77 (+ (/ (* 3.0 n) 2.0) (/ (* (- 27.0) (expt n 3)) 32.0)) 78 (/ (* 269.0 (expt n 5)) 512.0))) 79 79 (setq gamma_ 80 (+ (/ (* 21.0 (expt n 2 .0)) 16.0)81 (/ (* (- 55.0) (expt n 4 .0)) 32.0)))80 (+ (/ (* 21.0 (expt n 2)) 16.0) 81 (/ (* (- 55.0) (expt n 4)) 32.0))) 82 82 (setq delta_ 83 (+ (/ (* 151.0 (expt n 3 .0)) 96.0)84 (/ (* (- 417.0) (expt n 5 .0)) 128.0)))85 (setq epsilon_ (/ (* 1097.0 (expt n 4 .0)) 512.0))83 (+ (/ (* 151.0 (expt n 3)) 96.0) 84 (/ (* (- 417.0) (expt n 5)) 128.0))) 85 (setq epsilon_ (/ (* 1097.0 (expt n 4)) 512.0)) 86 86 (setq result 87 87 (+ … … 99 99 (setq ep2 100 100 (/ (- (expt sm-a 2.0) (expt sm-b 2.0)) 101 (expt sm-b 2 .0)))102 (setq nu2 (* ep2 (expt (cos phi) 2 .0)))103 (setq n (/ (expt sm-a 2 .0) (* sm-b (sqrt (+ 1 nu2)))))101 (expt sm-b 2))) 102 (setq nu2 (* ep2 (expt (cos phi) 2))) 103 (setq n (/ (expt sm-a 2) (* sm-b (sqrt (+ 1 nu2))))) 104 104 (setq %t (tan phi)) 105 105 (setq t2 (* %t %t)) 106 (setq tmp (- (* (* t2 t2) t2) (expt %t 6 .0)))106 (setq tmp (- (* (* t2 t2) t2) (expt %t 6))) 107 107 (setq l (- lambda lambda0)) 108 108 (setq l3coef (+ (- 1.0 t2) nu2)) … … 124 124 (+ 125 125 (+ (* (* n (cos phi)) l) 126 (* (* (* (/ n 6.0) (expt (cos phi) 3 .0)) l3coef)127 (expt l 3 .0)))128 (* (* (* (/ n 120.0) (expt (cos phi) 5 .0)) l5coef)129 (expt l 5 .0)))130 (* (* (* (/ n 5040.0) (expt (cos phi) 7 .0)) l7coef)131 (expt l 7 .0)))126 (* (* (* (/ n 6.0) (expt (cos phi) 3)) l3coef) 127 (expt l 3))) 128 (* (* (* (/ n 120.0) (expt (cos phi) 5)) l5coef) 129 (expt l 5))) 130 (* (* (* (/ n 5040.0) (expt (cos phi) 7)) l7coef) 131 (expt l 7))) 132 132 (+ 133 133 (+ 134 134 (+ 135 135 (+ (arc-length-of-meridian phi) 136 (* (* (* (/ %t 2.0) n) (expt (cos phi) 2 .0))137 (expt l 2 .0)))138 (* (* (* (* (/ %t 24.0) n) (expt (cos phi) 4 .0)) l4coef)139 (expt l 4 .0)))140 (* (* (* (* (/ %t 720.0) n) (expt (cos phi) 6 .0)) l6coef)141 (expt l 6 .0)))142 (* (* (* (* (/ %t 40320.0) n) (expt (cos phi) 8 .0)) l8coef)143 (expt l 8 .0))))))))136 (* (* (* (/ %t 2.0) n) (expt (cos phi) 2)) 137 (expt l 2))) 138 (* (* (* (* (/ %t 24.0) n) (expt (cos phi) 4)) l4coef) 139 (expt l 4))) 140 (* (* (* (* (/ %t 720.0) n) (expt (cos phi) 6)) l6coef) 141 (expt l 6))) 142 (* (* (* (* (/ %t 40320.0) n) (expt (cos phi) 8)) l8coef) 143 (expt l 8)))))))) 144 144 145 145 (defun map-xyto-lat-lon (x y lambda0) … … 149 149 (setq phif (footpoint-latitude y)) 150 150 (setq ep2 151 (/ (- (expt sm-a 2 .0) (expt sm-b 2.0))152 (expt sm-b 2 .0)))151 (/ (- (expt sm-a 2) (expt sm-b 2)) 152 (expt sm-b 2))) 153 153 (setq cf (cos phif)) 154 (setq nuf2 (* ep2 (expt cf 2 .0)))155 (setq nf (/ (expt sm-a 2 .0) (* sm-b (sqrt (+ 1 nuf2)))))154 (setq nuf2 (* ep2 (expt cf 2))) 155 (setq nf (/ (expt sm-a 2) (* sm-b (sqrt (+ 1 nuf2))))) 156 156 (setq nfpow nf) 157 157 (setq tf (tan phif)) … … 201 201 (+ 202 202 (+ (+ phif (* (* x2frac x2poly) (* x x))) 203 (* (* x4frac x4poly) (expt x 4 .0)))204 (* (* x6frac x6poly) (expt x 6 .0)))205 (* (* x8frac x8poly) (expt x 8 .0)))203 (* (* x4frac x4poly) (expt x 4))) 204 (* (* x6frac x6poly) (expt x 6))) 205 (* (* x8frac x8poly) (expt x 8))) 206 206 (+ 207 207 (+ 208 208 (+ (+ lambda0 (* x1frac x)) 209 (* (* x3frac x3poly) (expt x 3 .0)))210 (* (* x5frac x5poly) (expt x 5 .0)))211 (* (* x7frac x7poly) (expt x 7 .0))))))))209 (* (* x3frac x3poly) (expt x 3))) 210 (* (* x5frac x5poly) (expt x 5))) 211 (* (* x7frac x7poly) (expt x 7)))))))) 212 212 213 213 (defun lon-lat-to-utm-x-y (lon lat) … … 224 224 225 225 (defun utm-x-y-to-lon-lat (x y zone southhemi-p) 226 "Returns two values LON and LAT."226 "Returns list (LON LAT)." 227 227 (let ((x (float x 0d0)) 228 228 (y (float y 0d0)) trunk/projects/bos/m2/geometry.lisp
r2632 r2644 286 286 287 287 (defun format-decimal-degree (degree) 288 (format-mixed-radix-number nil (* 60 60 degree) '(60 60 360) '(" ~,2FŽŽ" "~DŽ" "~D°")))288 (format-mixed-radix-number nil (* 60 60 degree) '(60 60 360) '("~,2FŽŽ" "~DŽ" "~D°"))) 289 289 290 290 (defun format-lon-lat (stream lon lat) 291 (format stream "~A ~:[S~;N~], ~A~:[W~;E~]"291 (format stream "~A~:[S~;N~], ~A~:[W~;E~]" 292 292 (format-decimal-degree (abs lat)) 293 293 (plusp lat) trunk/projects/bos/m2/m2-pdf.lisp
r2629 r2644 27 27 (draw-coordinate 180 40 (m2-lon-lat last-m2)) 28 28 29 (pdf:translate (+ 65.0 (if (> bb-width bb-height) 029 (pdf:translate (+ 65.0 (if (>= bb-width bb-height) 0 30 30 (* 0.5 (abs (- bb-width bb-height)) scale))) 31 (+ 65.0 (if (> bb-height bb-width) 031 (+ 65.0 (if (>= bb-height bb-width) 0 32 32 (* 0.5 (abs (- bb-width bb-height)) scale)))) 33 33 trunk/projects/bos/web/allocation-area-handlers.lisp
r2599 r2644 144 144 (redirect (format nil "/map-browser/~A/~A?heading=~A&chosen-url=~A&" 145 145 x y 146 ( uriencode-string"Choose lower right point of allocation area")147 ( uriencode-string(format nil "~A?left=~A&top=~A&"146 (encode-urlencoded "Choose lower right point of allocation area") 147 (encode-urlencoded (format nil "~A?left=~A&top=~A&" 148 148 (hunchentoot:request-uri) 149 149 x y))))) … … 166 166 (redirect (format nil "/map-browser/~A/~A?heading=~A&chosen-url=~A&" 167 167 start-x start-y 168 ( uriencode-string"Choose upper left point of allocation area")169 ( uriencode-string(format nil "~A?" (hunchentoot:request-uri)))))))168 (encode-urlencoded "Choose upper left point of allocation area") 169 (encode-urlencoded (format nil "~A?" (hunchentoot:request-uri))))))) 170 170 171 171 (defmethod handle-form ((handler create-allocation-area-handler) (action (eql :upload))) trunk/projects/bos/web/kml-handlers.lisp
r2479 r2644 6 6 (defun kml-format-color (color &optional (opacity 255)) 7 7 (format nil "~2,'0X~{~2,'0X~}" opacity (reverse color))) 8 9 (defun utf-8-text (string)10 ;; cxml::utf8-string-to-rod did not what we want, so we use11 ;; utf-8-string-to-bytes instead12 (cxml:text (utf-8-string-to-bytes string)))13 8 14 9 (defun contract-description (contract language) … … 25 20 (with-element "tr" 26 21 (with-element "td" (text "Name:")) 27 (with-element "td" ( utf-8-text (if name name "[anonymous]"))))22 (with-element "td" (if name name "[anonymous]"))) 28 23 (with-element "tr" 29 24 (with-element "td" (text "Land:")) … … 31 26 (with-element "tr" 32 27 (with-element "td" (text "gesponsort:")) 33 (with-element "td" ( utf-8-text (format nil "~D m²" (length (contract-m2s contract))))))28 (with-element "td" (format nil "~D m²" (length (contract-m2s contract))))) 34 29 (with-element "tr" 35 30 (with-element "td" (text "seit:")) 36 31 (with-element "td" (text (format-date-time (contract-date contract) :show-time nil))))) 37 32 (when (sponsor-info-text sponsor) 38 ( utf-8-text (sponsor-info-text sponsor))))))))33 (sponsor-info-text sponsor))))))) 39 34 40 35 (defclass contract-kml-handler (object-handler) … … 50 45 (name (user-full-name (contract-sponsor c)))) 51 46 (with-element "Placemark" 52 (with-element "name" ( utf-8-text (format nil "~A ~Dm²"53 (if name name "anonymous")54 (length (contract-m2s c)))))55 (with-element "description" ( utf-8-text (contract-description c :de)))47 (with-element "name" (format nil "~A ~Dm²" 48 (if name name "anonymous") 49 (length (contract-m2s c)))) 50 (with-element "description" (contract-description c :de)) 56 51 (with-element "Style" 57 52 (attribute "id" "#region") … … 70 65 (when (eq c contract) 71 66 (with-element "Placemark" 72 (with-element "name" ( utf-8-text (format nil "~A ~Dm²"73 (if name name "anonymous")74 (length (contract-m2s c)))))75 (with-element "description" ( utf-8-text (contract-description c :de)))67 (with-element "name" (format nil "~A ~Dm²" 68 (if name name "anonymous") 69 (length (contract-m2s c)))) 70 (with-element "description" (contract-description c :de)) 76 71 (with-element "Point" 77 72 (with-element "coordinates" trunk/projects/bos/web/map-handlers.lisp
r2484 r2644 69 69 operation-strings)) 70 70 71 ;; trunk-reorg adaption72 71 (defmethod handle-object ((handler image-tile-handler) tile) 73 72 ;; xxx parse url another time - the parse result of … … 75 74 (destructuring-bind (x y &rest operation-strings) (decoded-handler-path handler) 76 75 (declare (ignore x y)) 77 (let ((changed-time (image-tile-changed-time tile)) 78 (ims (hunchentoot:header-in :if-modified-since))) 79 (format t "Warning: not setting last-modified of *ent* to changed-time") 80 #+(or) 81 (format t "; image-tile-handler handle-object: changed-time: ~A if-modified-since: ~A~%" (format-date-time changed-time) ims) 82 (if (or (not ims) 83 (> changed-time (date-to-universal-time ims))) 84 (let ((image (image-tile-image tile (apply #'parse-operations operation-strings)))) 85 (emit-image-to-browser image :png 86 :date changed-time 87 :max-age 60) 88 (cl-gd:destroy-image image)) 89 (with-http-response () 90 (with-http-body () 91 ;; do nothing 92 )))))) 76 (let ((changed-time (image-tile-changed-time tile))) 77 (hunchentoot:handle-if-modified-since changed-time) 78 (let ((image (image-tile-image tile (apply #'parse-operations operation-strings)))) 79 (emit-image-to-browser image :png 80 :date changed-time 81 :max-age 60) 82 (cl-gd:destroy-image image))))) 93 83 94 84 (defclass enlarge-tile-handler (image-tile-handler) trunk/projects/bos/web/news-tags.lisp
r2484 r2644 34 34 35 35 (define-bknr-tag news-item () 36 (let ((news-item (find-store-object (parse-integer (nth-value 1 (parse-url (get-template-var :request))))))36 (let ((news-item (find-store-object (parse-integer (nth-value 1 (parse-url))))) 37 37 (language (hunchentoot:session-value :language))) 38 38 (html ((:h1 :class "extra") trunk/projects/bos/web/packages.lisp
r2560 r2644 2 2 3 3 (defpackage :bos.web 4 (:nicknames :web :worldpay-test) 4 5 (:use :cl 5 6 :date-calc … … 23 24 :bos.m2 24 25 :bos.m2.config) 25 (:nicknames :web :worldpay-test)26 26 (:shadowing-import-from :cl-interpol #:quote-meta-chars) 27 27 (:export)) trunk/projects/bos/web/poi-handlers.lisp
r2484 r2644 96 96 (cmslink (format nil "map-browser/~A/~A?chosen-url=~A" 97 97 (first (poi-area poi)) (second (poi-area poi)) 98 ( uriencode-string(format nil "~A?action=save&" (hunchentoot:request-uri))))98 (encode-urlencoded (format nil "~A?action=save&" (hunchentoot:request-uri)))) 99 99 "[relocate]")) 100 100 (t 101 101 (cmslink (format nil "map-browser/?chosen-url=~A" 102 ( uriencode-string(format nil "~A?action=save&" (hunchentoot:request-uri))))102 (encode-urlencoded (format nil "~A?action=save&" (hunchentoot:request-uri)))) 103 103 "[choose]"))))) 104 104 (:tr (:td "icon") … … 365 365 (setf (hunchentoot:header-out :expires) "-1") 366 366 (with-http-body () 367 (let ((*standard-output* *html-stream*)) 368 (princ "<script language=\"JavaScript\">") (terpri) 369 (princ (make-poi-javascript (or (hunchentoot:session-value :language) *default-language*))) (terpri) 370 (princ "parent.poi_fertig(pois, anzahlSponsoren, anzahlVerkauft);") (terpri) 371 (format t "parent.last_sponsors([~{~A~^,~%~}]);" (mapcar #'contract-js (last-paid-contracts))) 372 (princ "</script>") (terpri))))) 367 (html 368 ((:script :language "JavaScript") 369 (:princ (make-poi-javascript (or (hunchentoot:session-value :language) *default-language*))) 370 (:princ "parent.poi_fertig(pois, anzahlSponsoren, anzahlVerkauft);") 371 (:princ (format nil "parent.last_sponsors([~{~A~^,~%~}]);" (mapcar #'contract-js (last-paid-contracts))))))))) 373 372 374 373 (defclass poi-image-handler (object-handler) trunk/projects/bos/web/reports-xml-handler.lisp
r2481 r2644 11 11 (defvar *year*) 12 12 (defvar *month-names* '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) 13 14 (defmethod cxml:unparse-attribute ((value (eql nil))) 15 "false") 16 17 (defmethod cxml:unparse-attribute ((value (eql t))) 18 "true") 13 19 14 20 (defmacro defreport (name arguments &body body) trunk/projects/bos/web/sponsor-handlers.lisp
r2502 r2644 39 39 (defmethod handle-object-form ((handler edit-sponsor-handler) action (sponsor (eql nil))) 40 40 (with-query-params (id key count) 41 (format t "id ~A key ~A count ~A~%" id key count) 41 42 (when id 42 (redirect #?"/edit-sponsor/$(id)") 43 (return-from handle-object-form)) 44 (when (or key count) 43 (redirect #?"/edit-sponsor/$(id)")) 44 (if (or key count) 45 45 (let ((regex (format nil "(?i)~A" key)) 46 46 (found 0)) … … 67 67 (return)))) 68 68 (:tr ((:th :colspan "7") (:princ-safe (format nil "~A sponsor~:p ~A" found (if count "shown" "found")))))))) 69 (return-from handle-object-form))) 70 (with-bos-cms-page (:title "Find or Create Sponsor") 71 (html 72 ((:form :name "form") 73 ((:table) 74 (:tr ((:td :colspan "2") 75 (:h2 "Search for sponsor"))) 76 (:tr (:td "Sponsor- or Contract-ID") 77 (:td (text-field "id" :size 7))) 78 (:tr (:td "Email-Adress or name") 79 (:td (text-field "key"))) 80 (:tr (:td "Show new sponsors (enter count)") 81 (:td (text-field "count" :size 4))) 82 (:tr (:td (submit-button "search" "search"))) 83 (:tr (:td "") (:td ((:a :class "cmslink" 84 :href "/reports-xml/all-contracts?download=contracts.xls") 85 "Download complete sponsor DB in XML format"))) 86 (:tr ((:th :colspan "2" :align "left") 87 (:h2 "Create sponsor"))) 88 (:tr (:td "Date (DD.MM.YYYY)") 89 (:td (text-field "date" :size 10 :value (format-date-time (get-universal-time) :show-time nil)))) 90 (:tr (:td "Number of square meters") 91 (:td (text-field "numsqm" :size 5))) 92 (:tr (:td "Country code (2 chars)") 93 (:td (text-field "country" :size 2 :value "DE"))) 94 (:tr (:td "Email-Address") 95 (:td (text-field "email" :size 40))) 96 (:tr (:td "Language for communication and certificate") 97 (:td (language-selector "en"))) 98 (:tr (:td "Name for certificate") 99 (:td (text-field "name" :size 20))) 100 (:tr (:td "Postal address for certificate") 101 (:td (textarea-field "address" :rows 5 :cols 40))) 102 (:tr (:td "Issue donation cert at the end of the year") 103 (:td (checkbox-field "donationcert-yearly" "" :checked nil))) 104 (:tr (:td (submit-button "create" "create" :formcheck "javascript:return check_complete_sale()")))))))) 69 (with-bos-cms-page (:title "Find or Create Sponsor") 70 (html 71 ((:form :name "form") 72 ((:table) 73 (:tr ((:td :colspan "2") 74 (:h2 "Search for sponsor"))) 75 (:tr (:td "Sponsor- or Contract-ID") 76 (:td (text-field "id" :size 7))) 77 (:tr (:td "Email-Adress or name") 78 (:td (text-field "key"))) 79 (:tr (:td "Show new sponsors (enter count)") 80 (:td (text-field "count" :size 4))) 81 (:tr (:td (submit-button "search" "search"))) 82 (:tr (:td "") (:td ((:a :class "cmslink" 83 :href "/reports-xml/all-contracts?download=contracts.xls") 84 "Download complete sponsor DB in XML format"))) 85 (:tr ((:th :colspan "2" :align "left") 86 (:h2 "Create sponsor"))) 87 (:tr (:td "Date (DD.MM.YYYY)") 88 (:td (text-field "date" :size 10 :value (format-date-time (get-universal-time) :show-time nil)))) 89 (:tr (:td "Number of square meters") 90 (:td (text-field "numsqm" :size 5))) 91 (:tr (:td "Country code (2 chars)") 92 (:td (text-field "country" :size 2 :value "DE"))) 93 (:tr (:td "Email-Address") 94 (:td (text-field "email" :size 40))) 95 (:tr (:td "Language for communication and certificate") 96 (:td (language-selector "en"))) 97 (:tr (:td "Name for certificate") 98 (:td (text-field "name" :size 20))) 99 (:tr (:td "Postal address for certificate") 100 (:td (textarea-field "address" :rows 5 :cols 40))) 101 (:tr (:td "Issue donation cert at the end of the year") 102 (:td (checkbox-field "donationcert-yearly" "" :checked nil))) 103 (:tr (:td (submit-button "create" "create" :formcheck "javascript:return check_complete_sale()")))))))))) 105 104 106 105 (defun date-to-universal (date-string) … … 262 261 (find-store-object (parse-integer sponsor-id-or-x) :class 'sponsor)) 263 262 (t 264 ( when (eq (find-class 'sponsor) (class-of bknr.web:*user*))265 bknr.web:*user*)))))263 (and (typep (bknr-session-user) 'sponsor) 264 (bknr-session-user)))))) 266 265 (with-http-response (:content-type "text/html; charset=UTF-8") 267 266 (with-http-body () 268 (let ((*standard-output* *html-stream*)) 269 (princ "<script language=\"JavaScript\">") (terpri)270 ( princ "var profil;") (terpri)267 (html 268 ((:script :language "JavaScript") 269 (:princ "var profil;") 271 270 (when (and sponsor (find-if #'contract-paidp (sponsor-contracts sponsor))) 272 (princ (make-m2-javascript sponsor)) (terpri)) 273 (princ "parent.qm_fertig(profil);") (terpri) 274 (princ "</script>") (terpri))))))) 271 (html (:princ (make-m2-javascript sponsor)))) 272 (:princ "parent.qm_fertig(profil);")))))))) 275 273 276 274 (defclass sponsor-login-handler (page-handler) … … 284 282 (setf (hunchentoot:header-out :expires) "-1") 285 283 (with-http-body () 286 (format *html-stream* "<script>~%parent.set_loginstatus('~A');~%</script>~%" 287 (cond 288 ((eq (find-class 'sponsor) (class-of bknr.web:*user*)) 289 "logged-in") 290 (__sponsorid 291 "login-failed") 292 (t 293 "not-logged-in"))))))) 284 (html 285 ((:script :language "JavaScript") 286 (:princ (format nil "parent.set_loginstatus('~A');" 287 (cond 288 ((typep (bknr-session-user) 'sponsor) 289 "logged-in") 290 (__sponsorid 291 "login-failed") 292 (t 293 "not-logged-in")))))))))) 294 294 295 295 (defclass cert-regen-handler (editor-only-handler edit-object-handler) trunk/projects/bos/web/startup.lisp
r2484 r2644 47 47 (when *webserver* 48 48 (hunchentoot:stop-server *webserver*)) 49 (setf *hunchentoot-default-external-format* (flex:make-external-format :utf-8 :eol-style :lf))49 (setf hunchentoot:*hunchentoot-default-external-format* (flex:make-external-format :utf-8 :eol-style :lf)) 50 50 (setq *webserver* (hunchentoot:start-server :port *port*))) trunk/projects/bos/web/tags.lisp
r2590 r2644 43 43 (contract-set-download-only-p contract t)) 44 44 (contract-issue-cert contract name :address address :language (hunchentoot:session-value :language)) 45 (mail-worldpay-sponsor-data (get-template-var :request))45 (mail-worldpay-sponsor-data) 46 46 (bknr.web::redirect-request :target (if gift "index" 47 47 (format nil "profil_setup?name=~A&email=~A&sponsor-id=~A" 48 ( uriencode-string name) (uriencode-stringemail)48 (encode-urlencoded name) (encode-urlencoded email) 49 49 (store-object-id (contract-sponsor contract)))))))) 50 50 … … 135 135 plz ort) 136 136 :language (hunchentoot:session-value :language)) 137 (mail-manual-sponsor-data (get-template-var :request)))))137 (mail-manual-sponsor-data)))) 138 138 139 139 (define-bknr-tag when-certificate (&key children) 140 (let ((sponsor (bknr- request-user (get-template-var :request))))140 (let ((sponsor (bknr-session-user))) 141 141 (when (some #'contract-pdf-pathname (sponsor-contracts sponsor)) 142 142 (mapc #'emit-template-node children)))) … … 147 147 148 148 (define-bknr-tag save-profile (&key children) 149 (let* ((sponsor (bknr- request-user (get-template-var :request)))149 (let* ((sponsor (bknr-session-user)) 150 150 (contract (first (sponsor-contracts sponsor)))) 151 151 (with-template-vars (email name password infotext anonymize) … … 182 182 183 183 (define-bknr-tag admin-login-page (&key children) 184 (if (editor-p (bknr- request-user (get-template-var :request)))184 (if (editor-p (bknr-session-user)) 185 185 (html (:head ((:meta :http-equiv "refresh" :content "0; url=/admin")))) 186 186 (mapc #'emit-template-node children))) trunk/projects/bos/web/web-macros.lisp
r2479 r2644 3 3 (enable-interpol-syntax) 4 4 5 (defmacro with-bos-cms-page ((&key title response) &rest body)5 (defmacro with-bos-cms-page ((&key title (response hunchentoot:+http-ok+)) &rest body) 6 6 `(with-bknr-page (:title ,title :response ,response) 7 7 ,@body)) … … 15 15 (setf (hunchentoot:header-out :content-disposition) 16 16 (format nil "attachment; filename=~A" download)))) 17 (with-http-body ()18 (let ((*xml-sink* (make-character-stream-sink xhtml-generator:*html-sink*:canonical nil)))19 (with-xml-output *xml-sink*20 (with-element ,root-element21 ,@body))))))17 (with-output-to-string (s) 18 (let ((*xml-sink* (make-character-stream-sink s :canonical nil))) 19 (with-xml-output *xml-sink* 20 (with-element ,root-element 21 ,@body)))))) 22 22 23 23 (defmacro with-xml-error-handler (() &body body) trunk/projects/bos/web/web-utils.lisp
r2484 r2644 9 9 (defmethod website-show-page ((website bos-website) fn title) 10 10 (html 11 (princ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" *html-stream*)12 (princ #\Newline *html-stream*)13 11 (:html 14 12 (:head … … 28 26 "local time is " (:princ-safe (format-date-time)) 29 27 " - " 30 (if (and (equal 'bknr-request (type-of *req*)) 31 (bknr-request-user *req*)) 32 (html "logged in as " (html-link (bknr-request-user *req*))) 28 (if (bknr-session-user) 29 (html "logged in as " (html-link (bknr-session-user))) 33 30 (html "not logged in")) 34 31 " - current content language is " … … 61 58 62 59 (defun decode-ismap-query-string () 63 (let ((coord-string (caar ( request-query req))))60 (let ((coord-string (caar (query-params)))) 64 61 (when (and coord-string (scan #?r"^\d*,\d*$" coord-string)) 65 62 (mapcar #'parse-integer (split "," coord-string))))) trunk/projects/bos/web/webserver.lisp
r2488 r2644 112 112 (with-query-params (logout) 113 113 (when logout 114 ( bknr.web::drop-session*session*)))114 (hunchentoot:remove-session hunchentoot:*session*))) 115 115 (let ((language (hunchentoot:session-value :language))) 116 116 (redirect #?"/infosystem/$(language)/satellitenkarte.htm"))) … … 169 169 (call-next-method)))) 170 170 171 ;; trunk-reorg adaption 172 ;; (defmethod authorize :after ((authorizer bos-authorizer) 173 ;; (req http-request) 174 ;; (ent net.aserve::entity)) 175 ;; (let ((new-language (or (language-from-url (hunchentoot:request-uri)) 176 ;; (query-param "language"))) 177 ;; (current-language (gethash :language (bknr-session-variables *session*)))) 178 ;; (when (or (not current-language) 179 ;; (and new-language 180 ;; (not (equal new-language current-language)))) 181 ;; (setf (gethash :language (bknr-session-variables *session*)) 182 ;; (or new-language 183 ;; (find-browser-prefered-language) 184 ;; *default-language*))))) 171 (defmethod authorize :after ((authorizer bos-authorizer)) 172 (let ((new-language (or (languagen-from-url (hunchentoot:request-uri)) 173 (query-param "language"))) 174 (current-language (hunchentoot:session-value :language))) 175 (when (or (not current-language) 176 (and new-language 177 (not (equal new-language current-language)))) 178 (setf (hunchentoot:session-value :language) 179 (or new-language 180 (find-browser-prefered-language) 181 *default-language*))))) 185 182 186 183 ;;; TODOreorg … … 203 200 ("/edit-poi-image" edit-poi-image-handler) 204 201 ("/edit-sponsor" edit-sponsor-handler) 202 ("/contract-kml" contract-kml-handler) 203 ("/contract-image" contract-image-handler) 205 204 ("/contract" contract-handler) 206 205 ("/reports-xml" reports-xml-handler) … … 217 216 ("/allocation-area-gfx" allocation-area-gfx-handler) 218 217 ("/allocation-cache" allocation-cache-handler) 219 ("/contract-image" contract-image-handler)220 218 ("/certificate" certificate-handler) 221 219 ("/cert-regen" cert-regen-handler) … … 230 228 ("/statistics" statistics-handler) 231 229 ("/rss" rss-handler) 232 ("/contract-kml" contract-kml-handler)233 230 #+(or) 234 231 ("/" redirect-handler
