Changeset 3462

Show
Ignore:
Timestamp:
07/16/08 15:19:28 (4 months ago)
Author:
ksprotte
Message:

equipped poi-javascript-handler with last-modified

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/projects/bos/web/poi-handlers.lisp

    r3452 r3462  
    360360 
    361361(defmethod handle ((handler poi-javascript-handler)) 
    362   (with-http-response (:content-type "text/html; charset=UTF-8") 
    363     (setf (hunchentoot:header-out :cache-control) "no-cache") 
    364     (setf (hunchentoot:header-out :pragma) "no-cache") 
    365     (setf (hunchentoot:header-out :expires) "-1") 
    366     (with-http-body () 
    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))))))))) 
     362  (let* ((last-paid-contracts (last-paid-contracts)) 
     363         (timestamp (max (reduce #'max (class-instances 'poi) 
     364                                 :key (lambda (poi) (store-object-last-change poi 1))) 
     365                         (reduce #'max last-paid-contracts 
     366                                 :key (lambda (contract) (store-object-last-change contract 0)))))) 
     367    (hunchentoot:handle-if-modified-since timestamp)   
     368    (setf (hunchentoot:header-out :last-modified) 
     369          (hunchentoot:rfc-1123-date timestamp)) 
     370    (with-http-response (:content-type "text/html; charset=UTF-8")     
     371      (with-http-body () 
     372        (html 
     373         ((:script :language "JavaScript") 
     374          (:princ (make-poi-javascript (or (hunchentoot:session-value :language) *default-language*))) 
     375          (:princ "parent.poi_fertig(pois, anzahlSponsoren, anzahlVerkauft);") 
     376          (:princ (format nil "parent.last_sponsors([~{~A~^,~%~}]);" (mapcar #'contract-js last-paid-contracts))))))))) 
    372377 
    373378(defclass poi-image-handler (object-handler)