X-Git-Url: http://git.kpe.io/?p=lml2.git;a=blobdiff_plain;f=apache-dir.lisp;h=31c9d5cbb3769a0a8ad45f7d5b99daf1c5171ab3;hp=0791fac690a41029c7987b63618f3ce443b634a9;hb=8f6d5f2e61de2208e20a7c887a8bda5ff989f741;hpb=91da637a38b3a1f38d0bf25b2e3584b80400664f diff --git a/apache-dir.lisp b/apache-dir.lisp index 0791fac..31c9d5c 100644 --- a/apache-dir.lisp +++ b/apache-dir.lisp @@ -31,6 +31,15 @@ ((:a :href link) (:princ (string-maybe-shorten name *apache-name-width*)))) (write-name-trailing-spaces stream name)) +(defun universal-time-to-apache-date (utime) + (multiple-value-bind + (second minute hour day-of-month month year day-of-week daylight-p zone) + (decode-universal-time utime) + (declare (ignore second day-of-week daylight-p zone)) + (format nil + (formatter "~2,'0D-~3/kmrcl::monthname/-~4,'0D ~2,'0D:~2,'0D") + day-of-month month year hour minute))) + (defun sort-dir-entries (entries sort-field direct) (case sort-field (:name @@ -65,17 +74,17 @@ (let* ((query (when query-string (split-uri-query-string query-string))) (sort-field (if query (cond - ((string-equal (caar query) "N") :name) - ((string-equal (caar query) "M") :modified) - ((string-equal (caar query) "S") :size) - ((string-equal (caar query) "D") :description) - (t :name)) - :name)) + ((string-equal (caar query) "N") :name) + ((string-equal (caar query) "M") :modified) + ((string-equal (caar query) "S") :size) + ((string-equal (caar query) "D") :description) + (t :name)) + :name)) (dir (cond - ((and query (string-equal (cdr (first query)) "D") :desc)) - (t :asc)))) + ((and query (string-equal (cdr (first query)) "D") :desc)) + (t :asc)))) (setq entries (sort-dir-entries entries sort-field dir)) - + (html-stream stream "" @@ -151,13 +160,13 @@ (case (car entry) (:dir (format nil "~Afolder.png" icon-base)) (:text (format nil "~Atext.png" icon-base)) - (t (format nil "~Af.png" icon-base))] + (t (format nil "~Af.png" icon-base))) :alt (case (car entry) (:dir "[DIR]") (:text "[TXT]") (t "[FIL]")))))) - " " + " " (write-name-link stream (second entry) (third entry)) " " (:princ (universal-time-to-apache-date (fourth entry)))