X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Falbum.git;a=blobdiff_plain;f=www-page.el;h=2c50727d0bc707653f80904635642511416b8c8a;hp=1682d0910d326e186ee862f0791c5d7d5ed06ed7;hb=40a882698055201c3dee08225c4700cf71a4d948;hpb=9650f04f3fd8ee2ddb1056c1030f21013c66a879 diff --git a/www-page.el b/www-page.el index 1682d09..2c50727 100644 --- a/www-page.el +++ b/www-page.el @@ -1,6 +1,6 @@ ;;; www-page.el --- Album page generator for page.cgi. -;; Copyright (C) 2005,2006 MORIOKA Tomohiko +;; Copyright (C) 2005,2006,2007 MORIOKA Tomohiko ;; Keywords: Photo, image, album, HTML, WWW @@ -27,6 +27,8 @@ ;;; Code: +(defconst www-page-version "0.4") + (defvar www-page-coding-system (if (featurep 'chise) 'utf-8-jp-er @@ -41,7 +43,7 @@ (VGA 640 480) (SVGA 800 600) (XGA 1024 768) - (WXGA 1280 768) + (WXGA 1280 800) (SXGA 1280 1024) (SXGA+ 1400 1050) (WSXGA+ 1680 1050) @@ -49,6 +51,7 @@ (WUXGA 1920 1200) (QXGA 2048 1536) (WQXGA 2560 1600) + (original nil nil) )) (defun decode-url-string (string &optional coding-system) @@ -66,19 +69,34 @@ (concat dest (substring string i)) coding-system)))) -(defun www-page-display-thumbnails (url-dir &optional size image-root - lang title parent-url) - (setq url-dir (file-name-as-directory url-dir)) - (let* ((desc-file - (expand-file-name "dir.desc" - (expand-file-name url-dir image-root))) - (params +(defun www-page-open-dir (url-dir &optional image-root) + (let* ((path (expand-file-name url-dir image-root)) + (desc-file (expand-file-name "dir.desc" path))) + (cons (cons 'location path) (with-temp-buffer (when (file-exists-p desc-file) (insert-file-contents desc-file) - (read (current-buffer))))) - source-images - file + (read (current-buffer))))))) + +(defun www-page-directory-image-files (url-dir image-root) + (let (source-images) + (dolist (file (directory-files (expand-file-name url-dir image-root) + nil "\\.\\(jpg\\|JPG\\)$" nil t)) + (unless (string-match "_[^_]+GA[^_]*$" + (file-name-sans-extension file)) + (setq source-images (cons file source-images)))) + (nreverse source-images))) + +(defun www-page-display-dir (url-dir &optional size image-root + lang title parent-url hide-cgi + pivot-mode) + (setq url-dir (file-name-as-directory url-dir)) + (princ "Content-Type: text/html; charset=UTF-8 + +") + (let* ((params (www-page-open-dir url-dir image-root)) + source-images ref-images + file i ref-file prev-file next-file file-desc note) (when (setq title (assq 'title params)) (setq title (cdr title))) @@ -88,6 +106,11 @@ (substring url-dir 0 (1- (length url-dir)))))) (when (setq source-images (assq 'files params)) (setq source-images (cdr source-images))) + (when (setq ref-images (assq 'refs params)) + (setq ref-images (cdr ref-images))) + (unless (or source-images ref-images) + (setq source-images + (www-page-directory-image-files url-dir image-root))) (when (setq note (assq 'note params)) (setq note (cdr note))) (when (setq parent-url (assq 'exit params)) @@ -105,22 +128,80 @@ (insert "\n") (insert "
\n") (insert (format "") (insert note)) @@ -132,21 +213,24 @@ (if parent-url (insert (format "[Return]\n" parent-url))) + (insert + (format "