Changeset 12602 in project


Ignore:
Timestamp:
11/26/08 22:07:02 (13 years ago)
Author:
sjamaan
Message:

Update phoghorn and sxml-pagination to make use of update uri-generic code, which uses symbols instead of strings as query arg keys

Location:
release/4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/phoghorn/phoghorn.scm

    r12366 r12602  
    4848;; Config
    4949(define gallery-dir (make-parameter "galleries"))
    50 (define gallery-var (make-parameter "gallery"))
    51 (define entry-var (make-parameter "entry"))
     50(define gallery-var (make-parameter 'gallery))
     51(define entry-var (make-parameter 'entry))
    5252(define root-gallery-name (make-parameter "Galleries"))
    5353(define max-thumb-dimensions (make-parameter 100))
     
    8383
    8484(define (current-gallery)
    85   (alist-ref (gallery-var) (or (uri-query (request-uri (current-request))) '())
    86              string=?))
     85  (alist-ref (gallery-var) (or (uri-query (request-uri (current-request))) '())))
    8786
    8887(define (current-entry-filename)
    89   (alist-ref (entry-var) (or (uri-query (request-uri (current-request))) '())
    90              string=?))
     88  (alist-ref (entry-var) (or (uri-query (request-uri (current-request))) '())))
    9189
    9290(define (link-to path attribs)
    93   (if (null? attribs)
    94       path
    95       (string-append path "?" (string-join (map (lambda (v)
    96                                                   (sprintf "~A=~A"
    97                                                    (uri-encode-string (car v))
    98                                                    (uri-encode-string (cdr v))))
    99                                                 attribs) "&"))))
     91  (uri->string (update-uri (uri-reference path) query: attribs)))
    10092
    10193(define (gallery-contents)
  • release/4/sxml-fu/sxml-pagination.scm

    r12389 r12602  
    3838;; Variable fetching and link generation should be done differently
    3939(define page-size (make-parameter 20))
    40 (define page-var (make-parameter "page"))
     40(define page-var (make-parameter 'page))
    4141(define base-uri (make-parameter (uri-reference "")))
    4242
     
    4545  (let ((page (inexact->exact
    4646               (or (string->number
    47                     (alist-ref (page-var) (uri-query (base-uri)) string=? "1"))
     47                    (or (alist-ref (page-var) (uri-query (base-uri))) "1"))
    4848                   1))))
    4949    (cond
     
    122122                      ">>"))))))
    123123
    124 ;; XXX Hack, for now
    125124(define (make-uri-string pg)
    126   (sprintf "~A://~A~A~A?~A"
    127            (uri-scheme (base-uri))
    128            (uri-host (base-uri))
    129            (if (uri-port (base-uri)) (conc ":" (uri-port (base-uri))) "")
    130            (string-join (uri-path (base-uri)) "/")
    131            (string-join
    132             (map (lambda (p)
    133                    (conc (car p) "=" (cdr p)))
    134                  (alist-update! (page-var) pg (uri-query (base-uri))))
    135             "&")))
     125  (uri->string (update-uri (base-uri)
     126                           query: (alist-update! (page-var)
     127                                                 (number->string pg)
     128                                                 (uri-query (base-uri))))))
    136129
    137130(define pagination-rules
Note: See TracChangeset for help on using the changeset viewer.