Changeset 3881

Show
Ignore:
Timestamp:
09/10/08 17:36:40 (2 months ago)
Author:
hans
Message:

Consolidate all HTML into one template. Remove template names from URL.
Improve Javascript-less mode.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/projects/quickhoney/src

    • Property svn:ignore set to
      site-config.lisp
  • trunk/projects/quickhoney/src/config.lisp

    r2417 r3881  
    1010(defparameter *website-directory* (probe-file (merge-pathnames #p"website/" *root-directory*))) 
    1111 
    12 (defparameter *webserver-port* 8080
     12(defparameter *webserver-port* 8081
  • trunk/projects/quickhoney/src/init.lisp

    r3473 r3881  
    3232  (actor-start (make-instance 'cron-actor)) 
    3333  (publish-quickhoney) 
     34  (when (probe-file "site-config.lisp") 
     35    (format t "; loading site configuration file~%") 
     36    (let ((*package* (find-package :quickhoney.config))) 
     37      (load "site-config.lisp"))) 
    3438  (hunchentoot:start-server :port *webserver-port*)) 
  • trunk/projects/quickhoney/src/tags.lisp

    r3858 r3881  
    1111 
    1212(defun image-url (image) 
    13   (format nil "/image-browse/~(~A/~A~)/~A" 
     13  (format nil "/~(~A/~A~)/~A" 
    1414          (quickhoney-image-category image) 
    1515          (quickhoney-image-subcategory image) 
     
    1717 
    1818(defun navigation (&key previous up next) 
    19   (html ((:div :class "nav") 
     19  (html ((:div :id "logo") 
     20         ((:img :src "/image/quickhoney-black" :alt "" :id "the_logo"))) 
     21        ((:div :class "nav") 
    2022         (when previous 
    2123           (html ((:div :class "previous") 
     
    3032(define-bknr-tag simple-image-browser () 
    3133  (tbnl:handle-if-modified-since (last-image-upload-timestamp)) 
    32   (destructuring-bind (&optional category subcategory image-name) (multiple-value-list (parse-url)) 
     34  (destructuring-bind (&optional category subcategory image-name) 
     35      (cdr (mapcar #'hunchentoot:url-decode (cl-ppcre:split "/" (hunchentoot:script-name*)))) 
    3336    (cond 
    3437      (image-name 
     
    4245              (next (cadr (member image images-in-category)))) 
    4346         (navigation :previous (and previous (image-url previous)) 
    44                      :up (format nil "/image-browse/~(~A/~A~)" 
     47                     :up (format nil "/~(~A/~A~)" 
    4548                                 (quickhoney-image-category image) 
    4649                                 (quickhoney-image-subcategory image)) 
    4750                     :next (and next (image-url next))) 
    48          (html  
    49                ((:img :src #?"/image/$(image-name)" 
    50                       :class "image" 
    51                       :alt "" 
    52                       :width (bknr.images:store-image-width image) 
    53                       :height (bknr.images:store-image-height image))) 
    54                ((:div :class "metadata" :style #?"height: $((bknr.images:store-image-height image))px") 
    55                 (:table 
    56                  (:tbody 
    57                   (:tr (:th "name") 
    58                        (:td (:princ image-name))) 
    59                   (:tr (:th "artist") 
    60                        (:td (:princ (bknr.user:user-full-name (or (bknr.user:owned-object-owner image) 
    61                                                                   (bknr.user:find-user "hans")))) 
    62                             ", QuickHoney")) 
    63                   (:tr (:th "date") 
    64                        (:td (:princ (format-date-time (bknr.datastore:blob-timestamp image) :vms-style t :show-time nil)))) 
    65                   (when (and (quickhoney-image-client image) 
    66                              (not (equal "" (quickhoney-image-client image)))) 
    67                     (html (:tr (:th "client") 
    68                                (:td (:princ (quickhoney-image-client image)))))) 
    69                   (when (quickhoney-image-spider-keywords image) 
    70                     (html (:tr (:th "keywords") 
    71                                (:td (:princ (quickhoney-image-spider-keywords image)))))))))))) 
     51         (html 
     52          (:h1 (:princ #?"$(category) / $(subcategory)")) 
     53          ((:img :src #?"/image/$(image-name)" 
     54                 :class "image" 
     55                 :alt "" 
     56                 :width (bknr.images:store-image-width image) 
     57                 :height (bknr.images:store-image-height image))) 
     58          ((:div :class "metadata" :style #?"height: $((bknr.images:store-image-height image))px") 
     59           (:table 
     60            (:tbody 
     61             (:tr (:th "name") 
     62                  (:td (:princ image-name))) 
     63             (:tr (:th "artist") 
     64                  (:td (:princ (bknr.user:user-full-name (or (bknr.user:owned-object-owner image) 
     65                                                             (bknr.user:find-user "hans")))) 
     66                       ", QuickHoney")) 
     67             (:tr (:th "date") 
     68                  (:td (:princ (format-date-time (bknr.datastore:blob-timestamp image) :vms-style t :show-time nil)))) 
     69             (when (and (quickhoney-image-client image) 
     70                        (not (equal "" (quickhoney-image-client image)))) 
     71               (html (:tr (:th "client") 
     72                          (:td (:princ (quickhoney-image-client image)))))) 
     73             (when (quickhoney-image-spider-keywords image) 
     74               (html (:tr (:th "keywords") 
     75                          (:td (:princ (quickhoney-image-spider-keywords image)))))))))))) 
    7276      (subcategory 
    73        (navigation :up (format nil "/image-browse/~(~A~)" category)) 
     77       (navigation :up (format nil "/~(~A~)" category)) 
    7478       (html 
    7579        (:h1 (:princ #?"$(category) / $(subcategory)")) 
     
    7983                              :key #'bknr.datastore:blob-timestamp)) 
    8084           (html 
    81             (:li ((:a :href #?"/image-browse/$(category)/$(subcategory)/$((bknr.images:store-image-name image))") 
     85            (:li ((:a :href #?"/$(category)/$(subcategory)/$((bknr.images:store-image-name image))") 
    8286                  (:princ (bknr.images:store-image-name image))))))))) 
    8387      (category 
    84        (navigation :up "/image-browse") 
     88       (navigation :up "/") 
    8589       (html 
    8690        (:h1 (:princ category)) 
     
    8892         (dolist (subcategory (subcategories-of (make-keyword-from-string category))) 
    8993           (html 
    90             (:li ((:a :href (format nil "/image-browse/~A/~(~A~)" category subcategory))) 
     94            (:li ((:a :href (format nil "/~A/~(~A~)" category subcategory))) 
    9195                 (:princ subcategory))))))) 
    9296      (t 
    93        (html 
    94         (:h1 ((:a :href "/image-browse/pixel") 
    95                "Nana Rausch"))          
    96         (:h1 ((:a :href "/image-browse/vector") "Peter") " " 
    97               ((:a :href "/image-browse/pen") "Stemmler"))))) 
    98     (html 
    99      ((:script :type "text/javascript") 
    100       (:princ #?"document.location.href = document.location.href.replace(/\\/image-browse\\//, '/index#');"))))) 
     97       (emit-tag-children))))) 
    10198 
    10299(define-bknr-tag login-status () 
  • trunk/projects/quickhoney/src/webserver.lisp

    r3872 r3881  
    3838                                        ("/json-news-archive" json-news-archive-handler) 
    3939                                        ("/json-news" json-news-handler) 
    40                                         ("/" template-handler 
    41                                          :default-template "frontpage" 
    42                                          :destination ,(namestring (merge-pathnames "templates/" *website-directory*)) 
    43                                          :command-packages (("http://quickhoney.com/" . :quickhoney.tags) 
    44                                                             ("http://bknr.net/" . :bknr.web))) 
    4540                                        user 
    4641                                        images 
     
    5146                                        ("/favicon.ico" file-handler 
    5247                                         :destination ,(merge-pathnames #p"static/favicon.ico" *website-directory*) 
    53                                          :content-type "application/x-icon")) 
     48                                         :content-type "application/x-icon") 
     49                                        ("/" template-handler 
     50                                         :default-template "index" 
     51                                         :catch-all t 
     52                                         :destination ,(namestring (merge-pathnames "templates/" *website-directory*)) 
     53                                         :command-packages (("http://quickhoney.com/" . :quickhoney.tags) 
     54                                                            ("http://bknr.net/" . :bknr.web)))) 
    5455                 :admin-navigation '(("user" . "/user/") 
    5556                                     ("images" . "/edit-images") 
  • trunk/projects/quickhoney/website/static/index.css

    r3868 r3881  
    77a:active { outline: none } 
    88a:focus { -moz-outline-style: none } 
    9  
    10 #logo { 
    11         margin: 290px 0px 305px 105px; 
    12 } 
    139 
    1410.page { 
     
    328324#cue { 
    329325        position: absolute; 
    330         visibility: visible
     326        visibility: hidden
    331327        left: 0px; 
    332328        background-color: white; 
     
    617613} 
    618614 
     615#loading #logo { 
     616        margin: 0px 0px 80px 105px; 
     617} 
     618 
     619#loading p { 
     620        margin: 1em; 
     621} 
     622#loading div p { 
     623        margin: 2em; 
     624} 
     625 
     626/* styles for the image detail window */ 
     627 
    619628#loading h1 { 
    620         text-align: center; 
    621         margin: 5em 0em 5em 0em; 
    622 
     629        font-size: 120%; 
     630        margin-bottom: 20px; 
     631
     632 
     633#loading th { 
     634        font-size: 70%; 
     635        padding: 0px 5px 0px 5px; 
     636
     637 
     638#loading #logo { 
     639        position: absolute; 
     640        right: 10px; 
     641        top: 10px; 
     642        z-index: 2; 
     643
     644 
     645#loading .image { 
     646        position: absolute; 
     647        z-index: 5; 
     648        top: 50px; 
     649        left: 300px; 
     650
     651 
     652#loading .nav { 
     653        position: absolute; 
     654        top: 80px; 
     655        left: 8px; 
     656
     657 
     658#loading .nav .previous { 
     659        position: absolute; 
     660        left: 34px; 
     661
     662 
     663#loading .nav .up { 
     664        position: absolute; 
     665        left: 65px; 
     666
     667 
     668#loading .nav .next { 
     669        position: absolute; 
     670        left: 91px; 
     671
     672 
     673#loading .metadata { 
     674        z-index: 3; 
     675        background-color: white; 
     676
     677 
     678#loading #footer { 
     679        padding-top: 30px; 
     680        font-size: 70%; 
     681
  • trunk/projects/quickhoney/website/static/javascript.js

    r3872 r3881  
    252252{ 
    253253    var color = pages[item.category] ? pages[item.category].link_color : '000000'; 
    254     var link_dest = { href: '/index#' + item.category + '/' + item.subcategory + '/' + encodeURI(item.name), 
    255                       onclick: function () { jump_to(item.category + '/' + item.subcategory + '/' + item.name) } }; 
     254    var path = item.category + '/' + item.subcategory + '/' + encodeURI(item.name); 
    256255    return DIV({ 'class': 'newsentry autonews news_' + item.category }, 
    257                A(link_dest
     256               A({ href: '/#' + path, onclick: function () { jump_to(path) } }
    258257                 IMG({ src: "/image/" + encodeURI(item.name) + '/cutout-button,,' + color + ',98,98,0,' + item.category, 
    259258                             width: 98, height: 98 })), 
     
    261260                   H1(null, item.name), 
    262261                   item.date, ' by ', item.owner, ' | ', 
    263                    A(link_dest, 'permalink'), 
     262                   A({ href: '/' + path, onclick: function () { jump_to(path) } }, 'permalink'), 
    264263                   BR(), 
    265264                   item.description)); 
     
    285284                   H1(null, item.title), 
    286285                   item.date, ' by ', item.owner, ' | ', 
    287                    A({ href: '#news/' + item.name }, 'permalink'), 
     286                   A({ href: 'news/' + item.name }, 'permalink'), 
    288287                   BR(), 
    289288                   DIV({ 'class': 'item-text' }, item.text), 
     
    11181117} 
    11191118 
    1120 /* open the main browser window */ 
    1121  
    1122 function frontpage() { 
    1123     var index_window = window.open('index', "index", "width=720,height=872,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=yes"); 
    1124     index_window.focus(); 
    1125  
    1126     return true; 
    1127 } 
    1128  
    11291119/* main initialization routine */ 
    11301120 
     
    11541144    loadJSONDoc('/json-news-archive/quickhoney').addCallbacks(initialize_news_archive, alert); 
    11551145 
    1156     if (!document.location.href.match(/#/)) { 
    1157         document.location.href += '#home'; 
    1158     } 
     1146    path = 'home'; 
     1147    if (document.location.pathname != '/') { 
     1148        path = document.location.pathname.substr(1); 
     1149    } else if (document.location.href.match(/#./)) { 
     1150        path = document.location.href.substr(document.location.href.indexOf("#") + 1); 
     1151    } 
     1152    document.location.href = "/#" + path; 
    11591153 
    11601154    poll_path(); 
     
    12031197    checkboxes[i].checked = b; 
    12041198  } 
    1205 } 
    1206  
    1207 /* robot_check() redirects to the real system if the client is not a robot */ 
    1208  
    1209 function robot_check() 
    1210 { 
    1211     document.location.href = document.location.href.replace(/\/image-browse.*/, "index#"); 
    12121199} 
    12131200 
  • trunk/projects/quickhoney/website/templates/index.xml

    r3872 r3881  
    6767 
    6868    <div id="loading" class="page"> 
    69       <img alt="" src="/image/startscreen" id="logo" border="0" width="438" height="67" /> 
     69      <quickhoney:simple-image-browser> 
     70        <img alt="" src="/image/startscreen" id="logo" border="0" width="438" height="67" /> 
     71 
     72        <h1>QuickHoney Illustrations</h1> 
     73        <p>Studio for Illustration, New York</p> 
     74        <h1>Peter Stemmler</h1> 
     75        <p>Phone: 646.270.5562<br/>Email: p@quickhoney.com</p> 
     76        <p>Works: <a href="/vector">vector</a> and <a href="/pen">pen</a></p> 
     77        <h1>Nana Rausch</h1> 
     78        <p>Phone 646.270.5592<br/>Email: n@quickhoney.com</p> 
     79        <p>Works: <a href="/pixel">pixel</a></p> 
     80      </quickhoney:simple-image-browser> 
    7081    </div> 
    7182